How can cvx solve function like exp(x)*(exp(exp(-x))-1)?

(Humpbackwha1e) #1

I got a problem when I tried to minimize such function in cvx and I have already proved that it is convex.
I know that for functions like x*(exp(1/x) - 1), I could introduce another variable like z \triangleq x*(exp(1/x) - 1) and write rel_entr(z,x) in the constraints so that cvx can solve it, but how to directly solve function like exp(x)*(exp(exp(-x))-1) ? exp(x) cannot be replaced by t (or other variables) since some other constraints are product terms and it is needed to convert the posynomials into convex forms.
Could anyone help? Thanks a lot.

(Henrik A. Friberg) #2

This answer might need translation, as I am not a CVX user, but you nearly provided the answer yourself. The inequality

t >= exp(x)*(exp( exp(-x) )-1),

is the same as

t >= exp(x)*(exp( 1/exp(x) )-1),

representable as

t >= z*(exp(1/z)-1),
z >= exp(x).

which is the same as

(t+z) >= z*exp(1/z),
z >= exp(x).

This is two exponential cones (exp_cone in CVX).

(Mark L. Stone) #3

Welcome to the forum @hfriberg .Thanks for the solution.

I believe the following CVX code segment implements your solution:

variables t z
exp(x) <= z
{1,z,t+z} == exponential(1)

(Henrik A. Friberg) #4

If only my first post on this forum was correct. Variable z will of course just shoot to +infinity and satisfy all constraints since z*(exp(1/z)-1) is decreasing, oops. We need the inverse slack as in

t >= ( exp(z)-1 ) / z,
z >= 1/exp(x),

but neither of these inequalities can currently be handled in CVX I think, although both convex.

(Mark L. Stone) #5

Well yeah, admittedly I posted the CVX implementation of your erroneous solution before getting to the point of understanding why your solution was correct.

Actually, the second of your inequalities can be handled by using exp(-x) which is convex and accepted by CVX.

As for the first inequality, is that a “solution”:to the convex modeling challenge by @Erling as posted at

Conic modeling challenge by Do you have a nonlinear constraint that can be written in a modeling language, but can’t be represented with linear, socp, sdp, exponential cone and power cones?

(Erling D.Andersen) #6

Regarding the challenge then one good reply is

t \geq \log(1+d)/d, d>0


t \geq \log(1+d/x)/d, d,x>0.

Most likely CVX cannot deal with those either.