CVX wrong. How can I deal with this problem correctly?

I met some trouble when I tackeled a problem, the corresponding code as below

cvx_begin
variable x
maximize(-log(1.01+0.01*inv_pos(x+1)))
subject to
x>=0;
cvx_end

My objective function is convex, but the CVX code is infeasible and the report information is

Disciplined convex programming error:
Illegal operation: log( {convex} ).

What’s wrong with my CVX code? and how can I tackel this problem correctly?

CVX is not “wrong”. Please read this FAQ so you understand why CVX is doing what it does. I do not know if it is possible for CVX to solve your problem.

The solution to your verbatim problem is not very interesting because it is unattained at x=\infty. But assuming that you actually want to model the inequality

t\geq \log(1+1/y), \ y\geq 0

(which is the same as yours up to linear substitutions), you can write it equivalently as

(y+1)u\geq 1,\ 1-u\geq \exp(-t), \ u,y\geq 0

which is a conic model (one rotated quadratic and one exponential cone). Others will be better at figuring out if that helps to model it in cvx.

2 Likes

@Michal_Adamaszek 's formulation
(y+1)*u >= 1, 1−u >= exp(−t), u,y >= 0
can be handled in CVX with

   {1,y+1,u} == rotated_lorentz(1)
    1−u  >= exp(−t)
    y >= 0  % note: 1+y >= 0 will be enforced by rotated_lorentz

@Michal_Adamaszek gets a free virtual beer, plus a free copy of the free version of CVX, for producing a clever comic reformulation into a form which CVX can handle, for at least 3 problems which eluded other forum participants.

Thanks, although I hope the “comic reformulation” was not a Freudian slip :). A bunch of related models appears now in the Mosek modeling cookbook https://docs.mosek.com/modeling-cookbook/expo.html#modeling-with-the-exponential-cone

1 Like

Thank you very much.