# Disciplined convex programming error: Illegal operation: {convex} - {convex} 出错 - (第 21 行) z = plus( x, y, true, cheat );

I’m having a problem with the CVX toolbox in matlab. I’m sure of my constraint: ln(1+1/x)-1/(1+x) is a convex function. But I don’t know why it got an error on compilation. np1*((rel_entr(t1+1,t1)+rel_entr(t1,t1+1))-1inv_pos(1+t1)) + nd1((rel_entr(t2+1,t2)+rel_entr(t2,t2+1))-1inv_pos(1+t2)) <= 2epsilon^2; The first constraint is the problem. This is my part of the code:

``````cvx_begin
variables t1 t2
% Objective function
minimize( A*t1 + B*t2 + A*B*0.25*((t1+t2)^2+(4-3)^2-2*(4-3)*(t1-t2)) )
% Constraints
subject to
np1*((rel_entr(t1+1,t1)+rel_entr(t1,t1+1))-1*inv_pos(1+t1)) + nd1*((rel_entr(t2+1,t2)+rel_entr(t2,t2+1))-1*inv_pos(1+t2)) <= 2*epsilon^2;
t1 - sigma_w/(Pa_max*beta_aw) >= 0;
t2 - sigma_w/(Pup_max*alpha_uw) >= 0;
cvx_end
``````

`rel_entr(t1+1,t1)+rel_entr(t1,t1+1))-1*inv_pos(1+t1)` violates CVX’s rules, because it is convex.

For t >= 0, that is `log(1+1/t1)-1/(1+t1)`, which is convex. So you will need some reformulation to get it accepted by CVX, if it can be done.