How to use rel_ entr function

Hi,I am trying to solve this problem: a*x*log(1+b/x),where a and b are constants,x and y are variables.Can I use rel_entr? And how?Can I use python to solve this problem?Please hlep me ,thank you.

-a*rel_entr(x,x+b) can be used in CVX. Something similar can be done in CVXPY, but details for that are off-topic for this forum.

Thank you very much for your help. I have successfully solved this problem. :grin:

Hi, I have another question when using rel_entr.If I want to solve this problem:axlog(1+bv/x),where a and b are constants,X and V are variables.I try to use -arel_entr(x,x+b*v),and the solutions of X and V are obtained successfully, is this the optimal solution?Please help me,thank you.

Yes, in this case b*v serves as the b from my previous post.

Thank you for your reply. :grin:
My classmate used rel_entr,he failed,as shown in the picture,can you tell me why?

You haven’t told us what you mean by “he failed”.

Did CVX accept the problem? I think it should have.

Did the solver fail to solve the problem? That is possible. To minimize the chances of that happening, make sure the problem scaling is good, use CVX 2.2 with Mosek 9.x if possible, otherwise follow the advice 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 .

In the future, please copy and paste code using the Preformatted text icon, rather than posting an image of code.

Thank you again for your reply. Please allow me to describe my problem again. I use CVX to solve convex optimization problems. There are four variables T (1), T(2), x and y, and their relationship is just as described in the first code block. I encountered the following problems in the process of solving shown in the second code block. Is my usage correct?

cvx_begin
        variable T(n);
        variable x;
        variable y;

   maximize(-rel_entr(T(1),T(1)+ x * h1 / AWGN)/log(2) - rel_entr(T(2),T(2)+ y * h2 / AWGN)/log(2))% -a*rel_entr(x,x+b)
        subject to
            0<=T(1)<=1
            0<=T(2)<=1
            0<=T(1)+T(2)<=1-alpha
            h1E * x + zeta * h2E * y <= zeta * E2 * h2E
            h2E * y + zeta * h1E * x <= zeta * E1 * h1E

    cvx_end

Error message:
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: 14 variables, 6 equality constraints
2 exponentials add 16 variables, 10 equality constraints

Cones | Errors |
Mov/Act | Centering Exp cone Poly cone | Status
--------±--------------------------------±--------
2/ 2 | 6.806e+00 2.212e+01 2.316e-02 | Failed
2/ 2 | 6.410e+00s 1.578e+01 2.900e-01 | Failed
2/ 2 | 8.000e+00s 7.112e+00 0.000e+00 | Failed
2/ 2 | 8.000e+00s 7.965e+00s 0.000e+00 | Failed
2/ 2 | 8.000e+00s 1.021e+01s 0.000e+00 | Failed
2/ 2 | 8.000e+00s 1.352e+01s 0.000e+00 | Failed

Status: Failed
Optimal value (cvx_optval): NaN

This is what I was talking about in my paragraph from above

Did the solver fail to solve the problem? That is possible. To minimize the chances of that happening, make sure the problem scaling is good, use CVX 2.2 with Mosek 9.x if possible, otherwise follow the advice 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

Thank you very much.