slsqp_jax.state¶
All JAX-pytree state and result dataclasses (SLSQPState, SLSQPDiagnostics, QPResult, QPSolverResult, QPState, InnerSolveResult, ProjectionContext).
slsqp_jax.state
State / result dataclasses for the SLSQP solver and its sub-components.
This module consolidates every JAX-pytree dataclass and NamedTuple that flows between the SLSQP outer solver, the QP layer, and the inner projector / Krylov solvers. Splitting these out of the algorithmic modules makes the data flow legible at a glance and removes an otherwise pervasive set of cross-module imports.
The dataclasses are split into three thematic groups:
Outer-loop state (
SLSQPState,SLSQPDiagnostics,get_diagnostics(),_init_diagnostics()) — produced and consumed byslsqp_jax.SLSQPacross iterations.QP-layer state (
QPResult,QPSolverResult,QPState) — produced and consumed by the QP active-set loop and the bound-fixing pass.Inner-solver state (
InnerSolveResult,ProjectionContext) — produced by the equality-constrained inner solvers and consumed by the QP active-set loop.
- class slsqp_jax.state.InnerSolveResult[source]¶
Bases:
NamedTupleResult from an inner equality-constrained QP solve.
- Attributes:
d: Search direction. multipliers: Lagrange multipliers (shape
(m,); entries forinactive constraints are zero).
- converged: True when the inner Krylov / projection iteration
satisfied its tolerance.
- proj_residual: Post-solve constraint residual
||A d - b|| (Euclidean norm, restricted to active rows). Always
0for null-space solvers (CG / CRAIG) where feasibility is enforced structurally; non-zero forMinresQLPSolverwhere it reflects the floor of the M-metric range-space projection after iterative refinement.- n_proj_refinements: Number of M-metric projection refinement
rounds actually applied. Always
0for null-space solvers. At mostMinresQLPSolver.proj_refine_max_iter.- projected_grad_norm: Norm of the projected initial gradient
W̃_k gthat the inner solver actually iterated against (HR 2014, Theorem 3.5). This is the noise-aware stationarity proxy: when the outer SQP enablesuse_inexact_stationarity, the run is allowed to converge once this value drops belowrtol * max(mu_max, 1)(filterSQP eq. 6 with the shared denominator fromslsqp_jax.slsqp.termination.compute_mu_max()). Defaults toinfso that solvers which do not produce this quantity (i.e. anything other thanHRInexactSTCG) cannot accidentally satisfy a< rtoltest even if the user toggles the flag — the inexact path silently degrades to “never converges this way”.
- d: Float[Array, 'n']¶
Alias for field number 0
- multipliers: Float[Array, 'm']¶
Alias for field number 1
- converged: Bool[Array, '']¶
Alias for field number 2
- proj_residual: Float[Array, '']¶
Alias for field number 3
- n_proj_refinements: Int[Array, '']¶
Alias for field number 4
- projected_grad_norm: Float[Array, '']¶
Alias for field number 5
- class slsqp_jax.state.ProjectionContext[source]¶
Bases:
NamedTupleReusable bundle of projector + particular-solution + multiplier-recovery closures for an active equality system
A_active d = b_active.Existing strategies (
ProjectedCGCholesky,ProjectedCGCraig) build these inline inside theirsolvemethods. Composed strategies (e.g.HRInexactSTCG) callinner.build_projection_context(...)to reuse the projector and multiplier-recovery infrastructure of an underlying null-space solver while running their own CG loop on top.- Attributes:
- project: Inexact null-space projector
W̃_k(v). Maps a vector in the (free) ambient space to its projection onto
null(A_work)using whatever inner approximation the underlying strategy provides (Cholesky forProjectedCGCholesky, CRAIG forProjectedCGCraig).- d_p: Particular solution.
A_work @ d_p == b_workto inner solver precision;
d_palready incorporatesd_fixedon the bound-fixed coordinates, so it lives in the fulln- dimensional space.- recover_multipliers: Closure mapping
(B d + g)to a length-m multiplier vector with zeros on inactive rows. Encapsulates both the inversion of
A_work A_workᵀand the active-mask zeroing. HR Algorithm 4.5 calls this once per outer step (after the modified-residual CG iteration converges).- hvp_work: Working-subspace HVP. Equal to
hvp_fnwhen no bound fixing is in effect; otherwise
v -> _free * hvp_fn(_free * v)so the iteration only sees the free coordinates.- g_eff: Effective gradient
g + B @ d_pevaluated against hvp_work. HR’s notation calls thisg_k; it is the input to the projected-residual recurrence.- A_work: Already-masked working constraint matrix (active rows,
free columns). Surfaced primarily so callers can sanity-check the residual
||A_work @ d - b_work||;projectandrecover_multipliersalready incorporate it.- free_mask: Boolean mask of free variables (always present;
equals
ones(n)when no bound-fixing is in effect).- d_fixed: Fixed-variable values on bound-active coordinates
(zeros elsewhere; zeros everywhere when no bound-fixing).
- has_fixed:
Trueiff any coordinate is bound-fixed. Cheap indicator so consumers do not have to redo the mask check.
- converged: Convergence flag of the inner projector solve that
built the context (always
Truefor Cholesky; carries the CRAIG breakdown / convergence flag for the iterative projector). Composed strategies AND this with their own convergence to surface inner-projector failures upstream.
- project: Inexact null-space projector
- d_p: Float[Array, 'n']¶
Alias for field number 1
- g_eff: Float[Array, 'n']¶
Alias for field number 4
- A_work: Float[Array, 'm n']¶
Alias for field number 5
- free_mask: Bool[Array, 'n']¶
Alias for field number 6
- d_fixed: Float[Array, 'n']¶
Alias for field number 7
- converged: Bool[Array, '']¶
Alias for field number 9
- class slsqp_jax.state.QPState[source]¶
Bases:
ModuleState for the Active Set QP solver.
any_inner_failureaccumulates whether any inner-solver call during the active-set loop reported non-convergence or produced a non-finite direction. The finalQPSolverResult.convergedcombines this with the active-set completion check.last_add_idx/last_drop_idx/ping_pong_count/ping_pongedimplement an explicit anti-cycling guard on top of EXPAND: when the active-set loop alternately adds and drops the same constraint several times in a row (typical signature of multiplier-recovery noise on a degenerate vertex) the loop is short-circuited asconverged=Truewith the stickyping_pongedflag set so the outer solver can surface it through the diagnostic counters. Indices are initialised to-1to mean “no add/drop yet”.- d: Float[Array, 'n']¶
- active_set: Bool[Array, 'm_ineq']¶
- multipliers_eq: Float[Array, 'm_eq']¶
- multipliers_ineq: Float[Array, 'm_ineq']¶
- iteration: Int[Array, '']¶
- converged: Bool[Array, '']¶
- any_inner_failure: Bool[Array, '']¶
- last_add_idx: Int[Array, '']¶
- last_drop_idx: Int[Array, '']¶
- ping_pong_count: Int[Array, '']¶
- ping_ponged: Bool[Array, '']¶
- proj_residual: Float[Array, '']¶
- n_proj_refinements: Int[Array, '']¶
- projected_grad_norm: Float[Array, '']¶
- __init__(d, active_set, multipliers_eq, multipliers_ineq, iteration, converged, any_inner_failure, last_add_idx, last_drop_idx, ping_pong_count, ping_ponged, proj_residual, n_proj_refinements, projected_grad_norm)¶
- Parameters:
d (Float[Array, 'n'])
active_set (Bool[Array, 'm_ineq'])
multipliers_eq (Float[Array, 'm_eq'])
multipliers_ineq (Float[Array, 'm_ineq'])
iteration (Int[Array, ''])
converged (Bool[Array, ''])
any_inner_failure (Bool[Array, ''])
last_add_idx (Int[Array, ''])
last_drop_idx (Int[Array, ''])
ping_pong_count (Int[Array, ''])
ping_ponged (Bool[Array, ''])
proj_residual (Float[Array, ''])
n_proj_refinements (Int[Array, ''])
projected_grad_norm (Float[Array, ''])
- Return type:
None
- class slsqp_jax.state.QPSolverResult[source]¶
Bases:
NamedTupleResult returned by
slsqp_jax.qp.solve_qp().The Bundle 1 diagnostic fields
ping_ponged/reached_max_iter/final_working_tolare surfaced from the active-set loop so the outer solver can track why the QP stopped (clean convergence versus cycling versus iteration-budget exhaustion). They default toFalse/False/0.0for the trivial QP paths that do not run an active-set loop.This is the internal QP-pipeline result. The richer outer-facing
QPResult(returned bySLSQP._solve_qp_subproblem(), after bound-fixing) wraps this and adds bound-handling diagnostics.- d: Float[Array, 'n']¶
Alias for field number 0
- multipliers_eq: Float[Array, 'm_eq']¶
Alias for field number 1
- multipliers_ineq: Float[Array, 'm_ineq']¶
Alias for field number 2
- active_set: Bool[Array, 'm_ineq']¶
Alias for field number 3
- converged: Bool[Array, '']¶
Alias for field number 4
- iterations: Int[Array, '']¶
Alias for field number 5
- ping_ponged: Bool[Array, '']¶
Alias for field number 6
- reached_max_iter: Bool[Array, '']¶
Alias for field number 7
- final_working_tol: Float[Array, '']¶
Alias for field number 8
- proj_residual: Float[Array, '']¶
Alias for field number 9
- n_proj_refinements: Int[Array, '']¶
Alias for field number 10
- projected_grad_norm: Float[Array, '']¶
Alias for field number 11
- class slsqp_jax.state.QPResult[source]¶
Bases:
ModuleOuter-facing result of solving the SLSQP QP subproblem.
Returned by
SLSQP._solve_qp_subproblem()after the bound-fixing loop has post-processed the direction returned bysolve_qp().- Attributes:
direction: The search direction d from the QP solution. multipliers_eq: Lagrange multipliers for equality constraints. multipliers_ineq: Lagrange multipliers for inequality constraints. active_set: Boolean mask of active inequality constraints at the solution. converged: Whether the QP solver converged successfully. iterations: Number of active-set iterations taken. bound_fix_solves: Number of non-trivial bound-fixing passes that
actually ran the reduced-space inner solve (passes where the free mask did not change are short-circuited). Useful for debugging bound-handling overhead; 0 when the problem has no bound constraints.
- n_bound_fixed: Number of variables pinned to a box bound in the
final QP direction (counts both lower- and upper-bound activations).
- ping_ponged: True when the QP active-set loop short-circuited
on a detected add/drop ping-pong cycle.
- reached_max_iter: True when the QP active-set loop exhausted
its iteration budget (
qp_max_iter).- lpeca_bypassed: True when the LPEC-A prediction was skipped
for this step (warm-up window or trust gate fired).
- lpeca_capped: True when the LPEC-A prediction was truncated
by the rank-aware size cap.
- n_lpeca_bounds_prefixed: Number of box-bound variables
pre-fixed by LPEC-A before entering the bound-fixing loop. Always 0 when
active_set_method == "expand", whenlpeca_predict_bounds=False, or when LPEC-A was bypassed by the warm-up / trust gates.- proj_residual: Post-refinement constraint residual ``||A d -
b||`` from the inner solver producing the final QP direction (after bound-fixing). Always 0 for null-space CG / CRAIG; relevant for
MinresQLPSolverwhere it reflects the M-metric range-space projection floor and feeds the outer divergence detector viaSLSQPDiagnostics.max_proj_residual.- n_proj_refinements: Cumulative number of M-metric projection
refinement rounds across all inner solves performed for this QP step (active-set loop + bound-fixing loop). Always 0 for null-space solvers.
- projected_grad_norm: Latest inner-solver projected-gradient
norm (
HRInexactSTCGonly;infotherwise).
- direction: Float[Array, 'n']¶
- multipliers_eq: Float[Array, 'm_eq']¶
- multipliers_ineq: Float[Array, 'm_ineq']¶
- active_set: Bool[Array, 'm_ineq']¶
- converged: Bool[Array, '']¶
- iterations: Int[Array, '']¶
- bound_fix_solves: Int[Array, '']¶
- n_bound_fixed: Int[Array, '']¶
- ping_ponged: Bool[Array, '']¶
- reached_max_iter: Bool[Array, '']¶
- lpeca_bypassed: Bool[Array, '']¶
- lpeca_capped: Bool[Array, '']¶
- n_lpeca_bounds_prefixed: Int[Array, '']¶
- proj_residual: Float[Array, '']¶
- n_proj_refinements: Int[Array, '']¶
- projected_grad_norm: Float[Array, '']¶
- __init__(direction, multipliers_eq, multipliers_ineq, active_set, converged, iterations, bound_fix_solves, n_bound_fixed, ping_ponged, reached_max_iter, lpeca_bypassed, lpeca_capped, n_lpeca_bounds_prefixed, proj_residual, n_proj_refinements, projected_grad_norm)¶
- Parameters:
direction (Float[Array, 'n'])
multipliers_eq (Float[Array, 'm_eq'])
multipliers_ineq (Float[Array, 'm_ineq'])
active_set (Bool[Array, 'm_ineq'])
converged (Bool[Array, ''])
iterations (Int[Array, ''])
bound_fix_solves (Int[Array, ''])
n_bound_fixed (Int[Array, ''])
ping_ponged (Bool[Array, ''])
reached_max_iter (Bool[Array, ''])
lpeca_bypassed (Bool[Array, ''])
lpeca_capped (Bool[Array, ''])
n_lpeca_bounds_prefixed (Int[Array, ''])
proj_residual (Float[Array, ''])
n_proj_refinements (Int[Array, ''])
projected_grad_norm (Float[Array, ''])
- Return type:
None
- class slsqp_jax.state.SLSQPDiagnostics[source]¶
Bases:
ModuleDiagnostic counters and statistics accumulated during an SLSQP run.
These fields are populated inside
step()without Python-side branching, and can be inspected by the user after a solve to decide whether theoptimistixresult code is meaningful (e.g. to detect aRESULTS.successfulthat actually came from chronic line-search failure rather than real convergence).- Attributes:
- n_qp_inner_failures: Number of iterations where the QP solver
reported
converged=False.- n_ls_failures: Number of iterations where the line search
reported
success=False.- n_lbfgs_skips: Number of iterations where the L-BFGS append
skipped the new curvature pair.
- n_nan_directions: Number of iterations where the QP returned
a non-finite search direction.
max_gamma: Maximum L-BFGS
gammaobserved across iterations. min_diag: Minimum L-BFGS per-variable diagonal entry observed. max_diag: Maximum L-BFGS per-variable diagonal entry observed. eq_jac_min_sv_est: A lower bound on the smallest singular valueof
J_eqestimated from the Cholesky factor ofJ_eq J_eq^T. Small values indicate near rank-deficiency.ls_alpha_min: Smallest line-search step accepted across the run. tail_ls_failures: Consecutive line-search failure count at
termination. Non-zero values suggest stagnation.
- n_bound_fix_solves: Total number of non-trivial bound-fixing inner
solves that actually ran (no-op passes are skipped via
jax.lax.condand do not count). Growing unboundedly is a sign that the bound active set never stabilises.- max_bound_fixed: Largest number of variables pinned to their box
bounds across all iterations (from the final per-iteration
free_mask).- max_active_ineq: Largest number of active general inequalities
observed across iterations.
- n_merit_regressions: Number of iterations where the L1 merit
function value increased despite the line search reporting success. A non-zero count points to merit-function mis-calibration (too-small
rho) or line-search slippage.- n_qp_budget_exhausted: Number of SQP steps where the QP
active-set loop hit
qp_max_iter(i.e. exited because the budget ran out, not because of clean convergence or a ping-pong short-circuit). A non-zero count usually indicates degeneracy, multiplier-noise cycling, or an LPEC-A over-prediction that was not caught by the trust gate; consider raisingmult_drop_flooror tighteninglpeca_trust_threshold.- n_qp_ping_pong: Number of SQP steps where the QP loop’s
anti-cycling ping-pong detector fired. These are good short-circuits (the loop avoided wasting its full budget) but a chronic non-zero value still points to a degenerate constraint pair worth investigating.
- max_qp_iterations: Peak active-set iteration count observed
across all SQP steps. Useful for sizing
qp_max_iter: if this is consistently equal toqp_max_iterthe budget is too tight.- max_qp_active_size: Peak
|active_set|(general inequalities only) observed across all SQP steps.
- n_lpeca_bypassed: Number of SQP steps where the LPEC-A
prediction was skipped, either because of the warm-up window (
step_count < lpeca_warmup_steps) or because the trust gate vetoed it (rho_bar > lpeca_trust_threshold). Always 0 whenactive_set_method == "expand".- n_lpeca_capped: Number of SQP steps where the LPEC-A
rank-aware size cap truncated the prediction.
- n_lpeca_bounds_prefixed: Cumulative count of box-bound
pre-fixes contributed by LPEC-A across all SQP steps (summed over the bound predictions that survived the trust / warm-up gates and were installed as the initial
free_maskfor the bound-fixing loop). Always 0 whenactive_set_method == "expand"or whenlpeca_predict_bounds=False.- n_proj_refinements: Cumulative number of M-metric projection
refinement rounds taken across all inner solves performed by
MinresQLPSolverover the run. Always 0 for null-space CG / CRAIG.- max_proj_residual: High-water mark of the post-refinement
constraint residual
||A d - b||reported byMinresQLPSolveron the accepted QP direction across all SQP steps.- n_divergence_blowups: Total number of merit blowup events
observed across the run, whether or not the patience threshold was eventually reached.
- divergence_triggered: True when the best-iterate divergence
rollback fired at least once during the run.
- min_projected_grad_norm: Low-water mark of the inner solver’s
projected-gradient norm
||W̃_k g_k||across the run. Alwaysinffor inner solvers other thanHRInexactSTCG. Surfaced for post-hoc inspection of how close the run actually got to KKT in the inexact-projection sense, regardless of whetheruse_inexact_stationaritywas on.- n_steps_inexact_below_classical: Number of iterations where the
inner solver’s projected-gradient norm was strictly smaller than the classical Lagrangian gradient norm. A high count indicates that multiplier-recovery noise is the limiting factor and the user might benefit from
use_inexact_stationarity=Truepaired withHRInexactSTCG.
- n_qp_inner_failures: Int[Array, '']¶
- n_ls_failures: Int[Array, '']¶
- n_lbfgs_skips: Int[Array, '']¶
- n_nan_directions: Int[Array, '']¶
- max_gamma: Float[Array, '']¶
- min_diag: Float[Array, '']¶
- max_diag: Float[Array, '']¶
- eq_jac_min_sv_est: Float[Array, '']¶
- ls_alpha_min: Float[Array, '']¶
- tail_ls_failures: Int[Array, '']¶
- n_bound_fix_solves: Int[Array, '']¶
- max_bound_fixed: Int[Array, '']¶
- max_active_ineq: Int[Array, '']¶
- n_merit_regressions: Int[Array, '']¶
- n_qp_budget_exhausted: Int[Array, '']¶
- n_qp_ping_pong: Int[Array, '']¶
- max_qp_iterations: Int[Array, '']¶
- max_qp_active_size: Int[Array, '']¶
- n_lpeca_bypassed: Int[Array, '']¶
- n_lpeca_capped: Int[Array, '']¶
- n_lpeca_bounds_prefixed: Int[Array, '']¶
- n_proj_refinements: Int[Array, '']¶
- max_proj_residual: Float[Array, '']¶
- n_divergence_blowups: Int[Array, '']¶
- divergence_triggered: Bool[Array, '']¶
- min_projected_grad_norm: Float[Array, '']¶
- n_steps_inexact_below_classical: Int[Array, '']¶
- __init__(n_qp_inner_failures, n_ls_failures, n_lbfgs_skips, n_nan_directions, max_gamma, min_diag, max_diag, eq_jac_min_sv_est, ls_alpha_min, tail_ls_failures, n_bound_fix_solves, max_bound_fixed, max_active_ineq, n_merit_regressions, n_qp_budget_exhausted, n_qp_ping_pong, max_qp_iterations, max_qp_active_size, n_lpeca_bypassed, n_lpeca_capped, n_lpeca_bounds_prefixed, n_proj_refinements, max_proj_residual, n_divergence_blowups, divergence_triggered, min_projected_grad_norm, n_steps_inexact_below_classical)¶
- Parameters:
n_qp_inner_failures (Int[Array, ''])
n_ls_failures (Int[Array, ''])
n_lbfgs_skips (Int[Array, ''])
n_nan_directions (Int[Array, ''])
max_gamma (Float[Array, ''])
min_diag (Float[Array, ''])
max_diag (Float[Array, ''])
eq_jac_min_sv_est (Float[Array, ''])
ls_alpha_min (Float[Array, ''])
tail_ls_failures (Int[Array, ''])
n_bound_fix_solves (Int[Array, ''])
max_bound_fixed (Int[Array, ''])
max_active_ineq (Int[Array, ''])
n_merit_regressions (Int[Array, ''])
n_qp_budget_exhausted (Int[Array, ''])
n_qp_ping_pong (Int[Array, ''])
max_qp_iterations (Int[Array, ''])
max_qp_active_size (Int[Array, ''])
n_lpeca_bypassed (Int[Array, ''])
n_lpeca_capped (Int[Array, ''])
n_lpeca_bounds_prefixed (Int[Array, ''])
n_proj_refinements (Int[Array, ''])
max_proj_residual (Float[Array, ''])
n_divergence_blowups (Int[Array, ''])
divergence_triggered (Bool[Array, ''])
min_projected_grad_norm (Float[Array, ''])
n_steps_inexact_below_classical (Int[Array, ''])
- Return type:
None
- class slsqp_jax.state.SLSQPState[source]¶
Bases:
ModuleState for the SLSQP solver.
This is a JAX PyTree (via eqx.Module) that holds all mutable state needed across SLSQP iterations.
- Attributes:
step_count: Current iteration number. f_val: Current objective function value f(x_k). grad: Gradient of objective at current point. eq_val: Equality constraint values c_eq(x_k). ineq_val: Inequality constraint values c_ineq(x_k). eq_jac: Jacobian of equality constraints at x_k. ineq_jac: Jacobian of inequality constraints at x_k. lbfgs_history: L-BFGS history for matrix-free Hessian approximation. multipliers_eq_qp: QP-recovered equality multipliers
λ_QP = (A_k A_kᵀ)⁻¹ A_k (B d + g_k)from the active-set QP solver. Consumed by Han-Powell’s penalty rule (update_penalty_parameter), the LPEC-A predictor’srho_barproximity measure, and the active-set warm-start of the next QP. CarriesO(s_f / s_eq · cond(B))noise when the L-BFGS Hessian is poorly conditioned or when auto-scaling inflates the multiplier scale; do not use for∇f − Jᵀλstationarity checks.- multipliers_ineq_qp: QP-recovered inequality multipliers
(general-inequality block + bound block). The bound block comes from the post-line-search recovery in
slsqp_jax.slsqp.bounds.recover_bound_multipliers()so it agrees withmultipliers_ineq_lsfor the bound rows; only the general-inequality block carries the QP noise. Consumed by Han-Powell + LPEC-A + warm-start.- multipliers_eq_ls: Hessian-free least-squares multipliers
λ_LS = (J(x_{k+1}) J(x_{k+1})ᵀ)⁻¹ J(x_{k+1}) ∇f(x_{k+1})recovered post-line-search at the accepted iterate (seeslsqp_jax.slsqp.multipliers). Independent ofB,dandα. Consumed by the L-BFGS secant pair (so the same vector is used at both endpoints) and by_terminate_impl’s filterSQP-style stationarity denominator (the multipliers feed both the Lagrangian gradient numerator and themu_maxdenominator fromslsqp_jax.slsqp.termination.compute_mu_max()). These are the multipliers exposed viaSolution.stats["multipliers_eq"]because they are the stationarity-quality estimate. Atinit()time both_qpand_lsare seeded from the samelstsqsolution atx_0.- multipliers_ineq_ls: Hessian-free LS inequality multipliers
(general-inequality block from
slsqp_jax.slsqp.multiplierswith active-rowmax(0, ·)clamp + bound block fromslsqp_jax.slsqp.bounds.recover_bound_multipliers()). Atinit()initialised to zeros — bound blocks only get populated oncestep()runs the post-step recovery.- kkt_residual_grad: Lagrangian-gradient snapshot consumed by the
next QP subproblem as the KKT-residual proxy (
kkt_residual = ||state.kkt_residual_grad||insideSLSQP._solve_qp_subproblem()). Currently always written equal tograd_lagrangianat the end of each step; the field is kept separate fromgrad_lagrangianpurely so that future variants (e.g. carrying a previous iterate’s Lagrangian gradient instead of the current one) can be introduced without re-shaping the state pytree.- grad_lagrangian: Current gradient of the Lagrangian evaluated at
the accepted iterate using the LS multipliers (matching the L-BFGS secant pair). Reused by
terminateso the stationarity check does not fall out of sync with the L-BFGS secant pair.
merit_penalty: Current penalty parameter for L1 merit function. bound_jac: Constant Jacobian for bound constraints (computed once in init). qp_iterations: Total accumulated QP active-set iterations across all steps. qp_converged: Whether the most recent QP solve converged. prev_active_set: Active inequality constraint set from the previous QP solve,
used for warm-starting the next QP subproblem.
- termination_code: Granular
slsqp_jax.RESULTSclassification (
successful/merit_stagnation/line_search_failure/iterate_blowup/infeasible/qp_subproblem_failure/nonlinear_max_steps_reached/nonfinite). Surfaced viaSolution.stats["slsqp_result"];Solution.resultitself remains the coarseoptx.RESULTScode accepted by optimistix’s driver.
- step_count: Int[Array, '']¶
- f_val: Float[Array, '']¶
- grad: Float[Array, 'n']¶
- eq_val: Float[Array, 'm_eq']¶
- ineq_val: Float[Array, 'm_ineq']¶
- eq_jac: Float[Array, 'm_eq n']¶
- ineq_jac: Float[Array, 'm_ineq n']¶
- lbfgs_history: LBFGSHistory¶
- multipliers_eq_qp: Float[Array, 'm_eq']¶
- multipliers_ineq_qp: Float[Array, 'm_ineq']¶
- multipliers_eq_ls: Float[Array, 'm_eq']¶
- multipliers_ineq_ls: Float[Array, 'm_ineq']¶
- kkt_residual_grad: Float[Array, 'n']¶
- grad_lagrangian: Float[Array, 'n']¶
- merit_penalty: Float[Array, '']¶
- bound_jac: Float[Array, 'm_bounds n']¶
- qp_iterations: Int[Array, '']¶
- qp_converged: Bool[Array, '']¶
- prev_active_set: Bool[Array, 'm_ineq']¶
- consecutive_qp_failures: Int[Array, '']¶
- consecutive_ls_failures: Int[Array, '']¶
- consecutive_zero_steps: Int[Array, '']¶
- qp_optimal: Bool[Array, '']¶
- best_merit: Float[Array, '']¶
- steps_without_improvement: Int[Array, '']¶
- stagnation: Bool[Array, '']¶
- last_alpha: Float[Array, '']¶
- last_projected_grad_norm: Float[Array, '']¶
- ls_success: Bool[Array, '']¶
- ls_fatal: Bool[Array, '']¶
- qp_fatal: Bool[Array, '']¶
- best_x: Float[Array, 'n']¶
- blowup_count: Int[Array, '']¶
- diverging: Bool[Array, '']¶
- diagnostics: SLSQPDiagnostics¶
- __init__(step_count, f_val, grad, eq_val, ineq_val, eq_jac, ineq_jac, lbfgs_history, multipliers_eq_qp, multipliers_ineq_qp, multipliers_eq_ls, multipliers_ineq_ls, kkt_residual_grad, grad_lagrangian, merit_penalty, bound_jac, qp_iterations, qp_converged, prev_active_set, consecutive_qp_failures, consecutive_ls_failures, consecutive_zero_steps, qp_optimal, best_merit, steps_without_improvement, stagnation, last_alpha, last_projected_grad_norm, ls_success, ls_fatal, qp_fatal, best_x, blowup_count, diverging, termination_code, diagnostics)¶
- Parameters:
step_count (Int[Array, ''])
f_val (Float[Array, ''])
grad (Float[Array, 'n'])
eq_val (Float[Array, 'm_eq'])
ineq_val (Float[Array, 'm_ineq'])
eq_jac (Float[Array, 'm_eq n'])
ineq_jac (Float[Array, 'm_ineq n'])
lbfgs_history (LBFGSHistory)
multipliers_eq_qp (Float[Array, 'm_eq'])
multipliers_ineq_qp (Float[Array, 'm_ineq'])
multipliers_eq_ls (Float[Array, 'm_eq'])
multipliers_ineq_ls (Float[Array, 'm_ineq'])
kkt_residual_grad (Float[Array, 'n'])
grad_lagrangian (Float[Array, 'n'])
merit_penalty (Float[Array, ''])
bound_jac (Float[Array, 'm_bounds n'])
qp_iterations (Int[Array, ''])
qp_converged (Bool[Array, ''])
prev_active_set (Bool[Array, 'm_ineq'])
consecutive_qp_failures (Int[Array, ''])
consecutive_ls_failures (Int[Array, ''])
consecutive_zero_steps (Int[Array, ''])
qp_optimal (Bool[Array, ''])
best_merit (Float[Array, ''])
steps_without_improvement (Int[Array, ''])
stagnation (Bool[Array, ''])
last_alpha (Float[Array, ''])
last_projected_grad_norm (Float[Array, ''])
ls_success (Bool[Array, ''])
ls_fatal (Bool[Array, ''])
qp_fatal (Bool[Array, ''])
best_x (Float[Array, 'n'])
blowup_count (Int[Array, ''])
diverging (Bool[Array, ''])
termination_code (Any)
diagnostics (SLSQPDiagnostics)
- Return type:
None
- slsqp_jax.state.get_diagnostics(state)[source]¶
Return the
SLSQPDiagnosticsaccumulator from a final state.Use this after
optimistix.minimise(or a manualsolve / steploop) to inspect solver health indicators that the Optimistix result code alone does not expose. SeeSLSQPDiagnosticsfor field meanings.- Return type:
- Parameters:
state (SLSQPState)