slsqp_jax.config¶
Nested configuration dataclasses consumed by SLSQP. Replaces the legacy 40+ flat kwargs.
slsqp_jax.config
Grouped configuration dataclasses for the SLSQP solver.
The SLSQP outer-loop solver previously exposed ~40 keyword
arguments in a single flat namespace. This module groups them into
small, semantically related eqx.Module dataclasses so the user-facing
surface of SLSQP collapses to a single config: SLSQPConfig
field plus the constraint structure (functions, counts, bounds), the
optional derivative overrides, the optional pluggable inner solver, and
the verbose printer.
Example:
from slsqp_jax import SLSQP, SLSQPConfig, ToleranceConfig, LBFGSConfig
solver = SLSQP(
eq_constraint_fn=eq_fn,
n_eq_constraints=1,
config=SLSQPConfig(
tolerance=ToleranceConfig(rtol=1e-8, atol=1e-8, max_steps=200),
lbfgs=LBFGSConfig(memory=20),
),
)
The static / non-static distinction on each field mirrors the legacy field-by-field annotations so JAX retracing behaviour is unchanged.
- class slsqp_jax.config.ToleranceConfig[source]¶
Bases:
ModuleOuter-loop tolerances and iteration / divergence budgets.
- Attributes:
- rtol: Relative tolerance for the stationarity convergence
check. The test is the filterSQP normalised KKT residual (Fletcher & Leyffer, User manual for filterSQP, eqs. 5 and 6):
||grad_L|| <= rtol * max(mu_max, 1)wheremu_max = max_i {||grad_f||_2, |nu_i|, ||a_i||_2 |lambda_i|}is the largest single contributor to the Lagrangian gradient residual (objective-gradient norm, every bound multiplier, and every general-constraint||row||_2 * |multiplier|). The same test is applied to the inexact projected-gradient numerator||W_tilde g||whenAdaptiveCGConfig.use_inexact_stationarityis on. Replaces the legacy|L|-based denominator so the test is invariant to absolute objective magnitude and tracks multiplier blow-up under near-rank-deficient active sets. Default1e-6.- atol: Absolute tolerance for primal feasibility and a number of
internal heuristic floors (steepest-descent fallback, adaptive CG tolerance floor, default proximal mu floor). Default
1e-6.
max_steps: Maximum number of outer SQP iterations. Default 100. min_steps: Minimum iterations before convergence is allowed.
Prevents premature termination at trivial starting points. Default 1.
- stagnation_tol: Relative-improvement threshold for the
merit-based stagnation counter. Default
1e-12.- divergence_factor: Best-iterate divergence rollback fires when
the merit grows by more than
divergence_factor * max(|best_merit|, 1)fordivergence_patienceconsecutive steps. Default10.0.- divergence_patience: Number of consecutive blow-up steps required
before the divergence rollback latches. Default 3.
- class slsqp_jax.config.LBFGSConfig[source]¶
Bases:
ModuleL-BFGS Hessian-approximation parameters.
- Attributes:
- memory: Number of curvature pairs
(s, y)stored in the ring buffer. Default 10.
- damping_threshold: VARCHEN damping threshold applied to each
curvature pair before storage; set to
0.0to disable. Default0.2.- diag_floor: Lower clip for the per-variable secant diagonal
B_0 = diag(d). Default1e-4.- diag_ceil: Upper clip for the per-variable secant diagonal.
Default
1e6.
- memory: Number of curvature pairs
- class slsqp_jax.config.LineSearchConfig[source]¶
Bases:
ModuleBacktracking L1-merit line-search parameters.
- Attributes:
max_steps: Maximum number of backtracking iterations. Default 20. armijo_c1: Armijo condition coefficient
c_1. Default1e-4. failure_patience: After this many consecutive line-searchfailures, the L-BFGS history is hard-reset to identity. Default 3.
- class slsqp_jax.config.QPConfig[source]¶
Bases:
ModuleQP-subproblem parameters.
- Attributes:
- max_iter: Maximum number of active-set iterations per QP solve.
Default 100.
- max_cg_iter: Maximum number of CG iterations per inner solve.
Default 50.
- failure_patience: After this many consecutive QP failures, the
L-BFGS history is hard-reset to identity. Default 3.
- zero_step_patience: After this many consecutive iterations where
the QP returns
||d|| < atoland primal feasibility holds, convergence is declared via the guardedqp_kkt_successdisjunct. Default 3.- ping_pong_threshold: Threshold for the QP add/drop ping-pong
short-circuit. Default
2**31 - 1(effectively disabled); opt in by setting to3-8on degenerate problems.- mult_drop_floor: Floor on the negative-multiplier drop test
inside the QP active-set loop. Default
1e-6.- cg_regularization: Minimum eigenvalue threshold
delta**2for the CG curvature guard. Default
1e-6.- use_exact_hvp: When True, the QP inner CG uses the exact
Lagrangian HVP (via AD) instead of the L-BFGS approximation. Default False.
- __init__(max_iter=100, max_cg_iter=50, failure_patience=3, zero_step_patience=3, ping_pong_threshold=2147483647, mult_drop_floor=1e-06, cg_regularization=1e-06, use_exact_hvp=False)¶
- class slsqp_jax.config.ProximalConfig[source]¶
Bases:
ModuleAdaptive proximal multiplier stabilization (sSQP, Wright 2002).
- Attributes:
- tau: Exponent in
mu = clip(kkt_residual^tau, mu_min, mu_max). Must lie in the half-open interval
[0, 1). Set to0.0to disable sSQP entirely (equality constraints are then enforced via direct null-space projection). Default0.5.- mu_min: Floor on the adaptive proximal mu.
Noneresolves to ToleranceConfig.atolat runtime. DefaultNone.
mu_max: Ceiling on the adaptive proximal mu. Default
0.1.- tau: Exponent in
- class slsqp_jax.config.PreconditionerConfig[source]¶
Bases:
ModuleQP-inner-solver preconditioner configuration.
- Attributes:
enabled: Whether to use a preconditioner at all. Default True. type: Either
"lbfgs"(default) or"diagonal". Thediagonal estimator requires an exact HVP (set
QPConfig.use_exact_hvpor provideobj_hvp_fn).- diagonal_n_probes: Number of Rademacher probes for the
stochastic diagonal estimator. Default 20.
- class slsqp_jax.config.LPECAConfig[source]¶
Bases:
ModuleLPEC-A active-set identification (Oberlin & Wright, 2005).
- Attributes:
- method: One of
"expand"(default),"lpeca_init"or "lpeca"."expand"disables LPEC-A entirely.- sigma: Threshold exponent (
sigma_barin the paper). Must lie in the open interval
(0, 1). Default0.9.- beta: Threshold scaling factor.
Noneresolves to 1 / (m_ineq + n + m_eq)at runtime. DefaultNone.- use_lp: When True, solve the LPEC-A LP (via
mpax.r2HPDHG) for tighter multiplier estimates. Requires
mpax. Default False.- trust_threshold: Trust gate on
rho_bar. Whenrho_bar exceeds this value the prediction is replaced with an empty set. Default
1.0.- warmup_steps: The first
warmup_stepsouter SQP iterations bypass LPEC-A. Default 3.
- predict_bounds: When True (default), extend the LPEC-A prediction
to box constraints (warm-start the bound-fixing loop).
- method: One of
- class slsqp_jax.config.AdaptiveCGConfig[source]¶
Bases:
ModuleAdaptive CG / inexact stationarity configuration.
- Attributes:
- enabled: When True, the CG convergence tolerance is adapted from
the outer KKT residual (Eisenstat-Walker style). Default False to preserve baseline behaviour.
- use_inexact_stationarity: When True, the projected-gradient norm
from a noise-aware inner solver (e.g.
HRInexactSTCG) is added as a logical-OR disjunct to the classical stationarity test. Default False.
- class slsqp_jax.config.SLSQPConfig[source]¶
Bases:
ModuleAggregate configuration for
SLSQP.Replaces the legacy 40+ flat keyword arguments with a small set of grouped sub-configs. Pass directly to
SLSQPvia theconfig=keyword. All sub-configs default to their dataclass defaults soSLSQPConfig()reproduces the legacy default settings.- tolerance: ToleranceConfig¶
- lbfgs: LBFGSConfig¶
- line_search: LineSearchConfig¶
- proximal: ProximalConfig¶
- preconditioner: PreconditionerConfig¶
- lpeca: LPECAConfig¶
- adaptive_cg: AdaptiveCGConfig¶
- __init__(tolerance=<factory>, lbfgs=<factory>, line_search=<factory>, qp=<factory>, proximal=<factory>, preconditioner=<factory>, lpeca=<factory>, adaptive_cg=<factory>)¶
- Parameters:
tolerance (ToleranceConfig)
lbfgs (LBFGSConfig)
line_search (LineSearchConfig)
qp (QPConfig)
proximal (ProximalConfig)
preconditioner (PreconditionerConfig)
lpeca (LPECAConfig)
adaptive_cg (AdaptiveCGConfig)
- Return type:
None