All the constraints you have defined are satisfied
>> check(Constraints)
++++++++++++++++++++++++++++++++++++++++++++++++++++
| ID| Constraint| Primal residual|
++++++++++++++++++++++++++++++++++++++++++++++++++++
| #1| Elementwise inequality| 0|
| #2| Elementwise inequality| 8|
| #3| Elementwise inequality| 0|
| #4| Elementwise inequality| 0|
| #5| Elementwise inequality| 0|
| #6| Elementwise inequality| 0|
| #7| Elementwise inequality| 0|
++++++++++++++++++++++++++++++++++++++++++++++++++++
Could be that you are using variables first, and then you manipulate it to impose a structure. I.e., you're doing the equivalent of
sdpvar x1 x2
y = x1 + x2;
x1 = x2;
y will depend on two variables. To do this correctly, you do either
sdpvar x1 x2
x1 = x2;
y = x1 + x2;
or
sdpvar x1 x2
y = x1 + x2;
Constraints = [x1 == x2]
sdisplay(actionM(1:5,1:4))
ans =
5×4 cell array
'internal(24662)' 'internal(22858)' 'internal(23114)' 'internal(23370)' 'internal(24662)' 'internal(22859)' 'internal(23115)' 'internal(23371)' 'internal(24662)' 'internal(22860)' 'internal(23116)' 'internal(23372)' 'internal(24662)' 'internal(22861)' 'internal(23117)' 'internal(23373)' 'internal(24662)' 'internal(22862)' 'internal(23118)' 'internal(23374)'>> sdisplay(StateMatrix(1:5,1:4))
ans =
5×4 cell array
'B' 'B-G(1)' 'B-G(1)-G(257)' 'B-G(1)-G(257)-G(513)' 'B' 'B-G(2)' 'B-G(2)-G(258)' 'B-G(2)-G(258)-G(514)' 'B' 'B-G(3)' 'B-G(3)-G(259)' 'B-G(3)-G(259)-G(515)' 'B' 'B-G(4)' 'B-G(4)-G(260)' 'B-G(4)-G(260)-G(516)' 'B' 'B-G(5)' 'B-G(5)-G(261)' 'B-G(5)-G(261)-G(517)'A = randn(20,15);
b = randn(20,1)*20;x = sdpvar(15,1);
e = b-A*x;[s,location] = sort(x);F = [s(1)+s(end) == 1, -100 <= x <= 100];
ops = sdpsettings('mosek.MSK_DPAR_OPTIMIZER_MAX_TIME',1);
optimize(F,norm(e,1),ops);
Optimizer terminated. Time: 1.17
Integer solution solution summary Problem status : PRIMAL_FEASIBLE Solution status : PRIMAL_FEASIBLE Primal. obj: 2.6754295295e+002 nrm: 3e+002 Viol. con: 1e-014 var: 0e+000 itg: 0e+000 Optimizer summary Optimizer - time: 1.17 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: 3 time: 1.03
Mosek error: MSK_RES_TRM_MAX_TIME ()