Skip to content

Solvers

DiffAPQP accepts continuous affine-parametric quadratic and linear programs and uses CVXPY solver interfaces for the forward pass. The default forward solver is OSQP. Linear programs are included in the QP rows below as the special case \(P=0\).

Default solver arguments

The following are DiffAPQP defaults, not necessarily the upstream defaults of each solver. They are applied by both SolMapLayer and ValueFuncLayer before each forward solve.

Solver Backend form Algorithm DiffAPQP default solver_args
OSQP QP ADMM operator splitting eps_abs=1e-5
eps_rel=1e-5
max_iter=100000
Gurobi QP Automatic continuous optimizer selection Threads=1
OptimalityTol=1e-8
FeasibilityTol=1e-8
BarConvTol=1e-8
SCS Conic Douglas-Rachford operator splitting eps_abs=1e-6
eps_rel=1e-6
max_iters=10000
ECOS Conic Primal-dual interior point abstol=1e-8
reltol=1e-8
max_iters=200
Clarabel Conic Interior point with homogeneous embedding tol_gap_abs=1e-8
tol_gap_rel=1e-8
max_iter=1000
QPALM QP Proximal augmented Lagrangian eps_abs=1e-6
eps_rel=1e-6
max_iter=10000
PROXQP QP Primal-dual proximal augmented Lagrangian eps_abs=1e-6
eps_rel=1e-6
max_iter=10000
backend="sparse"

For Gurobi, DiffAPQP does not set Method, so Gurobi selects the continuous optimization algorithm automatically. Threads=1 limits each individual solve to one solver thread; DiffAPQP can still solve different batch samples in parallel.

Overriding defaults

Values supplied in solver_args override the corresponding DiffAPQP defaults. Unspecified settings retain the values shown above:

primal_dict, *_ = layer(
    param_dict,
    solver="OSQP",
    solver_args={
        "eps_abs": 1e-7,
        "eps_rel": 1e-7,
        "max_iter": 200000,
    },
)

For a CVXPY-compatible solver without an explicit DiffAPQP profile, solver_args is empty and the solver uses its upstream defaults.

Warm-start and update support

The custom CVXPY fork provides DiffAPQP's sample-indexed warm-start and in-place data-update paths for OSQP, SCS, QPALM, and PROXQP. Other solvers use their standard CVXPY interfaces. See Installation for solver packages and custom-fork setup.

These settings apply only to the forward optimization solver. The solution-map layer's full-KKT or reduced-KKT adjoint method is configured separately through reduced_kkt, mode, and mode_args.