Stopping cvx (mosek)?

Is there a way to set a max running time, or maximum number of cuts, when solving an integer problem with mosek? Or at least a way to stop a running optimization? It seems when the solver is running, the only way to stop it is shutting down matlab?

Mosek has lots of parameters, incl. time limits etc.:

And in the second FAQ question it shows how to set them from CVX:

1 Like

@Michal_Adamaszek nicely answered your question about changing Mosek parameters prior to Mosek being called by CVX.

As for terminating Mosek while it is in the middle of solving a problem provided by CVX, it seems that ctrl-C is generally effective in quickly halting Mosek and returning control to the MATLAB command line, at least under Windows, and I suspect under other operating systems as well. I have to defer to someone else whether situations ever occur in which Mosek is in the middle of something and non-responsive to ctrl-C. There are some mex optimizers under MATLAB which are non-responsive to ctrl-C, for which killing the MATLAB session may be the only way of stopping execution.

He did indeed. I didn’t reply ‘thanks’ because apparently that’s too short a post for this forum. I did ‘like’ it though :slight_smile:

On my system (windows 10 with matlab 2016b), crtl-c does not stop mosek, at least not during my integer problem. I get something like this instead:

941      940      856      7        -8.0331941223e+003   -1.1848245370e+004   47.49       55.4  
1064     1063     979      8        -8.0331941223e+003   -1.1837168401e+004   47.35       61.0  
1186     1185     1097     11       -8.0331941223e+003   -1.1811499176e+004   47.03       66.6  
1308     1307     1219     42       -8.0331941223e+003   -1.1811499176e+004   47.03       72.2  
1431     1430     1320     8        -8.0331941223e+003   -1.1808082791e+004   46.99       77.7  
1552     1551     1431     8        -8.0331941223e+003   -1.1806416583e+004   46.97       83.5  
1672     1671     1541     26       -8.0331941223e+003   -1.1800970040e+004   46.90       89.0  
Operation terminated by user during cvx_mosek

In cvx_mosek

In cvx_run_solver (line 50)
   [ varargout{1:nargout} ] = sfunc( inputs{:} );

In cvx_mosek

In cvxprob/solve (line 429)
            [ x, status, tprec, iters ] = shim.solve( At, b, c, cones, quiet, prec,
            solv.settings, eargs{:} );

In cvx_end (line 88)
        solve( prob );
1793     1792     1648     56       -8.0331941223e+003   -1.1800970040e+004   46.90       94.8  
1914     1913     1763     11       -8.0331941223e+003   -1.1800970040e+004   46.90       101.7 

(it acknowledges ctrl-c, but then continues)