7

I am using CVXPY (version 1.0) to solve a quadratic program (QP) and I often get this exception:

SolverError: Solver 'xxx' failed. Try another solver.

which makes my program really fragile. I have tried different solvers, including CVXOPT, OSQP, ECOS, ECOS_BB, SCS. They all have more or less the same problem. I noticed that when I make the stopping criteria of the solver more strict (e.g., decrease the absolute error tolerance), I get SolverError more frequently, and when I make it less strict, the SolverError problem is attenuated and even disappears. I also find that the way that CVXPY throws SolverError is stochastic: if I run the same program many times, there are some runs having SolverError and others get the optimal result.

Although I can avoid SolverError just by trying more times and lowering the stopping criteria, I really want to understand the real specific reasons behind the exception

SolverError: Solver 'xxx' failed. Try another solver.

This error is not really informative and I have no clues on what to do to improve the problem solving robustness. Are its causes specific to a solver? Is this exception thrown for a set of well-defined situations? Or is it just a way of saying "something goes wrong for unknown reasons"? What reasons might those be?

Rodrigo de Azevedo
  • 1,097
  • 9
  • 17
Tony
  • 445
  • 6
  • 13
  • (1) While the core-reason is the same, this is solver-specific (2) This boils down to limited-memory floating-point computations (3) There is a big difference between theory (of interior-point solvers) and practice (4) This should not be indeterministic (stochastic is the wrong word here), but i already pointed you to the reason in your other question. (5) Things get more tough when high-accuracy is needed: theory implies diverging for some values in those systems to solve; this will lead to an error at some time(6)If possible, use commercial solvers (no /trivial preprocessing in your solvers) – sascha Apr 13 '18 at 19:54
  • (Just to be clear: i explicitly mentioned IPM-methods like used in cvxopt, ecos, ecos_bb; but osqp and scs are based on a different theory) – sascha Apr 13 '18 at 19:56
  • You may want to ask on https://scicomp.stackexchange.com too. – Rodrigo de Azevedo Apr 14 '18 at 11:35
  • As far as I know, you are correct that `SolverError` is very generic and not very helpful. Did you try setting `verbose=True` for the `solve` method (documetation [here](http://www.cvxpy.org/en/latest/tutorial/advanced/#solve-method-options))? Maybe looking at the solver output will give you some better hints. – rkersh Apr 25 '18 at 18:36

1 Answers1

4

If you have a solver error, you need to either debug by calling the solve method with verbose=True to see the detailed error message or use a more robust commercial solver like MOSEK. The specific reasons for solver errors depend on the solver used. A common cause is having too tight a numerical tolerance or having badly scaled data (i.e., the dynamic range of the floats in your program is too large). I will modify the SolverError message to mention using verbose=True.

steven
  • 671
  • 4
  • 8