slsqp_jax.lpeca¶
LPEC-A (Oberlin & Wright, 2005) active-set identification used to warm-start the QP active set and the bound-fixing loop.
slsqp_jax.lpeca
LPEC-A Active Set Identification for SLSQP.
Implements the LPEC-A (Linear Program with Equilibrium Constraints Approximation) method from Oberlin & Wright (2005, Section 3.3) for identifying active inequality constraints in nonlinear programming.
The method computes a proximity measure rho_bar from primal
constraint values and dual multiplier estimates, then applies a
threshold test to predict the active set. Under Mangasarian-Fromovitz
constraint qualification (MFCQ) and second-order sufficiency conditions,
the prediction is asymptotically exact as the iterate converges to
the solution.
An optional LP refinement step (via mpax.r2HPDHG) can tighten
the multiplier estimates used in the threshold computation, but is
not required for asymptotic correctness.
Far-from-solution trust gate. Theorem 5 of Oberlin & Wright only
guarantees asymptotic exactness when the iterate is close to a
solution (so rho_bar is small). Far from the solution, the raw
threshold = (beta * rho_bar) ** sigma can grow large enough that
the test c_ineq_i <= threshold includes nearly every constraint,
producing an over-saturated working set that destroys QP convergence.
The implementation guards against this with a configurable
trust_threshold on rho_bar: when rho_bar > trust_threshold,
LPEC-A returns an empty prediction so the QP active-set loop falls
back to its warm-start / cold-start path.
Rank-aware size cap. As a secondary safety net, even when the
trust gate passes, the prediction is truncated so that at most
n - m_eq - 1 constraints are predicted active. This preserves a
LICQ-like rank margin in the working-set Jacobian
[A_eq; A_active] (which has at most n rows). Selection
prioritises the most-violated / most-confident constraints
(smallest c_ineq_i).
Sign convention¶
This module uses the slsqp-jax convention where
c_ineq(x) >= 0 means feasible. The Oberlin & Wright paper uses
c(x) <= 0 for feasible constraints, so all formulas are adapted
by mapping c_paper_i = -c_ineq_i.
References
Oberlin, C. & Wright, S. J. (2005). “An accelerated Newton method for equations with semismooth Jacobians and nonlinear complementarity problems.” Mathematical Programming, 117(1-2), 355-386.
- class slsqp_jax.lpeca.LPECAResult[source]¶
Bases:
NamedTupleLPEC-A active-set identification result.
- Attributes:
- predicted: Boolean mask of shape
(m_ineq,).Truemeans the constraint is predicted active. When
valid=Falsethis is the all-Falsemask (the trust gate fired).- valid:
Truewhenrho_baris below the trust threshold, so the prediction is theoretically meaningful.
Falseindicates the iterate is too far from the solution for LPEC-A to be reliable.- capped:
Truewhen the rank-aware size cap truncated the prediction (the raw threshold predicted more than
n - m_eq - 1constraints active, so the most confident entries were kept).
rho_bar: The scalar proximity measure used for the trust gate.
- predicted: Boolean mask of shape
- predicted: Bool[Array, 'm_ineq']¶
Alias for field number 0
- valid: Bool[Array, '']¶
Alias for field number 1
- capped: Bool[Array, '']¶
Alias for field number 2
- rho_bar: Float[Array, '']¶
Alias for field number 3
- slsqp_jax.lpeca.compute_rho_bar(c_ineq, c_eq, grad, A_ineq, A_eq, lambda_ineq, mu_eq)[source]¶
Compute the LPEC-A proximity measure rho_bar.
This implements Eq. 36 of Oberlin & Wright (2005), adapted to the
c_ineq >= 0(feasible) sign convention.For feasible inequality constraints (
c_ineq_i > 0), the contribution issqrt(c_ineq_i * lambda_ineq_i); for violated constraints (c_ineq_i <= 0), it is-c_ineq_i(the violation magnitude).- Return type:
Float[Array, '']- Parameters:
c_ineq (Float[Array, 'm_ineq'])
c_eq (Float[Array, 'm_eq'])
grad (Float[Array, 'n'])
A_ineq (Float[Array, 'm_ineq n'])
A_eq (Float[Array, 'm_eq n'])
lambda_ineq (Float[Array, 'm_ineq'])
mu_eq (Float[Array, 'm_eq'])
- Args:
c_ineq: Inequality constraint values at current point. c_eq: Equality constraint values at current point. grad: Objective gradient at current point. A_ineq: Inequality constraint Jacobian. A_eq: Equality constraint Jacobian. lambda_ineq: Multiplier estimates for inequality constraints. mu_eq: Multiplier estimates for equality constraints.
- Returns:
The scalar proximity measure rho_bar >= 0.
- slsqp_jax.lpeca.identify_active_set_lpeca(c_ineq, c_eq, grad, A_ineq, A_eq, lambda_ineq, mu_eq, sigma=0.9, beta=None, trust_threshold=1.0)[source]¶
Predict the active inequality set using the LPEC-A threshold test.
Applies Eq. 43 of Oberlin & Wright (2005), adapted to our sign convention. An inequality constraint
iis predicted active whenc_ineq_i <= (beta * rho_bar) ** sigmaandrho_baris below the trust threshold (otherwise the prediction is empty).The result is wrapped in an
LPECAResultso the caller can distinguish “no constraints predicted active” (a valid prediction) from “LPEC-A bypassed” (valid=False) or “size cap fired” (capped=True).- Return type:
- Parameters:
- Args:
c_ineq: Inequality constraint values at current point. c_eq: Equality constraint values at current point. grad: Objective gradient at current point. A_ineq: Inequality constraint Jacobian. A_eq: Equality constraint Jacobian. lambda_ineq: Multiplier estimates for inequality constraints. mu_eq: Multiplier estimates for equality constraints. sigma: Threshold exponent (
sigma_barin the paper).Must be in (0, 1). Default 0.9 per paper recommendation.
- beta: Threshold scaling factor. Default
Noneuses the paper’s recommendation
1 / (m_ineq + n + m_eq).- trust_threshold: Maximum
rho_barfor which the LPEC-A prediction is trusted. When
rho_bar > trust_threshold, the predicted set is empty (the iterate is considered too far from the solution for the asymptotic guarantees to apply). Default1.0.
- beta: Threshold scaling factor. Default
- Returns:
LPECAResultcontaining the boolean prediction mask and the diagnostic flagsvalid/capped/rho_bar.
- slsqp_jax.lpeca.solve_lpeca_lp(c_ineq, c_eq, grad, A_ineq, A_eq, lambda_bound=1000000.0, eps_abs=1e-06, eps_rel=1e-06, max_iter=1000)[source]¶
Solve the LPEC-A LP to obtain tighter multiplier estimates.
Solves the LP from Eq. 42 of Oberlin & Wright (2005), adapted to the
c_ineq >= 0sign convention:min_{lambda, mu, u, v} sum(c_ineq_i * lambda_i for feasible i) + e^T u + e^T v s.t. grad - A_ineq^T lambda - A_eq^T mu = u - v 0 <= lambda <= K_1 u, v >= 0
The LP is solved using
mpax.r2HPDHG, the reflected restarted Halpern PDHG algorithm (Lu & Yang, 2024), which achieves accelerated linear convergence on LP.- Return type:
tuple[Float[Array, 'm_ineq'],Float[Array, 'm_eq']]- Parameters:
- Args:
c_ineq: Inequality constraint values at current point. c_eq: Equality constraint values at current point. grad: Objective gradient at current point. A_ineq: Inequality constraint Jacobian. A_eq: Equality constraint Jacobian. lambda_bound: Upper bound
K_1on lambda. Default 1e6. eps_abs: Absolute tolerance for the LP solver. eps_rel: Relative tolerance for the LP solver. max_iter: Maximum LP solver iterations.- Returns:
Tuple of (lambda_ineq, mu_eq) — the LP-optimal multiplier estimates for inequality and equality constraints.
- Raises:
ImportError: If
mpaxis not installed.
- slsqp_jax.lpeca.compute_lpeca_active_set(c_ineq, c_eq, grad, A_ineq, A_eq, lambda_ineq, mu_eq, sigma=0.9, beta=None, trust_threshold=1.0, use_lp=False, lp_lambda_bound=1000000.0, lp_eps=1e-06, lp_max_iter=1000)[source]¶
Compute the LPEC-A predicted active set, optionally refining multipliers.
This is the main entry point for LPEC-A active set identification. It optionally solves the LPEC-A LP to obtain tighter multiplier estimates, then applies the threshold test (with the trust gate and rank-aware size cap from
identify_active_set_lpeca()).- Return type:
- Parameters:
c_ineq (Float[Array, 'm_ineq'])
c_eq (Float[Array, 'm_eq'])
grad (Float[Array, 'n'])
A_ineq (Float[Array, 'm_ineq n'])
A_eq (Float[Array, 'm_eq n'])
lambda_ineq (Float[Array, 'm_ineq'])
mu_eq (Float[Array, 'm_eq'])
sigma (float)
beta (float | None)
trust_threshold (float)
use_lp (bool)
lp_lambda_bound (float)
lp_eps (float)
lp_max_iter (int)
- Args:
c_ineq: Inequality constraint values at current point. c_eq: Equality constraint values at current point. grad: Objective gradient at current point. A_ineq: Inequality constraint Jacobian. A_eq: Equality constraint Jacobian. lambda_ineq: Current multiplier estimates for inequalities. mu_eq: Current multiplier estimates for equalities. sigma: Threshold exponent (default 0.9). beta: Threshold scaling factor (default: paper recommendation). trust_threshold: Maximum
rho_barfor which the predictionis trusted (see
identify_active_set_lpeca()).- use_lp: If True, solve the LPEC-A LP to refine multiplier
estimates before the threshold test. Requires
mpax.
lp_lambda_bound: Upper bound K_1 on lambda in the LP. lp_eps: Tolerance for the LP solver. lp_max_iter: Maximum LP solver iterations.
- Returns:
LPECAResultwith the predicted active mask and diagnostic flags.