✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。
🍎个人主页:Matlab科研工作室
🍊个人信条:格物致知。
更多Matlab仿真内容点击👇
⛄ 内容介绍
融合动态反向学习的阿奎拉鹰与哈里斯鹰混合优化算是一种用于解决优化问题的算法。这个算法的灵感来自于自然界中的两种鸟类:阿奎拉鹰和哈里斯鹰。
阿奎拉鹰是一种在空中悬停、搜索和捕食的鸟类。它们通过观察环境中的动态变化来调整自己的飞行策略,以更好地捕获猎物。这个特性被应用到算法中,就是通过动态反向学习来调整算法的参数,以适应问题的变化。
哈里斯鹰是一种善于跟踪和追踪猎物的鸟类。它们能够根据目标的位置和速度来调整自己的飞行路径,以更好地捕捉猎物。这个特性被应用到算法中,就是通过追踪和更新最优解的位置,以逐步优化算法的性能。
融合了阿奎拉鹰和哈里斯鹰的混合优化算法通过结合它们各自的优点,提供了一种更强大和高效的优化方法。它能够在动态环境中自适应地调整参数,并且能够快速收敛到较优解。这使得它在解决复杂的优化问题时具有很好的性能和鲁棒性。
总结起来,融合动态反向学习的阿奎拉鹰与哈里斯鹰混合优化算法是一种结合了两种鸟类优势的算法,用于解决优化问题,具有适应动态环境、快速收敛和高效性能等特点。
融合动态反向学习的阿奎拉鹰与哈里斯鹰混合优化算法的步骤如下:
-
初始化种群:随机生成一组个体作为初始种群。每个个体表示一个解决方案。
-
评估适应度:对于每个个体,使用适应度函数评估其解决方案的质量。适应度函数可以根据具体问题进行定义。
-
选择操作:根据个体的适应度值,选择一部分个体作为优秀个体,用于下一步的操作。
-
动态反向学习:对于优秀个体,使用动态反向学习算法进行学习和优化。动态反向学习是一种自适应学习算法,可以根据问题的特性自动调整参数和搜索策略,提高搜索效率和准确性。
-
哈里斯鹰算法操作:对于剩余的个体,使用哈里斯鹰算法进行搜索和优化。哈里斯鹰算法是一种基于鹰群行为的启发式搜索算法,通过模拟鹰群协作和竞争的行为来找到最优解。
-
更新种群:将动态反向学习和哈里斯鹰算法得到的优化个体与初始种群进行合并,形成新的种群。
-
重复步骤2至6:重复执行步骤2至6,直到达到停止条件(如达到最大迭代次数或找到满意的解决方案)。
-
输出结果:输出最优解决方案,即适应度最高的个体。
⛄ 部分代码
% Developed in MATLAB R2013b
% Source codes demo version 1.0
% _____________________________________________________
% Main paper:
% Harris hawks optimization: Algorithm and applications
% Ali Asghar Heidari, Seyedali Mirjalili, Hossam Faris, Ibrahim Aljarah, Majdi Mafarja, Huiling Chen
% Future Generation Computer Systems,
% DOI: https://doi.org/10.1016/j.future.2019.02.028
% https://www.sciencedirect.com/science/article/pii/S0167739X18313530
% _____________________________________________________
% You can run the HHO code online at codeocean.com https://doi.org/10.24433/CO.1455672.v1
% You can find the HHO code at https://github.com/aliasghar68/Harris-hawks-optimization-Algorithm-and-applications-.git
% _____________________________________________________
% Author, inventor and programmer: Ali Asghar Heidari,
% PhD research intern, Department of Computer Science, School of Computing, National University of Singapore, Singapore
% Exceptionally Talented Ph. DC funded by Iran's National Elites Foundation (INEF), University of Tehran
% 03-03-2019
% Researchgate: https://www.researchgate.net/profile/Ali_Asghar_Heidari
% e-Mail: as_heidari@ut.ac.ir, aliasghar68@gmail.com,
% e-Mail (Singapore): aliasgha@comp.nus.edu.sg, t0917038@u.nus.edu
% _____________________________________________________
% Co-author and Advisor: Seyedali Mirjalili
%
% e-Mail: ali.mirjalili@gmail.com
% seyedali.mirjalili@griffithuni.edu.au
%
% Homepage: http://www.alimirjalili.com
% _____________________________________________________
% Co-authors: Hossam Faris, Ibrahim Aljarah, Majdi Mafarja, and Hui-Ling Chen
% Homepage: http://www.evo-ml.com/2019/03/02/hho/
% _____________________________________________________
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Harris's hawk optimizer: In this algorithm, Harris' hawks try to catch the rabbit.
% T: maximum iterations, N: populatoin size, CNVG: Convergence curve
% To run HHO: [Rabbit_Energy,Rabbit_Location,CNVG]=HHO(N,T,lb,ub,dim,fobj)
function [Rabbit_Energy,Rabbit_Location,CNVG]=HHO(N,T,lb,ub,dim,fobj)
% initialize the location and Energy of the rabbit
Rabbit_Location=zeros(1,dim);
Rabbit_Energy=inf;
%Initialize the locations of Harris' hawks
X=initialization(N,dim,ub,lb);
CNVG=zeros(1,T);
t=0; % Loop counter
while t<T
for i=1:size(X,1)
% Check boundries
FU=X(i,:)>ub;FL=X(i,:)<lb;X(i,:)=(X(i,:).*(~(FU+FL)))+ub.*FU+lb.*FL;
% fitness of locations
fitness=fobj(X(i,:));
% Update the location of Rabbit
if fitness<Rabbit_Energy
Rabbit_Energy=fitness;
Rabbit_Location=X(i,:);
end
end
E1=2*(1-(t/T)); % factor to show the decreaing energy of rabbit
% Update the location of Harris' hawks
for i=1:size(X,1)
E0=2*rand()-1; %-1<E0<1
Escaping_Energy=E1*(E0); % escaping energy of rabbit
if abs(Escaping_Energy)>=1
%% Exploration:
% Harris' hawks perch randomly based on 2 strategy:
q=rand();
rand_Hawk_index = floor(N*rand()+1);
X_rand = X(rand_Hawk_index, :);
if q<0.5
% perch based on other family members
X(i,:)=X_rand-rand()*abs(X_rand-2*rand()*X(i,:));
elseif q>=0.5
% perch on a random tall tree (random site inside group's home range)
X(i,:)=(Rabbit_Location(1,:)-mean(X))-rand()*((ub-lb)*rand+lb);
end
elseif abs(Escaping_Energy)<1
%% Exploitation:
% Attacking the rabbit using 4 strategies regarding the behavior of the rabbit
%% phase 1: surprise pounce (seven kills)
% surprise pounce (seven kills): multiple, short rapid dives by different hawks
r=rand(); % probablity of each event
if r>=0.5 && abs(Escaping_Energy)<0.5 % Hard besiege
X(i,:)=(Rabbit_Location)-Escaping_Energy*abs(Rabbit_Location-X(i,:));
end
if r>=0.5 && abs(Escaping_Energy)>=0.5 % Soft besiege
Jump_strength=2*(1-rand()); % random jump strength of the rabbit
X(i,:)=(Rabbit_Location-X(i,:))-Escaping_Energy*abs(Jump_strength*Rabbit_Location-X(i,:));
end
%% phase 2: performing team rapid dives (leapfrog movements)
if r<0.5 && abs(Escaping_Energy)>=0.5, % Soft besiege % rabbit try to escape by many zigzag deceptive motions
Jump_strength=2*(1-rand());
X1=Rabbit_Location-Escaping_Energy*abs(Jump_strength*Rabbit_Location-X(i,:));
if fobj(X1)<fobj(X(i,:)) % improved move?
X(i,:)=X1;
else % hawks perform levy-based short rapid dives around the rabbit
X2=Rabbit_Location-Escaping_Energy*abs(Jump_strength*Rabbit_Location-X(i,:))+rand(1,dim).*Levy(dim);
if (fobj(X2)<fobj(X(i,:))), % improved move?
X(i,:)=X2;
end
end
end
if r<0.5 && abs(Escaping_Energy)<0.5, % Hard besiege % rabbit try to escape by many zigzag deceptive motions
% hawks try to decrease their average location with the rabbit
Jump_strength=2*(1-rand());
X1=Rabbit_Location-Escaping_Energy*abs(Jump_strength*Rabbit_Location-mean(X));
if fobj(X1)<fobj(X(i,:)) % improved move?
X(i,:)=X1;
else % Perform levy-based short rapid dives around the rabbit
X2=Rabbit_Location-Escaping_Energy*abs(Jump_strength*Rabbit_Location-mean(X))+rand(1,dim).*Levy(dim);
if (fobj(X2)<fobj(X(i,:))), % improved move?
X(i,:)=X2;
end
end
end
%%
end
end
t=t+1;
CNVG(t)=Rabbit_Energy;
% Print the progress every 100 iterations
% if mod(t,100)==0
% display(['At iteration ', num2str(t), ' the best fitness is ', num2str(Rabbit_Energy)]);
% end
end
end
% ___________________________________
function o=Levy(d)
beta=1.5;
sigma=(gamma(1+beta)*sin(pi*beta/2)/(gamma((1+beta)/2)*beta*2^((beta-1)/2)))^(1/beta);
u=randn(1,d)*sigma;v=randn(1,d);step=u./abs(v).^(1/beta);
o=step;
end
⛄ 运行结果
⛄ 参考文献
[1]贾鹤鸣,刘庆鑫,刘宇翔等.融合动态反向学习的阿奎拉鹰与哈里斯鹰混合优化算法[J].智能系统学报,2023,18(01):104-116.