路径规划多无人机协同任务规划matlab源码
Posted 博主QQ2449341593
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了路径规划多无人机协同任务规划matlab源码相关的知识,希望对你有一定的参考价值。
一、简介
二、源代码
1、问题 1 中对 10 个中心点的两架次最优调度规划 Matlab 源程序
clc;clear all;close all; position=load('坐标点.txt'); [m,n]=size(position);
j=1;
sumx=0; sumy=0; for i=1:10
sumx=sumx+position(i,1); sumy=sumy+position(i,2);
end ave(j,1)=sumx/10;ave(j,2)=sumy/10; j=j+1;
sumx=0; sumy=0; for i=11:19
sumx=sumx+position(i,1); sumy=sumy+position(i,2);
end ave(j,1)=sumx/9;ave(j,2)=sumy/9; j=j+1;
sumx=0; sumy=0; for i=20:24
sumx=sumx+position(i,1); sumy=sumy+position(i,2);
end ave(j,1)=sumx/5;ave(j,2)=sumy/5; j=j+1;
sumx=0; sumy=0; for i=25:34
sumx=sumx+position(i,1); sumy=sumy+position(i,2);
end ave(j,1)=sumx/10;ave(j,2)=sumy/10; j=j+1;
sumx=0; sumy=0; for i=35:41
sumx=sumx+position(i,1); sumy=sumy+position(i,2);
end ave(j,1)=sumx/7;ave(j,2)=sumy/7; j=j+1;
sumx=0; sumy=0; for i=42:47
sumx=sumx+position(i,1); sumy=sumy+position(i,2);
end ave(j,1)=sumx/6;ave(j,2)=sumy/6; j=j+1;
sumx=0; sumy=0; for i=48:53
sumx=sumx+position(i,1); sumy=sumy+position(i,2);
end ave(j,1)=sumx/6;ave(j,2)=sumy/6; j=j+1;
sumx=0; sumy=0; for i=54:58
sumx=sumx+position(i,1); sumy=sumy+position(i,2);
end ave(j,1)=sumx/5;ave(j,2)=sumy/5; j=j+1;
sumx=0; sumy=0; for i=59:63
sumx=sumx+position(i,1); sumy=sumy+position(i,2);
end ave(j,1)=sumx/5;ave(j,2)=sumy/5; j=j+1;
sumx=0; sumy=0; for i=64:68
sumx=sumx+position(i,1); sumy=sumy+position(i,2);
end ave(j,1)=sumx/5;ave(j,2)=sumy/5; j=j+1;
% ave=position;
Routebest=10000000000; for one=1:2^10/2
A=[];B=[];index=dec2bin(one,10); for two=1:10
if index(two)=='0' A=[A;ave(two,:)];
end
else end
B=[B;ave(two,:)];
[m,n]=size(A);
fit1=[];p1=[];
if m==1
fit1=A;L1=0;
else
[d1]=dj(A);
[p1,L1] = tspsearch2(d1,2);
for i=1:m
fit1(i,1)=A(p1(i),1);
fit1(i,2)=A(p1(i),2);
end
end
[m,n]=size(B);
fit2=[];p2=[];
if m==1
fit2=B;L2=0;
else
[d2]=dj(B);
[p2,L2] = tspsearch2(d2,2);
for i=1:m
fit2(i,1)=B(p2(i),1);
fit2(i,2)=B(p2(i),2);
end
end
if (L1+L2)<Routebest Routebest=L1+L2;
fit1best=[];fit2best=[];p1best=[];p2best=[]; fit1best=fit1;fit2best=fit2;p1best=p1;p2best=p2;
end end
2、问题 1 中对 68 个目标点的两架次最优调度规划 Matlab 源程序
clc;clear all;close all; position=load('坐标点.txt'); po1=position(1:10,:);%A1 po2=position(11:19,:);%A2 po8=position(54:58,:);%A8 po9=position(59:63,:);%A9 po3=position(20:24,:); %A3 po4=position(25:34,:);%A4 po10=position(64:68,:);%A10 po7=position(48:53,:);%A7 po5=position(35:41,:);%A5 po6=position(42:47,:); %A6
A=[po2;po3;po4;po5;po6;po7;po8;po9;po10]; B=po1;
[d1]=dj(A);
[p1,L1] = tspsearch2(d1,2); [m,n]=size(A) ;
for i=1:m
fit1(i,1)=A(p1(i),1);
fit1(i,2)=A(p1(i),2);
end
[d2]=dj(B);
[p2,L2] = tspsearch2(d2,2); [m,n]=size(B) ;
for i=1:m
fit2(i,1)=B(p2(i),1);
fit2(i,2)=B(p2(i),2);
end
完整代码咨询QQ1575304183
以上是关于路径规划多无人机协同任务规划matlab源码的主要内容,如果未能解决你的问题,请参考以下文章
路径规划基于改进差分实现三维多无人机协同航迹规划matlab源码
任务分配基于matlab蚁群算法无人机任务分配含Matlab源码 1265期
任务分配基于matlab蚁群算法无人机任务分配含Matlab源码 1265期
路径规划基于人工势场的无人机编队协同路径规划matlab源码