100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > 蝴蝶优化算法 CEC//进行测试 MATLAB代码获取 与麻雀 蜣螂 灰狼算法比较...

蝴蝶优化算法 CEC//进行测试 MATLAB代码获取 与麻雀 蜣螂 灰狼算法比较...

时间:2021-01-26 02:44:56

相关推荐

蝴蝶优化算法 CEC//进行测试 MATLAB代码获取 与麻雀 蜣螂 灰狼算法比较...

今天为大家带来一期蝴蝶优化算法。并与麻雀,蜣螂,灰狼算法比较。

蝴蝶优化算法( BOA) 是 Arora [1]等人于提出的一种模拟蝴蝶觅食和求偶行为的新型元启发式优化算法。基本 BOA 中参 数少、原理简单、易于实现。

原理详解

蝴蝶优化算法是模拟自然界中蝴蝶觅食( 花蜜) 和求偶行 为而衍生出的一种新型群智能优化算法。从生物学上讲,蝴蝶 有感官感受器用来闻/感觉食物及花朵的香味,这些感受器被称为化学感受器,分散在蝴蝶身体的各个部位,如腿、触须等。

步骤:

a) 所有的蝴蝶会散发香味,使蝴蝶个体之间相互吸引。

b) 每只蝴蝶都会随机移动或向发出最多香味的蝴蝶移动。

c) 蝴蝶的刺激强度受目标函数的影响或决定。

d) 全局搜索和局部搜索使用切换概率 p 来控制,由于物理近似度以及风雨、雷电等各种其他自然因素等,局部搜索和全 局开采的切换概率 p 有重要意义。在BOA 中,每一只蝴蝶有它自己独特的感觉和个体感知能力,同时这也是区别于其他群智能算法的一个重要特征。蝴蝶产生香味的数学公式:

(1)

其中: f 是香味的感知强度,即香味能够被其他蝴蝶感知的强 度; c 是蝴蝶的感觉模态; I 是刺激强度; a 是依赖于模态的幂指数,它解释了不同程度香味的吸收。在全局搜索阶段,蝴蝶朝着最优的蝴蝶 ( 解g* ) 移动,全局位置更新公式:(2)

其中: xti是第 t 次迭代中第 i 只蝴蝶的解向量 xi ; g* 表示在当 前迭代的所有解中的最优解; 第 i 只蝴蝶发出的香味用fi表示; r 是[0,1]的随机数。局部位置更新公式为: (3)

基本蝴蝶算法流程如图所示:

结果展示

CEC测试结果:

CEC测试结果:

CEC测试结果:

可以看到蝴蝶算法的寻优能力令人堪忧呀,不过这也说明了该算法的改进空间很大!

代码展示

%Butterfly optimization algorithm% AroraS,SinghS.Butterflyoptimizationalgorithm:Anovel approach for global optimization [J].% SoftComputing,,23 (3):715-734.function [fmin,best_pos,Convergence_curve]=BOA(n,N_iter,Lb,Ub,dim,fobj)% n is the population size% N_iter represnets total number of iterationsp=0.8; % probabibility switchpower_exponent=0.1;sensory_modality=0.01;%Initialize the positions of search agentsSol=initialization(n,dim,Ub,Lb);for i=1:nFitness(i)=fobj(Sol(i,:));end% Find the current best_pos[fmin,I]=min(Fitness);best_pos=Sol(I,:);S=Sol; % Start the iterations -- Butterfly Optimization Algorithm for t=1:N_iterfor i=1:n% Loop over all butterflies/solutions%Calculate fragrance of each butterfly which is correlated with objective functionFnew=fobj(S(i,:));FP=(sensory_modality*(Fnew^power_exponent)); %Global or local searchif rand<p dis = rand * rand * best_pos - Sol(i,:); %Eq. (2) in paperS(i,:)=Sol(i,:)+dis*FP;else% Find random butterflies in the neighbourhoodepsilon=rand;JK=randperm(n);dis=epsilon*epsilon*Sol(JK(1),:)-Sol(JK(2),:);S(i,:)=Sol(i,:)+dis*FP;%Eq. (3) in paperend% Check if the simple limits/bounds are OKS(i,:)=simplebounds(S(i,:),Lb,Ub);% Evaluate new solutionsFnew=fobj(S(i,:)); %Fnew represents new fitness values% If fitness improves (better solutions found), update thenif (Fnew<=Fitness(i))Sol(i,:)=S(i,:);Fitness(i)=Fnew;end% Update the current global best_posif Fnew<=fminbest_pos=S(i,:);fmin=Fnew;endendConvergence_curve(t,1)=fmin;%Update sensory_modalitysensory_modality=sensory_modality_NEW(sensory_modality, N_iter);endend% Boundary constraintsfunction s=simplebounds(s,Lb,Ub)% Apply the lower boundns_tmp=s;I=ns_tmp<Lb;ns_tmp(I)=Lb;% Apply the upper bounds J=ns_tmp>Ub;ns_tmp(J)=Ub;% Update this new move s=ns_tmp;endfunction y=sensory_modality_NEW(x,Ngen)y=x+(0.025/(x*Ngen));end

下一期对蝴蝶算法进行改进!

代码免费获取方式

完整代码获取方式:后台回复关键字,不区分大小写。关键字:

TGDM827

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。