I have simplified my code:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
E_max=10^7;
% cvx_begin gp
cvx_begin
variable x1
variable t1
variable z
variable x2
variable t2
variable x3
expression E1
expression E2
expression E3
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
E1=z -t1; % E1= t1*exp( x1/t1 )-t1
E2=x2^3/t2^2 ;
E3=x3^3;
% E1=z -t1; % E1= t1*exp( x1/t1 )-t1
% E2=pow_p(x2/t2,3)*t2 ;
% E3=pow_p( x3,3 );
maximize(x1+x3)
subject to
x1>=0;
x2>=0;
x3>=0;
E1+E2+E3<=E_max;
{x1,t1,z}== exponential(1); % the added constraint for t1*exp( x1/t1 )<=z in E1
% x1+rel_entr(t1,z1)<=0;
cvx_end
cvx_status
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
I am sure it is convex, because there are mainly three expressions in the code: ‘E1= t1*exp( x1/t1 )-t1’,
'E2=x2^3/t2^2 ', ‘E3=x3^3’, and they are all convex. I have added another variable ‘z’ to re-express E1 as ‘E1= z-t1’ with an added constraint ‘{x1,t1,z}== exponential(1)’ .
However, the errors are still there: If I use the command ‘cvx_begin’, the expression of E2=x2^3/t2^2 encounter the error as follows:
%%%%%%%%%%%%%%%%%%%%%%
Error using cvx/pow_cvx (line 142)
Disciplined convex programming error:
Illegal operation: {real affine} .^ {3}
(Consider POW_P, POW_POS, or POW_ABS instead.)
Error in .^ (line 55)
z = pow_cvx( x, y, ‘power’ );
Error in ^ (line 9)
z = power( x, y );
Error in Sample_Trajectory_CVX (line 24)
E2=x2^3/t2^2 ;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
If I re-express the E2 as 'E2=pow_p(x2/t2,3)t2 ', the error will change as
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Error using . (line 173)
Disciplined convex programming error:
Cannot perform the operation: {real affine} ./ {real affine}
Error in ./ (line 19)
z = times( x, y, ‘./’ );
Error in * (line 36)
z = feval( oper, x, y );
Error in / (line 15)
z = mtimes( x, y, ‘rdivide’ );
Error in Sample_Trajectory_CVX (line 28)
E2=pow_p(x2/t2,3)*t2 ;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Unfortunately, if I use the command ‘cvx_begin gp’, the expression of E1=z -t1 will encounter an error as follows:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Error using + (line 83)
Disciplined convex programming error:
Illegal operation: {log-affine} - {log-affine}
Error in - (line 21)
z = plus( x, y, true, cheat );
Error in Sample_Trajectory_CVX (line 23)
E1=z -t1; % E1= t1*exp( x1/t1 )-t1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%