clc;
clear all;
close all;
cvx_solver mosek
%轨迹初始化
T = 120; %mission period
delta = T/120; %elemental length
N = T/delta; %number of time slot
K=6;
% 用户在移动
% 用户一的初始轨迹
xw1 = 700;%圆心
yw1 = 100;
rw1 = 200;%radius
theta = 0:2pi/(N-1):2pi;
qw11 = xw1 + rw1cos(theta);
qw21 = yw1 + rw1sin(theta);
qw11 = qw11’;
qw21 = qw21’;
w1 = [qw11,qw21];
%用户二的初始轨迹
xw2 = 200;%圆心
yw2 = 450;
rw2 = 100;%radius
theta = 0:2pi/(N-1):2pi;
qw12 = xw2 + rw2cos(theta);
qw22 = yw2 + rw2sin(theta);
qw12 = qw12’;
qw22 = qw22’;
w2 = [qw12,qw22];
% w1 = [700ones(N,1),100ones(N,1)];
% w2 = [200ones(N,1),450ones(N,1)];
w3 = [-300ones(N,1),450ones(N,1)];
w4 = [-600ones(N,1),200ones(N,1)];
w5 = [-450ones(N,1),-450ones(N,1)];
w6 = [400ones(N,1),-500ones(N,1)];
% 恶意干扰在移动
% 干扰点的初始轨迹
% Jx1 =0 ;%圆心
% Jy1 = 0;
% Jw1 = 200;%radius
% theta = 0:2pi/(N-1):2pi;
% J11 = Jx1 + Jw1cos(theta);
% J21 = Jy1 + Jw1sin(theta);
% J11 = J11’;
% J21 = J21’;
% J = [J11,J21];
J = [0ones(N,1),0ones(N,1)];%恶意干扰信号位置
p1=10;
p2=1;
p3=1;
p4=1;
p5=1;
p6=1;
x1=0.1;
x2=0.1;
x3=0.1;
x4=0.1;
x5=0.1;
x6=0.1;
pm=0.00001;%干扰功率
pmax=10;
B=10^6;
vmax = 200; %maximum speed
beta_db =-60; %单位距离下信道增益 dB
sigma_db = -148; %噪声强度dB
beta = 10^(beta_db/10);
sigma = 10^(sigma_db/10);
H = 100; %无人机高度
%初始轨迹
x11 = 0;%圆心
y11 = 0;
r1 = 800;%radius
theta = 0:2pi/(N-1):2pi;
% 无人机轨迹
% q11 = x11 + r1cos(theta);
% q21 = y11 + r1sin(theta);
% q11 = q11’;
% q21 = q21’;
% q1 = [q11,q21];
q1=[38ones(N,1),5ones(N,1)];
q1s = q1;
for cntTra =1:1:2
d11 = H^2+(q1s(:,1)-w1(:,1)).^2+(q1s(:,2)-w1(:,2)).^2;
d12 = H^2+(q1s(:,1)-w2(:,1)).^2+(q1s(:,2)-w2(:,2)).^2;
d13 = H^2+(q1s(:,1)-w3(:,1)).^2+(q1s(:,2)-w3(:,2)).^2;
d14 = H^2+(q1s(:,1)-w4(:,1)).^2+(q1s(:,2)-w4(:,2)).^2;
d15 = H^2+(q1s(:,1)-w5(:,1)).^2+(q1s(:,2)-w5(:,2)).^2;
d16 = H^2+(q1s(:,1)-w6(:,1)).^2+(q1s(:,2)-w6(:,2)).^2;
d= H^2+(q1s(:,1)-J(:,1)).^2+(q1s(:,2)-J(:,2)).^2;
Is=sigma+(beta.*pm)./d;%初始可行解
Ls1=d11./(beta.*p1);
Ls2=d12./(beta.*p2);
Ls3=d13./(beta.*p3);
Ls4=d14./(beta.*p4);
Ls5=d15./(beta.*p5);
Ls6=d16./(beta.*p6);
A1=-(x1.*B)./(Ls1+(x1.*B).*Ls1.^2.*Is);%泰勒展开系数
A2=-(x2.*B)./(Ls2+(x2.*B).*Ls2.^2.*Is);
A3=-(x3.*B)./(Ls3+(x3.*B).*Ls3.^2.*Is);
A4=-(x4.*B)./(Ls4+(x4.*B).*Ls4.^2.*Is);
A5=-(x5.*B)./(Ls5+(x5.*B).*Ls5.^2.*Is);
A6=-(x6.*B)./(Ls6+(x6.*B).*Ls6.^2.*Is);
C1=-(x1.*B)./(Is+(x1.*B).*Is.^2.*Ls1);%泰勒展开系数
C2=-(x2.*B)./(Is+(x2.*B).*Is.^2.*Ls2);
C3=-(x3.*B)./(Is+(x3.*B).*Is.^2.*Ls3);
C4=-(x4.*B)./(Is+(x4.*B).*Is.^2.*Ls4);
C5=-(x5.*B)./(Is+(x5.*B).*Is.^2.*Ls5);
C6=-(x6.*B)./(Is+(x6.*B).*Is.^2.*Ls6);
cvx_begin
cvx_precision default
variable q1(N,2)
variable L1(N)
variable L2(N)
variable L3(N)
variable L4(N)
variable L5(N)
variable L6(N)
variable I(N)
variable eta
variable m(N)
expression qu1(N,1)
maximize eta
subject to
sum((x1.*B).*log(1+1./((x1.*B).Ls1(:).Is(:)))-abs(A1).(L1(:)-Ls1(:))-abs(C1).(I(:)-Is(:)))>=eta;%(1-1)
sum((x2.*B).*log(1+1./((x2.*B).Ls2(:).Is(:)))-abs(A2).(L2(:)-Ls2(:))-abs(C2).(I(:)-Is(:)))>=eta;
sum((x3.*B).*log(1+1./((x3.*B).Ls3(:).Is(:)))-abs(A3).(L3(:)-Ls3(:))-abs(C3).(I(:)-Is(:)))>=eta;
sum((x4.*B).*log(1+1./((x4.*B).Ls4(:).Is(:)))-abs(A4).(L4(:)-Ls4(:))-abs(C4).(I(:)-Is(:)))>=eta;
sum((x5.*B).*log(1+1./((x5.*B).Ls5(:).Is(:)))-abs(A5).(L5(:)-Ls5(:))-abs(C5).(I(:)-Is(:)))>=eta;
sum((x6.*B).*log(1+1./((x6.*B).Ls6(:).Is(:)))-abs(A6).(L6(:)-Ls6(:))-abs(C6).(I(:)-Is(:)))>=eta;
for i=1:1:N
H^2+sum_square_abs(q1(i,:)-w1(i,:))<=beta.*p1.*L1(i)%(1-2)
H^2+sum_square_abs(q1(i,:)-w2(i,:))<=beta.*p2.*L2(i);
H^2+sum_square_abs(q1(i,:)-w3(i,:))<=beta.*p3.*L3(i);
H^2+sum_square_abs(q1(i,:)-w4(i,:))<=beta.*p4.*L4(i);
H^2+sum_square_abs(q1(i,:)-w5(i,:))<=beta.*p5.*L5(i);
H^2+sum_square_abs(q1(i,:)-w6(i,:))<=beta.*p6.*L6(i);
pm*beta.*inv_pos(m(i))+sigma<=I(i)%(1-3)
end
for i=1:1:N
qu1(i)=2*q1s(i,1)q1(i,1)-q1s(i,1)^2+J(i,1)^2-2J(i,1)q1(i,1)+2q1s(i,2)q1(i,2)-q1s(i,2)^2+J(i,2)^2-2J(i,2)*q1(i,2)+H^2;%一阶泰勒
end
m<=qu1;%1-4
m>=0;%(1-5)
% q1(1, == [-500,0];
% q1(N, == [-500,0];
for i = 1:1:N-1
norm(q1(i+1,:)-q1(i,:))<=vmax*delta;
end
cvx_end
q1s = q1;
end
Calling Mosek 8.0.0.60: 4802 variables, 2160 equality constraints
For improved efficiency, Mosek is solving the dual problem.
MOSEK Version 8.0.0.60 (Build date: 2017-3-1 13:09:33)
Copyright © MOSEK ApS, Denmark. WWW: mosek.com
Platform: Windows/64-X86
MOSEK warning 62: The A matrix contains a large value of -2.1e+018 in constraint ‘’ (714) at variable ‘’ (0).
MOSEK warning 62: The A matrix contains a large value of -2.1e+018 in constraint ‘’ (715) at variable ‘’ (0).
MOSEK warning 62: The A matrix contains a large value of -2.1e+018 in constraint ‘’ (716) at variable ‘’ (0).
MOSEK warning 62: The A matrix contains a large value of -2.1e+018 in constraint ‘’ (717) at variable ‘’ (0).
MOSEK warning 62: The A matrix contains a large value of -2.1e+018 in constraint ‘’ (718) at variable ‘’ (0).
MOSEK warning 62: The A matrix contains a large value of -2.1e+018 in constraint ‘’ (719) at variable ‘’ (0).
MOSEK warning 62: The A matrix contains a large value of -2.1e+018 in constraint ‘’ (720) at variable ‘’ (0).
MOSEK warning 62: The A matrix contains a large value of -2.1e+018 in constraint ‘’ (721) at variable ‘’ (0).
MOSEK warning 62: The A matrix contains a large value of -2.1e+018 in constraint ‘’ (722) at variable ‘’ (0).
MOSEK warning 62: The A matrix contains a large value of -2.1e+018 in constraint ‘’ (723) at variable ‘’ (0).
Warning number 62 is disabled.
Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 2160
Cones : 959
Scalar variables : 4802
Matrix variables : 0
Integer variables : 0
Optimizer started.
Conic interior-point optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator - tries : 0 time : 0.00
Lin. dep. - tries : 1 time : 0.00
Lin. dep. - number : 0
Presolve terminated. Time: 0.00
Optimizer - threads : 8
Optimizer - solved problem : the primal
Optimizer - Constraints : 1915
Optimizer - Cones : 959
Optimizer - Scalar variables : 4557 conic : 3597
Optimizer - Semi-definite variables: 0 scalarized : 0
Factor - setup time : 0.01 dense det. time : 0.00
Factor - ML order time : 0.00 GP order time : 0.00
Factor - nonzeros before factor : 1.44e+005 after factor : 3.16e+005
Factor - dense dim. : 0 flops : 1.38e+008
ITE PFEAS DFEAS GFEAS PRSTATUS POBJ DOBJ MU TIME
0 1.0e+000 5.0e+004 5.5e+004 0.00e+000 -2.269339532e+008 0.000000000e+000 1.0e+000 0.03
1 7.1e-003 3.6e+002 4.5e+001 -9.89e-001 -1.354411559e+008 4.582620517e+003 7.1e-003 0.08
2 6.8e-004 3.4e+001 2.5e+000 -4.97e-001 -5.995987528e+007 1.483798382e+004 6.8e-004 0.09
3 7.4e-005 3.7e+000 2.6e-001 -1.57e-001 -1.841148405e+007 3.760487286e+004 7.4e-005 0.09
4 1.8e-005 9.0e-001 7.5e-002 1.36e-001 -7.620906828e+006 3.386253035e+005 1.8e-005 0.11
5 1.5e-005 7.5e-001 6.5e-002 3.81e-001 -3.739780799e+006 3.550548461e+006 1.5e-005 0.11
6 1.0e-005 5.2e-001 3.2e-002 1.58e-001 1.224693510e+008 1.326886992e+008 1.0e-005 0.13
7 5.3e-006 2.6e-001 2.1e-002 -8.78e-002 6.808304265e+007 7.432414518e+007 5.3e-006 0.13
8 1.2e-006 5.9e-002 1.2e-002 6.21e-001 1.339755818e+007 1.473216089e+007 1.2e-006 0.14
9 4.1e-007 2.0e-002 7.1e-003 1.07e+000 5.589691092e+006 6.039676485e+006 4.1e-007 0.16
10 1.9e-007 9.7e-003 4.4e-003 1.05e+000 4.514110268e+006 4.751893598e+006 1.9e-007 0.16
11 1.3e-007 6.5e-003 3.5e-003 2.02e-001 3.310418128e+006 3.485795864e+006 1.3e-007 0.17
12 2.0e-008 9.9e-004 1.3e-003 8.19e-001 9.318700121e+005 9.623730350e+005 2.0e-008 0.17
13 3.0e-009 1.5e-004 9.3e-004 1.25e+000 9.008428196e+004 9.338626568e+004 3.0e-009 0.19
14 1.7e-010 8.6e-006 7.3e-004 1.66e+000 1.126276910e+005 1.127596754e+005 1.7e-010 0.19
15 9.1e-011 4.5e-006 2.9e-004 1.12e+000 1.094805036e+005 1.095480052e+005 9.1e-011 0.20
16 1.2e-011 5.8e-007 6.0e-005 1.06e+000 1.071205891e+005 1.071293201e+005 1.2e-011 0.20
17 1.1e-012 5.5e-008 1.9e-005 1.00e+000 1.069139513e+005 1.069147872e+005 1.1e-012 0.22
18 3.9e-013 1.4e-010 9.9e-011 1.00e+000 1.068917357e+005 1.068917370e+005 1.8e-015 0.22
Interior-point optimizer terminated. Time: 0.22.
Optimizer terminated. Time: 0.27
Interior-point solution summary
Problem status : PRIMAL_AND_DUAL_FEASIBLE
Solution status : OPTIMAL
Primal. obj: 1.0689173567e+005 nrm: 4e+017 Viol. con: 4e+011 var: 0e+000 cones: 7e-010
Dual. obj: 1.0689173699e+005 nrm: 6e+011 Viol. con: 0e+000 var: 3e-005 cones: 0e+000
Optimizer summary
Optimizer - time: 0.27
Interior-point - iterations : 18 time: 0.22
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: Solved
Optimal value (cvx_optval): +106892
Calling Mosek 8.0.0.60: 4802 variables, 2160 equality constraints
For improved efficiency, Mosek is solving the dual problem.
MOSEK Version 8.0.0.60 (Build date: 2017-3-1 13:09:33)
Copyright © MOSEK ApS, Denmark. WWW: mosek.com
Platform: Windows/64-X86
MOSEK warning 62: The A matrix contains a large value of -2.0e+018 in constraint ‘’ (714) at variable ‘’ (0).
MOSEK warning 62: The A matrix contains a large value of -2.0e+018 in constraint ‘’ (715) at variable ‘’ (0).
MOSEK warning 62: The A matrix contains a large value of -2.0e+018 in constraint ‘’ (716) at variable ‘’ (0).
MOSEK warning 62: The A matrix contains a large value of -2.0e+018 in constraint ‘’ (717) at variable ‘’ (0).
MOSEK warning 62: The A matrix contains a large value of -2.0e+018 in constraint ‘’ (718) at variable ‘’ (0).
MOSEK warning 62: The A matrix contains a large value of -2.0e+018 in constraint ‘’ (719) at variable ‘’ (0).
MOSEK warning 62: The A matrix contains a large value of -2.0e+018 in constraint ‘’ (720) at variable ‘’ (0).
MOSEK warning 62: The A matrix contains a large value of -2.0e+018 in constraint ‘’ (721) at variable ‘’ (0).
MOSEK warning 62: The A matrix contains a large value of -2.0e+018 in constraint ‘’ (722) at variable ‘’ (0).
MOSEK warning 62: The A matrix contains a large value of -2.0e+018 in constraint ‘’ (723) at variable ‘’ (0).
Warning number 62 is disabled.
Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 2160
Cones : 959
Scalar variables : 4802
Matrix variables : 0
Integer variables : 0
Optimizer started.
Conic interior-point optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator - tries : 0 time : 0.00
Lin. dep. - tries : 1 time : 0.00
Lin. dep. - number : 0
Presolve terminated. Time: 0.02
Optimizer - threads : 8
Optimizer - solved problem : the primal
Optimizer - Constraints : 1915
Optimizer - Cones : 959
Optimizer - Scalar variables : 4557 conic : 3597
Optimizer - Semi-definite variables: 0 scalarized : 0
Factor - setup time : 0.01 dense det. time : 0.00
Factor - ML order time : 0.00 GP order time : 0.00
Factor - nonzeros before factor : 1.44e+005 after factor : 3.16e+005
Factor - dense dim. : 0 flops : 1.38e+008
ITE PFEAS DFEAS GFEAS PRSTATUS POBJ DOBJ MU TIME
0 1.0e+000 4.9e+004 5.5e+004 0.00e+000 -2.269339532e+008 0.000000000e+000 1.0e+000 0.05
1 7.4e-003 3.6e+002 4.7e+001 -9.88e-001 -1.372020095e+008 4.560622210e+003 7.4e-003 0.11
2 7.3e-004 3.5e+001 2.8e+000 -5.02e-001 -6.106752310e+007 1.461883779e+004 7.3e-004 0.11
3 7.8e-005 3.8e+000 2.8e-001 -1.60e-001 -1.873387513e+007 3.758070991e+004 7.8e-005 0.13
4 1.8e-005 8.8e-001 8.3e-002 1.31e-001 -6.331646268e+006 1.235036703e+006 1.8e-005 0.14
5 3.3e-006 1.6e-001 2.2e-002 3.98e-001 1.697492781e+007 1.942929444e+007 3.7e-006 0.14
6 2.9e-006 1.4e-001 2.1e-002 4.93e-001 1.402719986e+007 1.620577593e+007 3.2e-006 0.16
7 1.6e-006 7.6e-002 1.6e-002 6.77e-001 8.969813605e+006 1.024357620e+007 1.8e-006 0.16
8 1.0e-006 5.0e-002 1.3e-002 8.33e-001 6.217072891e+006 7.078546650e+006 1.2e-006 0.17
9 7.1e-007 3.5e-002 1.0e-002 9.59e-001 4.882448887e+006 5.496436446e+006 8.7e-007 0.17
10 4.6e-007 2.2e-002 8.4e-003 9.96e-001 3.540563135e+006 3.943738506e+006 5.6e-007 0.19
11 3.1e-007 1.5e-002 6.7e-003 1.00e+000 2.857356579e+006 3.132061543e+006 3.8e-007 0.19
12 1.9e-007 9.3e-003 4.8e-003 9.12e-001 3.061538766e+006 3.253755417e+006 2.4e-007 0.20
13 1.3e-007 5.4e-003 3.4e-003 7.75e-001 2.749800637e+006 2.877265333e+006 1.4e-007 0.20
14 1.1e-007 4.7e-003 3.1e-003 4.47e-001 2.566413472e+006 2.681926748e+006 1.2e-007 0.22
15 8.6e-008 1.4e-003 1.8e-003 8.90e-001 8.159637404e+005 8.499089910e+005 3.7e-008 0.23
16 6.3e-008 8.2e-004 1.6e-003 1.33e+000 3.975897475e+005 4.146601891e+005 2.2e-008 0.23
17 3.1e-008 2.7e-004 1.9e-003 1.62e+000 9.771690229e+004 1.011381172e+005 6.8e-009 0.25
18 2.0e-008 1.3e-004 1.3e-003 2.51e+000 1.029033347e+005 1.039205263e+005 4.0e-009 0.25
19 2.0e-008 1.3e-004 1.3e-003 1.92e+000 1.029033347e+005 1.039205263e+005 4.0e-009 0.27
Interior-point optimizer terminated. Time: 0.27.
Optimizer terminated. Time: 0.30
Interior-point solution summary
Problem status : ILL_POSED
Solution status : DUAL_ILLPOSED_CER
Primal. obj: 6.3349227852e+001 nrm: 2e+014 Viol. con: 4e+012 var: 8e-009 cones: 0e+000
Optimizer summary
Optimizer - time: 0.30
Interior-point - iterations : 20 time: 0.27
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