Not logical values

cvx_begin

variables P(Nt,3) a(1,k) time_slot_allocation  min_rate alpha_rate_private(1,k) alpha_rate_common(1,k) raw_SINR_private(1,k) raw_SINR_common(1,k);
maximize(min_rate);
subject to
a(1)>=0;
a(2)>=0;
square_pos(norm(P,'fro'))<= max_power;

1+raw_SINR_private-(2.^(alpha_rate_private))>=0;
1+raw_SINR_common-(2.^(alpha_rate_common))>=0;

0.5*(time_slot_allocation_old+alpha_rate_private_old).*(time_slot_allocation+alpha_rate_private)-0.25*((time_slot_allocation_old+alpha_rate_private_old).^2)-0.25*((time_slot_allocation-alpha_rate_private).^2)+a >= min_rate;
0.5*(time_slot_allocation_old+alpha_rate_common_old(1))*(time_slot_allocation+alpha_rate_common(1))-0.25*((time_slot_allocation_old+alpha_rate_common_old(1))^2)-0.25*((time_slot_allocation-alpha_rate_common(1))^2)>= a(1)+a(2);
0.5*(time_slot_allocation_old+alpha_rate_common_old(2))*(time_slot_allocation+alpha_rate_common(2))-0.25*((time_slot_allocation_old+alpha_rate_common_old(2))^2)-0.25*((time_slot_allocation-alpha_rate_common(2))^2)+((1-time_slot_allocation)*log2(1+SINR_common_sec))>= a(1)+a(2);

(square_pos(norm(((g_U1)')*(P(:,3)))))+noise_power-((2*real(((P_old(:,2))')*(g_U1)*((g_U1)')*(P(:,2))))./raw_SINR_private_old(1))+(square((norm(((g_U1)')*P_old(:,2))))*raw_SINR_private(1))/square(raw_SINR_private_old(1))<=0;
(square_pos(norm(((g_U2)')*(P(:,2)))))+noise_power-((2*real(((P_old(:,3))')*(g_U2)*((g_U2)')*(P(:,3))))./raw_SINR_private_old(2))+(square((norm(((g_U2)')*P_old(:,3))))*raw_SINR_private(2))/square(raw_SINR_private_old(2))<=0;

