CVX Modeling time vs. Solver time


#1

When we solve a convex problem by CVX,
The cpu_time in CVX includes in the the modeling time. How to get the time taken by the solver to solve the convex problem?


Get solver cpu time
Get the running time of the inner solver
(Michael C. Grant) #2

I’m afraid this is not possible in the current version of CVX. The only thing I can think to do is dump out a copy of the raw solver data and run the solver by hand. To do that, type help cvx_solver_settings at the MATLAB prompt, and examine the dumpfile setting.

Keep in mind, however, that nearly all solvers perform a variety of transformations on the problems they take in before they actually start the solution proper. In other words, in a very real way, the modeling process continues even once a solver (like SeDuMi) has been called. And of course, after the solution is obtained, the solver’s transformations and CVX’s must be reversed in order to get the desired answer.

So in a sense, the modeling process cannot be totally separated from the raw numerical method being employed.


#3

@mcg: Thanks for your reply… In my matlab program I input like this:

cvx_solver sedumi

cvx_solver_settings( ‘dumpfile’, ‘Test’ )

But when I run my code, it does not work and the error message I get is:

Saving output to: Test.mat

Error using cell2struct
Number of field names must match number of fields in new structure.

And how to run the solver by hand?


#4

@mcg: Thanks for your reply… In my matlab program I input like this:

cvx_solver sedumi

cvx_solver_settings( ‘dumpfile’, ‘Test’ )

But when I run my code, it does not work and the error message I get is:

Saving output to: Test.mat

Error using cell2struct Number of field names must match number o


#5

@mcg: Thanks for your reply… In my matlab program I input like this:

cvx_solver sedumi

cvx_solver_settings( ‘dumpfile’, ‘Test’ )

But when I run my code, it does not work and the error message I get is:

Saving output to: Test.mat

Error using cell2struct Number of field names must match number o


(Frank) #6

I have the same problem. Is it related to the matlab version? Shall I use an older Matlab to run the dumpfile functionality?


(Behrooz) #7

You can use the matlab diary function.
https://www.mathworks.com/help/matlab/import_export/write-to-a-diary-file.html


(Stefan) #8

Hi, just came accross this post since I also wanted to determine runtime of the solver, in my case Mosek.

I solved it in the following way (notice solution will be solver dependent):

In “cvx_run_solver” I accessed the output (“varargout”) of the solver after calling “sfunc” (around line 50).

I found the optimization time of Mosek in varargout{2}.info.MSK_DINF_OPTIMIZER_TIME

I simply stored this in the structure cvx___ in order to access it later on.


(Royi) #9

@sschwarz, Can you give us some data on how much time it takes CVX build the model and how much time for the solver to solve it?

@mcg, Can we have a timing feature (With ON / OFF flag) in the next version?
Is CVX 3 project still alive?

Thank You.


(Stefan) #10

Well, I guess there is no generally valid answer to this question since it very much depends on how complicated your optimization problem is: I am solving a rather large MISOCP, where the actual optimization definitely dominates the total execution time.