# Why is the solution state of the SDP model unbounded?

Why is the solution state of my SDP model unbounded？But theoretically my SDP model should be bounded.

``````ph=0.05;eff=1;
lap=1-2*ph;
e0=[1;0;0;0];e1=[0;1;0;0];e2=[0;0;1;0];e3=[0;0;0;1];

p0=e0*e0';
p1=(lap*e0+sqrt(1-lap^2)*e1)*(lap*e0+sqrt(1-lap^2)*e1)';
p2=(lap*e0+lap*sqrt((1-lap)/(1+lap))*e1+sqrt((1+lap-2*lap^2)/(1+lap))*e2)*(lap*e0+lap*sqrt((1-lap)/(1+lap))*e1+sqrt((1+lap-2*lap^2)/(1+lap))*e2)';
p3=(lap*e0+lap*sqrt((1-lap)/(1+lap))*e1+lap*sqrt((1-lap)/(1+lap*(2*lap+1)))*e2+sqrt((-3*lap^2+2*lap+1)/(2*lap+1))*e3)*(lap*e0+lap*sqrt((1-lap)/(1+lap))*e1+lap*sqrt((1-lap)/(1+lap*(2*lap+1)))*e2+sqrt((-3*lap^2+2*lap+1)/(2*lap+1))*e3)';
u=[1 0 0 0;0 1 0 0;0 0 1 0;0 0 0 1];
pr=[0.312042591483681 ,0.187957408512046,0.187957408512046,0.312042591483681;
0.312042591483681,0.312042591483681,0.187957408512046,0.187957408512046;
0.187957408512046,0.312042591483681,0.312042591483681,0.187957408512046;
0.187957408512046,0.187957408512046,0.312042591483681,0.312042591483681];
cvx_solver mosek
cvx_begin
variable H(4,4,4,4,4,4)  hermitian;
variable v(4,4);
y=-sum(sum(v.*pr));
minimize y
subject to
for u4=1:4
for u3=1:4
for u2=1:4
for u1=1:4
for j=1:4
-(p0*(1/4*kr(u1,j)+v(1,j))+p1*(1/4*kr(u2,j)+v(2,j))+p2*(1/4*kr(u3,j)+v(3,j))+p3*(1/4*kr(u4,j)+v(4,j))+H(:,:,u1,u2,u3,u4)-1/4*trace(H(:,:,u1,u2,u3,u4))*u)==semidefinite(4);
end
end
end
end
end
cvx_end
``````

Your problem is not reproducible, because `kr` has not been supplied.

To get it to run, I set `kr = eye(4);`, and the problem was reported as unbounded.

I then set a (negative) lower bound to the elements of `v`. For each value I tried, such as -100 or -1000, the problem was solved, and all elements of `v(4,:) ` were on the lower bound, producing ever small optimal objective value as the lower bound decreased (became a larger magnitude negative number).

Similar behavior occurred when I tired `kr = ones(4);`

I don’t know what your basis is for concluding the problem should be bounded. But your code, with the inputs you provided, does appear to be genuinely unbounded. i don’t know whether your code is correct, or the inputs, because i don’t understand the notation and conventions in the problem image.

Sorry, I forgot to mention that kr is my custom function, which is the delta function in the constraint. Additionally, one of the constraints can be simplified into the following form

In fact, the result of this model should be greater than or equal to 0, but I don’t know why the solution state is unbounded

Why is that a fact?

Your custom function is just (indexing into) the identity matrix, which is the first thing I tried, per my previous post, i.e., `kr = eye(4)`. So I actually ran with your input values, Adding `-200 <= v` produces an optimal objective value which is negative. Changing -200 to something even more negative, makes the optimal objective value even more negative. Apparently the objective of the original problem can become arbitrarily small, hence unbounded.

Experimentation with subtracting off even large multiples of the identity matrix from the LHS of the semidefinite constraints, thereby tightening the constraints, but the problem still being unbounded, convinces me that the unboundedness is not due to scaling or “cheating” on satisfying the constraints. Rather, given your input data and code, the problem is genuinely unbounded.

