当前位置: 灰狼 >> 灰狼的天敌 >> 智能优化算法基于改进收敛因子和比例权
在分析灰狼优化算法不足的基础上,提出一种改进的灰狼优化算法(CGWO),该算法采用基于余弦规律变化的收敛因子,平衡算法的全局搜索和局部搜索能力,同时引入基于步长欧氏距离的比例权重更新灰狼位置,从而加快算法的收敛速度.对8个经典测试函数进行仿真实验,结果表明CGWO算法的求解精度更高,稳定性更好.最后以预测谷氨酸菌体生长浓度为例,利用CGWO算法估计Richards模型的参数,以均方根误差和平均绝对误差作为评价指标,与PSO算法,GA算法和VS-FOA算法的结果进行比较,CGWO算法可以有效地估计Richards模型中的参数.
2部分代码%___________________________________________________________________%%GreyWoldOptimizer(GWO)sourcecodesversion1.0%%%%___________________________________________________________________%%GreyWolfOptimizerfunction[Alpha_score,Alpha_pos,Convergence_curve]=GWO(SearchAgents_no,Max_iter,lb,ub,dim,fobj)%initializealpha,beta,anddelta_posAlpha_pos=zeros(1,dim);Alpha_score=inf;%changethisto-infformaximizationproblemsBeta_pos=zeros(1,dim);Beta_score=inf;%changethisto-infformaximizationproblemsDelta_pos=zeros(1,dim);Delta_score=inf;%changethisto-infformaximizationproblems%InitializethepositionsofsearchagentsPositions=initialization(SearchAgents_no,dim,ub,lb);Convergence_curve=zeros(1,Max_iter);l=0;%Loopcounter%MainloopwhilelMax_iterfori=1:size(Positions,1)%ReturnbackthesearchagentsthatgobeyondtheboundariesofthesearchspaceFlag4ub=Positions(i,:)ub;Flag4lb=Positions(i,:)lb;Positions(i,:)=(Positions(i,:).*(~(Flag4ub+Flag4lb)))+ub.*Flag4ub+lb.*Flag4lb;%Calculateobjectivefunctionforeachsearchagentfitness=fobj(Positions(i,:));%UpdateAlpha,Beta,andDeltaiffitnessAlpha_scoreAlpha_score=fitness;%UpdatealphaAlpha_pos=Positions(i,:);endiffitnessAlpha_scorefitnessBeta_scoreBeta_score=fitness;%UpdatebetaBeta_pos=Positions(i,:);endiffitnessAlpha_scorefitnessBeta_scorefitnessDelta_scoreDelta_score=fitness;%UpdatedeltaDelta_pos=Positions(i,:);endend%adecreaseslinearlyfron2to0a=sin(((l*pi)/Max_iter)+pi/2)+1;%UpdatethePositionofsearchagentsincludingomegasfori=1:size(Positions,1)forj=1:size(Positions,2)r1=rand();%r1isarandomnumberin[0,1]r2=rand();%r2isarandomnumberin[0,1]A1=2*a*r1-a;%Equation(3.3)C1=2*r2;%Equation(3.4)D_alpha=abs(C1*Alpha_pos(j)-Positions(i,j));%Equation(3.5)-part1X1=Alpha_pos(j)-A1*D_alpha;%Equation(3.6)-part1r1=rand();r2=rand();A2=2*a*r1-a;%Equation(3.3)C2=2*r2;%Equation(3.4)D_beta=abs(C2*Beta_pos(j)-Positions(i,j));%Equation(3.5)-part2X2=Beta_pos(j)-A2*D_beta;%Equation(3.6)-part2r1=rand();r2=rand();A3=2*a*r1-a;%Equation(3.3)C3=2*r2;%Equation(3.4)D_delta=abs(C3*Delta_pos(j)-Positions(i,j));%Equation(3.5)-part3X3=Delta_pos(j)-A3*D_delta;%Equation(3.5)-part3Positions(i,j)=(X1+X2+X3)/3;%Equation(3.7)endendl=l+1;Convergence_curve(l)=Alpha_score;end3仿真结果4参考文献
[1]王秋萍,王梦娜,王晓峰.改进收敛因子和比例权重的灰狼优化算法[J].计算机工程与应用,,55(21):7.
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。部分理论引用网络文献,若有侵权联系博主删除。预览时标签不可点收录于合集#个上一篇下一篇