How can I construct the objective following the DCP ruleset?

I have a convex optimization problem. When I use CVX toolbox to handle it, something is wrong. Specifically, the code is as follows:

a = 1;
b = 1;
cvx_begin
variable x;
variable y;
objective = x*exp((a*y + b) / x) + y^2;
minimize(objective)
subject to
x + y <= 1
cvx_end

The Hessian matrix of the objective is positive.

The error message is as follows:

Error using .*
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 cvx_effective (line 7)
objective = xexp((ay+b) / x) + y^2;

I know before using CVX toolbox, the objective must follow the DCP ruleset. But I don’t know how to construct the above objective in a recommended way.

x has to be a nonnegative variable for the problem to be convex.

Try formulate it using the exponential cone

i.e. something like

objective = z + y^2;
minimize(objective)
subject to
x + y <= 1
{a*y+b,x,z} = exponential(1);

That should be

{a*y+b,x,z} == exponential(1);
not
{a*y+b,x,z} = exponential(1);

1 Like

Thanks for your help!