一、部分代码
蛇鹫优化算法(Secretary bird optimization algorithm,SBOA)由 Fu Youfa等人于2024年提出,该算法的灵感来自于蛇鹫在自然环境中的生存行为。
参考文献:
[1]Fu Y, Liu D, Chen J, et al. Secretary bird optimization algorithm: a new metaheuristic for solving global optimization problems[J]. Artificial Intelligence Review, 2024, 57(5): 1-102.
原文链接:https://blog.csdn.net/weixin_46204734/article/details/139331352
close all
clear
clc
rng('default');
%% 载入数据
data.S=[50,950,12]; %起点位置 横坐标与纵坐标需为50的倍数
data.E=[950,50,1]; %终点点位置 横坐标与纵坐标需为50的倍数
data.Obstacle=xlsread('data1.xls');
data.numObstacles=length(data.Obstacle(:,1));
%% 画图
figure
hold on
plot(curve,'r','LineWidth',2)
xlabel('迭代次数')
ylabel('路径长度')
legend(str);
[~,result]=fobj(Best_pos);
drawPc(result,option,data,str)
result.path(:,1)=result.path(:,1).*data.unit(1);
result.path(:,2)=result.path(:,2).*data.unit(2);
result.path(:,3)=result.path(:,3).*data.unit(3);
%% 显示路径信息
fprintf("路径坐标:\n");
display(result.path)
fprintf("路径长度:%f\n",result.fit);
二、部分结果
路径坐标:
50 950 12
50 900 11
100 850 10
100 800 10
150 750 9
200 750 8
250 700 9
300 700 10
300 700 9
350 700 8
400 700 8
450 650 7
500 600 7
500 550 7
500 500 7
500 450 7
500 400 7
500 350 6
550 300 5
550 250 6
600 300 6
600 300 7
650 300 8
700 300 7
750 250 6
750 300 5
800 250 4
800 200 4
800 200 3
850 150 2
900 100 1
900 50 1
950 50 1
路径长度:1680.971087
三、完整MATLAB代码