Solve optimization problems of exp function

I have a function y*exp(x/y). It is proved to be convex by getting its hessian matrix. But I find no similar form of functions in the list of built-in functions.

Any advice about how to solve it in CVX? I have used convex optimization methods to solve it, but it is very hard to determine the initial values of dual variables, it seems that it can not converge to the optimal result, so I want to use CVX to help solve it.

This is the (scalar) relative entropy, which can be expressed in CVX as rel_entr(y,x).

I am afraid it is not. rel_entr(x,y) = x.*log(x/y). They are not the same. one is log, the other is exp. And the position of x and y is not the same.

cvx_begin

variables x y z;

min z; % wrong here, should use minimize(z) instead

{x,y,z} == exponential(1);

x>=1;x<=10;

y>=0.01;y<=1;

cvx_end

I have this code run on matlab. It gives an answer 0.

x = 3.55;

y= 0.89

z = 80;

actually, y*exp(x/y) = 48. So what is wrong? It output little information that I can not decide where is wrong. On Lingo, it gives the result that
x = 1;y=1; z = 2.7.

EDIT: mcg here. I’m editing the post so that the answer is more easily seen by others: the problem with the code above is the use of min instead of minimize.

------------Updated--------------

I am also curious if it is possible to print out the process of iterating. For example, I want to plot the processing of converging of the object function’s value or the variables related to the object function. for example, x in the previous code or z in the previous code

Thanks a lot for your help. My problem is I have downloaded a old version of documentation file which was written last year. I have gone to the website and updated it.

------------Updated---------------

Oops, pardon me!

Yes, it can be done, but it’s a bit complicated. Suppose you have a single term y*exp(x/y) that you wish to handle. Then what you do is replace that term with a new variable z, and now you need to add a constraint equivalent to

y*exp(x/y) <= z

There are two ways to do this. One is to use the exponential cone:

{ x, y, z } == exponential( 1 )

The other is to use rel_entr:

x + rel_entr(y,z) <= 0

You’ll have to do some algebra to confirm that this inequality is equivalent to the first. If you have multiple terms of the form y*exp(x/y), you have to replace each one in the same way: create the new variable, add a new constraint.

Of course, please do remember that log, exp, rel_entr, the exponential cone, etc. all depend on CVX’s experimental successive approximation method. Using CVX with these functions is less reliable.

1 Like

Don’t use min z, use minimize(z).

I am also curious if it is possible to print out the process of iterating. For example, I want to plot the processing of converging of the object function’s value or the variables related to the object function. for example, x in the previous code or z in the previous code

I am afraid that is not possible.