# Stop: progress is bad Status: Inaccurate/Solved

Hello, I encountered the following problem when using CVX to solve, please help me, my running result and code are as follows.

## Calling SDPT3 4.0: 2737 variables, 1198 equality constraints For improved efficiency, SDPT3 is solving the dual problem.

num. of constraints = 1198
dim. of sdp var = 1436, num. of sdp blk = 718
dim. of linear var = 579
dim. of free var = 4 *** convert ublk to lblk

SDPT3: Infeasible path-following algorithms

## number of iterations = 47 primal objective value = -7.61737739e+01 dual objective value = -3.80829803e+01 gap := trace(XZ) = 5.14e-04 relative gap = 4.46e-06 actual relative gap = -3.30e-01 rel. primal infeas (scaled problem) = 9.38e-13 rel. dual " " " = 1.27e-14 rel. primal infeas (unscaled problem) = 0.00e+00 rel. dual " " " = 0.00e+00 norm(X), norm(y), norm(Z) = 3.7e+08, 5.1e+07, 6.5e+07 norm(A), norm(b), norm© = 5.3e+03, 4.5e+06, 8.4e+05 Total CPU time (secs) = 3.96 CPU time per iteration = 0.08 termination code = -5 DIMACS: 8.4e-12 0.0e+00 7.6e-14 0.0e+00 -3.3e-01 4.5e-06

Status: Inaccurate/Solved
Optimal value (cvx_optval): +38.083

``````indent preformatted text by 4 spaces
K=4;
N=20;
delta=1;
V_max=30;
B=1*10^6;                  %bandwidth=1MHZ
beta0=1*10^(-6);           %-60dB
P=1;                       %user power=1W
noise_p=1*10^(-14);        %noise power=-110dBm
H=50;
w_k=[50,70,330,350;180,210,210,180];          %user location
w_e=[200,50];              %eavesdropper location
M=30;

%SCA local point q_r
q_r=zeros([2,N]);
c_ini_x=200;
c_ini_y=80;
r_ini=80;
ang=2*pi/(N-1);
for n=1:N
q_r(1,n)=c_ini_x+r_ini*cos((n-1)*ang-pi/2);
q_r(2,n)=c_ini_y+r_ini*sin((n-1)*ang-pi/2);
end

%SCA local point v1_r,v2_r
v1_r=zeros([K,N]);
v2_r=zeros([1,N]);
for k=1:K
for n=1:N
v1_r(k,n)=sqrt((q_r(1,n)-w_k(1,k))^2+(q_r(2,n)-w_k(2,k))^2+H^2);
end
end

for n=1:N
v2_r(n)=sqrt((q_r(1,n)-w_e(1))^2+(q_r(2,n)-w_e(2))^2+H^2);
end

%constant dke,A_k,B_k,C
dke=zeros([1,K]);                %||wk-we||
A_k=zeros([1,K]);
B_k=zeros([1,K]);
for k=1:K
dke(k)=sqrt((w_k(1,k)-w_e(1))^2+(w_k(2,k)-w_e(2))^2);
A_k(k)=beta0/(dke(k)^4);
B_k(k)=(2*M*beta0^(1.5))/(dke(k)^2);
end
C=(M^2)*(beta0^2);

%SCA local point eta_r
eta_r=zeros([K,N]);
for k=1:K
for n=1:N
eta_r(k,n)=log(1+(P/noise_p)*(A_k(k)-B_k(k)/(v1_r(k,n)*v2_r(n))+C/((v1_r(k,n)^2)*(v2_r(n)^2))));
end
end

%constant D_l,E_l,dku_l_horizon2,due_l_horizon2
D_r=zeros([K,N]);
E_r=zeros([K,N]);
dku_r_horizon2=zeros([K,N]);    %||qr[n]-wk||2
due_r_horizon2=zeros([1,N]);    %||qr[n]-we||2
for k=1:K
for n=1:N
dx_uav_ue2=(q_r(1,n)-w_k(1,k))^2;
dy_uav_ue2=(q_r(2,n)-w_k(2,k))^2;
dku_r_horizon2(k,n)=dx_uav_ue2+dy_uav_ue2;

