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

#1

My optimization program is

maximize(sum(x.*log( 1+1./x )))
subject to
x >= 0
sum(x) <= 1


and when running the code above, the following error occur
"cannot perform the operation: {positive constant}./{real affine}"
Does there exist some possible transformation that the problem can be dealt with cvx??

How to implement following function $\sum\limits_i {\sum\limits_k {{y_i}\log (1 + \frac{{x_i^k}}{{{y_i}}})} }$
Expression for Shannon Capacity of Wireless channel in CVX
I have a constraint, that I am unable to write in CVX acceptable syntax. Help!
How to implement this function using cvx?
Writing a constraint in DCP complient format
#2

This seems highly nonconvex (especially given the affine constraints), in which case CVX cannot do much.

(Michael C. Grant) #3

Note that
$$x\log(1+x^{-1})= x\log(x+1)-x\log x.$$
The function rel_entr implements
$$f(x,y) = x\log(x/y) = x\log x-x\log y.$$
Therefore, I believe that -rel_entr(x,x+1) will give you the function you need.

That said, I must point you to the warning given by CVX when attempting to solve models using logarithms, exponentials, and entropy functions, which is elaborated on here in the user gude.

(Mark L. Stone) #4

mcg’s May 27, 2013 answer has a typo. It should be -rel_entr(x,x+1), not -rel_entr(x+1,x).

(Michael C. Grant) #5

Thanks Mark, I’ve edited the post.

(Michael C. Grant) #6

I’ve decided to make this post a FAQ…