jaxopt.BoxCDQP
- class jaxopt.BoxCDQP(maxiter=500, tol=0.0001, verbose=0, implicit_diff=True, implicit_diff_solve=None, jit='auto', unroll='auto')[source]
Coordinate descent solver for box-constrained QPs.
This solver minimizes:
0.5 <x, Qx> + <c, x> subject to l <= x <= u
- Parameters
maxiter (int) –
tol (float) –
verbose (int) –
implicit_diff (bool) –
implicit_diff_solve (Optional[Callable]) –
jit (Union[str, bool]) –
unroll (Union[str, bool]) –
- maxiter
maximum number of coordinate descent iterations.
- Type
int
- tol
tolerance to use.
- Type
float
- verbose
whether to print error on every iteration or not. Warning: verbose=True will automatically disable jit.
- Type
int
- implicit_diff
whether to enable implicit diff or autodiff of unrolled iterations.
- Type
bool
- implicit_diff_solve
the linear system solver to use.
- Type
Optional[Callable]
- jit
whether to JIT-compile the optimization loop (default: “auto”).
- Type
Union[str, bool]
- unroll
whether to unroll the optimization loop (default: “auto”).
- Type
Union[str, bool]
- __init__(maxiter=500, tol=0.0001, verbose=0, implicit_diff=True, implicit_diff_solve=None, jit='auto', unroll='auto')
- Parameters
maxiter (int) –
tol (float) –
verbose (int) –
implicit_diff (bool) –
implicit_diff_solve (Optional[Callable]) –
jit (Union[str, bool]) –
unroll (Union[str, bool]) –
- Return type
None
Methods
__init__([maxiter, tol, verbose, ...])attribute_names()attribute_values()init_state(init_params[, params_obj, ...])Initialize the solver state.
l2_optimality_error(params, *args, **kwargs)Computes the L2 optimality error.
optimality_fun(sol, params_obj, params_ineq)- rtype
Array
run(init_params, *args, **kwargs)Runs the optimization loop.
update(params, state, params_obj, params_ineq)Performs one epoch of coordinate descent.
Attributes
- init_state(init_params, params_obj=None, params_ineq=None)[source]
Initialize the solver state.
- Parameters
init_params (
Array) – array containing the initial parameters.params_obj (
Optional[Tuple[Array,Array]]) – Tuple of arrays(Q, c).params_ineq (
Optional[Tuple[Array,Array]]) – Tuple of arrays(l, u).
- Return type
BoxCDQPState- Returns
state
- l2_optimality_error(params, *args, **kwargs)
Computes the L2 optimality error.
- run(init_params, *args, **kwargs)
Runs the optimization loop.
- Parameters
init_params (
Any) – pytree containing the initial parameters.*args – additional positional arguments to be passed to the update method.
**kwargs – additional keyword arguments to be passed to the update method.
- Return type
OptStep- Returns
(params, state)
- update(params, state, params_obj, params_ineq)[source]
Performs one epoch of coordinate descent.
- Parameters
params (
Array) – array containing the parameters.state (
NamedTuple) – named tuple containing the solver state.params_obj (
Tuple[Array,Array]) – Tuple of arrays(Q, c).params_ineq (
Tuple[Array,Array]) – Tuple of arrays(l, u).
- Return type
OptStep- Returns
(params, state)