Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/quadratic_programming.rst
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ Example::

It is also possible to specify only equality constraints or only inequality
constraints by setting ``params_eq`` or ``params_ineq`` to ``None``.
Use ``None`` for a missing constraint family rather than empty arrays, such as
zero-row equality matrices. If both equality and inequality constraints are
absent, use the unconstrained QP approach below instead of :class:`jaxopt.OSQP`.

OSQP
~~~~
Expand Down Expand Up @@ -231,6 +234,12 @@ Example::

See :class:`jaxopt.BoxOSQP` for a full description of the parameters.

When using :class:`jaxopt.OSQP`, pass ``params_eq=None`` if there are no
equality constraints, or ``params_ineq=None`` if there are no inequality
constraints. At least one of these two arguments must be provided. Problems
without constraints should be solved as unconstrained QPs, for example with
conjugate gradient.

.. topic:: Example

* :ref:`sphx_glr_auto_examples_constrained_multiclass_linear_svm.py`
Expand Down
8 changes: 6 additions & 2 deletions jaxopt/_src/osqp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1058,8 +1058,12 @@ def run(self,
a tuple (Q, c) with Q a pytree of matrices,
or a tuple (params_Q, c) if ``matvec_Q`` is provided,
or an arbitrary pytree if ``fun`` is provided.
params_eq: (A, b) or None if no equality constraints.
params_ineq: (G, h) or None if no inequality constraints.
params_eq: (A, b) or None if no equality constraints. Use None rather
than an empty equality matrix.
params_ineq: (G, h) or None if no inequality constraints. Use None
rather than an empty inequality matrix. At least one of params_eq or
params_ineq must be not None; use an unconstrained QP solver when both
constraint families are absent.
Returns:
(params, state), ``params = (primal_var, dual_var_eq, dual_var_ineq)``
"""
Expand Down