Cpu time per iteration and number of iterations

I am using cvx 2.1 Matlab interface. I want to find only solution time of my optimization problem. The report after the solution of the optimization problem showing the following:

number of iterations = 13
. … .
Total CPU time (secs) = 0.14
CPU time per iteration = 0.01

What is ‘Total CPU time’ in CVX 2.1 version ? Is it problem conversion + solution ?

Does ‘number of iterations’ include only iterations of the solution algorithm ?

Is the measure for ‘CPU time per iteration’ in ‘sec’ ? Does it mean average of problem conversion + solution or Does it indicate solution time only ?

Below the entire output is given:

Calling SDPT3 4.0: 35 variables, 12 equality constraints
For improved efficiency, SDPT3 is solving the dual problem.

num. of constraints = 12
dim. of socp var = 13, num. of socp blk = 1
dim. of linear var = 22


SDPT3: Infeasible path-following algorithms


version predcorr gam expon scale_data
NT 1 0.000 1 0
it pstep dstep pinfeas dinfeas gap prim-obj dual-obj cputime

0|0.000|0.000|1.3e+000|3.8e+000|1.7e+007| 2.170741e+006 0.000000e+000| 0:0:00| chol 1 1
1|0.764|0.768|3.0e-001|8.9e-001|4.8e+006| 1.743033e+006 2.631242e+004| 0:0:00| chol 1 1
2|0.596|0.600|1.2e-001|3.6e-001|2.8e+006| 1.505080e+006 3.484280e+004| 0:0:00| chol 1 1
3|0.587|0.583|5.0e-002|1.5e-001|1.7e+006| 1.164930e+006 3.563589e+004| 0:0:00| chol 1 1
4|0.615|0.583|1.9e-002|6.3e-002|1.0e+006| 8.294539e+005 3.346315e+004| 0:0:00| chol 1 1
5|0.711|0.590|5.6e-003|3.0e-002|6.3e+005| 5.433060e+005 3.221201e+004| 0:0:00| chol 1 1
6|1.000|0.545|2.8e-008|1.5e-002|2.8e+005| 2.781313e+005 4.417208e+004| 0:0:00| chol 1 1
7|0.856|1.000|6.4e-009|1.5e-004|1.0e+005| 1.071360e+005 6.847232e+003| 0:0:00| chol 1 1
8|0.990|0.877|1.0e-009|8.4e-005|4.3e+003| 1.551193e+004 1.169171e+004| 0:0:00| chol 1 1
9|0.929|0.961|2.3e-009|3.9e-005|3.3e+002| 1.178394e+004 1.168164e+004| 0:0:01| chol 1 1
10|0.982|1.000|2.0e-010|1.9e-005|1.8e+001| 1.147925e+004 1.156999e+004| 0:0:01| chol 1 1
11|0.985|0.991|9.0e-011|9.4e-006|2.7e-001| 1.146170e+004 1.151650e+004| 0:0:01| chol 2 2
12|0.957|1.000|7.8e-009|1.8e-011|1.2e-002| 1.146145e+004 1.146143e+004| 0:0:01| chol
linsysolve: Schur complement matrix not positive definite
switch to LU factor. lu 28 5
13|0.943|1.000|2.4e-009|1.4e-011|8.9e-004| 1.146144e+004 1.146144e+004| 0:0:01| lu 11 ^ 6
14|0.858|0.875|1.7e-008|3.7e-012|1.3e-004| 1.146144e+004 1.146144e+004| 0:0:01| lu 13 ^18
15|0.943|0.817|9.3e-009|9.8e-013|2.0e-005| 1.146143e+004 1.146144e+004| 0:0:01|
stop: max(relative gap, infeasibilities) < 1.49e-008

number of iterations = 15
primal objective value = 1.14614348e+004
dual objective value = 1.14614350e+004
gap := trace(XZ) = 2.00e-005
relative gap = 8.72e-010
actual relative gap = -8.41e-009
rel. primal infeas = 9.32e-009
rel. dual infeas = 9.84e-013
norm(X), norm(y), norm(Z) = 1.6e+005, 8.9e+003, 1.3e+004
norm(A), norm(b), norm© = 6.9e+000, 3.3e+003, 2.5e+002
Total CPU time (secs) = 0.59
CPU time per iteration = 0.04
termination code = 0
DIMACS: 1.8e-008 0.0e+000 2.0e-012 0.0e+000 -8.4e-009 8.7e-010


Status: Solved
Optimal value (cvx_optval): -111763

Where are you seeing this? CVX itself doesn’t provide that kind of information. Perhaps the solver is offering that?

It was in matlab. Using ‘cvx_begin’ and ‘cvx_end’.

Yes, I know you were using CVX. Perhaps you should edit your post with the entire output you’re seeing. Like I said, my suspicion is that it is the solver providing this information.

I have edited the post with complete output.

Great. As I suspected, it is the output of the SDPT3 solver where you are seeing that information. So it is only the solution time, not the conversion time.

Then is it possible to extract the solution time through cvx command or some matlab command? Or I can only get this by reading the output of the SDPT3? I wish to do some comparison according to the solution time.

You could use the MATLAB diary command to write the output to a file, then use something like PERL or sed to extract the time from the file.

1 Like