Status: Infeasible, Optimal value (cvx_optval): +Inf, stop: progress is too slow

Dear all,
I’m a rookie in cvx. All my constraints are convex and suit DCP. But the code just doesn’t work out. I’ve tried some methods like do some scaling but failed.
However, when I delete these two constraints(as shown in the picture), the code worked.


Besides, during the coding, I found that inv_pos function sometimes presented negative results and pow_p also gave wrong results which should not happen according to specification. Do you know why this happens?

I’m desperate to know where the problem is and what I should do to address it. Here is my code. Thank u in advance.

clear all;
close all;
randn(‘state’,0); rand(‘twister’,0);
K = 10;
N = 100;
FRE = 10^4;
D = 0.1;
ENE = 10 ^ 10;
B = 100;
p = randi(1,K,1);
l = repelem(1,K,N);
s = rand(K,N) * 10;
R = dB2dec(-10);
N0= dB2dec(-50);
q = [0,0]; % UAV当前位置假设一直处于0,0
w = randi(10,K,2); % w位随机生成的用户位置
H = 5; % UAV飞行高度,正常值位100或者20米
d = zeros(K,N); % 计算距离
PH= zeros(K,N); % 存储PHI值,
for i=1:N
for j=1:K
d(j,i)=sum((w(j, : ) - q).^2) + H^2;
end
PH(:,i)= p.*R ./ (N0.*d(:,i));
end

cvx_begin
variable b(K,N) nonnegative
variable F(K,N) nonnegative
variable Y(K,N) nonnegative
expression E(K,N)
for n=1:N
for k=1:K
E(k,n) = p(k).*l(k,n).s(k,n).Y(k,n);
end
end
ES = sum(sum(E))
minimize(ES)
subject to:
for n=1:N
0<= ES
0<= b(:,n) <=1;
0<= sum(b(:,n)) <= 1;
0<=F(:,n);
0<= sum(F(:,n)) <= FRE;
pwp = pow_p(F(:,n),-1);
ipf = inv_pos(F(:,n));
t1 = s(:,n) .
ipf;
t2 = s(:,n) .
Y(:,n);
t3 = t1 + t2;
t3 <= D;
pow_p(Y(:,n),-1) + kl_div(B.*b(:,n),B.*b(:,n)+PH(:,n)) <= PH(:,n);
end
ET = s.*F.*F;
ETT=sum(sum(ET));
ETT <= ENE;
cvx_end

Calling SDPT3 4.0: 39501 variables, 14000 equality constraints
For improved efficiency, SDPT3 is solving the dual problem.

num. of constraints = 14000
dim. of sdp var = 20000, num. of sdp blk = 10000
dim. of linear var = 9501
number of dense column in A = 100


SDPT3: Infeasible path-following algorithms


version predcorr gam expon scale_data
HKM 1 0.000 1 0
it pstep dstep pinfeas dinfeas gap prim-obj dual-obj cputime