Okay, thank you very much for the answer. It could be that the data or code I provided was incorrect.
However, I also tried to solve its duality problem and found that the state is not feasible.Although I know that this is equivalent, only considering its duality problem, what is the factor that makes this SDP problem not feasible?
ph=0.05;eff=1;
lap=1-2*ph;
e0=[1;0;0;0];e1=[0;1;0;0];e2=[0;0;1;0];e3=[0;0;0;1];

p0=e0e0’;
p1=(lap
e0+sqrt(1-lap^2)e1)(lape0+sqrt(1-lap^2)e1)';
p2=(lap
e0+lap
sqrt((1-lap)/(1+lap))e1+sqrt((1+lap-2lap^2)/(1+lap))e2)(lape0+lapsqrt((1-lap)/(1+lap))e1+sqrt((1+lap-2lap^2)/(1+lap))e2)';
p3=(lap
e0+lapsqrt((1-lap)/(1+lap))e1+lapsqrt((1-lap)/(1+lap(2lap+1)))e2+sqrt((-3lap^2+2lap+1)/(2lap+1))e3)(lape0+lapsqrt((1-lap)/(1+lap))e1+lapsqrt((1-lap)/(1+lap(2lap+1)))e2+sqrt((-3lap^2+2lap+1)/(2lap+1))e3)';
u=[1 0 0 0;0 1 0 0;0 0 1 0;0 0 0 1];
pr=[0.312042591483681 ,0.187957408512046,0.187957408512046,0.312042591483681;
0.312042591483681,0.312042591483681,0.187957408512046,0.187957408512046;
0.187957408512046,0.312042591483681,0.312042591483681,0.187957408512046;
0.187957408512046,0.187957408512046,0.312042591483681,0.312042591483681];
cvx_begin sdp
variable M(4,4,4,4,4,4,4) hermitian semidefinite;
su=0;
for u4=1:4
for u3=1:4
for u2=1:4
for u1=1:4
su=trace(p0
M(:,:,u1,u1,u2,u3,u4))+trace(p1
M(:,:,u2,u1,u2,u3,u4))+trace(p2M(:,:,u3,u1,u2,u3,u4))+trace(p3M(:,:,u4,u1,u2,u3,u4))+su;
end
end
end
end
y=1/4su;
maximize y
subject to
for j=1:4
su1=0;
su2=0;
su3=0;
su4=0;
for u4=1:4
for u3=1:4
for u2=1:4
for u1=1:4
su1=trace(p0
M(:,:,j,u1,u2,u3,u4))+su1;
su2=trace(p1M(:,:,j,u1,u2,u3,u4))+su2;
su3=trace(p2
M(:,:,j,u1,u2,u3,u4))+su3;
su4=trace(p3*M(:,:,j,u1,u2,u3,u4))+su4;
end
end
end
end
su1==pr(1,j);
su2==pr(2,j);
su3==pr(3,j);
su4==pr(4,j);
end

for u4=1:4
for u3=1:4
for u2=1:4
for u1=1:4
suu=zeros(4);
for j=1:4
suu=M(:,:,j,u1,u2,u3,u4)+suu;
end
suu==1/4*trace(suu)*u;
end
end
end
end
cvx_end

Not all constraints can be satisfies simultaneously… You can selectively eliminate some of them, or introduce slack variables and try to minimize their magnitudes (rather than the using the original objective) to see how far they are from being satisfied. For the semidefinite constraints, that would require writing out the constraints with slacks (`s*eye(4) ) rather than declaring them hermitian semidefinite;.

If you took the dual correctly, maybe Mosek got more of less the same problem for both of your formulations, because CVX provided Modek the dual of your primal formulation,. and provided the primal of your duall formulation. in each case Mosek declared the problem as primal infeasible, which corresponds to your primal being unbounded. or your dual being infeasible.

Well, thank you very much for the suggestion. I will debug the program as you suggested.