Open amansouri3476 opened 2 years ago
First, until 2022, CVXPY Layer supports two open-source solvers: SCS and ECOS. More details can be found in issue #51 .
Besides, CVXPY Layers uses the package diffcp
to differentiate through cone programs. Right now, diffcp
only supports SCS... Once diffcp supports (say) MOSEK, CVXPY Layers could support it as well.
To specify the solver, you need to pass solver_args={"solve_method":"ECOS"}
to your cvxpylayer.
Hi!
Thank you for this great package!
I have a simple question for which I couldn't find the answer in other issues or on the web.
If I have a simple problem like the following, for which I'm using cvxpylayers (to be able to solve a batch of optimization problems), how/where can I specify the solver? In the documents, I see that the solver is specified as an argument to
problem.solve(solver='mosek')
. However, when using cvxpylayers, we don't invokesolve()
on the problem, rather it's done internally.Here's my problem definition:
Additionally, I would very much appreciate it if one could advise me as to whether my problem definition adheres to best practices for using cvxpy. I've reformulated my problem a couple of times to get speed-ups, and to me, this seems the closest form to defining a set of vectorized constraints. In fact when I remove all constraints, except for
constraints.extend([w >= 0.001])
, it only gets slower by about 20%, so I'm not sure if there's much room for improvement. But for my application, it is still slow, and each batch of size 128 still takes about 1s with 40 CPU cores. If I increase the problem size, it easily gets to 7s or 10s per batch which is considered very slow for my use case. I would very much appreciate any advice on speeding it up.Many thanks for your time and support.