融合高斯扰动与竞争学习的改进型多目标部落竞争与成员合作算法(IMOCTCM)求解多无人机协同路径规划(多起点多终点,起始点、无人机数、障碍物可自定义)
完整MATLAB代码:
https://mbd.pub/o/bread/mbd-YZWVl59raQ==
代码块
%% 画图
lineColor=linspecer(UAVnum);%%路径颜色
for Anum=1:length(AlgorithmName)
Result=FinalResult(Anum).Algorithm.Result;
%% 定义3个视图
gca1=figure;
gca2=figure;
gca3=figure;
%% 画地形图及起始点
[hh2,hh3,hhh2,hhh3,hhhh2,hhhh3]=PlotUAVRoute(ModelUAV,gca1,gca2,gca3);
%% 画各个无人机的路径
hh=[];
hhh=[];
hhhh=[];
lenstr=[];
for i=1:UAVnum
[hh10,hhh10,hhhh10]=PlotUAV(Result(i).BestPosition,ModelUAV(i).model,gca1,gca2,gca3,lineColor(i,:));
hh=[hh,hh10];
hhh=[hhh,hhh10];
hhhh=[hhhh,hhhh10];
lenstr{i}=strcat('UAV',num2str(i));
end
legenstr=lenstr;
lenstr{i+1}='start';
lenstr{i+2}='end';
legend([hh,hh2,hh3],lenstr,Location="best")
title(AlgorithmName{Anum})
legend([hhh,hhh2,hhh3],lenstr,Location="best")
title(AlgorithmName{Anum})
legend([hhhh,hhhh2,hhhh3],lenstr,Location="best")
title(AlgorithmName{Anum})
figure(gca1)
saveas(gca,['./Picture/',AlgorithmName{Anum},'1.jpg']);
figure(gca2)
saveas(gca,['./Picture/',AlgorithmName{Anum},'2.jpg']);
figure(gca3)
saveas(gca,['./Picture/',AlgorithmName{Anum},'3.jpg']);
figure
for i=1:UAVnum
plot(Result(i).data.fit,'-o','LineWidth',2)
hold on
end
legend(legenstr)
set(gca,'xtick',1:1:4);
set(gca,'XTickLabel',{})
title(AlgorithmName{Anum})
saveas(gca,['./Picture/',AlgorithmName{Anum},'5.jpg']);
end
复制成功




















免责声明:本文系网络转载或改编,未找到原创作者,版权归原作者所有。如涉及版权,请联系删