Dear experts, I have some problems when I use CVX. I list relevant codes in the following. Could you please help me figure out the problems? Thanks for your time.
-
Code 1
cvx_begin
variables x y z r;
rdr=-rel_entr(1-2z,1-2z+ytheta1);
rbd=ztheta2;
rdc=-rel_entr(z,z+xtheta2);
maximize (w1r+w2*rdr);
subject to
x+y<=z;
r<=rbd;
r<=rdc;
x>0;
y>0;
z>0;
z<0.5;
cvx_end
In this code, x,y,z and r are variables, and theta1, theta2 and theta3 are constants. I can run this code successfully.
-
Code 2
cvx_begin variables x y m n p q R; R10=-rel_entr(y,y+x*rho10); R12=-rel_entr(y,y+x*rho12); R20=-rel_entr(m,m+p*rho2); R2=-rel_entr(n,n+q*rho2); R=min(R10+R20,R12); maximize (w1*R+w2*R2); subject to x+y+m+n<=1; p+q<=x; R<=R12; R<=R10+R20; x>=0; y>=0; m>=0; n>=0; p>=0; q>=0; cvx_end
In this code, x, y, m, n, p, q and R are variables, and rho10, rho12 and rho2 are constants. When I run this code, the notice is listed as follows:
cvxprob/newcnstr (line 192)
Disciplined convex programming error:
Invalid constraint: {concave} <= {concave}
<= (line 21)
b = newcnstr( evalin( ‘caller’, ‘cvx_problem’, ‘[]’ ), x, y, ‘<=’ );
bishe (line 39)
R<=R12;
In summary, I can confirm these two mathematical problems are both convex optimization problems. Moreover, they are same in essence. Could youo please help me correct the second code?