# Failed Status and optimal value NAN

(akram) #1

I am running below codes on MATLAB and licensed cvx solver SDPT3 4.0.
As a result, I am getting Failed status. Also, I have tried use SeDuMi and Mosek to solve it, they both returned that：Infeasilbe.
So I want to know what’s the problem or how can I modify the model.
Thanks.

``````M=3;
N=2;
K=4;
E0=5;
pmax_r=2;
pr_max=pmax_r*ones(1,M);
min_user_rate=.1;
e_avail=E0*ones(1,K,M);
J_nor=0*rand(N,K,M);
b_nkm(:,:,1)=[ 1 1 0 0;1 0 1 0];
b_nkm(:,:,2)=[ 1 0 1 0;1 1 0 0];
b_nkm(:,:,3)=[ 0 0 1 1;0 1 1 0];

pr_old=2*ones(N,M);
landa=.5;
R_rrh_min=.4;
e_old=.3*ones(N,K,M);
alfa_old=[.6 .5 .7];
cvx_begin
variables alfa(1,M)

tr=log(1+cnr.*pr_old);
r_rrh=cvx(zeros(N,M));

for m=1:M
E_km=e_avail(:,:,m);
r_rrh(:,m)=((1-alfa(m))*tr(:,m));
for n=1:N
for k=1:K
check=J_nor(n,:,m)>=J_nor(n,k,m);
x=sum(J_nor(n,:,m).*b_nkm(n,:,m).*e_old(n,:,m).*check.*E_km)+alfa(m);
G=entr(x)+ sum(J_nor(n,:,m).*b_nkm(n,:,m).*e_old(n,:,m).*check.*E_km)*log(x);
H=-alfa_old(m)*log(alfa_old(m)+sum(J_nor(n,:,m).*b_nkm(n,:,m).*e_old(n,:,m).*check.*E_km)+(J_nor(n,k,m)*b_nkm(n,k,m)*e_old(n,k,m)*E_km(1,k)));
for i=1:K
if(i~=k)
temp=alfa_old(m)/(alfa_old(m)+sum(J_nor(n,:,m).*b_nkm(n,:,m).*e_old(n,:,m).*check.*E_km)+(J_nor(n,k,m)*b_nkm(n,k,m)*e_old(n,k,m)*E_km(1,k)));
else
obj_s3(n,k,m)=G-H_hat;
end
end
end
end
end

maximize sum(sum(sum(obj_s3)))+sum(sum(r_rrh))-(landa*sum(sum(pr_old)))
subject to
for m=1:M
0<=alfa(m)<=1
end
%constraint for the rate of the users

for m=1:M
ot1=obj_s3(:,:,m);
btemp=b_nkm(:,:,m)
ot2=obj_s3(:,:,m).*b_nkm(:,:,m);
ot3=sum(ot2,1);
for k=1:K
ot3(k)-min_user_rate >= 0;
end
end

%constraint for the rate of the rrh
for m=1:M
temp1=sum(tr,1);
R_rrh_min-temp1(:,m) <=0;
end

cvx_end``````

(Mark L. Stone) #2

Your code is missing the right-hand side variables in `cnr=rrh_fad./(N0*Bw);` and therefore is not reproducible.

Given use of log, your program is invoking the not very reliable CVX successive approximation method. I recommend you install CVXQUAD https://github.com/hfawzi/cvxquad , including its `exponential.m` replacement for CVX’s version. This is sufficient for your program to cause CVXQUAD’s Pade approximant to be used instead of CVX’s successive approximation method. That should hopefully avoid “failure”, as you got with SDPT3 . However, your problem may still be infeasible. The most reliable assessment of that can probably be made using the MOSEK solver together with CVXQUAD;s Pade approximant.

If your program is infeasible, you will have to do more investigation to determine why. You can try eliminating certain constraints, minimizing infeasibilities instead of your current objective, etc.

(akram) #3

``````M=3;
N=2;
K=4;
E0=5;
pmax_r=2;
pr_max=pmax_r*ones(1,M);
min_user_rate=.1;
e_avail=E0*ones(1,K,M);
J_nor=0*rand(N,K,M);
b_nkm(:,:,1)=[ 1 1 0 0;1 0 1 0];
b_nkm(:,:,2)=[ 1 0 1 0;1 1 0 0];
b_nkm(:,:,3)=[ 0 0 1 1;0 1 1 0];

pr_old=2*ones(N,M);
landa=.5;
R_rrh_min=.4;
e_old=.3*ones(N,K,M);
alfa_old=[.6 .5 .7];
N0=10^-16;
Bw=100e6;

cvx_begin
variables alfa(1,M)

tr=log(1+cnr.*pr_old);
r_rrh=cvx(zeros(N,M));

for m=1:M
E_km=e_avail(:,:,m);
r_rrh(:,m)=((1-alfa(m))*tr(:,m));
for n=1:N
for k=1:K
check=J_nor(n,:,m)>=J_nor(n,k,m);
x=sum(J_nor(n,:,m).*b_nkm(n,:,m).*e_old(n,:,m).*check.*E_km)+alfa(m);
G=entr(x)+ sum(J_nor(n,:,m).*b_nkm(n,:,m).*e_old(n,:,m).*check.*E_km)*log(x);
H=-alfa_old(m)*log(alfa_old(m)+sum(J_nor(n,:,m).*b_nkm(n,:,m).*e_old(n,:,m).*check.*E_km)+(J_nor(n,k,m)*b_nkm(n,k,m)*e_old(n,k,m)*E_km(1,k)));
for i=1:K
if(i~=k)
temp=alfa_old(m)/(alfa_old(m)+sum(J_nor(n,:,m).*b_nkm(n,:,m).*e_old(n,:,m).*check.*E_km)+(J_nor(n,k,m)*b_nkm(n,k,m)*e_old(n,k,m)*E_km(1,k)));
else
obj_s3(n,k,m)=G-H_hat;
end
end
end
end
end

maximize sum(sum(sum(obj_s3)))+sum(sum(r_rrh))-(landa*sum(sum(pr_old)))
subject to
for m=1:M
0<=alfa(m)<=1
end
%constraint for the rate of the users

for m=1:M
ot1=obj_s3(:,:,m);
btemp=b_nkm(:,:,m)
ot2=obj_s3(:,:,m).*b_nkm(:,:,m);
ot3=sum(ot2,1);
for k=1:K
ot3(k)-min_user_rate >= 0;
end
end

%constraint for the rate of the rrh
for m=1:M
temp1=sum(tr,1);
R_rrh_min-temp1(:,m) <=0;
end

cvx_end
``````

Thanks again.

(Mark L. Stone) #4

Removing these constraints makes the problem feasible:

``````%constraint for the rate of the users

for m=1:M
ot1=obj_s3(:,:,m);
btemp=b_nkm(:,:,m)
ot2=obj_s3(:,:,m).*b_nkm(:,:,m);
ot3=sum(ot2,1);
for k=1:K
ot3(k)-min_user_rate >= 0;
end
end
``````

To further diagnose, I declared
`variable joe`
changed
`ot3(k)-min_user_rate >= 0;`
to
`ot3(k)-min_user_rate >= joe;`
and changed the objective to
`maximize(joe)` .
The optimal value of joe = -0.100, when of course it needs to be at least 0 for your original problem to be feasible.

Even if all the other constraints are removed, the optimal value of joe is still -0.100, which shows that the “joe” constraints are what you have to focus on.

(akram) #5

Or another way of looking at is that your problem would be feasible if `min_user_rate` were set to `0` rather than the `0.1` you have imposed.