How can I adjust the following expression as an objective function in the CVX tool?

**log(1+x/(y+1)) + log(1+x)**

The expression is convex in nature. The error message I am getting while applying this in the Matlab CVX tool is:

Disciplined convex programming error:

Cannot perform the operation: {real affine} ./

{real affine}**

Your claim to the contrary notwithstanding, it is neither convex nor concave. At x = y = 1, its Hessian has one negative eigenvalue and one positive eigenvalue.

My mistake. Please consider the corrected expression below:

**log(1+x/(y+1)) + log(1+y)**

At x = y = 1, its Hessian has one negative eigenvalue and one zero eigenvalue. Is it concave/covex @Mark_L_Stone ?

`log(1+x/(y+1)) + log(1+y) = log(1+y+x)`

, the latter of which can be entered “as is”. However, it is concave, not convex. So it can be maximized in CVX, but not minimized.

1 Like

You are roght @Mark_L_Stone .I tried to maximize it for all non-negative variables, but it showed the below result:

Status: Failed

Optimal value (cvx_optval): NaN

You havent shown the solver output. But my guess is that CVX’s Successive Approximation was used, and it failed, as it often does. It may also be the case that the numerical scaling of the input data is bad.

Use CVX 2.2 with Mosek 10.x or 9.x if available. Otherwise, follow the directions 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 .

1 Like

Yes you are right. Successive approximation method is employed by the cvx tool.

I will try the method you suggested. Can you please tell whether the below expression is convex/concave ?

**log(1+1/(5x+5y+3))**

Hint:

`rel_entr(5*x+5*y+3,5*x+5*y+4) + rel_entr(5*x+5*y+4,5*x+5*y+3)`

But you shouldn’t be asking us, you should be telling us, which you would know if you read the link I provided above.