Can a varialbe 'cvx_problem' be saved into a file?

When solving a big scale problem, the time of creating a cvx problem is very long.
But I find that before the iteration displays on the screen, the corresponding cvx problem has been set up and saved as a variable ‘cvx_problem’, which can be found when debuging the program, as shown in the picture.


Is there any method that this variable ‘cvx_problem’ can be saved into a file, and loaded directly to start iteration in the next solving?

I don’t think so. …

Very thanks for your reply. Even though this method does not work, it doesn’t matter.
And I have another problem to ask. I’d appreciate it if you could take your time to see it.

From the iteration step cvx displayed, are these two problems nicely solve?
If not, how can I modify them?
For your convenience, I have bolded the important information. And it needs emphasing that these two problems are equivalent, the only difference is that Problem 2 is amplified by 1e6 times.

Problem 1:
Calling SDPT3 4.0:
478266 variables, 38 equality constraints
For improved efficiency, SDPT3 is solving the dual problem.

num. of constraints = 38
dim. of sdp var = 12, num. of sdp blk = 1
** dim. of linear var = 478230**

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|1.0e+08|1.8e+05|2.3e+11| 8.702784e+02 0.000000e+00| 0:0:04| chol 1 1
1|0.906|0.187|9.7e+06|1.4e+05|2.2e+10| 1.738444e+04 -2.612748e+02| 0:0:08| chol 1 1
2|0.982|0.984|1.7e+05|2.3e+03|3.8e+08| 1.730255e+04 -1.370374e+03| 0:0:11| chol 1 1
3|0.989|1.000|1.9e+03|1.2e-01|4.2e+06| 1.410609e+04 -1.388262e+03| 0:0:13| chol 1 1
4|0.989|1.000|2.1e+01|6.2e-02|4.8e+04| 1.547139e+02 -1.387206e+03| 0:0:16| chol 1 1
5|0.989|1.000|2.3e-01|6.2e-03|1.8e+03| 1.690945e+00 -1.296172e+03| 0:0:19| chol 1 1
6|0.989|1.000|2.4e-03|6.3e-04|1.1e+02| 1.857096e-02 -1.048797e+02| 0:0:22| chol 1 1
7|0.989|0.989|2.7e-05|5.5e-04|1.2e+00| 2.040227e-04 -1.153803e+00| 0:0:25| chol 1 1
8|0.989|0.989|2.9e-07|1.8e-05|1.3e-02| 2.246131e-06 -1.267887e-02| 0:0:28| chol 1 1
9|0.991|0.999|2.6e-09|7.0e-07|1.5e-04| 2.892996e-08 -1.529792e-04| 0:0:30| chol 1 1
10|0.974|0.998|6.7e-11|6.4e-08|1.9e-06| 4.538077e-09 -1.941238e-06| 0:0:33| chol 1 1
11|0.982|0.981|2.1e-12|1.2e-09|7.0e-08| 4.199326e-09 -6.557215e-08| 0:0:36| chol 1 1
12|1.000|0.993|8.8e-13|9.7e-12|1.1e-08| 3.924820e-09 -6.713040e-09| 0:0:38|
stop: max(relative gap, infeasibilities) < 1.49e-08

number of iterations = 12
primal objective value = 3.92481998e-09
dual objective value = -6.71304030e-09
gap := trace(XZ) = 1.06e-08
relative gap = 1.06e-08
actual relative gap = 1.06e-08
rel. primal infeas (scaled problem) = 8.84e-13
rel. dual " " " = 9.65e-12
rel. primal infeas (unscaled problem) = 0.00e+00
rel. dual " " " = 0.00e+00
norm(X), norm(y), norm(Z) = 3.1e-03, 3.6e-04, 1.7e+00
norm(A), norm(b), norm© = 6.9e+02, 2.4e+00, 2.7e+00
Total CPU time (secs) = 38.47
CPU time per iteration = 3.21
termination code = 0
DIMACS: 1.1e-12 0.0e+00 1.8e-11 0.0e+00 1.1e-08 1.1e-08


Status: Solved
Optimal value (cvx_optval): -6.71304e-09

Problem 2:
Calling SDPT3 4.0:
478266 variables, 38 equality constraints
For improved efficiency, SDPT3 is solving the dual problem.

