1.问题描述:
陆基制导系统地面站布设策略
2.部分程序:
clc;
clear;
close all;
warning off;
addpath 'func\'
addpath 'GA_toolbox\'
global SCALE
SCALE = 10e3;
global STEPS
STEPS = 1e3;
for tt=1:1%为了仿真速度快点,这里只显示某一个时刻的部署结果
%输出每一时刻的无人机位置
if mod(tt,1000) == 1%每1000s更新一次部署,这个1000可以自己修改
target_pos= [1e3, 10e3, 0]';
end
N = 3;%机动站个数,自己可以调整,调整后重新运行即可。
MAXGEN = 100;
NIND = 50;
Nums = 3*N; %
Chrom = crtbp(NIND,Nums*10);
%sh
Areas = [];
%设置地图的最大范围
for i = 1:2*N
Areas = [Areas,[-SCALE;SCALE]];%雷达最大部署范围距离
end
for i = 1:N
Areas = [Areas,[0;100]];%雷达最大部署范围距离
end
FieldD = [rep([10],[1,Nums]);Areas;rep([0;0;0;0],[1,Nums])];
gen = 0;
%计算对应的目标值
tmps = repmat([400],[1,Nums]);
X = tmps;%初始值
[fobj,Vgdop] = func_obj(X,target_pos);
E = fobj;
Js = E*ones(NIND,1);
Objv = (Js+eps);
gen = 0;
while gen < MAXGEN;
gen
rng(gen);
Pe0 = 0.995;
pe1 = 0.005;
FitnV=ranking(Objv);
Selch=select('sus',Chrom,FitnV);
Selch=recombin('xovsp', Selch,Pe0);
Selch=mut( Selch,pe1);
phen1=bs2rv(Selch,FieldD);
for a=1:1:NIND
X1 = phen1(a,:);
%计算对应的目标值
[fobj,Vgdop]= func_obj(X1,target_pos);
JJ(a,1) = fobj;
XYp{a} = X1;
Vp{a} = Vgdop;
end
Objvsel=(JJ);
[Chrom,Objv]=reins(Chrom,Selch,1,1,Objv,Objvsel);
gen=gen+1;
%保存参数收敛过程和误差收敛过程以及函数值拟合结论
Error(gen) = mean(JJ);
end
figure;
plot(Error,'linewidth',2);
grid on
xlabel('迭代次数');
ylabel('遗传算法优化过程');
%根据优化结果输出部署结果
figure;
[V,I] = min(JJ);
XY = XYp{I};
Gdop = Vp{a};
X = XY(1:length(XY)/3);
Y = XY(1+length(XY)/3:2*length(XY)/3);
Z = XY(1+2*length(XY)/3:end);
JZ_pos= [X',Y',Z'];
x =-2*SCALE:STEPS:2*SCALE;
y =-2*SCALE:STEPS:2*SCALE;
xx = [0:0.5:20];
[c,handle]=contour(x/1e3,y/1e3,Gdop,xx);
clabel(c,handle);
hold on;
plot(JZ_pos(:,1)/1e3,JZ_pos(:,2)/1e3,'r.');
xlabel('x(km)')
ylabel('y(km)')
title('GDOP图')
end
3.仿真结论:
A06-63