# I have a constraint, that I am unable to write in CVX acceptable syntax. Help!

#1

log(w(i)*square(sigma) + p(i)*H(i)) + ln(1 + inv_pos(w(i)*square(sigma))) >=r(i)*N*inv_pos(w(i)*B)
w and p are variables
rest are constants

Problem in formulating my problem in CVX
(Michael C. Grant) #2

Have you proven it is convex? Do consider if perhaps the rel_entr function can help with the second term.

(Mark L. Stone) #3

Convexity depends on parameter values. Assume w>0 and make all parameters equal 1 for simplicity (and convexity). then constraint is 1/w-log(w+p)-log(1+1/w) <= 0, which is convex, since 2nd deriv of 1/w-log(1+1/w) is (3w+2)/(w^3(w+1)^2) , though -log(1+1/w) by itself is concave. (cont.)

(Mark L. Stone) #4

And of course -log(w+p) is convex. 1/w–log(1+1/w) equals 1/w*(1+rel_entr(w+1,w)) , but this is a convex times convex, so not DCP-compliant even though it is convex (have assumed w>0). Can 1/w-log(1+1/w) be expressed in DCP-compliant form?

(Michael C. Grant) #5

Based on Mark’s analysis I’m going to suggest that even if it is convex for the chosen parameters, it cannot be represented in CVX. See the following similar models:

x\log(1+1/x) using CVX

How to implement following function \sum\limits_i {\sum\limits_k {{y_i}\log (1 + \frac{{x_i^k}}{{{y_i}}})} }

CVX simply cannot handle arbitrary convex functions, even if they are differentiable. If a model cannot be represented by the functions listed in the reference guide, then CVX cannot handle it. Any new functions we add will actually be represented by the existing list. This is due to the very specific way CVX translates and solves models, and due to the limitations of the underlying solvers.

#6

Thanks a lot!!

#7

Sir, putting the values of all the constants as 1 and then checking that the hessian of the constraint is positive semi define or not, is it the correct way of proving the convexity of the function, of course my constants are positive. w and p are also positive(it can take value as 10)

#8

if the hessian is indefinite on some of the values of variables, does that mean the constraint is non convex?