一、部分代码
人工原生动物优化器(Artificial Protozoa Optimizer ,APO)由Xiaopeng Wang等人于2024年提出,其灵感来自自然界中的原生动物。APO 模拟了原生动物的觅食、休眠和繁殖行为。
参考文献
[1]Wang X, Snášel V, Mirjalili S, et al. Artificial Protozoa Optimizer (APO): A novel bio-inspired metaheuristic algorithm for engineering optimization[J]. Knowledge-Based Systems, 2024: 111737.
原文链接:https://blog.csdn.net/weixin_46204734/article/details/139333699
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
50 900 12
50 900 13
100 900 12
150 850 12
200 800 11
250 800 10
300 750 9
250 700 8
300 700 7
250 650 6
250 600 5
250 550 5
250 550 6
250 500 6
250 450 6
300 400 7
300 350 6
350 300 5
300 250 4
350 200 3
350 200 2
350 200 1
400 150 1
450 150 1
500 100 1
550 100 1
600 100 1
650 100 1
650 50 2
700 50 3
750 50 4
800 50 3
850 50 2
850 50 1
900 100 1
950 50 1
路径长度:1825.405370
三、完整MATLAB代码