一、算法介绍
(1)白鲸优化算法BWO
参考文献:Zhong C, Li G, Meng Z. Beluga whale optimization: A novel nature-inspired metaheuristic algorithm[J]. Knowledge-Based Systems, 2022, 109215.
(2)龙格-库塔优化算法 RUN
参考文献: Iman Ahmadianfar, Ali Asghar Heidari, Amir H. Gandomi, Xuefeng Chu, Huiling Chen. RUN beyond the metaphor: An efficient optimization algorithm based on Runge Kutta method[J]. Expert Systems with Applications, 2021, 181(115079): 0957-4174.
(3)蛇优化算法SO
参考文献:Hashim, F. A., & Hussien, A. G. (2022). Snake Optimizer: A novel meta-heuristic optimization algorithm.Knowledge-Based Systems, 108320.
(4)海马优化算法HO
参考文献:Zhao, S., Zhang, T., Ma, S. et al. Sea-horse optimizer: a novel nature-inspired meta-heuristic for global optimization problems. Appl Intell (2022). https://doi.org/10.1007/s10489-022-03994-3
(5)灰狼优化算法GWO
参考文献:Seyedali Mirjalili,Seyed Mohammad Mirjalili,Andrew Lewis. Grey Wolf Optimizer[J]. Advances in Engineering Software,2014,69.
二、部分代码
close all
clear
clc
rng('default');
%% 载入数据
data.E=[50,950,12]; %起点位置 横坐标与纵坐标需为50的倍数
data.S=[950,50,1]; %终点点位置 横坐标与纵坐标需为50的倍数
data.Obstacle=xlsread('data1.xls');
data.numObstacles=length(data.Obstacle(:,1));
data.mapSize=[1000,1000,20]; %10m 地图尺寸
data.unit=[50,50,1]; %地图精度
data.S0=ceil(data.S./data.unit);
data.E0=ceil(data.E./data.unit);
data.mapSize0=data.mapSize./data.unit;
data.map=zeros(data.mapSize0);
%% 算法设置
SearchAgents_no=30; % 种群大小
Max_iteration=30;% 最大迭代次数
ColorStr={'r-','b--','c-.','g-.','m-'};%颜色
%% 画图
PlotFigure;
%% 显示路径信息
for i=1:length(AlgorithName)
fprintf(AlgorithName{i});
fprintf("路径坐标:\n");
display(Result(i).path)
fprintf(AlgorithName{i});
fprintf("路径长度:%f\n",Result(i).fit);
end
三、部分结果
四、完整MATLAB代码