Disciplined convex programming error Illegal operation: {real affine} - {invalid}

This is my matlab codes

h1=1e-5*[6.164;3.067;1.829;3.067];
h2=1e-5*[3.067;6.614;3.067;1.829];
noise1=2*(1.6e-19)(10e6)((1.143e-4)0.5+(100e-6)0.562);
noise2=2
(1.6e-19)
(10e6)((1.143e-4)0.5+(100e-6)0.562);
t=1;
H1=h1
h1’;
H2=h2
h2’;
e1=[1,0,0,0]; E1=diag(e1);
e2=[0,1,0,0]; E2=diag(e2);
e3=[0,0,1,0]; E3=diag(e3);
e4=[0,0,0,1]; E4=diag(e4);
C=0.1;
C1=C/sqrt(3)
p0=[C/sqrt(3);0;0;C/sqrt(3)]; Q00=p0
p0’;
p1=[0;C/sqrt(3);0;0]; Q10=p1p1’;
p2=[0;0;C/sqrt(3);0]; Q20=p2
p2’;
b10=log(2pinoise1+2pitrace(Q20H1));
b20=log(2
pinoise2+2pitrace(Q10H2));
f10=log(2pinoise1+2pitrace(Q10H1)+2pitrace(Q20H1));
f20=log(2pinoise2+2pitrace(Q10H2)+2pitrace(Q20H2));

for k=1:6
%% CVX
cvx_begin sdp
variables c1 c2 a1 a2 b1 b2 d1 d2 f1 f2;
variable Q0(4,4) symmetric;
variable Q1(4,4) symmetric;
variable Q2(4,4) symmetric;
maximize c1+c2+(1/(2log(2)))(a1-b1)+(1/(2log(2)))(a2-b2)
subject to
c1+c2 <=1/(log(2))(d1-f1);
c1+c2 <=1/(log(2))
(d2-f2);
%% LOR constraint
trace(Q0E1)+trace(Q1E1)+trace(Q2E1)<=1/3C^2;
trace(Q0E2)+trace(Q1E2)+trace(Q2E2)<=1/3C^2;
trace(Q0E3)+trace(Q1E3)+trace(Q2E3)<=1/3C^2;
trace(Q0E4)+trace(Q1E4)+trace(Q2E4)<=1/3C^2;
% trace(Q0)+trace(Q1)+trace(Q2)<=Pt;
%% PRIVATE RATE
noise1+ttrace(Q1H1)+trace(Q2H1)>= exp(a1);
noise1+trace(Q2
H1)<=(b1-b10+1)exp(b10);
noise2+t
trace(Q2H2)+trace(Q1H2)>=exp(a2);
noise2+trace(Q1H2)<=(b2-b20+1)exp(b20);
%% COMMOM RATE
noise1+t
trace(Q0
H1)+trace(Q1H1)+trace(Q2H1)>=exp(d1); %COMMON
noise2+ttrace(Q0H2)+trace(Q1H2)+trace(Q2H2)>=exp(d2); %COMMON
noise1+trace(Q1H1)+trace(Q2H1)<=(f1-f10+1)exp(f10); %COMMON
noise2+trace(Q1
H2)+trace(Q2*H2)<=(f2-f20+1)*exp(f20); %COMMON
%% other constraint
c1>=0;
c2>=0;
Q0==semidefinite(4);
Q1==semidefinite(4);
Q2==semidefinite(4);
cvx_end

b10=b1;
b20=b2;
f10=f1;
f20=f2;
end

This is the output

CVX Warning:
Models involving “log” or other functions in the log, exp, and entropy
family are solved using an experimental successive approximation method.
This method is slower and less reliable than the method CVX employs for
other models. Please see the section of the user’s guide entitled
The successive approximation method
for more details about the approach, and for instructions on how to
suppress this warning message in the future.

Successive approximation method to be employed.
SDPT3 will be called several times to refine the solution.
Original size: 52 variables, 16 equality constraints
4 exponentials add 32 variables, 20 equality constraints

Cones | Errors |
Mov/Act | Centering Exp cone Poly cone | Status
--------±--------------------------------±--------
4/ 4 | 6.783e+00 2.003e+01 0.000e+00 | Solved
4/ 4 | 6.401e+00s 1.235e+01 1.912e-07 | Solved
4/ 4 | 5.436e+00 5.776e+00 9.723e-07 | Solved
4/ 4 | 3.625e+00 1.693e+00 4.862e-06 | Solved
4/ 4 | 1.321e+00 1.634e-01 0.000e+00 | Solved
4/ 4 | 3.665e-01 1.137e-02 8.727e-07 | Solved
1/ 1 | 1.483e-01 1.623e-03 0.000e+00 | Solved
1/ 1 | 1.304e-02 1.191e-06 0.000e+00 | Solved
0/ 0 | 3.024e-03 0.000e+00 0.000e+00 | Solved

Status: Solved
Optimal value (cvx_optval): +3.45069

Successive approximation method to be employed.
SDPT3 will be called several times to refine the solution.
Original size: 52 variables, 16 equality constraints
4 exponentials add 32 variables, 20 equality constraints

Cones | Errors |
Mov/Act | Centering Exp cone Poly cone | Status
--------±--------------------------------±--------
4/ 4 | 6.758e+00 1.920e+01 0.000e+00 | Solved
4/ 4 | 6.371e+00s 1.200e+01 0.000e+00 | Solved
4/ 4 | 5.428e+00 5.744e+00 2.651e-09 | Solved
4/ 4 | 3.518e+00 1.566e+00 4.674e-09 | Solved
4/ 4 | 1.230e+00 1.403e-01 5.974e-09 | Solved
4/ 4 | 2.455e-01 5.038e-03 5.088e-09 | Solved
4/ 4 | 6.539e-02 3.511e-04 4.798e-09 | Solved
4/ 4 | 7.515e-02s 4.579e-04s 1.981e-08 | Solved
4/ 4 | 1.648e-01s 2.183e-03s 7.271e-09 | Solved
4/ 4 | 4.209e-01s 1.507e-02s 5.408e-09 | Solved
4/ 4 | 7.178e-01s 3.939e-02s 1.343e-08 | Solved
4/ 4 | 2.576e-01 5.553e-03 1.056e-08 | Solved
4/ 4 | 8.687e-02 6.213e-04 9.641e-09 | Solved
4/ 4 | 2.243e-01s 4.198e-03s 1.116e-08 | Solved

Status: Failed
Optimal value (cvx_optval): NaN

Error using +
Disciplined convex programming error:
Illegal operation: {real affine} - {invalid}

Error in - (line 21)
z = plus( x, y, true, cheat );

Error in channel_xing (line 51)
noise1+trace(Q2*H1)<=(b1-b10+1)*exp(b10);

Welcome Steve!! You have hit the Trifecta.

The error message is due to NaN in input data, which in turns is the result of the previous iteration failing (which populates CVX variables with NaN), which is a result of some combination of using CVX’s Successive Approximation method and bad input data scaling and using SCA.

  1. Improve scaling of input data. Input data should be within a small number of orders of magnitude of one.

  2. Use Mosek as solver. If that is not possible, see the instructions 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

  3. Crude, unsafeguarded, Successive Convex Approximation (SCA) is inherently unstable and unreliable.

how did you solve it?