首页 > 行业资讯 > 【编队】基于遗传算法实现无人机编队为位置优化附matlab代码

【编队】基于遗传算法实现无人机编队为位置优化附matlab代码

时间:2023-06-20 来源: 浏览:

【编队】基于遗传算法实现无人机编队为位置优化附matlab代码

天天Matlab 天天Matlab
天天Matlab

TT_Matlab

博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,完整matlab代码或者程序定制加qq1575304183。

收录于合集 #无人机matlab源码 110个

✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。

个人主页: Matlab科研工作室

个人信条:格物致知。

更多Matlab仿真内容点击

智能优化算法       神经网络预测       雷达通信       无线传感器         电力系统

信号处理               图像处理               路径规划       元胞自动机         无人机

⛄ 内容介绍

UAV swarms have numerous applications in our modern world. They can facilitate mapping, observing,  and overseeing large areas with ease. It is necessary for these agents to autonomously navigate potentially  dangerous terrain and airspace in order to log information about areas. In this project we simulate the motion  of a swarm of drones, and their interaction with obstacles, and targets.

The goal of this project is to optimize this simulation using a Genetic Algorithm to maximize the number  of targets mapped, minimize the number of crashed drones, and minimize the amount of time used in the  simulation. To do this we will use 15 design parameters to determine the dynamics and kinematics of each  drone, using Forward Euler time discretization to update drone positions.

A Genetic Algorithm will be used to train this swarm of drones by generating random strings of design  parameters, and breeding new strings to fifind the optimal string for this simulation.  In this paper, I will present relevant background information, and equations to describe the simulation. I will  also describe the process by which I go about optimizing the Genetic Algorithm. Finally, I present the outcome  of the simulation and Genetic Algorithm, and discuss the relevance of my results.

⛄ 部分代码

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function myProgressBar(tock, t, tf, m)

% Provides a status update on a calculation, printed to the command window.

% avoids the issues associated with the GUI-based equilvalent functions. 

% Inputs: 

%   tock -- total run time so far, seconds

%   t -- cycles, simulation time, etc completed

%   tf -- total cycles, etc required for process

%   m -- optional message input, empty by default

% Outputs: 

% no variables, prints information to the command window in the format: 

% "#######-----------" + "m" + "Time remaining: " + "HH:MM:SS"

if nargin < 4

    m = ’’;

end

rem = max(tock*(tf/t - 1), 0);

clock = sec2Clock(rem);

totchar = 20;

fprintf(repeatStr("#", floor(t/tf*totchar)) + repeatStr("-", totchar - floor(t/tf*totchar)) ...

    + "   " + m + "   Time remaining: " + clock + " ");

end

function out = sec2Clock(s)

% returns a string of characters that represents a number of seconds in

% format HH:MM:SS. Can include arbitrarily many hour digits to account for

% large times. Rounded down to nearest number of seconds. 

    remh = floor(s / 3600); s = s - 3600*remh; remm = floor(s / 60); s = s - 60*remm; rems = floor(s); 

    out = padStr(num2str(remh), "0", 2)  + ":" + padStr(num2str(remm), "0", 2) ...

    + ":" + padStr(num2str(rems), "0", 2); 

end

function out = padStr(st, pad, minlength)

% returns string st plus some number of pad characters such that the total

% string length is as least minlength. Puts the padding on the left side. 

out = st; 

while (strlength(out) < minlength) out = pad + out; end

end

function out = repeatStr(st, n)

% returns a given string st repeated n times

out = ""; for i = 1:n out = out + st; end

end

⛄ 运行结果

The simulation was successfully optimized using a Genetic Algorithm. The dynamics, and kinematic equations  of 15 UAVs were used to simulate the movements of these drones. Each drone was affected by a repulsive, and an attractive force from each other member, target, and obstacle. These equations utilized 15 design  parameters that were optimized by a Genetic Algorithm. Random strings of design parameters were created  at the beginning, passed into the simulator, and the resulting success of the strings was evaluated. The  strings were then ranked, and the top strings were mated with each other, resulting in child strings. The  next generation was fifilled out with more randomly generated strings, and the process was repeated for 100  generations. The GA resulted in a fifinal cost of 25.3333. Additional optimizations for T*, and prevention of  inbreeding could signifificantly decrease the cost, and should be implemented in future work on this, and other  projects.

⛄ 参考文献

⛳️ 代码获取关注我

❤️部分理论引用网络文献,若有侵权联系博主删除
❤️ 关注我领取海量matlab电子书和数学建模资料

版权:如无特殊注明,文章转载自网络,侵权请联系cnmhg168#163.com删除!文件均为网友上传,仅供研究和学习使用,务必24小时内删除。
相关推荐