0|0.000|0.000|1.1e+04|1.0e+00|1.5e+11| 2.788286e+10 0.000000e+00| 0:0:00| spchol 1 1
1|0.000|0.000|1.1e+04|1.0e+00|1.5e+11| 2.787862e+10 -2.854165e+01| 0:0:01| spchol 1 1
2|0.000|0.002|1.1e+04|1.0e+00|1.5e+11| 2.787080e+10 -2.708952e+02| 0:0:02| spchol 1 1
3|0.003|0.002|1.1e+04|1.0e+00|1.5e+11| 2.776983e+10 -5.061898e+02| 0:0:03| spchol 1 1
4|0.001|0.016|1.1e+04|9.8e-01|1.4e+11| 2.775315e+10 -2.843345e+03| 0:0:03| spchol 1 1
5|0.047|0.042|1.1e+04|9.4e-01|1.4e+11| 2.658631e+10 -8.991326e+03| 0:0:04| spchol 1 1
6|0.096|0.099|9.7e+03|8.5e-01|1.4e+11| 2.456256e+10 -2.267015e+04| 0:0:05| spchol 1 1
7|0.373|0.331|6.1e+03|5.7e-01|1.1e+11| 1.689436e+10 -6.421726e+04| 0:0:05| spchol 1 1
8|0.624|0.596|2.3e+03|2.3e-01|5.3e+10| 7.906569e+09 -1.275767e+05| 0:0:06| spchol 1 1
9|0.604|0.517|9.1e+02|1.1e-01|3.0e+10| 4.163153e+09 -2.416077e+05| 0:0:07| spchol 1 1
10|0.613|0.622|3.5e+02|4.2e-02|1.7e+10| 3.090127e+09 -9.606838e+05| 0:0:07| spchol 1 1
11|0.788|0.647|7.4e+01|1.5e-02|7.3e+09| 1.365258e+09 -5.326110e+05| 0:0:08| spchol 1 1
12|0.924|0.750|5.7e+00|3.7e-03|2.2e+09| 5.277435e+08 -1.332783e+05| 0:0:08| spchol 1 1
13|0.946|0.913|3.1e-01|3.2e-04|2.4e+08| 1.102052e+08 -1.162603e+04| 0:0:09| spchol 1 1
14|0.616|0.692|1.2e-01|9.9e-05|1.1e+08| 6.677646e+07 -3.735969e+03| 0:0:10| spchol 1 1
15|0.260|0.245|8.8e-02|7.5e-05|1.0e+08| 5.235329e+07 -2.906909e+03| 0:0:10| spchol 1 1
16|0.854|0.673|1.3e-02|2.4e-05|6.7e+07| 3.549102e+07 -1.205109e+03| 0:0:11| spchol 1 1
17|0.778|0.734|2.9e-03|6.5e-06|3.2e+07| 1.848553e+07 -5.405855e+02| 0:0:12| spchol 1 1
18|0.813|0.646|5.3e-04|2.3e-06|1.5e+07| 7.916986e+06 -3.252598e+02| 0:0:12| spchol 1 1
19|0.717|0.544|1.5e-04|1.0e-06|1.0e+07| 4.873511e+06 -2.287198e+02| 0:0:13| spchol 1 1
20|0.834|0.459|2.5e-05|5.7e-07|7.9e+06| 1.133112e+06 -1.908439e+02| 0:0:13| spchol 1 1
21|0.551|0.285|1.1e-05|4.1e-07|9.1e+06|-4.376656e+06 -1.761895e+02| 0:0:14| spchol 1 1
22|0.188|0.096|9.2e-06|3.7e-07|1.4e+07|-1.880989e+07 -1.729189e+02| 0:0:15| spchol 1 1
23|0.086|0.102|8.4e-06|3.3e-07|1.8e+07|-6.057899e+07 -1.700196e+02| 0:0:15| spchol 2 2
24|0.016|0.028|8.3e-06|3.2e-07|2.5e+07|-2.431219e+08 -1.693190e+02| 0:0:16| spchol 2 2
25|0.005|0.013|8.2e-06|3.2e-07|4.2e+07|-1.405763e+09 -1.690100e+02| 0:0:16| spchol 2 2
26|0.002|0.005|8.3e-06|3.1e-07|1.5e+08|-1.130337e+10 -1.689031e+02| 0:0:17| spchol 2 2
27|0.001|0.006|1.6e-05|3.1e-07|6.1e+08|-1.022500e+11 -1.688016e+02| 0:0:18| spchol 2 2
28|0.000|0.005|1.5e-04|3.1e-07|9.7e+08|-9.675382e+11 -1.687878e+02| 0:0:18| spchol 2 2
29|0.000|0.001|4.8e-04|3.1e-07|2.6e+09|-8.791394e+12 -1.687926e+02| 0:0:19|
stop: progress is too slow
prim_inf,dual_inf,relgap = 4.81e-04, 3.11e-07, 2.99e-04
sqlp stop: dual problem is suspected of being infeasible

number of iterations = 29
residual of dual infeasibility
certificate X = 2.06e-11
reldist to infeas. <= 3.78e-17
Total CPU time (secs) = 18.94
CPU time per iteration = 0.65
termination code = 2
DIMACS: 8.0e-03 0.0e+00 3.1e-07 0.0e+00 -1.0e+00 3.0e-04


Status: Infeasible
Optimal value (cvx_optval): +Inf

It looks like the primal objective is huge. Try to rescale your problem to have things within a small number of orders of magnitude of 1.

Furthermore, given that your program uses 'kl_div which is an exponential cone problem, and SDPT3 was run, it must be the case,that you are using CVXQUAD’s exponential.m replacemenrt. If you have access to Mosek, it would be better to use CVX 2,.2 with Mosek 9.1, which will utilize Mosek 9.1’s native exponential cone capability, and should work better. If you do use Mosek 9.1, then switch back in CVX;s version of exponential.m and then start a new session of MATLAB.if you can’;t do that, you could at least try SeDuMi and see whether it does better.

Also, you can try removing the objective function and see what happens regarding feasibility. it could be that bad scaling is causing an inaccurate infeasibility diagnosis.it might be that bad scaling in the objective function is coupling into an inaccurate infeasibility determination.

You can also read https://yalmip.github.io/debugginginfeasible/ , most of which is pertinent to CVX.