Keep solution on failure

From the doc:

Failed: “The solver failed to make sufficient progress towards a solution, even to within the “relaxed” tolerance setting. The values of cvx_optval and primal and dual variables are filled with NaN.”

Is it possible to tell CVX not to delete the solution on failure (not to fill with NaN)?
(I don’t want to change cvx_precision, since I still want to know that it failed within tolerance.)

No, there is not. The only thing you can do is reduce the target precision using the cvx_precision command. Do look at the documentation on that, though, because it may give you what you want, at least for some solvers.

For instance, you can specify one precision level as the “goal”, and then a second (worse) precision level as the “acceptable” target, and a third (worse) precision level as a “inaccurate” target.

That way, if the solver can give you a more accurate result, it will.

I think this option should be added, since changing cvx_precision would change the solver behavior (which might be possible to bypass manually - e.g. set tol to 0.999, and determine by myself if it failed or not).

Again, if you read the documentation, you will see that you can do something similar to this already.

What do you me by ‘again’, when you started your answer by ‘no, there isn’t’? Let me be specific. cvx_precision accepts 3 params: tolerance for the solver, and two tolerances for determining if the solution is good or not. I can set the third param at the most to 1-eps. If the violation is above

that, there’s nothing I can do to prevent cvx to throw away the solution. Also, what happens if I do want cvx to tell me that it fails for a third param of eps^0.25 (rely on cvx to determine if the solution is accurate enough), but still would like to preserve the solution and not get NaNs?