本文主要是介绍【免费分享】2024最新优化算法-花斑翠鸟优化算法PKO,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
斑翠鸟是一种美丽的鸟类,隶属于翠鸟科,主要分布在东南亚地区,如马来西亚、泰国、印度尼西亚等国。斑翠鸟的身体呈蓝色,头部有黑色斑点,翅膀和尾巴同样为蓝色。它们具有长而尖的嘴巴,适合捕食小型水生动物。斑翠鸟偏爱栖息在水边,常见于河流、湖泊和沼泽附近,以鱼类为主要食物,通常通过潜水来捕获猎物。捕食时,斑翠鸟会从栖息地的树枝上俯冲而下,迅速抓住猎物后返回树枝进食。
斑翠鸟优化算法(Pied Kingfisher Optimizer, PKO)是一种由Abdelazim Hussien于2024年提出的新型群体基元启发式算法。该算法受到斑翠鸟独特的狩猎行为和共生关系的启发,围绕三个阶段展开:栖息/悬停猎物(探索/多样化)、潜水寻找猎物(开发/集约化)以及培养共生关系。这些行为被转化为数学模型,用于有效解决不同搜索空间中的多种优化问题。
代码如下
function [Best_fitness,Best_position,Convergence_curve]=PKO(Popsize,Maxiteration,LB,UB,Dim,Fobj)
tic;
BF=8;%beating Factor
Crest_angles=2*pi*rand;
X=Initialization(Popsize,Dim,UB,LB);
Fitness = zeros(1,Popsize);
Convergence_curve=zeros(1,Maxiteration);
for i=1:PopsizeFitness(i)=Fobj(X(i,:));
end
% Calculate the fitness values of initial PKO.
[~,sorted_indexes]=sort(Fitness);
Best_position=X(sorted_indexes(1),:);
Best_fitness = Fitness(sorted_indexes(1));
Convergence_curve(1)=Best_fitness;
t=1;
PEmax=0.5;
PEmin=0;
while t<Maxiteration+1o=exp(-t/Maxiteration)^2;for i=1:Popsizeif rand<.8 %explorationj=i;while i==jseed=randperm(Popsize);j=seed(1);endbeatingRate=rand*(Fitness(j))/(Fitness(i));alpha=2*randn(1,Dim)-1;if rand<.5T=beatingRate-((t)^(1/BF)/(Maxiteration)^(1/BF));X_1(i,:)=X(i,:)+alpha.*T.*(X(j,:)-X(i,:));elseT= (exp(1)-exp(((t-1)/Maxiteration)^(1/BF)))*(cos(Crest_angles));X_1(i,:)=X(i,:)+alpha.*T.*(X(j,:)-X(i,:));endelse %exploitationalpha=2*randn(1,Dim)-1;b=X(i,:)+o^2*randn.*Best_position; HuntingAbility=rand*(Fitness(i))/(Best_fitness);X_1(i,:)=X(i,:)+ HuntingAbility*o*alpha.*(b-Best_position);endendfor i=1:PopsizeFU=X_1(i,:)>UB;FL=X_1(i,:)<LB;X_1(i,:)=(X_1(i,:).*(~(FU+FL)))+UB.*FU+LB.*FL;fitnessn(i) = Fobj(X_1(i,:));if fitnessn(i)<Fitness(i)Fitness(i)=fitnessn(i);X(i,:)=X_1(i,:);endif Fitness(i)<Best_fitnessBest_fitness=Fitness(i);Best_position=X(i,:);endend% Commensal association of the pied kingfisher with foraging Eurasian ottersPE=PEmax-(PEmax-PEmin)*(t/Maxiteration); %Predatory Efficiencyfor i=1:Popsizealpha=2*randn(1,Dim)-1;if rand>(1-PE) X_1(i,:)=X(randi([1,Popsize]),:)+o*alpha.*abs(X(i,:)-X(randi([1,Popsize]),:));elseX_1(i,:)=X(i,:);endFU=X_1(i,:)>UB;FL=X_1(i,:)<LB;X_1(i,:)=(X_1(i,:).*(~(FU+FL)))+UB.*FU+LB.*FL;fitnessn(i) = Fobj(X_1(i,:));if fitnessn(i)<Fitness(i)Fitness(i)=fitnessn(i);X(i,:)=X_1(i,:);endif Fitness(i)<Best_fitnessBest_fitness=Fitness(i);Best_position=X(i,:);endendConvergence_curve(t)=Best_fitness;t = t + 1;
end
time = toc;
end
这篇关于【免费分享】2024最新优化算法-花斑翠鸟优化算法PKO的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!