d_uav_ue2=H^2+dx_uav_ue2+dy_uav_ue2;
D_r(k,n)=B*log2(1+(P*beta0)/(noise_p*(H^2+dku_r_horizon2(k,n))));
E_r(k,n)=(B*P*beta0)/(log(2)*d_uav_ue2*(noise_p*d_uav_ue2+P*beta0));
end
end
for n=1:N
due_r_horizon2(n)=(q_r(1,n)-w_e(1))^2+(q_r(2,n)-w_e(2))^2;
end

cvx_begin
variable Q(2,N) nonnegative          %trajectory
variable omega(K,N) nonnegative    %slack variable omega
variable eta(K,N)                  %slack variable eta
variable v1(K,N)                   %slack variable v1
variable v2(1,N)                   %slack variable v2
variable v3(K,N)                   %slack variable v3
variable v4(1,N)                   %slack variable v4

expressions R_lb(K,N) nonnegative          %lower boundary of Rk[n]
for k=1:K
for n=1:N
dku_horizon2=(Q(1,n)-w_k(1,k))^2+(Q(2,n)-w_k(2,k))^2;
R_lb(k,n)=D_r(k,n)-E_r(k,n)*(dku_horizon2-dku_r_horizon2(k,n));
end
end

expressions F_lb(K,N)       %lower boundary of 1/v1k[n]v2[n]
for k=1:K
for n=1:N
F_lb(k,n)=3/(v1_r(k,n)*v2_r(n))-v1(k,n)/(v2_r(n)*v1_r(k,n)^2)...
-v2(n)/(v1_r(k,n)*v2_r(n)^2);
end
end

G_lb=exp(eta_r)+(exp(eta_r).*(eta-eta_r));      %lower boundary of exp(eta)

energy=P*L*alpha_k_n*inv_pos(omega);

minimize(sum(sum(energy)))
subject to
Q(1,1)==q_r(1,1);
Q(2,1)==q_r(2,1);
Q(1,N)==Q(1,1);
Q(2,N)==Q(2,1);

for n=1:N-1
(Q(1,n+1)-Q(1,n))^2+(Q(2,n+1)-Q(2,n))^2<=(delta*V_max)^2;
end

omega<=R_lb-eta*B/log(2);

for k=1:K
for n=1:N
1+P*(A_k(k)-B_k(k)*F_lb(k,n)+C*prod_inv([v3(k,n),v4(1,n)]))/noise_p<=G_lb(k,n);

(Q(1,n)-w_k(1,k))^2+(Q(2,n)-w_k(2,k))^2+H^2<=2*v1_r(k,n)*v1(k,n)-v1_r(k,n)^2;

v3(k,n)<=H^2+dku_r_horizon2(k,n)+...
2*((q_r(1,n)-w_k(1,k))*(Q(1,n)-q_r(1,n))+(q_r(2,n)-w_k(2,k))*(Q(2,n)-q_r(2,n)));
end
end

for n=1:N
(Q(1,n)-w_e(1))^2+(Q(2,n)-w_e(2))^2+H^2<=2*v2_r(n)*v2(n)-v2_r(n)^2;

v4(1,n)<=H^2+due_r_horizon2(n)+...
2*((q_r(1,n)-w_e(1))*(Q(1,n)-q_r(1,n))+(q_r(2,n)-w_e(2))*(Q(2,n)-q_r(2,n)));
end
cvx_end
cvx_clear``````

see

## thanks for your reply,i tried to use mosek,but it failed.this is result of its operation Calling Mosek 9.1.9: 2737 variables, 1198 equality constraints For improved efficiency, Mosek is solving the dual problem.

MOSEK Version 9.1.9 (Build date: 2019-11-21 11:34:40)
Copyright © MOSEK ApS, Denmark. WWW: mosek.com
Platform: Windows/64-X86

MOSEK warning 710: #1 (nearly) zero elements are specified in sparse col ‘’ (582) of matrix ‘A’.
Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 1198
Cones : 718
Scalar variables : 2737
Matrix variables : 0
Integer variables : 0

Optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator started.
Freed constraints in eliminator : 387
Eliminator terminated.
Eliminator started.
Freed constraints in eliminator : 0
Eliminator terminated.
Eliminator - tries : 2 time : 0.00
Lin. dep. - tries : 1 time : 0.00
Lin. dep. - number : 0
Presolve terminated. Time: 0.00
Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 1198
Cones : 718
Scalar variables : 2737
Matrix variables : 0
Integer variables : 0

Optimizer - threads : 16
Optimizer - solved problem : the primal
Optimizer - Constraints : 725
Optimizer - Cones : 716
Optimizer - Scalar variables : 2364 conic : 2148
Optimizer - Semi-definite variables: 0 scalarized : 0
Factor - setup time : 0.00 dense det. time : 0.00
Factor - ML order time : 0.00 GP order time : 0.00
Factor - nonzeros before factor : 3385 after factor : 4438
Factor - dense dim. : 0 flops : 5.43e+04
ITE PFEAS DFEAS GFEAS PRSTATUS POBJ DOBJ MU TIME
0 3.5e+05 2.0e+05 2.0e+07 0.00e+00 1.896008213e+03 -2.000000000e+07 1.0e+00 0.05
1 9.7e+04 5.4e+04 1.0e+07 -1.00e+00 1.141997884e+07 -8.581758914e+06 2.7e-01 0.05
2 4.9e+04 2.7e+04 7.5e+06 -1.00e+00 1.033093224e+07 -9.670207220e+06 1.4e-01 0.05
3 1.6e+04 8.6e+03 4.2e+06 -1.00e+00 1.090390748e+07 -9.093915246e+06 4.4e-02 0.05
4 3.8e+03 2.1e+03 2.1e+06 -9.99e-01 1.189373959e+07 -8.086780825e+06 1.1e-02 0.05
5 7.6e+02 4.2e+02 9.2e+05 -9.98e-01 1.459900599e+07 -5.281119985e+06 2.2e-03 0.05
6 2.5e+02 1.4e+02 5.2e+05 -9.87e-01 1.484694708e+07 -4.779386795e+06 7.1e-04 0.05
7 1.3e+02 7.1e+01 3.7e+05 -9.62e-01 1.488994974e+07 -4.389152597e+06 3.6e-04 0.06
8 3.7e+01 2.0e+01 1.8e+05 -9.28e-01 1.417578031e+07 -3.496229778e+06 1.0e-04 0.06
9 1.6e+01 9.1e+00 1.1e+05 -7.61e-01 1.258036743e+07 -2.733002846e+06 4.6e-05 0.06
10 4.8e+00 2.7e+00 3.7e+04 -5.02e-01 8.002566727e+06 -1.411123248e+06 1.4e-05 0.06
11 8.0e-01 4.5e-01 3.8e+03 1.59e-01 2.050085952e+06 -2.716410305e+05 2.3e-06 0.06
12 1.2e-01 6.9e-02 2.2e+02 8.21e-01 3.408535123e+05 -4.465794100e+04 3.5e-07 0.06
13 2.7e-02 1.5e-02 2.3e+01 9.47e-01 7.372789117e+04 -1.118212410e+04 7.5e-08 0.06
14 5.9e-03 3.3e-03 2.4e+00 9.85e-01 1.557258972e+04 -3.416023605e+03 1.7e-08 0.06
15 1.2e-03 6.7e-04 2.3e-01 9.77e-01 2.484230192e+03 -1.434980271e+03 3.4e-09 0.06
16 3.4e-04 1.9e-04 3.6e-02 9.50e-01 4.479458176e+02 -6.992134973e+02 9.7e-10 0.08
17 1.6e-04 9.1e-05 1.3e-02 8.86e-01 1.547263278e+02 -4.401473392e+02 4.6e-10 0.08
18 6.7e-05 3.7e-05 3.5e-03 9.95e-01 -1.394174315e+02 -3.881598473e+02 1.9e-10 0.08
19 4.4e-05 5.5e-05 2.3e-03 5.79e-01 -1.714680176e+01 -2.244252630e+02 1.2e-10 0.08
20 1.2e-05 3.3e-05 3.6e-04 8.93e-01 -1.444806131e+02 -2.064728042e+02 3.5e-11 0.08
21 5.6e-06 2.1e-04 1.6e-04 4.85e-01 -7.180036644e+01 -1.122565891e+02 1.6e-11 0.08
22 1.7e-06 2.5e-04 2.9e-05 7.83e-01 -8.199319561e+01 -9.546821730e+01 4.7e-12 0.08
23 7.5e-07 1.5e-03 1.3e-05 4.46e-01 -4.716349701e+01 -5.610532683e+01 2.1e-12 0.08
24 2.3e-07 1.2e-03 2.6e-06 7.25e-01 -4.423225783e+01 -4.745833101e+01 6.5e-13 0.08
25 1.1e-07 6.4e-03 1.2e-06 3.62e-01 -2.573900429e+01 -2.800605340e+01 3.0e-13 0.08
26 3.2e-08 5.1e-03 2.2e-07 7.00e-01 -2.294567850e+01 -2.372082336e+01 8.7e-14 0.08
27 1.4e-08 2.1e-03 9.3e-08 3.60e-01 -1.390969831e+01 -1.441013353e+01 3.6e-14 0.09
28 4.7e-09 1.9e-02 1.9e-08 6.43e-01 -1.156324237e+01 -1.174259106e+01 1.1e-14 0.09
29 2.5e-09 8.3e-03 7.1e-09 3.59e-01 -7.378595741e+00 -7.486044728e+00 4.3e-15 0.09
30 1.7e-09 9.4e-02 1.7e-09 6.32e-01 -6.196545707e+00 -6.239822448e+00 1.5e-15 0.09
31 2.0e-09 2.6e-01 3.4e-10 5.54e-01 -4.698341532e+00 -4.713944426e+00 4.1e-16 0.09
32 1.5e-09 2.0e-01 8.1e-11 7.59e-01 -4.253918973e+00 -4.260198080e+00 1.5e-16 0.09
33 1.4e-09 2.4e-01 1.8e-11 8.78e-01 -4.053705360e+00 -4.056073102e+00 5.6e-17 0.09
34 1.6e-09 2.6e-01 4.2e-12 9.13e-01 -3.968855107e+00 -3.969745085e+00 2.1e-17 0.11
35 2.0e-09 1.2e-01 1.4e-12 9.03e-01 -3.908236428e+00 -3.908661418e+00 1.2e-17 0.11
36 2.0e-09 1.2e-01 1.4e-12 9.45e-01 -3.908236428e+00 -3.908661418e+00 1.2e-17 0.11
37 2.0e-09 1.2e-01 1.4e-12 9.91e-01 -3.908236428e+00 -3.908661418e+00 1.2e-17 0.13
Optimizer terminated. Time: 0.13

