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?
CVX Modeling time vs. Solver time
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.
@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?
@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
@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
I have the same problem. Is it related to the matlab version? Shall I use an older Matlab to run the dumpfile functionality?
You can use the matlab diary function.
https://www.mathworks.com/help/matlab/import_export/write-to-a-diary-file.html
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.