jaxopt.CvxpyQP
- class jaxopt.CvxpyQP(solver='OSQP', implicit_diff_solve=None)[source]
Wraps CVXPY’s quadratic solver with implicit diff support.
No support for matvec, pytrees, jit and vmap. Meant to be run on CPU. Provide high precision solutions.
The objective function is:
0.5 * x^T Q x + c^T x subject to Gx <= h, Ax = b.
- Parameters
solver (str) –
implicit_diff_solve (Optional[Callable]) –
- solver
string specifying the underlying solver used by Cvxpy, in
"OSQP", "ECOS", "SCS"
(default:"OSQP"
).- Type
str
- __init__(solver='OSQP', implicit_diff_solve=None)
- Parameters
solver (str) –
implicit_diff_solve (Optional[Callable]) –
- Return type
None
Methods
__init__
([solver, implicit_diff_solve])attribute_names
()attribute_values
()l2_optimality_error
(params, params_obj, ...)Computes the L2 norm of the KKT residuals.
run
(init_params, params_obj[, params_eq, ...])Runs the quadratic programming solver in CVXPY.
Attributes
implicit_diff_solve
- l2_optimality_error(params, params_obj, params_eq, params_ineq)[source]
Computes the L2 norm of the KKT residuals.
- Return type
OptStep
- Parameters
params (Array) –
params_obj (Tuple[Array, Array]) –
params_eq (Optional[Tuple[Array, Array]]) –
params_ineq (Optional[Tuple[Array, Array]]) –
- run(init_params, params_obj, params_eq=None, params_ineq=None)[source]
Runs the quadratic programming solver in CVXPY.
The returned params contains both the primal and dual solutions.
- Parameters
init_params (
Optional
[Array
]) – ignored.params_obj (
Tuple
[Array
,Array
]) – (Q, c).params_eq (
Optional
[Tuple
[Array
,Array
]]) – (A, b) or None if no equality constraints.params_ineq (
Optional
[Tuple
[Array
,Array
]]) – (G, h) or None if no inequality constraints.
- Return type
OptStep
- Returns
(params, state),
params = (primal_var, dual_var_eq, dual_var_ineq)