Interior-point solution summary
Problem status : UNKNOWN
Solution status : UNKNOWN
Primal. obj: -3.9082364281e+00 nrm: 5e+05 Viol. con: 2e-06 var: 4e-11 cones: 2e-10
Dual. obj: -3.8886931052e+00 nrm: 2e+07 Viol. con: 0e+00 var: 3e+05 cones: 8e-09
Optimizer summary
Optimizer - time: 0.13
Interior-point - iterations : 38 time: 0.13
Basis identification - time: 0.00
Primal - iterations : 0 time: 0.00
Dual - iterations : 0 time: 0.00
Clean primal - iterations : 0 time: 0.00
Clean dual - iterations : 0 time: 0.00
Simplex - time: 0.00
Primal simplex - iterations : 0 time: 0.00
Dual simplex - iterations : 0 time: 0.00
Mixed integer - relaxations: 0 time: 0.00

Status: Failed
Optimal value (cvx_optval): NaN

This

means some of your data are too small (but not zero, like `noise_p=1*10^(-14)` or too big, solvers cannot handle them stably. see Handling numerical issues section of

By the way, I’m wondering if CVX2.2 supports SCS solver.

thank you,i will try it.I only have sdpt3, sedumi, mosek and gurobi in my list of CVX solvers

I believe SCS is only supported in CVX 3.0beta. But that version of CVX is riddled with bugs, including not honoring some constraints, so i don’t recommend using it.

As for warnings about nearly zero numbers, you need to improve the scaling of your input data. Change the units to avoid such small numbers as 10^(-14),. 10^(-6) is not very wonderful, but you might get away with it.

2 Likes