Convenience API for QPs
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 76
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 1
Description
Currently, the interface for QPs is like this:
```python
params_obj = (Q, c)
params_eq = (A, b)
params_ineq = (G, h)
osqp = jaxopt.OSQP()
osqp.run(init, params_obj, params_eq, params_ineq)
```
I propose that we also add the following convenience API:
```python
def guaranteed_quadratic_function(params, params_obj):
[...]
osqp = jaxopt.OSQP(fun=guaranteed_quadratic_function)
osqp.run(init, params_obj, params_eq, params_ineq)
```
The idea is that we can, internally, automatically compute `Q` and `c` for the user using AD
```python
grad = jax.grad(self.fun)
c = grad(zeros, params_obj)
Q = jax.jacobian(grad)(zeros, params_obj)
```
Similarly, for solvers like OSQP that can leverage matvecs, we can derive the matvec of Q automatically.
CC @Algue-Rythme
Contributor guide
Assessment
This issue has not been assessed yet.