(square_pos(norm(((g_U1)')*(P(:,2)))))+(square_pos(norm(((g_U1)')*(P(:,3)))))+noise_power-(((2*real(((P_old(:,1))')*(g_U1)*((g_U1)')*(P(:,1)))))./raw_SINR_common_old(1)) +((square((norm(((g_U1)')*P_old(:,1))))*raw_SINR_common(1))/square(raw_SINR_common_old(1)))<=0;
(square_pos(norm(((g_U2)')*(P(:,2)))))+(square_pos(norm(((g_U2)')*(P(:,3)))))+noise_power-(((2*real(((P_old(:,1))')*(g_U2)*((g_U2)')*(P(:,1)))))./raw_SINR_common_old(2))+((square((norm(((g_U2)')*P_old(:,1))))*raw_SINR_common(2))/square(raw_SINR_common_old(2)))<=0;

cvx_end

Capture1

Capture2

Capture3

Capture4

Capture5

Capture6

NOTE:
t: min rate

I initialize the values with zeros.

I am new to CVX and this my optimization problem and code, it gives me that rate with negative value which is wrong. I do not know what is wrong so can someone help me.

Thank you in advance.

Any values you assigned prior to execution fo your CVX program to anything declared as a CVX variable, is superseded by the variable declaration in CVX; and any previous value is totally ignored.

Are you referring to min_rate, which is also the objective value, as being negative? What is its numerical value after cvx_end? Perhaps it is negative by an amount within solver tolerance of zero, and the exact optimal value (if the problem were solved exactly in infinite precision) is zero?

You should also look at and show all CVX and solver output.

I tried to write the code as given above but it keeps giving me infeasible status, although I started with values that is feasible ( by assuming P and then equating the conditions).

SO can anyone help me

You will have to help us help you.

Please be explicit, and show all the code, starting from a new MATLAB session, which you executed when “assuming P and then equating the conditions”, because I have no idea what that means. Everything in my previous post still applies.

For general help in debugging infeasibility, everything except section ` of Debugging infeasible models - YALMIP also applies to CVX.

Thank you so much for your help.

My code from beginning is as the following:

k=2;
Nt=2;
N=4;
max_power=10;

d_BS_RIS= sqrt((0-40).^2+(0-10)^2);
d_BS_U1= sqrt((0-40).^2+(0-0)^2);
d_BS_U2= sqrt((0-60).^2+(0-0)^2);
d_RIS_U1= sqrt((40-40).^2+(0-10)^2);
d_RIS_U2=sqrt((40-60).^2+(0-10)^2);
d_U1_U2= sqrt((40-60).^2+(0-0)^2);

G_BS_RIS=(1./sqrt(2*(d_BS_RIS.^pathloss_ex)))(randn(N,Nt)+jrandn(N,Nt));
g_BS_U1= (1./sqrt(2*(d_BS_U1.^pathloss_ex)))(randn(Nt,1)+jrandn(Nt,1));
g_BS_U2= (1./sqrt(2*(d_BS_U2.^pathloss_ex)))(randn(Nt,1)+jrandn(Nt,1));
h_RIS_U1= (1./sqrt(2*(d_RIS_U1.^pathloss_ex)))(randn(N,1)+jrandn(N,1));
h_RIS_U2= loss*(1./sqrt(2*(d_RIS_U2.^pathloss_ex)))(randn(N,1)+jrandn(N,1));
h_RIS_U1_sec= (1./sqrt(2*(d_RIS_U1.^pathloss_ex)))(randn(N,1)+jrandn(N,1));
h_RIS_U2_sec= (1./sqrt(2*(d_RIS_U2.^pathloss_ex)))(randn(N,1)+1irandn(N,1));
h_U1_U2=(1./sqrt(2*(d_U1_U2.^pathloss_ex)))(randn(1,1)+jrandn(1,1));

theta_first=diag(ones(1,N));
theta_second=diag(ones(1,N));
g_U1= g_BS_U1+((G_BS_RIS)'*(theta_first)‘h_RIS_U1);
g_U2= g_BS_U2+((G_BS_RIS)'
(theta_first)’*h_RIS_U2);

min_rate=0;
P_phases=exp(j.(2pirand(Nt,2)));
power_coff=(ones(1,k+1)
(1/(k+1)))/Nt;
P_old=sqrt((max_power*power_coff)).*P_phases;
raw_SINR_private_U1_old=(norm((g_U1)‘P_old(:,2)).^2)/(norm((g_U1)'(P_old(:,3)).^2)+1;
raw_SINR_private_U2_old=(norm((g_U2)’*P_old(:,3)).^2)/(norm((g_U1)‘*P_old(:,2)).^2)+1;
raw_SINR_private_old=[raw_SINR_private_U1_old raw_SINR_private_U2_old];
raw_SINR_common_U1_old=(norm((g_U1)’*P_old(:,1)).^2)/(norm((g_U1)‘*P_old(:,2)).^2)+(norm((g_U1)’*P_old(:,3)).^2)+1;
raw_SINR_common_U2_old=(norm((g_U2)‘*P_old(:,1)).^2)/(norm((g_U2)’*P_old(:,2)).^2)+(norm((g_U2)'*P_old(:,3)).^2)+1;
raw_SINR_common_old=[raw_SINR_common_U1_old raw_SINR_common_U2_old];
alpha_rate_private_old= log2(1+raw_SINR_private_old);
alpha_rate_common_old= log2(1+raw_SINR_common_old);
time_slot_allocation_old=0.8;

rate_common_sec=(1-time_slot_allocation_old)log2(1+(max_power((norm(h_U1_U2+(h_RIS_U2_sec)'theta_secondh_RIS_U1_sec)).^2)));

cvx_begin
variable P(Nt,2) complex
variables a(1,k) time_slot_allocation min_rate alpha_rate_private(1,k) alpha_rate_common(1,k) raw_SINR_private(1,k) raw_SINR_common(1,k);
maximize(min_rate);
subject to
a>=0;
time_slot_allocation>=0;
time_slot_allocation<=1;
square_pos(norm(P,‘fro’))<= max_power;
1+raw_SINR_private-(2.^(alpha_rate_private))>=0;
1+raw_SINR_common-(2.^(alpha_rate_common))>=0;

0.5*(time_slot_allocation_old+alpha_rate_private_old).*(time_slot_allocation+alpha_rate_private)-0.25*((time_slot_allocation_old+alpha_rate_private_old).^2)-0.25*((time_slot_allocation-alpha_rate_private).^2)+a >= min_rate;
0.5*(time_slot_allocation_old+alpha_rate_common_old(1)).*(time_slot_allocation+alpha_rate_common(1))-0.25*((time_slot_allocation_old+alpha_rate_common_old(1))^2)-0.25*((time_slot_allocation-alpha_rate_common(1))^2)>= a(1)+a(2);
0.5*(time_slot_allocation_old+alpha_rate_common_old(2))*(time_slot_allocation+alpha_rate_common(2))-0.25*((time_slot_allocation_old+alpha_rate_common_old(2))^2)-0.25*((time_slot_allocation-alpha_rate_common(2))^2)+(1-time_slot_allocation)*log2(1+(max_power*((norm(h_U1_U2+(h_RIS_U2_sec)'*theta_second*h_RIS_U1_sec)).^2)))>=a(1)+a(2);

(square_pos(norm(((g_U1)')*(P(:,3)))))+1-((2*real(((P_old(:,2))')*(g_U1)*((g_U1)')*(P(:,2))))./raw_SINR_private_old(1))+((square((norm(((g_U1)')*P_old(:,2)))))*raw_SINR_private(1))/square(raw_SINR_private_old(1))<=0
(square_pos(norm(((g_U2)')*(P(:,2)))))+1-(((2*real(((P_old(:,3))')*(g_U2)*((g_U2)')*(P(:,3)))))./raw_SINR_private_old(2))+((square((norm(((g_U2)')*P_old(:,3)))))*raw_SINR_private(2))/square(raw_SINR_private_old(2))<=0 

(square_pos(norm(((g_U1)')*(P(:,2)))))+(square_pos(norm(((g_U1)')*(P(:,3)))))+1-(((2*real(((P_old(:,1))')*(g_U1)*((g_U1)')*(P(:,1)))))./raw_SINR_common_old(1))+((square((norm(((g_U1)')*P_old(:,1))))*raw_SINR_common(1))/square(raw_SINR_common_old(1)))<=0
(square_pos(norm(((g_U2)')*(P(:,2)))))+(square_pos(norm(((g_U2)')*(P(:,3)))))+1-(square_pos(norm(((g_U2)')*(P(:,3)))))+1-(((2*real(((P_old(:,1))')*(g_U2)*((g_U2)')*(P(:,1)))))./raw_SINR_common_old(2))+((square((norm(((g_U2)')*P_old(:,1))))*raw_SINR_common(2))/square(raw_SINR_common_old(2)))<=0

cvx_end

So this my full code with my initial values

What you call “initial values” appears to be input data to your optimization problem.

You haven’t shown us the CVX and solver output from running it. Not have you shown us why you believe the problem should be feasible (I don’t know what you mean by “assuming P and then equating the conditions”).