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.

1. Code 1

cvx_begin
variables x y z r;
rdr=-rel_entr(1-2z,1-2z+ytheta1);
rbd=z
theta2;
rdc=-rel_entr(z,z+xtheta2);
maximize (w1
r+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.

1. 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?

`R<=R12;` and `R<=R10+R20;` are both {concave} <= {concave} .

That is because `R10, R12, R20` are all concave. `R` is the min of concave arguments, so is also concave.

The constraint `R<=R12;` must always hold, and therefore can be eliminated from the problem formulation. The same with `R<=R10+R20;`. In both cases, these constraints are of the form: `min of {something} and {something else} <= {something}`., so of course are always satisfied.

So you’re right. Code 2 is a convex optimization problem, or in any event is equivalent to the convex optimization problem obtained by eliminating the two vacuous constraints.

As to what problem(s) you actually want to solve, I will not hazard a guess.

Thanks for your kind reply. Yes, this problem is a convex optimization problem. Is there any method to make this code (Code 2) successfully perform?

As I wrote, if those two constrains are eliminated, the problem will be accepted by CVX, and is mathematically equivalent to your code. II believe it will, however, be unbounded. So likely not a useful code without some modifications.