# 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.

## 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

## 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.