pysolver_view.optimization.solvers.slsqp.driver module#
Run SciPy’s SLSQP with controlled trial steps and explicit domain recovery.
This driver manages the evaluation loop around SciPy’s compiled optimizer. A
model can be undefined at a trial point even when every variable satisfies its
bounds. On a recognized DomainError, the driver can shorten the pending step
and retry the actual model. Successful recovery can also limit the next step,
with gradual growth toward the configured maximum fraction. SciPy’s own merit
line search remains active, and its accumulated solver state is retained.
In the supported SciPy version, minimize(method='SLSQP') exposes neither
these step fractions nor a hook to reject an undefined pending trial and retry
it with consistent internal state. An iteration callback cannot supply that
control, and an exception from a model evaluation would otherwise escape the
public wrapper. The private interaction is isolated in _scipy_backend;
this module chooses when to evaluate, shorten, recover, or stop. It uses the
existing SLSQP algorithm rather than implementing another optimizer.
Bound-aware finite differences use one probe per variable. An invalid probe
stops the solve with a diagnostic instead of retrying or inventing a derivative. Histories and callbacks describe the initial and accepted designs,
and kkt supplies independent first-order diagnostics at those points.
Final success requires native success and the configured feasibility and
optimality limits by default. Disabling check_kkt skips the optimality gate.
These derivative and reporting features could also surround
the public interface; pending-trial control is the reason for the private bridge.
The numerical driver requires NumPy and SciPy and has no application or UI assumptions.
The caller owns coordinates and scaling and returns an Evaluation containing
a minimized objective, equalities == 0, and inequalities >= 0. Only explicitly
identified DomainError failures are recoverable. No artificial objective
values or modifications to the model equations are used, and programming errors
propagate to the caller. Recovery has finite retry limits and cannot guarantee
that a feasible continuation exists.
- pysolver_view.optimization.solvers.slsqp.driver.minimize_slsqp(evaluate, x0, bounds=None, *, jac=None, options=None, callback=None, logger=None)[source]#
Minimize a combined model evaluation through SciPy’s compiled SLSQP.
jacoptionally returns rows [objective, equalities, inequalities]. Otherwise use bounded, one-sided differences with one probe per variable. Choose the direction from the available bound distance before evaluating; a DomainError stops differentiation without retrying. No artificial objective/constraint penalties are used.The two step fractions scale the QP direction before its first trial: the first major iteration uses min(first_step_fraction, max_step_fraction), and later initial caps grow by step_growth_factor up to max_step_fraction. After a domain-recovered iteration, growth restarts from the actual accepted fraction of that iteration’s original QP direction, including any native merit shortening. Further recoveries reset it again. Growth 1 holds the current/recovered cap; None restores max_step_fraction immediately on each iteration after the first. Native merit backtracking remains active in both cases. Domain backtracking is applied to every native function request. A final first-order stationarity check prevents tiny imposed steps from being mistaken for convergence merely because SciPy’s step tolerance is met.
Callback/history contain initial and accepted points (not derivative probes or rejected trials). StopIteration from callback gives status 13. Failure during domain recovery returns the last accepted point with success=False.