N = 100;%所有路径分为100段,实际上轨迹分为了101段,因为要求首尾轨迹相同
T = 200;%此次迭代假设给定的飞行时间为200s
Rt = 210^6; %要求达到的平均速率
%常量
%六个地面用户的坐标,分布在5000m5000m的平面中
s1x = 0; s1y = 0; plot(0,0,‘r.’); hold on;
s2x = 1500 ; s2y = 2000; plot(1500,2000,‘r.’);
s3x = 4100 ; s3y = 3000; plot(4100,3000,‘r.’);
d1x = 3100 ; d1y = 4700; plot(3100,4700,‘r.’);
d2x = 2700 ; d2y = 1000; plot(2700,1000,‘r.’);
d3x = 1000 ; d3y = 3800; plot(1000,3800,‘r.’);
Vmax = 50;
B0 = 10^6;
N0 = 10^-17;
%距离为一米时的相对信噪比
g0 = 10^-5;
h0 = g0/(B0N0);
H = 50;
Pv = 0.01;
Pu = 0.01;
%初始化的无人机轨迹,为一圆形
x0 = (s1x+s2x+s3x+d1x+d2x+d3x)/6;
y0 = (s1y+s2y+s3y+d1y+d2y+d3y)/6;
alpha = 0:pi/50:2pi;
r = 1000;
x = x0+rcos(alpha’);
y = y0+rsin(alpha’);
plot(x,y,’-’);
axis equal
axis([0,5000,0,5000])
%问题P1.4
cvx_begin
%优化变量,a1,a2,a3为源用户的带宽分配,b1,b2,b3为目标用户的带宽分配,P1,P2,P3为目标用户的功率分配
variables t a1(101) a2(101) a3(101) b1(101) b2(101) b3(101) P1(101) P2(101) P3(101)
%设置变量关系
maximize(t)
subject to
%各用户可达速率的定义
R1u = -rel_entr(a1.(H^2+(x-s1x).^2+(y-s1y).^2),Puh0+a1.(H^2+(x-s1x).^2+(y-s1y).^2))./(H^2+(x-s1x).^2+(y-s1y).^2);
R2u = -rel_entr(a2.(H^2+(x-s2x).^2+(y-s2y).^2),Puh0+a2.(H^2+(x-s2x).^2+(y-s2y).^2))./(H^2+(x-s2x).^2+(y-s2y).^2);
R3u = -rel_entr(a3.(H^2+(x-s3x).^2+(y-s3y).^2),Puh0+a3.(H^2+(x-s3x).^2+(y-s3y).^2))./(H^2+(x-s3x).^2+(y-s3y).^2);
R1v = -rel_entr(b1.(H^2+(x-d1x).^2+(y-d1y).^2),P1h0+b1.(H^2+(x-d1x).^2+(y-d1y).^2))./(H^2+(x-d1x).^2+(y-d1y).^2);
R2v = -rel_entr(b2.(H^2+(x-d2x).^2+(y-d2y).^2),P2h0+b2.(H^2+(x-d2x).^2+(y-d2y).^2))./(H^2+(x-d2x).^2+(y-d2y).^2);
R3v = -rel_entr(b3.(H^2+(x-d3x).^2+(y-d3y).^2),P3h0+b3.(H^2+(x-d3x).^2+(y-d3y).^2))./(H^2+(x-d3x).^2+(y-d3y).^2);
%约束条件(19a)和(19b),因为有六个用户,所以分为六个式子
B0/(101*Rt)sum(R1u) >= t;
B0/(101Rt)sum(R2u) >= t;
B0/(101Rt)sum(R3u) >= t;
B0/(101Rt)sum(R1v) >= t;
B0/(101Rt)sum(R2v) >= t;
B0/(101Rt)*sum(R3v) >= t;
Pall=P1+P2+P3;
Ball=a1+a2+a3+b1+b2+b3;
Pall <= Pv;
P1 >= 0;
P2 >= 0;
P3 >= 0;
Ball <= 1;
cvx_end
Successive approximation method to be employed.
SDPT3 will be called several times to refine the solution.
Original size: 2330 variables, 814 equality constraints
606 exponentials add 4848 variables, 3030 equality constraints
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
Status: Failed
Optimal value (cvx_optval): NaN