Stopping criterion in CVX based integer programs

I am trying to solve a mixed integer convex programming using CVX Mosek. My program works for smaller number of integer variables but does not converge for a large number of integer variables.

Since CVX Mosek shows improving feasible solutions in each step, I can see that the program is trying to go close to lowest feasible solution (it’s a minimization problem) in each iteration. However, it can’t reach since no. of variables are too high.

I wonder if one can change CVX stopping criterion to the following:

STOP WHEN feasible solution <= A * global lower bound.

Here, A is a user-defined constant. If A is 2, i.e. user is satisfied with 50% gap from optimality. This will ensure that I will get a reasonable solution with 50% gap even for large number of variables.



That’s a good suggestion, and we’re considering the “right” way to handle this. In the meanwhile, see the documentation on cvx_solver_settings on this page of the documentation for information, and Mosek or Gurobi’s own documentation, for information on how to set the solver’s internal settings.

For Gurobi you probably want to set the MIP gap setting. I believe you can do this via:

cvx_solver_settings( 'MIPGap', .1 );

Further info on Gurobi’s MIPGap parameter is available here:

Sometimes it is possible to construct/guess a good feasible solution easily and if you feed that into optimizer it will most likely finish faster. However, I am not sure if it is possible to feed in a feasible solution CVX. If not, then I think it is important feature to add if possible.

You are also welcome to email your problem to MOSEK support at and we will take a look at it. It is vacation time so we may look at at immediately though.

I’m afraid it is not possible to feed in a feasible solution, and that feature is not likely to be added any time soon. After all, CVX creates a number of internal variables as it transforms problems to solvable form; the user never sees them, and would not know what values to supply for them!

Thanks a lot for your information. Do you know if such an option exists for MOSEK? For some reason, CVX MOSEK is working better for my problems than CVX Gurobi.

Erling, I sent an email to Mosek support today. It would be great to know if MOSEK has an “MipGap” option like Gurobi. CVX MOSEK is working better for my problem than CVX Gurobi. Therefore, a “MipGap” type stopping criterion in MOSEK would have been very helpful for me.

Hello Michael, I tried following command: cvx_solver_settings( ‘mio_max_time’, 200 ). I tried cvx_solver_settings( ‘mio_near_tol_rel_gap’, 0.8 ). (Ref:*mio-near-tol-rel-gap). But, CVX is showing me errors.

CVX is displaying: The argument ‘param.mio_near_tol_rel_gap’ is invalid.
Return code - 1200 [MSK_RES_ERR_IN_ARGUMENT] [A function argument is incorrect.]. Do you how I can resolve this?

Sorry to hear you are having trouble with Gurobi. If you posted your CVX/Gurobi model and log here (or on the Gurobi Google Group), I may be able to help you with it.