Discussion about this post

User's avatar
cvx123's avatar

You can specify solver precision in cvxpy. For your example if you run prob.solve(verbose=True, eps_abs=1e-7, eps_rel=1e-7) OSQP gets the correct answer. By default OSQP solves to tolerances of 1e-4.

You could also call Clarabel and it will solve the problem correctly since its default tolerances are 1e-8. Seems like the issue is that by default OSQP uses tolerances that are extraordinarily loose compared to any IPMs. It also looks like SCS (also a first order solver) by default uses extremely loose tolerances (1e-5) and gets the wrong answer.

Another take away is that you should by default use IPMs which are able to solve to high accuracy.

Expand full comment
weary-traveler's avatar

> Loosely specified solver precision now adds one more headache to your

> modeling. You have to ensure that no variables get too small with respect to

> other variables in your code. The annoying part is it’s hard to see which ones

> in advance.

Out of curiosity, would you label this behavior as hindering reproducibility or

replicability (or both, or neither)?

Expand full comment
5 more comments...

No posts