How to write the following objective function about Exponential function in CVX?


(李东东) #1

We know g(x,t)=tf(x/t) is perspective function,if f is a convex function,g is also a convex function,or if f is a convex function,g is also a convex function.
Assume f(x)=exp(x),then g(x,t)=t
exp(x/t) ,g(x,t) is a f is a convex function. So how to express this objective function ?
if we write the
cvx_begin
variable x
variable y
minimize x*exp(y/x);
subject to
x>0;
y>0;
y<1
cvx_end
then there is error"Disciplined convex programming error:
Invalid operation: {real affine} / {real affine}",

so how to write it?


(Mark L. Stone) #2

Use the exp_cone set documented at http://cvxr.com/cvx/doc/funcref.html#sets . That documentation does not tell you that you need to implement
y > 0 , y*exp(x/y) <= z
as
{x,y,z} == exponential(1)

In your case, the roles of x and y are reversed from the above. So you could do

cvx_begin
variables x y z
minimize(z)
subject to
{y,x,z} == exponential(1)
0 <= y <= 1
cvx_end

I recommend you read CVXQUAD: How to use CVXQUAD's Pade Approximant instead of CVX's unreliable Successive Approximation for GP mode, log, exp, entr, rel_entr, kl_div, log_det, det_rootn, exponential cone. CVXQUAD's Quantum (Matrix) Entropy & Matrix Log related functions . The code I provided above will invoke CVXQUAD’s Pade Approximation, presuming that CXVQUAD and its exponential.m replacement are installed per the instructions.

That said, this is a rather boring problem, exactly as stated, because the optimal solution has x = y = z = 0. So presumably, you ultimately want to solve a more interesting problem building on this construct.


(李东东) #3

Thank you!However,if “<=” is reversed “>=”,what should I do?


(Mark L. Stone) #4

You need to make clearrer what your new problem would be. Which <= would be reversed to >= ?


(李东东) #5

for the program
“cvx_begin
variables x y z
minimize(z)
subject to {y,x,z} == exponential(1)
0<=y<=1
cvx_end”,

if “minimize(z)” is reversed “maximize(z)”, " y > 0 , y*exp(x/y) <= z"is reversed “y > 0 , y*exp(x/y) >= z”, what should I do,how to use the structure of “{y,x,z} == exponential(1)” ?


(Mark L. Stone) #6

So do you want to
maximize x*exp(y/x)
instead of
minimize x*exp(y/x) ?

If so, that would be non-convex and cannot be handled with CVX.


(李东东) #7

Thanks to reply my questions! I understand.


(Mark L. Stone) #8

In any event, if the problem you want to solve is maximize x*exp(y/x) subject to 0 <= y <= 1, x >= 0, it is unbounded with the objective function going to infinity as x goes to infinity (with “optimal” y = 1 (or really, any positive value of y)). This must be so because limit as x goes to infinity of x*exp(1/x) equals infinity.