# Getting error while solving convex constraint x*(2^(y/x)-1) <= constant

Hi,

In my optimization problem, I am getting following error message while solving following constraint:

w + x*(2^(y/x)-1) <= constant

w, x, y are optimization variables. I checked that constraint is convex.

Error message:
Disciplined convex programming error: Cannot perform the operation: {real affine} ./ {real affine}

Please suggest me in this regard.

Nilanjan

That constraint is non-convex for x < 0.

Presuming x >= 0, it can be handled using CVX’s exponential cone constraint capability to represent it as an exponential cone constraint,.

The constraint can be rewritten as
`x*exp(y/x) <= (constant + x)/log(2)`
which can be implemented in CVX as
`{y,x,(constant + x)/log(2)} == exponential(1)`

Note that although http://cvxr.com/cvx/doc/funcref.html#sets has an entry for `exp_cone`, it has to actually be entered using `exponential`, as I’ve shown here.

The exponential cone constraint si a powerful construct Learn it. Love it. Use it. And when using it, use Mosek 9.x as solver if you can, otherwise follow the instructions at 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 .