Why the constraint dosen't take effect in cvx model

Dear friends,my cvx model code as follows,but the outcome doesn’t meet the constraint.
eta_0=10^3;
P1_max=3;
P2_max=2;
Pmax_bs=5;
B_v=2010^6;
B_r=16
10^6;
g=(randn(1,1)+1irandn(1,1))/sqrt(2);
a=10^(-4);
psi=pi/3;
T=1;
d=10;
n=1.5;
Theta=pi/3;
g_Theta=(n^2)/((sin(Theta))^2);
zeta=-log(2)/log(cos(pi/3));
r=((zeta+1)
(cos(psi))^(zeta))/2/pi;
h=(a/(d^2))rTg_Thetacos(psi);
N=10^(-19);
N1=10^(-19);
N2=10^(-19);

cvx_begin
variable P1_bs nonnegative;
variable P2_bs nonnegative;
variable P1 nonnegative;
variable P2 nonnegative;
expression R1;
expression R2;

R1=B_v*-rel_entr(1,((B_v+P1h/N1)/B_v))/-rel_entr(1,2);
R2=B_r
-rel_entr(1,((B_r+P2abs(g)^2/N2)/B_r))/-rel_entr(1,2);
minimize (eta_0
(P1_bs+P2_bs+P1+P2)-R1-R2)
subject to

P1_bs<=P1_max;
P2_bs<=P2_max;
P1+P2<=Pmax_bs;
cvx_end

R1_bs=B_vlog((B_v+P1_bsh/N)/B_v)/log(2);
R2_bs=B_rlog((B_r+P2_bsabs(g)^2/N)/B_r)/log(2);
R1=B_vlog((B_v+P1h/N1)/B_v)/log(2);
R2=B_rlog((B_r+P2abs(g)^2/N2)/B_r)/log(2);
eta=(R1+R2)/(P1_bs+P2_bs+P1+P2);

You haven’t shown us what constraint is not met by how much or what the solver and CVX output/status are.

Your input data is horribly scaled with very large and small magnitude numbers. That is a recipe for numerical difficulties for solvers. You need to get non-zero input data to be much closer to 1 in magnitude.

Thanks for your reply.All the linear constraint doesn’t been met.
And Status: Failed Optimal value (cvx_optval): NaN
As for the suggestion of “get non-zero input data to be much closer to 1 in magnitude”, how can i get it?

When status is failed, any returned result in meaningless.

You haven’t shown the output, so I don’t know what solution method was used. Because rel_entr is used with a CVX argument, the problem has either been solved with CVX"s Successive Approximation Method, CVXQUAD, or Mosek native exponential cone.

The best method is Mosek native exponential cone, which is automatically invoked if CVX 2,2 is used with Mosek 9.x. That is the best method.

If that is not available and CVXQUAD with exponential.m replacement is used, CVXQUAD will be used.

Otherwise, CVX"s Successive Approximation Method, which often fails, and is the worst of the methods, will be used.

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 provides instructions.

As for scaling, try to choose better units for the variables.

Thanks a lot! The solved procedure is as below:
Successive approximation method to be employed.
SDPT3 will be called several times to refine the solution.
Original size: 17 variables, 7 equality constraints
2 exponentials add 16 variables, 10 equality constraints

Cones | Errors |
Mov/Act | Centering Exp cone Poly cone | Status
--------±--------------------------------±--------
0/ 0 | 0.000e+00 0.000e+00 0.000e+00 | Failed
0/ 0 | 0.000e+00 0.000e+00 0.000e+00 | Failed
0/ 0 | 0.000e+00 0.000e+00 0.000e+00 | Failed

Follow the advice in the previously provided link. Also try to change units for variables to improve scaling. I don’t know whether one or both of the better methods will succeed without improved scaling.

ok,I’ll try.Thanks your advice!