# Why mosek 7 does not change the variables?

I need to solve the following problem. I do it once with the default cvx solver (SDPT3) and for comparison I switch the solver to Mosek 7. I need Mosek 7 since I will need the mixed integer feature later on. But before that, with the SDPT3, I get an apparently feasible result whereas with the Mosek I get that the problem was “Solved” but it apparently stays degenerated as if Mosek does not recognizes the variables.
Below is the script:

``````J = 2; % # of FSLs
T0 = 5; % Planning horizon
h = ones(1,J); pai = ones(1,J);
Tr = [5 7];

cvx_begin
variable y(time_index(T0),J)
expression f
expression S(time_index(max(Tr)+T0), J)
expression G(size(S))
expression cum_y(time_index(T0),J)
expression S0_tilda(time_index(T0), 1)
expression S_tilda(time_index(max(Tr)+T0), J)
expression XX(size(S))
expression X(size(S))

S0_tilda = [0; 0; 0; 0; 1; 150]+200;
S_tilda =  [0 0; 0 0; 0 1; 0 2; 1 2; 1 3; 1 3; 1 3; 1 3; 1 3; 1 3; 1 3; 2 3];
%S = sparse([0 0; 0 0; 0 0; 0 0; 0 0; 1 3; 1 3; 1 3; 1 3; 1 3; 1 3; 2 3]);
XX = randi(20, size(S)) - 1; % TBD
for t = size(X,1):-1:1
X(t,:) = sum(XX(1:t,:));
end

%G(:,:) = 0;
%cum_y(:,:) = 0;

minimize f
subject to

y >= 0;

for t = T0:-1:0
cum_y(time_index(t), :) = sum(y(1:time_index(t),:),1);
end

sum(cum_y,2) <= S0_tilda

%% Calculating S and S_tilda
for j = 1:J
for t = Tr(j):Tr(j)+T0
%        if (t - Tr(j) > 0) && (t - Tr(j) <= size(cum_y,1))
S(time_index(t),j) = S_tilda(time_index(Tr(j)-1),j) + cum_y(time_index(t- Tr(j)),j);
%        end
end
end

%% Calculating G
for j = 1:J
for t = T0:Tr(j)+T0
%         if (S(t,j)-X(t,j) > 0)
G(time_index(t),j) = max(max(h(j)*(S(time_index(t),j)-X(time_index(t),j)), pai(j)*(X(time_index(t),j)-S(time_index(t),j))),0);
%             G(t,j) = max(G(t,j), 0);
%         else
%             G(t,j) = pai(j)*(X(t,j)-S(t,j));
%         end
end
end

f = sum(sum(G));
% The original constraints

cvx_end

% This is in a different m-file as required
function tind = time_index(time)
tind = time + 1;
end
``````

With SDPT3 I get:

``````Calling SDPT3: 66 variables, 36 equality constraints
For improved efficiency, SDPT3 is solving the dual problem.
------------------------------------------------------------
num. of constraints = 36 dim. of linear var  = 66
*******************************************************************

SDPT3: Infeasible path-following algorithms

****************************************************************

