How to express xlog(1+exp(-(y/x))) in CVX

Hi everyone,
I have -xlog(1+exp(-y/x)) in my optimization problem where x and y are variables(>=0). I don’t know how to express it in CVX. Could someone can help me to solve this problem?
Thanks in advance.

Assuming at the end you want to model something convex, then following should help you.

f(y) = log (1+exp(-y))

then the perspective function of that is

x * f(y/x) = x * log (1+exp(-y/x))

This is essentially the perspective function of log(sum exp) function, See


1+exp(-y)= exp(s)+exp(t)

1 Like

Thanks a lot for your help. The term -x(log(1+exp(-y/x))) is the objective function I want to maximize, can we just use the perspective function to replace?

If you understand section 7.1.1 in the previous link you should be able to write up the objective function an a CVX compliant way.

I read the previous link and related information. I’m sorry to bother you again. I just don’t know how to express (Kexp) in CVX. Is it coded like sum_i(ui)<=x; (u1, x,-q)==exponential(1)?
I would appreciate that if you can provide some examples or guidance.

{x1,x2,x3) in K_{exp} in the Mosek Modeling Cookbook is implemented in CVX as
{x3,x2,x1} == exponential(1)

See exp_cone in . But note that although not stated in the CVX Users’ Guide, this has to be implemented as
{x,y,z} == exponential(1)
to achieve what is shown in exp_cone.
The roles of what CVX Users’ Guide call x,y,z are the same as what is called x3,x2,x1 by Mosek Modeling Cookbook. I made this adjustment when showing the CVX code above corresponding to the Mosek Modeling Cookbook definition.