# Invalid constraint: {convex} <= {convex}

Hello everyone,I’m a newer to use cvx.During I use it to solve a problem, an error occurred.
I wish you to point out what’s wrong happened in my code constraint.

``````eta_0=1;
P1_max=5;
P2_max=5;
Pmax_bs=10;
B_v=20*10^6;
B_r=10*10^6;
g=(randn(1,1)+1i*randn(1,1))/sqrt(2);
a=10^(-4);
psi=pi/3;
T=1;
d=10;
n=0.53;
Theta=pi/3;
g_Theta=(n^2)/((sin(Theta))^2);
zeta=-log(2)/log(cos(pi/3));
r=((zeta+1)*(cos(psi))^(zeta))/2/pi;
h=(a/(d^2))*r*T*g_Theta*cos(psi);
N=10^(-19);
N1=10^(-19);
N2=10^(-19);

cvx_begin
variable P1_bs nonnegative;
variable P2_bs nonnegative;
variable P1 nonnegative;
variable P2 nonnegative;
expression R1;
expression R2;
expression R1_bs;
expression R2_bs;

R1_bs=B_v*log(1+P1_bs*h/B_v/N)/log(2);
R2_bs=B_r*log(1+P2_bs*abs(g)^2/B_r/N)/log(2);
R1=B_v*log(1+P1*h/B_v/N1)/log(2);
R2=B_r*log(1+P2*abs(g)^2/B_r/N2)/log(2);
minimize (eta_0*(P1_bs+P2_bs+P1+P2)-R1-R2)
subject to

P1_bs<=P1_max;
P2_bs<=P2_max;
P1+P2<=Pmax_bs;
-R1_bs<=-R2;
-R2_bs<=-R1;
cvx_end
eta=(R1+R2)/(P1_bs+P2_bs+P1+P2);
``````

Disciplined convex programming error:
Invalid constraint: {convex} <= {convex}

-R1_bs<=-R2;

In order for the constraints to be convex, `R2-R1_bs` and `R1-R2_bs` must be convex. Have you proven they are?