# 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

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