jaxopt icon indicating copy to clipboard operation
jaxopt copied to clipboard

Batched QP (and other optimization algorithm)

Open jn-tang opened this issue 3 years ago • 2 comments

I'm trying to make OSQP batchable (so I can make it a layer in neural networks, like OptNet), but I couldn't find any documentation yet about using vmap to solve batched version of optimization problems.

jn-tang avatar Nov 28 '22 11:11 jn-tang

Hi !

OSQP is batchable if you set the jitargument in constructor to True. The functions init_state, init_params, update and run are pure and jittable. Hence you can wrap them in any other function that you want to jit/vmap.

However note that a single OSQP instance corresponds to a certain form of problem with fixed hyper-parameters (in constructor). Hence all the instances you want to solve must share the same hyper-parameters. Only the initialization and the params_obj,params_eq,params_ineq may vary from an instance to another.

Algue-Rythme avatar Nov 29 '22 04:11 Algue-Rythme