Cvx is returning NaN as output


(Kiran Shiragur) #1

I have a code where cvx returns NaN as output. However if I either change the solver or change the cvx_precision parameter it runs great. There have been instances where if I manually input the cvx_precision to exp(-5) it returns unbounded and cvx_opt will be set to Inf. However clearly my convex program is bounded as all the variables are bounded. For instance: Here is what I get when I run the code with mosek solver:

Successive approximation method to be employed.
For improved efficiency, Mosek is solving the dual problem.
Mosek will be called several times to refine the solution.
Original size: 627 variables, 234 equality constraints
117 exponentials add 819 variables, 468 equality constraints

Cones | Errors |
Mov/Act | Centering Exp cone Poly cone | Status
--------±--------------------------------±--------
60/ 60 | 4.488e+00 3.005e+00 5.171e-08 | Solved
66/ 66 | 4.584e+00 2.103e+00 7.297e-10 | Solved
25/ 25 | 3.867e+00 1.835e+00 5.332e-06 | Inaccurate/Solved
3/ 9 | 8.000e+00 5.811e-01 8.618e-06 | Failed
4/ 11 | 8.000e+00 8.298e+00 7.858e-06 | Failed
4/ 11 | 8.000e+00s 1.618e+01s 8.358e-06 | Failed
5/ 12 | 8.000e+00 2.424e+01 8.022e-06 | Failed
5/ 12 | 8.000e+00s 3.242e+01s 6.761e-06 | Failed
5/ 11 | 8.000e+00 4.011e+01 9.148e-06 | Failed

Status: Failed
Optimal value (cvx_optval): NaN

If I run the same code with Sedumi solver I get (I am not changing anything in the input):
Successive approximation method to be employed.
For improved efficiency, SeDuMi is solving the dual problem.
SeDuMi will be called several times to refine the solution.
Original size: 627 variables, 234 equality constraints
117 exponentials add 819 variables, 468 equality constraints

Cones | Errors |
Mov/Act | Centering Exp cone Poly cone | Status
--------±--------------------------------±--------
47/ 47 | 4.489e+00 3.005e+00 0.000e+00 | Solved
37/ 37 | 3.780e+00 1.830e+00 0.000e+00 | Inaccurate/Solved
23/ 23 | 2.789e+00 8.038e-01 0.000e+00 | Inaccurate/Solved
0/ 0 | 0.000e+00 0.000e+00 0.000e+00 | Inaccurate/Solved
0/ 0 | 0.000e+00 0.000e+00 0.000e+00 | Inaccurate/Solved
2/ 2 | 6.997e+00 3.916e+00 0.000e+00 | Failed
2/ 2 | 6.998e+00s 7.889e+00s 0.000e+00 | Failed
3/ 3 | 7.000e+00 1.450e+01 0.000e+00 | Failed
3/ 3 | 7.001e+00s 1.739e+01s 0.000e+00 | Failed
3/ 3 | 7.000e+00s 1.656e+01s 0.000e+00 | Failed
3/ 3 | 7.004e+00s 1.991e+01s 0.000e+00 | Failed

Status: Inaccurate/Solved
Optimal value (cvx_optval): +5891.48

This new output is a good solution for my purpose and I wish to have a more stable solution. There are also instances where Sedumi solver fails and mosek runs amazing. Would you please let me know what is the best strategy here. Thanks in advance for help!


(Mark L. Stone) #2

See the 2nd paragraph of my answer at Logistic Regression + linear programming - getting only Nan regarding use of CVXQUAD .

If your program is causing CVX’s successive approximation method to be invoked due to rel_entr ,as in Unable to implement this using entr() function. Any suggestions on how to implement this problem on cvx? , then once CVXQUAD has been installed and its exponential.m been installed by you to replace CVX’s version, CVXQUAD’s Pade approximation should automatically be invoked. Otherwise, you may need to reformulate your problem to explicitly invoke the exponential cone construct in CVX, as is covered in various other forum posts.