This is absurd that cvx sometimes can solve this problem, sometimes it cannot and reports such error.
I can make sure the problem is a convex function. By the way, it’s a same expression but different inner loop. And I sum the results up from different loop. It went wrong, which I have no idea of what happened. Gratefully thanks for helping me to handle it.
Here’s my input parameters.
%% Parameters Initialization %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ‘1’ stands for source-relays; ‘2’ stands for relays-destination
N = 5; % array number of BS 缁村害蹇呴』涓?5锛屽洜涓?5鏉℃洸绾?
Nr = 6;
M = 10; % array number of STAR-RIS 10-50
M1=M/2;
K = 2; % number of users
SNR_dB = 10; % dBW
cof_L = 0.8; %coefficient of loop interference
cof_S = 0.8; %coefficient of self interference
cof =[cof_S;1];%select coeffient 21dimension
%%%%% noise
N0=10^((-174-30) / 10); %-174dBm
B=10^7; %10MHz
down_maxpower_all=20;
up_maxpower_all = 1;
% noise_maxpower_original = N0B; % % W
noise_maxpower_original = 10^((-80-30) / 10);%-80dBm
power_max_dBm=10;
%% Simulation loop %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
num_loop =100;
num_iterative = 10;
load(‘H_UI_ALL’);
load(‘H_IU_ALL’);%鍒濆鍖栦俊閬?
load(‘H_IE_ALL’);
load(‘H_IB_ALL’);
load(‘H_BI_ALL’);
load(‘H_BB_ALL’);
load(‘H_UU_ALL’);
%Rate=zeros(K,length(rate_min_dB),100);%鍒濆鍖栭?熺巼鐭╅樀鐢ㄤ簬淇濆瓨鍙傛暟銆?
SumRate1=zeros(num_loop,num_iterative,length(down_maxpower_all));
for loop = 1 : num_loop %浠?1寮?濮嬪惊鐜?
outerflag=1;
T1=cputime;
noise_maxpower=1;%鍣0鍔熺巼褰掍竴鍖?
%%% For different 鑷彉閲? %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
fprintf(’ loop | N | iteration \n’);
for i_p = 1 : length(down_maxpower_all)%涓嶅悓N,M鎴栦笉鍚屽彂灏勫姛鐜?
t0=cputime;
down_maxpower=down_maxpower_all;
up_maxpower=up_maxpower_all;
%%%%% Initialize Fi for different mode(ES,MS and TS ) %%%%%%%%%%%%%%%
% H_IB=H_IB_ALL(1:Nr,1:M,loop)/sqrt(noise_maxpower_original);%淇¢亾褰掍竴鍖?
%
% H_BI=H_BI_ALL(1:M,1:N,loop)/sqrt(noise_maxpower_original);
%
% H_IU=H_IU_ALL(1:M,1:K,loop)/sqrt(noise_maxpower_original);
%
% H_UI=H_UI_ALL(1:K,1:M,loop)/sqrt(noise_maxpower_original);
%
% H_IE=H_IE_ALL(1:M,1:K,loop)/sqrt(noise_maxpower_original);
%
% H_BB=H_BB_ALL(1:N,1:Nr,loop)/sqrt(noise_maxpower_original);
%
% H_UU=H_UU_ALL(1,1:K,loop)/sqrt(noise_maxpower_original);
H_IB=0.1*ones(Nr,M);
H_BI=0.1*ones(M,N);
H_IU=ones(M,K);
H_UI=ones(K,M);
H_IE=0.1*ones(M,K);
H_BB=0.001*ones(N,Nr);
H_UU=0.001*ones(1,K);
%clear Phi_1 Phi_2 Phi_i3 Phi_4 Phi_6 W_1 W_3
%%%%% Initialize Fi for different mode(ES,MS and TS ) %%%%%%%%%%%%%%%
%%%%% ES妯″紡鍙傛暟鍒濆鍖? %%%%%%%%%%%%%%%
Phi_temp=randn(2,M) + sqrt(-1)*randn(2,M);
Phi_tamp=rand(1,M);
Phi_ramp=1-Phi_tamp;
Angle=rad2deg(angle(Phi_temp));
Angle(Angle<0)=Angle(Angle<0)+360;
Ang=deg2rad(Angle);
Phi_amp=[sqrt(Phi_tamp) ;sqrt(Phi_ramp)];%骞呭害鍒濆鍖?
Phi_ini_ES=Phi_amp.*exp(1j*Ang);%/sqrt(trans_maxpower/(M*K));%骞呭害鍒濆鍖栵紝鍧囧寑鍒嗗竷
Phi_ini_eES=sqrt(0.5).*exp(1j*Ang);%骞呭害鍚勪负0.5,_equal_ES.
Phi1(:,:,1)=full(Phi_ini_ES);%ESmode涓嬬殑Fi杩唬鍊?
%Phi4(:,:,1)=full(Phi_ini_eES);%equalESmode涓婩i鐨勮凯浠e??
%%%%% MS妯″紡鍙傛暟鍒濆鍖? %%%%%%%%%%%%%%%
Phi_Mtemp=randn(2,M1) + sqrt(-1)*randn(2,M1);
Phi_Mtamp=rand(1,M1);
Phi_Mramp=1-Phi_Mtamp;
Phi_Mamp=[sqrt(Phi_Mtamp) ;sqrt(Phi_Mramp)];
Angle2=rad2deg(angle(Phi_Mtemp));
Angle2(Angle2<0)=Angle2(Angle2<0)+360;
Ang2=deg2rad(Angle2);
Phi_ini_MS=Phi_Mamp.*exp(1j*Ang2);
Phi2(:,:,1)=full(Phi_ini_MS);
%%%%% TS妯″紡鍙傛暟鍒濆鍖? %%%%%%%%%%%%%%%
Phi_ini_TS=exp(1j*Ang);
Phi3(:,:,1)=full(Phi_ini_TS);
%%%%% conventional RIS鍙傛暟鍒濆鍖? %%%%%%%%%%%%%%%
%Phi_ini_cRIS=exp(1j*angle(Phi_Mtemp));
%Phi6(:,:,1)=full(Phi_ini_cRIS);
%%%%% Initialize W %%%%%%%%%%%%%%%
W_ini=randn(N,K)*sqrt(down_maxpower/(N*K));
W1(:,:,1)=full(W_ini);
W3(:,:,1)=full(W_ini);
%%%%% Initialize F %%%%%%%%%%%%%%%
F_ini=randn(K,Nr)*sqrt(up_maxpower/(K*Nr))+1i*randn(K,Nr)*sqrt(up_maxpower/(K*Nr));
F1(:,:,1)=full(F_ini);
F3(:,:,1)=full(F_ini);
%%%%% Initialize a %%%%%%%%%%%%%%%
a_ini=randn(1,K)*sqrt(down_maxpower/(1*K));
a(:,1)=full(a_ini);
%%%%% Initialize uplink MMSE variable %%%%%%%%%%%%%%%
u_up(:,1)=ones(1,2);
%%%%% Initialize downlink MMSE variable %%%%%%%%%%%%%%%
u_dwn(:,1)=ones(1,2);
And here’s my cvx optimization problem.
function [F_opt,flag] = Generate_ESMS_recv_beamforming(cof,cof_L,N,Nr, M, K, H_IB, H_BI,H_BB,…
H_IU, H_UI, H_IE,W_ini,F_ini, Phi_ini, u_up_ini,u_dwn_ini,…
noise_maxpower, down_maxpower,up_maxpower)
cvx_begin quiet
%cvx_solver mosek
variable F(K,Nr) complex
expressions up_r(K);
k=1:1:K;
u=K:-1:1;
for i=1:1:length(k)
if k(i)==1||u(i)==1
a=0.5;
%%%%%%%%uplink expression of MMSE%%%%%%%%%%
up_USER_ch(:,k(i))=u_up_ini(k(i))*H_IB(:,:)*diag(sum(H_UI(:,:),1))*Phi_ini(k(i),:)';
up_USER_poly(:,:,k(i))=up_maxpower*up_USER_ch(:,k(i))*up_USER_ch(:,k(i))';
%up_USER(k(i))=F(k(i),:)*up_USER_poly(k(i))*F(k(i),:)';
up_USER_ini(k(i))=F_ini(k(i),:)*up_USER_poly(k(i))*F_ini(k(i),:)';
real_part_ch(:,k(i))=u_up_ini(k(i))*H_IB(:,:)*diag(H_UI(k(i),:))*Phi_ini(k(i),:)';
%real_part(k(i))=2*real(sqrt(up_maxpower)*F(k(i),:)*real_part_ch(:,k(i))*(1/2)*aux_var(k(i)));
real_part_ini(k(i))=2*real(sqrt(up_maxpower)*F_ini(k(i),:)*real_part_ch(:,k(i)));
%%%%%%%%%end%%%%%%%%%%%%%%
%%%%%%%%LI of MMSE%%%%%%%%%%%%
upLI_ch(:,k(i))=u_up_ini(k(i))*H_BB(:,:)'*sum(W_ini(:,:),2);
upLI_poly(:,:,k(i))=upLI_ch(:,k(i))*upLI_ch(:,k(i))';
%upLI(k(i))=F(k(i),:)*upLI_poly(k(i))*F(k(i),:)';
upLI_ini(k(i))=F_ini(k(i),:)*upLI_poly(:,:,k(i))*F_ini(k(i),:)';
%%%%%%%end%%%%%%%%%%%%
%%%%%%%%%%SI of MMSE%%%%%%%%%
upSI_ch(:,k(i))=u_up_ini(k(i))*H_IB(:,:)*H_BI(:,:)*sum(W_ini(:,:),2);
upSI_poly(:,:,k(i))=upSI_ch(:,k(i))*upSI_ch(:,k(i))';
%upSI(k(i))=F(k(i),:)*upSI_poly(k(i))*F(k(i),:)';
upSI_ini(k(i))=F_ini(k(i),:)*upSI_poly(:,:,k(i))*F_ini(k(i),:)';
%%%%%%%%%end%%%%%%%%%%%%
%%%%%%%noise of MMSE%%%%%%%%
nois_poly(k(i))=noise_maxpower*u_up_ini(k(i))*u_up_ini(k(i));
%nois(k(i))=F(k(i),:)*real(nois_poly(k(i)))*F(k(i),:)';
nois_ini(k(i))=F_ini(k(i),:)*nois_poly(k(i))*F_ini(k(i),:)';
%%%%%%%%%end%%%%%%%%%%%%%%%
up_e_poly(:,:,k(i))=up_USER_poly(:,:,k(i))+upLI_poly(:,:,k(i))+upSI_poly(:,:,k(i))+nois_poly(k(i));
%up_e(k(i))=F(k(i),:)*real(up_e_poly(k(i)))*F(k(i),:)'+real_part(k(i))+1;
aux_var(k(i))=1/(up_USER_ini(k(i))-real_part_ini(k(i))+upLI_ini(k(i))+upSI_ini(k(i))+nois_ini(k(i))+1)
final_matrix(:,:,k(i))=aux_var(k(i))*up_e_poly(:,:,k(i));
A_matrix(:,:,k(i))=0.5*(final_matrix(:,:,k(i))+final_matrix(:,:,k(i))');
real_part(:,k(i))=sqrt(up_maxpower)*real_part_ch(:,k(i))*aux_var(k(i));
up_r(k(i))=-F(k(i),:)*A_matrix(:,:,k(i))*F(k(i),:)'+2*real(F(k(i),:)*real_part(:,k(i)));
end
end
maximize sum(up_r)
%
pow_pos(norm(F,‘fro’),2)<=1;
% subject to
% pow_pos(norm(F,‘fro’),2)<=1;
cvx_end
%pow_pos(norm(F,‘fro’),2)
if cvx_status(1)==‘S’ || cvx_status(3)==‘a’
flag=1;
F_opt=F;
else
flag=0;
F_opt=ones(K,Nr);
end
end
Again, thanks for helping me.
Sincerely,