slsqp_jax.qp.bound_fixing¶
Box-bound active-set loop that runs after the QP direction; extracts the released / pinned variables, re-solves the reduced subproblem, and recovers bound multipliers.
slsqp_jax.qp.bound_fixing
Box-bound active-set loop run on top of the QP solution.
Previously inlined inside SLSQP._solve_qp_subproblem, this module
hosts the iterative bound-fixing post-pass: after the main QP solve
returns a direction in the unconstrained-on-bounds space, fix the
variables that violate their box bounds, re-solve the inner equality-
constrained QP in the reduced free subspace, check for new violations
and wrong-sign bound multipliers, repeat (up to 5 passes).
The loop also recovers the bound multipliers from the reduced gradient
Bd + g − A^T λ at the final clipped direction and packages
everything into the outer-facing QPResult.
- slsqp_jax.qp.bound_fixing.package_qp_result_no_bounds(qp_result)[source]¶
Wrap a
QPSolverResultas the outerQPResultwhen no bound constraints are present.Mirrors the
elsebranch of the legacy_solve_qp_subproblembound-fixing block: copy through multipliers and active set, set the bound-related diagnostics to zero / False, and copy the projection diagnostics from the inner result.- Return type:
- Parameters:
qp_result (QPSolverResult)
- slsqp_jax.qp.bound_fixing.run_bound_fixing(qp_result, *, inner_solver, hvp_fn, g, A_eq, b_eq, A_ineq_general, b_ineq_general, n_eq_constraints, m_ineq_general, bounds, y, n_lower_bounds, n_upper_bounds, lower_indices, upper_indices, precond_fn, adaptive_tol, lpeca_bound_lower, lpeca_bound_upper, lpeca_bypassed, lpeca_capped, lpeca_bounds_prefixed_count)[source]¶
Run the bound-fixing post-pass on top of a QP solution.
- Return type:
- Parameters:
qp_result (QPSolverResult)
inner_solver (AbstractInnerSolver)
hvp_fn (Callable[[Float[Array, 'n']], Float[Array, 'n']])
g (Float[Array, 'n'])
A_eq (Float[Array, 'm_eq n'])
b_eq (Float[Array, 'm_eq'])
A_ineq_general (Float[Array, 'm_gen n'])
b_ineq_general (Float[Array, 'm_gen'])
n_eq_constraints (int)
m_ineq_general (int)
bounds (Float[Array, 'n 2'] | None)
y (Float[Array, 'n'])
n_lower_bounds (int)
n_upper_bounds (int)
precond_fn (Callable[[Float[Array, 'n']], Float[Array, 'n']] | None)
adaptive_tol (Float[Array, ''] | float | None)
lpeca_bound_lower (Bool[Array, 'n'])
lpeca_bound_upper (Bool[Array, 'n'])
lpeca_bypassed (Bool[Array, ''])
lpeca_capped (Bool[Array, ''])
lpeca_bounds_prefixed_count (Array)
- Args:
qp_result: Result of the main QP solve (no bound block). inner_solver: The inner equality-constrained QP solver. Used
for the reduced-space re-solves in each bound-fixing pass.
hvp_fn: Lagrangian HVP. g: Objective gradient. A_eq, b_eq: Equality constraint matrix / RHS. A_ineq_general, b_ineq_general: General-inequality matrix / RHS
(bounds are NOT included; they are handled here).
n_eq_constraints: Number of equality constraints. m_ineq_general: Number of general inequality constraints
(excluding bounds).
- bounds:
(n, 2)array of[lower, upper]per variable, or None(in which case this function should not be called).- y: Current iterate (for converting bounds to direction-space
limits
d_lower = lb - y,d_upper = ub - y).- n_lower_bounds, n_upper_bounds: Counts of finite lower / upper
bounds.
- lower_indices, upper_indices: Variable indices with finite
lower / upper bounds (precomputed at NLP construction).
precond_fn: Preconditioner forwarded to the inner solver. adaptive_tol: Eisenstat-Walker adaptive CG tolerance, or
None.- lpeca_bound_lower, lpeca_bound_upper: LPEC-A predicted active
bound masks (length
n). All-False when LPEC-A is disabled / bypassed / not predicting bounds.- lpeca_bypassed, lpeca_capped: LPEC-A status flags forwarded to
the outer
QPResult.- lpeca_bounds_prefixed_count: Number of variables warm-started
from LPEC-A bound predictions (diagnostic).
- bounds:
- Returns:
Outer-facing
QPResultwith bound multipliers recovered and all bound-related diagnostics populated.