Why does cvx solution sometimes have two stop conditions in matlab?

This is the relevant solution information:

Calling SDPT3 4.0: 3206 variables, 1410 equality constraints


num. of constraints = 1410
dim. of sdp var = 130, num. of sdp blk = 3
dim. of socp var = 1153, num. of socp blk = 385
dim. of linear var = 2


SDPT3: Infeasible path-following algorithms


version predcorr gam expon scale_data

HKM 1 0.000 1 0
it pstep dstep pinfeas dinfeas gap prim-obj dual-obj cputime

0|0.000|0.000|3.1e+02|9.4e+00|6.4e+05| 1.984331e+04 0.000000e+00| 0:0:00| spchol 1 1
1|0.174|0.067|2.5e+02|8.8e+00|5.6e+05| 1.785891e+04 -5.443133e+00| 0:0:00| chol 1 1
2|0.074|0.021|2.3e+02|8.6e+00|6.4e+05| 2.848533e+04 1.041366e+00| 0:0:00| chol 1 1
3|0.607|0.299|9.2e+01|6.1e+00|4.4e+05| 3.201831e+04 -1.477130e+01| 0:0:01| chol 1 1
4|0.838|0.909|1.5e+01|5.8e-01|7.1e+04| 3.441604e+04 -3.620493e+01| 0:0:01| chol 1 1
5|1.000|1.000|1.8e-07|1.9e-02|8.2e+03| 7.907011e+03 -1.732373e+01| 0:0:01| chol 1 1
6|0.952|1.000|1.5e-08|5.6e-03|1.7e+03| 1.691935e+03 -5.811846e+00| 0:0:01| chol 1 1
7|0.874|0.887|2.0e-09|1.1e-03|2.6e+02| 2.627169e+02 3.509646e+00| 0:0:02| chol 1 1
8|0.952|0.864|1.0e-10|2.0e-04|5.4e+01| 6.313471e+01 8.925130e+00| 0:0:02| chol 1 1
9|0.504|0.509|6.0e-11|1.0e-04|3.1e+01| 4.188609e+01 1.091709e+01| 0:0:02| chol 1 1
10|0.497|0.370|3.0e-11|6.5e-05|2.0e+01| 3.173579e+01 1.172999e+01| 0:0:03| chol 1 1
11|0.506|0.694|1.5e-11|2.0e-05|1.3e+01| 2.578889e+01 1.273564e+01| 0:0:03| chol 1 1
12|0.699|0.698|4.5e-12|6.0e-06|6.1e+00| 1.912957e+01 1.306165e+01| 0:0:03| chol 1 1
13|0.830|1.000|7.6e-13|5.6e-10|2.3e+00| 1.562124e+01 1.327705e+01| 0:0:04| chol 1 1
14|0.813|1.000|1.6e-13|5.7e-11|9.2e-01| 1.429366e+01 1.337469e+01| 0:0:04| chol 1 1
15|0.995|0.960|1.6e-14|8.7e-12|1.7e-01| 1.358227e+01 1.340925e+01| 0:0:04| chol 1 1
16|0.814|0.972|7.5e-14|1.8e-12|5.9e-02| 1.347936e+01 1.342075e+01| 0:0:05| chol 1 1
17|0.983|0.925|2.1e-13|1.2e-12|6.7e-03| 1.343022e+01 1.342348e+01| 0:0:05| chol 1 1
18|0.952|0.911|1.7e-12|1.1e-12|7.2e-04| 1.342475e+01 1.342403e+01| 0:0:05| chol 1 1
19|0.991|0.971|1.6e-10|1.0e-12|7.2e-05| 1.342418e+01 1.342411e+01| 0:0:06| chol 2 2
20|1.000|0.998|1.8e-12|1.5e-12|2.4e-06| 1.342411e+01 1.342411e+01| 0:0:06| chol
linsysolve: Schur complement matrix not positive definite
switch to LU factor. lu 7 1
21|0.993|0.993|1.3e-08|1.0e-12|2.8e-08| 1.342411e+01 1.342411e+01| 0:0:06|
stop: relative gap < infeasibility
stop: max(relative gap, infeasibilities) < 1.49e-08

number of iterations = 21
primal objective value = 1.34241127e+01
dual objective value = 1.34241126e+01
gap := trace(XZ) = 2.79e-08
relative gap = 1.00e-09
actual relative gap = 9.99e-10
rel. primal infeas (scaled problem) = 1.28e-08
rel. dual " " " = 1.01e-12
rel. primal infeas (unscaled problem) = 0.00e+00
rel. dual " " " = 0.00e+00
norm(X), norm(y), norm(Z) = 2.4e+01, 1.5e+01, 1.4e+01
norm(A), norm(b), norm(C) = 8.7e+01, 1.8e+01, 1.8e+01
Total CPU time (secs) = 6.25
CPU time per iteration = 0.30
termination code = 0

DIMACS: 2.1e-08 0.0e+00 5.9e-12 0.0e+00 1.0e-09 1.0e-09



Status: Solved
Optimal value (cvx_optval): +13.4241

Why we need two stop conditions (sometimes there is only the second condition):
stop: relative gap < infeasibility
stop: max(relative gap, infeasibilities) < 1.49e-08 ?
And why we need the relative gap?

I advise you not to worry about the low level details of the solver termination criteria, and just pay attention to the final CVX status.

OK, thanks. If I get the Status: Inaccurate/Solved, can I use the solution? Because it indeed give me a “normal” solution if I don’t query the solution state. And when get the Status: Inaccurate/Solved, what does “stop: primal infeas has deteriorated too much, 1.8e-07” mean?

Status: Inaccurate/Solved means that the optimalty criteria weren’t met to the desired tolerance. Sometimes a different solver will be able to solve to desired tolerance (hence, not Inaccurate/solved). Mosek is more numerically robust and reliable than SDPT3 or SeDuMi, so sometimes can get a normal termination when other solvers don’t.

Improving numerical scaling sometimes can avoid inaccurate solved status .

1 Like

Thanks, now I know “Inaccurate/Solved” means that the precision is at “reduced tolerance” level when the cvx_precision is set as default: ([ \epsilon^{1/2}, \epsilon^{1/2}, \epsilon^{1/4} ]). If I want to avoid this status, apart from using mosek solvers, what does “improving numerical scaling” mean? (any other methods?)

Try to choose units so that all non-zero input data is within a small number of orders of magnitude of 1.