version  predcorr  gam  expon  scale_data
NT      1      0.000   1        0
it pstep dstep pinfeas dinfeas  gap      prim-obj      dual-obj    cputime
-------------------------------------------------------------------
0|0.000|0.000|1.3e+02|8.0e+00|5.3e+05| 1.059000e+04  0.000000e+00| 0:0:00| chol  1  1
1|0.883|0.848|1.5e+01|1.2e+00|7.6e+04| 4.861874e+03  0.000000e+00| 0:0:00| chol  1  1
2|0.927|1.000|1.1e+00|1.0e-04|7.3e+03| 3.676286e+03  0.000000e+00| 0:0:00| chol  1  1
3|0.989|1.000|1.2e-02|1.0e-05|8.4e+01| 4.226538e+01  0.000000e+00| 0:0:00| chol  1  1
4|0.989|1.000|1.4e-04|2.5e-03|9.3e-01| 4.647096e-01  0.000000e+00| 0:0:00| chol  1  1
5|0.989|1.000|1.5e-06|2.8e-05|1.0e-02| 5.189064e-03  0.000000e+00| 0:0:00| chol  1  1
6|0.989|1.000|1.7e-08|3.1e-07|1.1e-04| 5.703919e-05  0.000000e+00| 0:0:00| chol  1  1
7|0.989|1.000|1.8e-10|4.4e-09|1.2e-06| 6.268985e-07  0.000000e+00| 0:0:00| chol  1  1
8|0.985|1.000|2.8e-12|3.7e-11|2.3e-08| 1.313856e-08  0.000000e+00| 0:0:00| chol  1  1
9|0.988|1.000|3.2e-14|1.0e-12|3.3e-10| 2.222271e-10  0.000000e+00| 0:0:00|
stop: max(relative gap, infeasibilities) < 1.49e-08
-------------------------------------------------------------------
number of iterations   =  9
primal objective value =  2.22227148e-10
dual   objective value =  0.00000000e+00
gap := trace(XZ)       = 3.34e-10
relative gap           = 3.34e-10
actual relative gap    = 2.22e-10
rel. primal infeas     = 3.23e-14
rel. dual   infeas     = 1.00e-12
norm(X), norm(y), norm(Z) = 2.4e-12, 5.7e+03, 6.8e+03
norm(A), norm(b), norm(C) = 1.6e+01, 1.0e+00, 8.0e+02
Total CPU time (secs)  = 0.08
CPU time per iteration = 0.01
termination code       =  0
DIMACS: 3.2e-14  0.0e+00  2.3e-12  0.0e+00  2.2e-10  3.3e-10
-------------------------------------------------------------------
------------------------------------------------------------
Status: Solved
Optimal value (cvx_optval): +0
``````

With Mosek I get:

``````Calling Mosek: 66 variables, 36 equality constraints
For improved efficiency, Mosek is solving the dual problem.
------------------------------------------------------------

MOSEK Version 7.0.0.46(BETA) (Build date: 2013-3-5 12:46:45)
Copyright (c) 1998-2013 MOSEK ApS, Denmark. WWW: http://mosek.com

Computer
Platform               : Windows/64-X86
Cores                  : 2

Problem
Name                   :
Objective sense        : min
Type                   : LO (linear optimization problem)
Constraints            : 36
Cones                  : 0
Scalar variables       : 66
Matrix variables       : 0
Integer variables      : 0

Optimizer started.
Interior-point optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator - tries                  : 0                 time                   : 0.00
Eliminator - elim's                 : 20
Lin. dep.  - tries                  : 1                 time                   : 0.01
Lin. dep.  - number                 : 0
Presolve terminated. Time: 0.01
Interior-point optimizer terminated. Time: 0.03.

Optimizer terminated. Time: 0.06

Interior-point solution summary
Problem status  : PRIMAL_AND_DUAL_FEASIBLE
Solution status : OPTIMAL
Primal.  obj: 0.0000000000e+000   Viol.  con: 0e+000   var: 0e+000
Dual.    obj: 0.0000000000e+000   Viol.  con: 0e+000   var: 0e+000

Basic solution summary
Problem status  : PRIMAL_AND_DUAL_FEASIBLE
Solution status : OPTIMAL
Primal.  obj: 0.0000000000e+000   Viol.  con: 0e+000   var: 0e+000
Dual.    obj: 0.0000000000e+000   Viol.  con: 0e+000   var: 0e+000
Optimizer summary
Optimizer                 -                        time: 0.06
Interior-point          - iterations : 0         time: 0.03
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
Clean primal-dual   - iterations : 0         time: 0.00
Simplex                 -                        time: 0.00
Primal simplex        - iterations : 0         time: 0.00
Dual simplex          - iterations : 0         time: 0.00
Primal-dual simplex   - iterations : 0         time: 0.00
Mixed integer           - relaxations: 0         time: 0.00

------------------------------------------------------------
Status: Solved
Optimal value (cvx_optval): +0``````

The differences are not clear to me here. Both solvers are saying that the optimal value of the problem is zero.

Don’t bother. I’ve worked it out - the problem was ill-defined.