Pro tip: Mosek and cvx_precision

Here is a pro tip.

DO NOT USE THE

cvx_precision

option when using Mosek. Period.

Mosek is designed so its default stopping criteria is the one that should be used.
Using a tighter tolerance will in the majority of cases not work.

If you need a tighter termination tolerance you should improve your model so it is not needed or use another optimizer. (Hint: Using another optimizer is unlikely to help.)

I hope @mcg will state this fact regarding Mosek in the manual next time he updates it.

1 Like

I have a question regarding this. What is meant by “the majority of cases will not work”? Does it mean that it will be ignored by Mosek?

From the discussion in
https://groups.google.com/g/mosek/c/QMM_Bsx44AI
it seems as if cvx_precision will have some effect on the Mosek tolerance.

I am a little confused, and if you can clarify on this, it would be very helpful.

That linked post is correct for what it says. However, @Michal_Adamaszek (its author) as well as @Erling (Mosek CEO/Chief Scientist), have been quite clear in posts on this forum that cvx_precision should always be left at its default setting when Mosek is the solver.

I would go further and state that cvx_precision should always be left at its default value for all solvers. That capability was a well-intentioned idea that we now know to not be a good idea.

If you use Mosek, then do NOT use cvx_precision. It is not ignored, but it does no good.

I am pretty if you ask Michael Grant the author of Cvx, then he will admit that it is a bad feature.

PS. All optimizers are usually only tested extensively with the default algorithmic parameters. Therefore, using anything but the default parameters is to ask for problems.

To be very precise:

  • cvx_precision best sets some termination criteria to values which Mosek should plain refuse to accept, but I guess nobody noticed until it was too late, or better said nobody thought a user could ever set such values. They can cause extremely weird behavior.
  • cvx_precision low is less harmful, but it will mostly give you a lousy solution. Here most people miss the fact that under the homogenous algorithm the solution will not only be poor for optimality but also poor for feasibility at a similar rate. Ie. it is not a magic switch to get some suboptimal solution much faster.

These are the main reasons not to use these settings.

If you really need to tune Mosek tolerances because you have a good reason and good evidence that it improves convergence on your problem then use the parameters directly 13.3 Conic Optimization - Interior-point optimizer — MOSEK Optimization Toolbox for MATLAB 10.1.12 In almost all situations we see this is, however, not the way to go.

1 Like

Thank you. I now understand that I should not use cvx_precision in general.

But what is the problem with cvx_precision high?
The minimum allowed values documented in
https://docs.mosek.com/latest/cxxfusion/parameters.html
for the values that @Michal_Adamaszek mentioned in the linked post are all 0 (listed below for completeness).

MSK_DPAR_INTPNT_CO_TOL_DFEAS
MSK_DPAR_INTPNT_CO_TOL_INFEAS
MSK_DPAR_INTPNT_CO_TOL_MU_RED
MSK_DPAR_INTPNT_CO_TOL_PFEAS
MSK_DPAR_INTPNT_CO_TOL_REL_GAP

In my personal experience, cvx_precision best has indeed caused some peculiar outcomes. However, it seems like “high” would not be a problem, since its lower tolerance is eps^(3/4)?

This is just sloppiness of the documentation and the fact that we normally use closed intervals to specify possible values. But in practice you see that zero makes no sense. You can not expect that the solver will converge with a residual equal to 0 for a typical nontrivial problem.

If precision high works well for you then go ahead. We have little experience with what happens.