I have a convex problem that the following constraints are not fully satisfied. Moreover, the cvx_status is solved.
be=b_nkm.*e;
for m=1:M
be_temp= be(:,:,m);
be_t2=sum(be_temp,1);
for k=1:K
be_t2(:,k)-1<=0;
end
end
I will appreciate you if advise me.
The complete codes are as follows:
M=3;
N=2;
K=4;
E0=1;
N0=10^-16;
Bw=100e6;
pmax_r=2;
pr_max=pmax_rones(1,M);
min_user_rate=0;
e_avail=E0ones(1,K,M);
J_nor=10*rand(N,K,M);
landa=.5;
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];
p_rrh_old=(pmax_r/2)*ones(N,M);
alfa_old=[.6 .5 .7];
e_old=ones(N,K,M);
landa=.5;
R_rrh_min=.4;
e_old=.5ones(N,K,M);
rrh_fad=100rand(N,M);
cvx_begin
variables e(N,K,M) pr(N,M)
cnr=rrh_fad./(N0*Bw);
tr=log(1+cnr.*pr);
r_rrh=cvx(zeros(N,M));
for m=1:M
E_km=e_avail(:,:,m);
r_rrh(:,m)=((1-alfa_old(m))*tr(:,m));
for n=1:N
for k=1:K
check=J_nor(n,:,m)>=J_nor(n,k,m);
say= log(1+sum(((J_nor(n,:,m).*b_nkm(n,:,m).*e(n,:,m).*check.*E_km)/alfa_old(m)))+(J_nor(n,k,m)*b_nkm(n,k,m)*e(n,k,m)*E_km(1,k)));
omega=alfa_old(m)*log(1+sum(((J_nor(n,:,m).*b_nkm(n,:,m).*e_old(n,:,m).*check.*E_km)/alfa_old(m))));
for i=1:K
if(i~=k)
gerad_e=(J_nor(n,i,m)*b_nkm(n,i,m)*E_km(1,i))/(1+sum(((J_nor(n,:,m).*b_nkm(n,:,m).*e_old(n,:,m).*check.*E_km)/alfa_old(m))));
else
gerad_e=0;
omega_hat=omega+gerad_e*(e(n,k,m)-e_old(n,k,m));
objfunc(n,k,m)=(say-omega_hat);
end
end
end
end
end
maximize sum(sum(sum(objfunc)))+sum(sum(r_rrh))-(landa*sum(sum(pr)))
subject to
%constraint for the power of the rrh
for m=1:M
s=0;
for n=1:N
s=s+ pr(n,m);
end
s-pr_max(m) <=0;
end
%constraint for the rate of the rrh
for m=1:M
temp1=sum(tr,1);
R_rrh_min-temp1(:,m) <=0;
end
%constraint for the enegy of the user
be=b_nkm.*e;
for m=1:M
be_temp= be(:,:,m);
be_t2=sum(be_temp,1);
for k=1:K
be_t2(:,k)-1<=0;
end
end
%dc constraint
for m=1:M
tdc1=objfunc(:,:,m);
btemp=b_nkm(:,:,m);
tdc=btemp.*tdc1;
tdc2=sum(tdc,1);
for k=1:K
tdc2(k)-min_user_rate >= 0;
end
end
for m=1:M
for n=1:N
for k=1:K
1>=e(n,k,m)>=0
end
end
end
for m=1:M
for n=1:N
pr(n,m)>=0;
end
end
cvx_end
The output of “e” are as follows:
e(:,:,1) =
0.0000 1.0000 0.5000 0.5000
1.0000 0.5000 1.0000 0.5000
e(:,:,2) =
0.0483 0.5000 1.0000 0.5000
0.9517 1.0000 0.5000 0.5000
e(:,:,3) =
0.5000 0.5000 0.0000 1.0000
0.5000 1.0000 1.0000 0.5000
For example for the second column of “e(:,:,1)”, the values are 1 and .5 that their summation is more than one while the summation should be less than one.
Thanks.