Is the mixed integer SOCP optimization problem solvable in MOSEK-CVX?

I would appreciate it if you help me.
I have a mixed integer SOCP ( second-order cone program) optimization problem.
I solved it with MOSEK solver- CVX but my achieved results have some mistakes. Why?
Thank you in advance

You will have to provide a lot more information in order for anyone to diagnose the situation and help you.

Thank you so much for your help and consideration.
In my problem, I have Cardinality and SOCP Constraints and I restricted decision variables between -0.1 and 0.1. But when I solved this model with MOSEK solver, my achieved results are such as 0.5, 0.7,… that they are not in my goal bound.

Can you copy and paste your program into a post, preferably complete with all input data? And show all CVX and solver output (do not use quiet mode).

My input data has several matrices with dimensions 16 * 16
Can I email my program?

At least start out by showing the program and the output. Have you tried to make a reduced size (dimension) version of your problem to see whether that exhibits the same problem?

cvx_begin %quiet
cvx_solver mosek
variables x(n) u(n)
variables p(n) gama(n) ro tau
variable z(n) binary
variable h(n) binary

minimize(lambda*(ro +tau)...
    -(1-lambda)*( mu0'*x - (beta'*gama)-rc*sum(p)))
subject to


{[2*(W0^0.5)*x; 1-ro], 1+ro} <In> lorentz(n+1);
{[2*(delta^0.5)*gama; 1-tau], 1+tau } <In> lorentz(n+1);

sum(gama) <=1;
x<= gama;
-gama <= x;
sum(z)== 10;
x >= (-0.1)*z;
x <= 0.1*z;
gama >= 0

p <= M*(h)
c*x - p <= M*(1-h)
p <= c*x;
p >= -(h)*M
x <= M*(1-h);
x >= -M*(h);


Calling Mosek 293 variables, 228 equality constraints

MOSEK Version (Build date: 2017-3-1 13:09:33)
Copyright © MOSEK ApS, Denmark. WWW:
Platform: Windows/64-X86

MOSEK warning 710: #1 (nearly) zero elements are specified in sparse col ‘’ (4) of matrix ‘A’.
MOSEK warning 710: #1 (nearly) zero elements are specified in sparse col ‘’ (9) of matrix ‘A’.
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 228
Cones : 2
Scalar variables : 293
Matrix variables : 0
Integer variables : 32

Optimizer started.
Mixed integer optimizer started.
Threads used: 2
Presolve started.
Presolve terminated. Time = 0.02
Presolved problem: 116 variables, 226 constraints, 1394 non-zeros
Presolved problem: 0 general integer, 32 binary, 84 continuous
Clique table size: 0
0 1 0 0 NA -3.6646785261e-002 NA 0.1
0 1 0 0 -2.9135050814e-002 -3.6646785261e-002 25.78 0.1
0 1 0 0 -5.8852053748e-002 -5.8852053748e-002 0.00e+000 0.1
An optimal solution satisfying the relative gap tolerance of 1.00e-002(%) has been located.
The relative gap is 0.00e+000(%).
An optimal solution satisfying the absolute gap tolerance of 0.00e+000 has been located.
The absolute gap is 0.00e+000.

Objective of best integer solution : -5.885205374769e-002
Best objective bound : -3.664678526094e-002
Construct solution objective : Not employed
Construct solution # roundings : 0
User objective cut value : 0
Number of cuts generated : 0
Number of branches : 0
Number of relaxations solved : 1
Number of interior point iterations: 10
Number of simplex iterations : 0
Time spend presolving the root : 0.02
Time spend in the heuristic : 0.00
Time spend in the sub optimizers : 0.00
Time spend optimizing the root : 0.00
Mixed integer optimizer terminated. Time: 0.11

Optimizer terminated. Time: 0.19

Integer solution solution summary
Problem status : PRIMAL_FEASIBLE
Solution status : INTEGER_OPTIMAL
Primal. obj: -5.8852053748e-002 nrm: 1e+001 Viol. con: 2e-010 var: 6e-001 cones: 0e+000 itg: 0e+000
Optimizer summary
Optimizer - time: 0.19
Interior-point - iterations : 0 time: 0.00
Basis identification - time: 0.00
Primal - iterations : 0 time: 0.00
Dual - iterations : 0 time: 0.00
Clean primal - iterations : 0 time: 0.00
Clean dual - iterations : 0 time: 0.00
Simplex - time: 0.00
Primal simplex - iterations : 0 time: 0.00
Dual simplex - iterations : 0 time: 0.00
Mixed integer - relaxations: 1 time: 0.11

Status: Solved
Optimal value (cvx_optval): -0.0588521

out =

struct with fields:

opt2: -0.0589


x =


What is the optimal value of the z vector?

I don’t know what the consequences of

MOSEK warning 710: #1 (nearly) zero elements are specified in sparse col ‘’ (4) of matrix ‘A’.
MOSEK warning 710: #1 (nearly) zero elements are specified in sparse col ‘’ (9) of matrix ‘A’.

are, and whether that played a role in what happened with x.

Is any of your input data of very small magnitude? How about large magnitude input data, such as (big) M, which can cause havoc if it is too large.

Also, I recommend you use Mosel 9.0. To do this, presuming you have installed Mosek 9.0 under MATLAB, rename or delete the mosek directory under the CVX directory, and reinstall CVX. Or you may be able to look at the output of cvx_solver, and use the cvx_solver command to specify the Mosek 9 version of CVX.

Thanks for your attention and recommend

z =


Yes, my input data are small at 0.001
M= 10

If you can create a reproducible example, perhaps we can further help. Can you reduce the dimension to a small value of n, and include all input data in your posted program, and still exhibit the problem? For example, include
mu0 = [0.422706568149129 0.736556819442958 0.539333291198740]';
etc., in your code.

I tried to create an example in small dimensions.
I did not get this error.

Please show the results of cvx_version .

If you are using CVX 3.0beta, switch to CVX 2.1, because CVX 3.0beta is known to have many bugs, including in some cases constraints not being correctly provided to the solver.

Do you have Gurobi available? If so, try that and see what happens. How about an intermediate-size problem,? Or in any event, display all your input data in a MATLAB session, then read that it in as part of your MATLAB program, and veiify that this read in version exhibits the “error”.

Otherwise, you can try
cvx_solver_settings('write', 'dump.task.gz')
as advised in
and see whether Mosek support might be able to help. I have no idea whether the problem is on the CVX or Mosek side, or perhaps is due to “nasty” input data.

The viol var at 0.6 is a bit large. Either it is bad problem or you have hit bug. I would upgrade to Mosek v9. If that does not solve the problem I would contact Mosek support at

my cvx_version is as follows

CVX: Software for Disciplined Convex Programming ©2014 CVX Research
Version 2.1, Build 1127 (95903bf) Sat Dec 15 18:52:07 2018

Installation info:
Path: D:\CVX_software\cvx-w64\cvx
MATLAB version: 9.2 (R2017a)
OS: Windows 7 amd64 version 6.1
Java version: 1.7.0_60
Verfying CVX directory contents:
No missing files.
Path: C:\Users\pc\AppData\Roaming\MathWorks\MATLAB\cvx_prefs.mat
License host:
Username: pc
Host ID: dc0ea114afdd (eth3)
Installed license:
No license installed.

I didn’t use Gurobi solver.

Thank you so much for your help and consideration.

If you would like help from Mosek then the best would be to do

cvx_solver_settings('write', 'dump.task.gz')

and then send the file to

Otherwise you can also post a completely reproducible example with all the input data.

Thanks for your attention and help