num. of constraints = 38
dim. of sdp var = 12, num. of sdp blk = 1
** dim. of linear var = 478230**

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|1.6e+08|6.9e+02|1.4e+12| 7.262785e+08 0.000000e+00| 0:0:03| chol 1 1
1|0.892|0.224|1.7e+07|5.4e+02|1.5e+11| 7.849110e+07 -1.862516e+03| 0:0:07| chol 1 1
2|0.974|0.972|4.5e+05|1.5e+01|3.9e+09| 2.064510e+06 -8.183728e+03| 0:0:09| chol 1 1
3|0.989|1.000|5.0e+03|2.1e-02|4.3e+07| 3.759279e+04 -8.364168e+03| 0:0:12| chol 1 1
4|0.989|1.000|5.5e+01|1.0e-02|4.8e+05| 6.793454e+02 -8.360591e+03| 0:0:15| chol 1 1
5|1.000|1.000|4.3e-07|1.0e-03|8.0e+03| 8.729598e+00 -8.029366e+03| 0:0:17| chol 1 1
6|0.989|0.989|3.8e-07|1.1e-04|8.8e+01| 9.946314e-02 -8.754634e+01| 0:0:20| chol 1 1
7|0.979|0.988|7.9e-09|1.2e-05|1.0e+00| 5.465371e-03 -1.021526e+00| 0:0:22| chol 1 1
8|0.939|0.967|4.9e-10|1.4e-06|3.5e-02| 4.179182e-03 -3.046027e-02| 0:0:25| chol 1 1
9|0.976|0.926|1.3e-11|2.0e-07|8.5e-03| 3.803474e-03 -4.656938e-03| 0:0:27| chol 1 1
10|1.000|0.939|5.1e-14|2.2e-08|6.5e-03| 2.726735e-03 -3.796468e-03| 0:0:30| chol 1 1
11|1.000|0.924|3.3e-14|2.6e-09|3.4e-03| 2.462853e-03 -9.863482e-04| 0:0:32| chol 1 1
12|0.533|1.000|2.4e-14|1.1e-10|2.7e-03| 2.234449e-03 -4.220279e-04| 0:0:35| chol 1 1
13|0.712|1.000|4.2e-14|1.1e-11|2.0e-03| 1.893417e-03 -1.067617e-04| 0:0:37| chol 1 2
14|0.175|0.902|8.6e-12|3.1e-12|1.8e-03| 1.853256e-03 4.292601e-05| 0:0:40| chol 2 2
15|0.307|0.555|8.0e-12|2.9e-12|1.7e-03| 1.811151e-03 9.583110e-05| 0:0:42| chol 2 2
16|0.270|0.244|2.3e-10|3.8e-12|1.6e-03| 1.817327e-03 2.071849e-04| 0:0:45| chol 2 2
17|0.343|0.629|1.5e-10|3.8e-12|1.4e-03| 1.742493e-03 3.329454e-04| 0:0:47| chol 2 2
18|0.303|0.757|1.1e-10|4.5e-12|1.2e-03| 1.655833e-03 4.874806e-04| 0:0:50| chol 2 2
19|0.172|0.783|9.5e-11|6.4e-12|1.0e-03| 1.599953e-03 5.706707e-04| 0:0:52| chol 1 1
20|0.285|1.000|7.8e-11|8.1e-12|9.2e-04| 1.517799e-03 5.963192e-04| 0:0:55| chol 2 2
21|0.580|1.000|7.0e-11|1.2e-11|7.0e-04| 1.352828e-03 6.496560e-04| 0:0:58| chol 2 2
22|0.589|0.444|7.7e-10|2.1e-11|6.2e-04| 1.276504e-03 6.533158e-04| 0:1:00| chol 2 2
23|0.280|0.074|3.9e-09|4.0e-11|6.1e-04| 1.271765e-03 6.596996e-04| 0:1:03|
stop: progress is too slow
** stop: progress is bad**

number of iterations = 23
primal objective value = 1.27176548e-03
dual objective value = 6.59699612e-04
gap := trace(XZ) = 6.12e-04
relative gap = 6.11e-04
actual relative gap = 6.11e-04
rel. primal infeas (scaled problem) = 3.86e-09
rel. dual " " " = 4.00e-11
rel. primal infeas (unscaled problem) = 0.00e+00
rel. dual " " " = 0.00e+00
norm(X), norm(y), norm(Z) = 1.8e-01, 7.3e+00, 2.1e+00
norm(A), norm(b), norm© = 5.7e+03, 2.4e+00, 4.1e+03
Total CPU time (secs) = 62.79
CPU time per iteration = 2.73
termination code = -5
DIMACS: 4.7e-09 0.0e+00 2.4e-08 0.0e+00 6.1e-04 6.1e-04


Status: Failed
Optimal value (cvx_optval): NaN

Each problem above takes about 21 hours.

SPT3 claims to have solved the first problem, and failed due to numerical difficulties on the second problem.

Multiplying everything by 1e6 results in an equivalent problem if in exact (infinite precision) arithmetic. SDPT3 and the other solvers available in CVX are double precision solvers, and multiplying everything by 1e6 is very much not equivalent in double precision. Double precision solvers often have difficulty dealing with very large or small magnitude numbers, or a large span of magnitudes. Don’t tempt fate, unless you are just experimenting for recreational purposes.

Thanks a lot for your enthusiasm and the constructive reply.
Though SPT3 claims to have solve the first problem, the difference between primal and dual objective value is still relatively large when compared to primal objective value itself. Is there any method to narrow the difference?
Moreover, the stop criterion of SPT3 claims that max(relative gap, infeasibilities) < 1.49e-08, as far as the problem itself is concerned, is this stop criterion precise enough? Because the objective value is in the 1e-9 magnitude, and the number of iteration step is only 12.

The optimal objective of the first problem is essentially zero. Perhaps it would be exactly zero if the problem were solved exactly. (Unadjusted) Relative errors of numbers very close to zero are not very meaningful.

If you want a more in depth assessment, and can use Mosek as solver, then a Mosek employee on this forum might be able to provide a more in depth assessment.

Thanks a lot, I will have a try!
Once again, very grateful for your taking time to answer my question.