✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。
🍎个人主页:Matlab科研工作室
🍊个人信条:格物致知。
更多Matlab仿真内容点击👇
⛄ 内容介绍
针对哈里斯鹰优化算法收敛精度低,易陷入局部最优的问题,本文提出了融合黄金正弦和随机游走的哈里斯鹰优化算法.首先,该算法在哈里斯鹰的探索阶段融合黄金正弦优化算法,增强算法的全局探索能力;其次,使用一种非线性能量指数递减策略,平衡算法的全局探索和局部开发能力;然后,在哈里斯鹰的开发阶段引入高斯随机游走策略对猎物进行随机游走,提升算法的局部开发能力;最后,在23个测试函数上进行实验,评估改进后的哈里斯鹰优化算法的寻优性能.实验结果表明,所提算法具有更好的寻优速度和寻优精度.
GSHHO(融合黄金正弦和随机游走的哈里斯鹰优化算法)是一种基于黄金正弦和随机游走的优化算法。它结合了这两种方法的优点,旨在提高优化问题的求解效率和精度。
黄金正弦是一种基于黄金比例(1.618)的算法,它模拟了黄金分割的规律。通过使用正弦函数来生成候选解,可以在搜索空间中尽可能地覆盖更多的区域,从而增加找到全局最优解的概率。
随机游走是一种基于随机性的搜索方法,通过在搜索空间中随机移动来寻找解空间中的最优解。它可以避免陷入局部最优解,并帮助算法跳出局部极值点。
GSHHO算法将黄金正弦和随机游走相结合,通过不断迭代生成新的候选解,并根据一定的策略进行选择和更新。算法会根据目标函数的值来评估候选解的好坏,并根据一定的概率选择是否接受新的解。通过不断迭代优化,GSHHO算法可以找到较好的近似最优解。
需要注意的是,GSHHO算法的具体实现可能会因应用场景和问题而有所差异。该算法的效果和性能也需要根据具体情况进行评估和调整。
⛄ 部分代码
% 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 rabbitRabbit_Location=zeros(1,dim);Rabbit_Energy=inf;%Initialize the locations of Harris' hawksX=initialization(N,dim,ub,lb);CNVG=zeros(1,T);t=0; % Loop counterwhile t<Tfor i=1:size(X,1)% Check boundriesFU=X(i,:)>ub;FL=X(i,:)<lb;X(i,:)=(X(i,:).*(~(FU+FL)))+ub.*FU+lb.*FL;% fitness of locationsfitness=fobj(X(i,:));% Update the location of Rabbitif fitness<Rabbit_EnergyRabbit_Energy=fitness;Rabbit_Location=X(i,:);endendE1=2*(1-(t/T)); % factor to show the decreaing energy of rabbit% Update the location of Harris' hawksfor i=1:size(X,1)E0=2*rand()-1; %-1<E0<1Escaping_Energy=E1*(E0); % escaping energy of rabbitif 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 membersX(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);endelseif 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 hawksr=rand(); % probablity of each eventif r>=0.5 && abs(Escaping_Energy)<0.5 % Hard besiegeX(i,:)=(Rabbit_Location)-Escaping_Energy*abs(Rabbit_Location-X(i,:));endif r>=0.5 && abs(Escaping_Energy)>=0.5 % Soft besiegeJump_strength=2*(1-rand()); % random jump strength of the rabbitX(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 motionsJump_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 rabbitX2=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;endendendif 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 rabbitJump_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 rabbitX2=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;endendend%%endendt=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)]);% endendend% ___________________________________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].智能计算机与应用, 2021.DOI:10.3969/j.issn.2095-2163.2021.07.021.
本文提出了一种融合黄金正弦和随机游走的哈里斯鹰优化算法(GSHHO),旨在解决原算法收敛精度低和易陷入局部最优的问题。通过在探索阶段应用黄金正弦增强全局探索,用非线性能量指数递减策略平衡全局与局部搜索,以及在开发阶段利用高斯随机游走提升局部开发能力,GSHHO算法在23个测试函数上表现出更优的寻优速度和精度。实验结果显示,该算法在优化问题求解中表现出更高的效率和精度。

被折叠的 条评论
为什么被折叠?



