一、算法介绍
(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). Sea-horse optimizer: a novel nature-inspired meta-heuristic for global optimization problems | Applied Intelligence
(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
三、部分结果
BWO路径坐标:
950 50 1
900 100 2
850 150 3
800 200 4
750 200 5
700 250 5
650 300 6
600 300 7
550 300 7
500 350 8
500 400 8
500 450 8
500 500 8
450 550 9
450 600 9
450 650 9
400 700 9
350 700 9
300 750 10
250 800 11
200 850 12
150 900 12
100 900 12
50 950 12
BWO路径长度:1419.322450
RUN路径坐标:
950 50 1
950 50 2
900 100 3
850 150 3
800 200 4
750 250 5
700 250 6
650 300 6
600 300 7
550 300 8
500 350 8
450 350 7
450 400 8
450 450 8
500 500 9
500 550 10
500 600 11
450 650 10
400 700 9
350 700 10
300 700 9
300 750 10
250 700 11
200 750 10
150 800 11
150 850 12
100 900 13
50 950 12
RUN路径长度:1591.137261
SO路径坐标:
950 50 1
900 100 2
850 150 3
800 200 4
750 250 5
700 300 6
650 300 6
600 300 6
550 300 6
500 350 7
450 400 7
450 450 7
450 500 7
450 550 7
450 600 7
450 650 7
400 700 8
350 700 8
300 750 9
250 800 10
200 800 10
150 800 10
100 850 11
100 900 11
50 950 12
SO路径长度:1448.605915
HO路径坐标:
950 50 1
900 100 1
850 150 2
800 200 3
750 250 4
700 300 5
650 300 5
600 300 5
550 300 5
500 350 6
450 400 7
450 450 7
450 500 7
450 550 8
450 600 8
450 650 8
400 700 9
350 700 9
300 750 10
250 800 11
200 850 12
150 900 12
100 950 12
50 950 12
HO路径长度:1419.319522
GWO路径坐标:
950 50 1
900 100 1
850 100 1
800 100 1
800 100 2
800 100 3
750 150 3
800 200 2
750 200 2
700 250 3
650 300 3
600 300 4
600 300 3
550 300 3
500 350 3
500 400 4
450 450 4
450 500 4
500 550 4
550 600 5
550 650 5
500 650 6
500 650 5
450 650 6
400 700 7
350 700 8
300 700 9
250 700 9
250 750 9
250 750 10
200 800 11
200 800 12
200 800 13
200 850 13
200 900 13
150 950 13
100 950 13
50 950 12
GWO路径长度:1755.633484
四、完整MATLAB代码
私