# Why is this program Failed?

rmpath(‘D:\matlab\toolbox\signal\signal’);
%问题P1.5
cvx_begin
%优化变量, x1,y1为新的轨迹
variables t x1(101) y1(101)
%设置变量关系
maximize(t)
subject to
e1 = Puh0./a1;
e2 = Pu
h0./a2;
e3 = Pu*h0./a3;
c1 = P1.*h0./b1;
c2 = P2.*h0./b2;
c3 = P3.h0./b3;
%各用户可达速率的定义
R1ulb = a1.log(1+e1./(H^2+norms([x y]-repmat([s1x s1y],101,1),[],2).^2))./log(2)-a1/log(2).e1./((H^2+norms([x y]-repmat([s1x s1y],101,1),[],2).^2).(H^2+norms([x y]-repmat([s1x s1y],101,1),[],2).^2+e1)).(square_pos(norms([x1 y1]-repmat([s1x s1y],101,1),[],2))-norms([x y]-repmat([s1x s1y],101,1),[],2).^2);
R2ulb = a2.log(1+e2./(H^2+norms([x y]-repmat([s2x s2y],101,1),[],2).^2))./log(2)-a2/log(2).e2./((H^2+norms([x y]-repmat([s2x s2y],101,1),[],2).^2).(H^2+norms([x y]-repmat([s2x s2y],101,1),[],2).^2+e2)).(square_pos(norms([x1 y1]-repmat([s2x s2y],101,1),[],2))-norms([x y]-repmat([s2x s2y],101,1),[],2).^2);
R3ulb = a3.log(1+e3./(H^2+norms([x y]-repmat([s3x s3y],101,1),[],2).^2))./log(2)-a3/log(2).e3./((H^2+norms([x y]-repmat([s3x s3y],101,1),[],2).^2).(H^2+norms([x y]-repmat([s3x s3y],101,1),[],2).^2+e3)).(square_pos(norms([x1 y1]-repmat([s3x s3y],101,1),[],2))-norms([x y]-repmat([s3x s3y],101,1),[],2).^2);
R1vlb = b1.log(1+c1./(H^2+norms([x y]-repmat([d1x d1y],101,1),[],2).^2))./log(2)-b1/log(2).c1./((H^2+norms([x y]-repmat([d1x d1y],101,1),[],2).^2).(H^2+norms([x y]-repmat([d1x d1y],101,1),[],2).^2+c1)).(square_pos(norms([x1 y1]-repmat([d1x d1y],101,1),[],2))-norms([x y]-repmat([d1x d1y],101,1),[],2).^2);
R2vlb = b2.log(1+c2./(H^2+norms([x y]-repmat([d2x d2y],101,1),[],2).^2))./log(2)-b2/log(2).c2./((H^2+norms([x y]-repmat([d2x d2y],101,1),[],2).^2).(H^2+norms([x y]-repmat([d2x d2y],101,1),[],2).^2+c2)).(square_pos(norms([x1 y1]-repmat([d2x d2y],101,1),[],2))-norms([x y]-repmat([d2x d2y],101,1),[],2).^2);
R3vlb = b3.log(1+c3./(H^2+norms([x y]-repmat([d3x d3y],101,1),[],2).^2))./log(2)-b3/log(2).c3./((H^2+norms([x y]-repmat([d3x d3y],101,1),[],2).^2).(H^2+norms([x y]-repmat([d3x d3y],101,1),[],2).^2+c3)).(square_pos(norms([x1 y1]-repmat([d3x d3y],101,1),[],2))-norms([x y]-repmat([d3x d3y],101,1),[],2).^2);
%约束条件(22a)和(22b)，因为有六个用户，所以分为六个式子0.
B0/(101
Rt)sum(R1ulb) >= t;
B0/(101
Rt)sum(R2ulb) >= t;
B0/(101
Rt)sum(R3ulb) >= t;
B0/(101
Rt)sum(R1vlb) >= t;
B0/(101
Rt)sum(R2vlb) >= t;
B0/(101
Rt)*sum(R3vlb) >= t;
%约束条件(18h)和(18i)
for i=1:100
norm([x1(i+1)-x1(i),y1(i+1)-y1(i)]) <= Dmax
end
x1(101) == x1(1);
y1(101) == y1(1);

cvx_end

## Calling SDPT3 4.0: 5255 variables, 2530 equality constraints

num. of constraints = 2530
dim. of sdp var = 1212, num. of sdp blk = 606
dim. of socp var = 2118, num. of socp blk = 706
dim. of linear var = 1318
dim. of free var = 1 *** convert ublk to lblk

SDPT3: Infeasible path-following algorithms

## number of iterations = 39 primal objective value = -1.77262836e+03 dual objective value = 9.85015670e-01 gap := trace(XZ) = 1.27e+00 relative gap = 7.15e-04 actual relative gap = -9.99e-01 rel. primal infeas (scaled problem) = 4.73e-02 rel. dual " " " = 1.08e-08 rel. primal infeas (unscaled problem) = 0.00e+00 rel. dual " " " = 0.00e+00 norm(X), norm(y), norm(Z) = 2.2e+08, 6.4e-01, 6.4e-01 norm(A), norm(b), norm© = 7.6e+01, 9.4e+04, 2.4e+00 Total CPU time (secs) = 1.24 CPU time per iteration = 0.03 termination code = -5 DIMACS: 9.5e-01 0.0e+00 1.3e-08 0.0e+00 -1.0e+00 7.1e-04

Status: Failed
Optimal value (cvx_optval): NaN

Try another solver, such as Mosek, if available.

Check and try to improve the scaling of the data in the problem.