# Convex constraint rejected

I have the following constraint:

1/t <= exp(x)-exp(y)

where t is known to be positive (and x>y).

In its current form, CVX rejects it as the right hand side is not concave (and neither convex).

I perform the following transformation:

log(1/t + exp(y)) <= x

Now, the rhs is concave. I also proved that the lhs is a convex function when t is positive (which is the case here). This can be easily shown using the positive semi definite Hessian test. So technically, the current form of the constraint is convex.

However, CVX rejects it. If I understand correctly, the lhs doesn’t conform to the DCP rule set. Obviously, 1/t should be replaced with the built in inv_pos(t) function which helps CVX understand that 1/t is convex (as it is not convex when t is negative).

However, this doesn’t help much and CVX still rejects the function.

Looking at the CVX composition rules, it seems that composition is useful to show that a convex function stays convex (under certain conditions for its arguments) or a concave function stays concave. Here, log(x) is concave, but I want CVX to realize that log(1/t + exp(y)) is convex.

Does anyone has an idea how to handle this constraint with CVX?

In addition, CVX handles logarithms and exponents using “Successive approximation method” which according to documentation is heuristic. I understand that this is a limitation related to the fact that the underlying solvers (e.g. MOSEK which I’m using) doesn’t support such functions (even when they are convex and DCP). Does anyone knows of a different solver (possibly not supported by CVX) that handles exp and log (as long they are convex)?

First of all, please read this FAQ). In particular, read the section “Yes, I am sure my model is convex!”. It is important for you to understand that CVX can’t just be told an expression is convex. It doesn’t work that way.

Now, that said: if t is a positive constant, then
\$\$\log(1/t+\exp(y))=\log(\exp(-\log t)+\exp(y))\$\$
and the `log_sum_exp` function will serve you well here:

``````log_sum_exp([-log(t),y]) <= x
``````

There is experimental support for the solver SCS in CVX 3.0 beta. This solver can indeed handle exp/log natively. But you still must express your problem in the same way as before; i.e., with `log_sum_exp`.

Thanks. This is a great idea. CVX accepts the model now.

What puzzles me though is that CVX also accepts:

log(exp(-log(t)) + exp(y)) <= x

While this constraint is mathematically the same as

log_sum_exp([-log(t),y]) <= x

The former one is using log which is concave, so it doesn’t conform to the DCP composition rules.

That’s because CVX also tracks log-convexity, but because it’s rarely used we don’t talk about it much. See here for more info.