# Why does my program fail when it runs iteratively

I want to get a optimization iteratively while the first iteration result of my program gets solved/inaccurate status ,and until forth iteration ,the status is failed .I want to know what part of my program has a mistake.
the following is my code in the cvx
cvx_begin
% cvx_quiet true
% solver=‘mosek’;
% cvx_precision medium
cvx_solver sdpt3;
%variables
variable Q(2,N)
variable X_1(1,N)
variable X_2(1,N)
variable Y_1(1,N)
variable Y_2(1,N)
variable P_B(1,N) nonnegative
variable P_U(1,N) nonnegative
variable D(1,N) nonnegative
variable X_3(1,N)

expression R_U_low(1,N)
expression R_US_up(1,N)
expression R_B_low(1,N)
expression R_BS_up(1,N)
expression sum_R(1,N)
for n=1:N
R_U_low(n)=a_1_f(n)+b_1_f(n)(X_1_f(n)-X_1(n))+c_1_f(n)(Y_1_f(n)-Y_1(n));
R_B_low(n)=a_2_f(n)+b_2_f(n)(X_2_f(n)-X_2(n))+c_2_f(n)(Y_2_f(n)-Y_2(n));
R_BS_up(n)=a_3_f(n)+b_3_f(n)(P_B(n)-P_B_f(n));
% R_BS_up(n)=log(1-pow_p(X_3(n)+1,-1));
R_US_up(n)=rel_entr(1+X_3(n),X_3(n))+rel_entr(X_3(n),X_3(n)+1);
sum_R(n)=R_U_low(n)+R_B_low(n)-R_BS_up(n)-R_US_up(n);
end
maximize (sum(sum_R));
%constrain
subject to
% primal constraint
P_B<=Pmax;
P_U<=PUmax;
sum(P_B)<=N
Pave;
sum(P_U)<=NPUave;
sum_square(Q(:,1)-Q_0)<=(vmax
d)^2;
sum_square(Q(:,N)-Q_F)<=(vmaxd)^2;
for n=2:N
sum_square(Q(:,n)-Q(:,n-1))<=(vmax
d)^2;
end
% slack variable X1 Y1 D
for n=1:N
sigma_2+P_J
beta_0
pow_p(D(n),-1)+P_U(n)sigma_SI<=Y_1(n);
power(norm(Q_f(:,n)-Q_J(:)),2)+2
(Q_f(:,n)-Q_J(:))’*(Q(:,n)-Q_f(:,n))+H^2>=D(n);
end
% slack variable X2 Y2
for n=1:N
sigma_2+P_J
h_JB+P_B(n)sigma_SI<=Y_2(n);
end
% slack variable X3
for n=1:N
(beta_0_sigma_2)X_3(n)<=a_4_f(n)-a_4_f(n)(P_U(n)-P_U_f(n))/P_U_f(n)+2
(Q_f(:,n)-Q_E(:))’
(Q(:,n)-Q_f(:,n))/P_U_f(n);
end
cvx_end
cvx_status
opt=cvx_optval;
cvx_slvtol

## 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

Perhaps the problem scaling is bad. But not necessarily. However, CVX accepted your problem, but its unreliable Successive Approximation method failed.

If you have Mosek available, then use that with CVX 2.2 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 .