HELP!Optimal value (cvx_optval): NaN

Why does cvx optimization fail, but still outputs the result,

clc;clear all;close all
kappa=0.6;
eta=0.6;
K=3;
T=1;
pd=10^(-5);
pe=10^(-4);
b=10^(-8);
dertak=b/K;
dgk=1;
gk=dgk^(-3);
dhk=7;
hk=dhk^(-3);
g_k=dertak/gk
 etaEE=0;
 
 
 
 Pmax=1;


%***********************************************************************

%***********************************************************************
%*****************************cvx****************************************
 cvx_begin 
         variables  T1 T2 L p_bl p_sj;
          R1=(-rel_entr(T1*g_k,T1*g_k+p_bl*hk))/g_k;
          R2=kappa*(-rel_entr(T2,T2+L));
         R=(R1+R2);
         Power=(p_sj+3*(p_sj-p_bl)*hk*eta-pe*T1-pd*T);
         maximize R-etaEE*Power
         subject to  
         T1>0;
         T2>0;
         T1<1;
         T1+T2==1; 
         p_bl>=0;
         p_sj>=0;
         L>=0;
         3*p_sj<=T1*Pmax;
         eta*3*hk*(p_sj-p_bl)>=L*g_k*K+pd*T+pe*T1;
  cvx_end 

Status: Failed
Optimal value (cvx_optval): NaN

L =

2.4560e+04

T1 =

0.9986

If Status is Failed, all variable values are meaningless.

However, with CVXQUAD and its exponential.m replacement installed 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, this problem is solved to optimality, as I did with 3 different solvers. Unfortunately, the optimal objective value differed significantly among the 3. I suggest you try to improve the scaling in your model.

Thank you very much. I found the optimal solution under this parameter by modifying the parameters. What I want to know is whether I can use a loop. For example, a loop at Pmax, [1: 0.1: 2], to output the optimization amount I need at different pmax at one time.
What should I do if CCVX can

You can have

for Pmax=1:.01:2
  cvx_begin
  <your code from aboive>
  cvx_end
end

So you will be calling CVX 101 times, and solving 101 separate optimization problems.

Thank you very much for your reply, but in this way, I cannot record the value of the optimization value under each Pmax. For example, I want to use the Plot function in matlab to draw the horizontal axis as Pmax and the vertical axis as etaEE. Graph, in this way, I can’t seem to draw the desired curve

In other words, how do I record these values, when Pmax changes, the corresponding changes in T1, p_bl, p_sj, etc.

i = 1`
for Pmax=1:.01:2
  cvx_begin
  <your code from above>
  cvx_end
optimal_objective(i) = cvx_optval;
optimal_T1(i) = T1;
<etc.>
i = i+1
end

Thank you for your answer, then next, can I use the plot instruction to draw the corresponding graph, for example, plot (Pmax, T1)

At that point, you are outside CVX, and can use plot or any other MATLAB tools in accordance with MATLAB capabilities.

Thank you so much, you help me too much

Can I use CVXQUAD to solve a formula like this. For example, log (1 + x / c), where c is a constant and x is the optimized value

Yes. That is a concave expression which CVX will accept, if used in accordance with its DCP rules.

However, to get CVXUQAD’s Pade appproximant to be invoked for this, it must be refromulated per 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

image
According to the illustration, can I think it can be transformed into this?
Replace log(1+x/c) with -rel_entr(1,(x+c)/c) or -rel_entr(1,1+x/c)

That should work. Remember to install the exponential.m replacement as per the link.

Okay, thank you. happy New Year!