Hello!Dear Everyone!I meet a new problem! By using cvx,I can’t solve a feasible solution.Everytime I run my program,the status is unbounded.the result is +Inf.
I don’t know what’s the Problem ?
clc;
clear;
cvx_setup
%=================================
%SystemSetup
%=================================
%numbers of antennas
N=4;
%numbers of users
K=2;
sigma = 1.0;% set noise 1.
dr=1;%源到中继的距离
d1=1;%用户1的距离
d2=0.2;%用户2的距离(近)
coe_dr=sqrt(dr^(-2));% 系数
coe_d1=sqrt(d1^(-2));
coe_d2=sqrt(d2^(-2));
r_2 = [];
% for Pr_dB=10:5:30
% Pr=10^(0.1*Pr_dB);
Ps=80;%w不是dB
Pr=100;%w不是dB
%Pr=20;%according to fig to set power of relay.(dB)
% P1=0.8*Ps; %when 0 interation the value of p1.(dB)
% P1=0.6*Ps;
% P2=Ps-P1; %when 0 interation the value of p2.(dB)
CH_iter_max=10;%信道的数目
bug_iter=0;%解不出来的迭代次数(个数)
r2_sum=0;%r2速率的总和
% for CH_iter=1:CH_iter_max %换信道
n=16;% the dimension of f
% h=coe_dr*(randn(N,1)+1i*randn(N,1));
% g1=coe_d1*(randn(N,1)+1i*randn(N,1));
% g2=coe_d2*(randn(N,1)+1i*randn(N,1));
h=coe_dr*(rand(N,1)+1i*rand(N,1));
g1=coe_d1*(rand(N,1)+1i*rand(N,1));
g2=coe_d2*(rand(N,1)+1i*rand(N,1));
F=randn(N,N);
I1=eye(N);%setup unit matrix N dimension.
I2=eye(N^2);
f=vec(F);
W=f*f';
G_pre=0.1;
a=60;
b=90;
P1=SelectP( a,b,1 );
P2=Ps-P1;
B_1_1=P1*kron((conj(h)*h.'),g1*g1');%(13)k=1,j=1
B_2_1=P1*kron((conj(h)*h.'),g2*g2');%(13)k=1,j=2
B_2_2=P2*kron((conj(h)*h.'),g2*g2');%(13)k=2,j=2
b_1=kron((conj(h)*h.'),g1*g1');%mu_1没有P1,后面需要
b_2=kron((conj(h)*h.'),g2*g2');%mu_2
C_1_1=P2*kron(conj(h)*h.',g1*g1')+kron(sigma*sigma*I1,g1*g1');%(14)k=1,j=1
C_2_1=P2*kron(conj(h)*h.',g2*g2')+kron(sigma*sigma*I1,g2*g2');%(14)k=1,j=2
C_2_2=kron(sigma*sigma*I1,g2*g2');%(14)k=2,j=2
c_1=kron(sigma*sigma*I1,g1*g1');%C_1_1后面的一部分
c_2=kron(sigma*sigma*I1,g2*g2');
D=Ps*kron(conj(h)*h.',I1)+sigma*sigma*I2;%(16)
Q_1_1=C_1_1+sigma*sigma*D/Pr;%(21)k=1,j=1
Q_2_1=C_2_1+sigma*sigma*D/Pr;%(21)k=1,j=2
Q_2_2=C_2_2+sigma*sigma*D/Pr;%(21)k=2,j=2
r1=0.6;
t1=2^(2*r1)-1;%(7)
R1=B_1_1-t1*Q_1_1;
R2=B_2_1-t1*Q_2_1;
%=================================
%Initialize
%=================================
%=================================
%Repeat
%=================================
%==================================
%obtain f(m) by solving (34)iteratively with {Pk(m-1)}
% %==================================
% G_pre=0.1;
% a=60;
% b=90;
% P1=SelectP( a,b,1 );
while(1)
cvx_begin sdp quiet
variables W(N*N,N*N)
maximize real(P2*trace(b_2*W)/(trace((c_2+D*Pr^(-1)))))
subject to
real(P1*trace(b_1*W))-real(P2*trace(b_1*W))*t1-real(trace(c_1+D*Pr^(-1)))*t1>=0;
real(P1*trace(b_2*W))-real(P2*trace(b_2*W))*t1-real(trace(c_2+D*Pr^(-1)))*t1>=0;
P2==Ps-P1;
cvx_end
cvx_optval
W
a
b
if cvx_optval>G_pre
a=P1;
P1=SelectP(a,b,1);
G_pre=cvx_optval;
else
b=P1;
P1=SelectP(a,b,2);
G_pre=cvx_optval;
end
if abs(b-a)<0.1
break;
end
end