Unstoppable mosek

I am using mosek under cvx in matlab. My program has integer variables and sometimes is expensive timewise ( I do not know if this is relevant). I renewed my academic license today and I noticed that although when I used to press control C the execution would stop and return a suboptimal solution, the behavior now is different(?!) and cvx ignores me and continues running, even when I spam it to stop. How can this be happening?

In general MATLAB makes it very hard for us like MOSEK to stop a program based on control c. It is an undocumented feature how to do it. See for instance


Ctrlk-c and logging in recent MATLABs is pain. Sorry to say so.

But I do not see why it should just stop working unless you upgraded MATLAB.

This undocumented feature is very tough for me to understand. Could it be better to do it using cvx_slvitr ? Even when I try to set this number to something like (cvx_slvitr= 15), the solver seems to ignore it and continue without stopping. Actually is there any possible way to set some type of time-out dependent of some variable? (iterations,real time, or anything else?)

You migh be able to set a maximum time MOSEK will run. How you do it from CVX I do not know.

You can use cvx_solver_settings to set MOSEK parameters to (non-default) values http://cvxr.com/cvx/doc/solver.html#advanced-solver-settings

Better late than never. If someone has the same problem, you can add this before cvx_begin.
cvx_solver_settings(‘MSK_DPAR_MIO_TOL_REL_GAP’, 2); This means that your solution is 2 times inferior to the relaxed optimum. Giving a big number you can force cvx to stop, when a solution is found somehow closed to the relaxed objective.
You can also use cvx_solver_settings(‘MSK_DPAR_MIO_MAX_TIME’, 300). This will interrupt the solver after 300 seconds. Both settings are not guaranteed to work, but at least give you some control over forced interruptions

What do you mean by “Both settings are not guaranteed to work”?

I mean that in 300 seconds you might not find a solution, so you will get not feasible although if you had more time, you would eventually have found an answer. In the same way, the gap you choose might be strict and still find something feasible but not as good as to force the setting to interrupt mosek.