How do i use the rel_entr fucntion correctly?

Hi,I am trying to solve this problem: minimize(-x*log(1+b/x)+x),where b are constants,x and y are variables. I use the rel_entr function to transform this objective function into -rel_entr(x,x+b)+x.
the code as
h = 10;
n=2;
cvx_begin
variable a(n);

minimize(-rel_entr(a(1),a(1)+h)/log(2)+a(1))

subject to
    a(1)> 0

cvx_end

But an error has occurred.
Operation error in cvxprob/newobj (line 57 )
Disciplined convex programming error:
Cannot minimize a(n) concave expression.
Error in minimize (line 21 )
newobj( prob, ‘minimize’, x );
Error in dual2 (line 6)
minimize(-rel_entr(a(1),a(1)+h)/log(2)+a(1))

Furthermore, if I switch the objective function as maximize(-x*log(1+b/x)+x), it works. But -xlog(1+1/x) is a convex function but not a concave function, why does the minimum not work?
Successive approximation method to be employed.
For improved efficiency, SDPT3 is solving the dual problem.
SDPT3 will be called several times to refine the solution.
Original size: 5 variables, 2 equality constraints
1 exponentials add 8 variables, 5 equality constraints

Cones | Errors |
Mov/Act | Centering Exp cone Poly cone | Status
--------±--------------------------------±--------
1/ 1 | 9.700e-01 6.979e-02 0.000e+00 | Solved
1/ 1 | 6.530e-02 3.467e-04 0.000e+00 | Solved
0/ 1 | 3.589e-05 9.514e-11 0.000e+00 | Solved
0/ 0 | 0.000e+00 0.000e+00 0.000e+00 | Solved
0/ 0 | 0.000e+00 0.000e+00 0.000e+00 | Solved

Status: Solved
Optimal value (cvx_optval): +113.75

x*log(1+b/x) = -rel_entr(x,x+b)
so
-x*log(1+b/x) = rel_entr(x,x+b)
That explains all the phenomena you observed. Your 'switched" objective function was actually solving the problem you really wanted to solve.

You may also wish to read the beginning of 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 . for more reliable solution.

1 Like

I get it, thank you for your help!