slsqp_jax.inner.craig

ProjectedCGCraig — null-space projected CG with CRAIG / Golub-Kahan bidiagonalisation as the projector (no ε-regularised Cholesky).

slsqp_jax.inner.craig

Projected CG with CRAIG-based iterative null-space projection.

class slsqp_jax.inner.craig.ProjectedCGCraig[source]

Bases: AbstractInnerSolver

Projected CG with CRAIG-based iterative null-space projection.

Replaces the Cholesky factorization of A A^T with iterative CRAIG solves (Golub-Kahan bidiagonalization). This eliminates the O(m^3) factorization cost and the 1e-8 diagonal regularization, at the cost of an iterative solve per projection.

For multiplier recovery (done once after the CG loop), CG on the normal equations A A^T y = rhs is used, reusing the existing solve_unconstrained_cg infrastructure.

max_cg_iter: int
cg_tol: Float[Array, ''] | float
cg_regularization: float = 1e-06
use_constraint_preconditioner: bool = False
craig_tol: float = 1e-10
craig_max_iter: int = 200
mult_recovery_tol: float = 1e-12
mult_recovery_max_iter: int = 200
solve(hvp_fn, g, A, b, active_mask, precond_fn=None, free_mask=None, d_fixed=None, adaptive_tol=None)[source]

Solve the equality-constrained QP subproblem.

Solves:

minimize    (1/2) d^T B d + g^T d
subject to  A[active] d = b[active]
            d[i] = d_fixed[i]  for i where free_mask[i] is False

where B is given implicitly via hvp_fn(v) = B @ v.

Return type:

InnerSolveResult

Parameters:
  • hvp_fn (Callable[[Float[Array, 'n']], Float[Array, 'n']])

  • g (Float[Array, 'n'])

  • A (Float[Array, 'm n'])

  • b (Float[Array, 'm'])

  • active_mask (Bool[Array, 'm'])

  • precond_fn (Callable[[Float[Array, 'n']], Float[Array, 'n']] | None)

  • free_mask (Bool[Array, 'n'] | None)

  • d_fixed (Float[Array, 'n'] | None)

  • adaptive_tol (Float[Array, ''] | float | None)

Args:

hvp_fn: Hessian-vector product function v -> B @ v. g: Linear term (gradient of objective). A: Combined constraint matrix (m x n). b: Combined RHS vector (m,). active_mask: Boolean mask (m,) indicating active constraints. precond_fn: Optional preconditioner v -> M @ v where M ~ B^{-1}. free_mask: Optional boolean mask (n,). When provided, only

variables with free_mask[i] = True are optimized.

d_fixed: Values for fixed variables (n,). Required when

free_mask is provided.

adaptive_tol: Optional Eisenstat-Walker tolerance override.

When provided, overrides the solver’s default convergence tolerance for this call only.

Returns:

InnerSolveResult with the direction, multipliers, and convergence flag.

build_projection_context(hvp_fn, g, A, b, active_mask, precond_fn=None, free_mask=None, d_fixed=None)[source]

Build a reusable projector + multiplier-recovery context.

Composed strategies (e.g. HRInexactSTCG) call this on the underlying inner solver to obtain its null-space projector, particular solution and multiplier-recovery closure without running the projector’s own CG loop.

The default implementation raises NotImplementedError so full-KKT solvers (MinresQLPSolver) cleanly opt out — they have no separate projection step and therefore cannot supply the inexact-projector W̃_k that HR Algorithm 4.5 needs.

Return type:

ProjectionContext

Parameters:
  • hvp_fn (Callable[[Float[Array, 'n']], Float[Array, 'n']])

  • g (Float[Array, 'n'])

  • A (Float[Array, 'm n'])

  • b (Float[Array, 'm'])

  • active_mask (Bool[Array, 'm'])

  • precond_fn (Callable[[Float[Array, 'n']], Float[Array, 'n']] | None)

  • free_mask (Bool[Array, 'n'] | None)

  • d_fixed (Float[Array, 'n'] | None)

__init__(max_cg_iter, cg_tol, cg_regularization=1e-06, use_constraint_preconditioner=False, craig_tol=1e-10, craig_max_iter=200, mult_recovery_tol=1e-12, mult_recovery_max_iter=200)
Parameters:
  • max_cg_iter (int)

  • cg_tol (Float[Array, ''] | float)

  • cg_regularization (float)

  • use_constraint_preconditioner (bool)

  • craig_tol (float)

  • craig_max_iter (int)

  • mult_recovery_tol (float)

  • mult_recovery_max_iter (int)

Return type:

None