✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。

🍎个人主页:Matlab科研工作室

🍊个人信条:格物致知。

⛄ 内容介绍

蝴蝶优化算法是近年来提出的一种新型自然启发式算法.针对基本蝴蝶优化算法收敛速度慢,求解精度低,稳定性差等问题,提出了一种融合变异策略的自适应蝴蝶优化算法.通过引入随机惯性权重策略,利用迭代次数和个体适应度的优邻域扰动策略调整转换概率,有效维持了算法全局探索与局部搜索的平衡;通过动态转换概率策略,利用惯性权重值和混沌记忆权重因子进一步提高了算法的多样性,有效避免算法早熟收敛,同时加快了算法的收敛速度和求解精度.利用改进算法对12个基准测试函数进行仿真实验,与基本蝴蝶优化算法对比表明,改进算法具有收敛速度快,寻优精度高,稳定性强等优异性能.

⛄ 部分代码

function [fmin,best_pos,Convergence_curve]=BOA(n,N_iter,Lb,Ub,dim,fobj)

p=0.8; % probabibility switch,开关概率

power_exponent=0.1; % 幂指数

sensory_modality=0.01; % 感觉因子

%Initialize the positions of search agents

Sol=initialization(n,dim,Ub,Lb);

for i=1:n

    Fitness(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_iter

        for i=1:n% Loop over all butterflies/solutions

          %Calculate fragrance of each butterfly which is correlated with objective function,计算与目标函数相关的每只蝴蝶的香味

          Fnew=fobj(S(i,:));

          FP=(sensory_modality*(Fnew^power_exponent)); % 每只蝴蝶的香味

          %Global or local search

          if rand<p

              dis = rand * rand * best_pos - Sol(i,:);        % 全局搜索阶段

              S(i,:)=Sol(i,:)+dis*FP;

          else

              % Find random butterflies in the neighbourhood

              epsilon=rand;

              JK=randperm(n);

              dis=epsilon*epsilon*Sol(JK(1),:)-Sol(JK(2),:);  % 局部搜索阶段

              S(i,:)=Sol(i,:)+dis*FP;                         

          end

            % Check if the simple limits/bounds are OK

            S(i,:)=simplebounds(S(i,:),Lb,Ub);

            % Evaluate new solutions

            Fnew=fobj(S(i,:));  %Fnew represents new fitness values

            % If fitness improves (better solutions found), update then

            if (Fnew<=Fitness(i))

                Sol(i,:)=S(i,:);

                Fitness(i)=Fnew;

            end

           % Update the current global best_pos

           if Fnew<=fmin

                best_pos=S(i,:);

                fmin=Fnew;

           end

         end

         Convergence_curve(t,1)=fmin;

         %Update sensory_modality,更新感觉因子

         sensory_modality=sensory_modality_NEW(sensory_modality, N_iter);

end

% Boundary constraints

function s=simplebounds(s,Lb,Ub)

  % Apply the lower bound

  ns_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;

function y=sensory_modality_NEW(x,Ngen)

y=x+(0.025/(x*Ngen));

⛄ 运行结果

【蝴蝶算法】基于随机惯性权重策略+最优邻域扰动策略+动态转换概率策略的蝴蝶算法求解单目标优化问题附matlab代码IBOA_优化算法

【蝴蝶算法】基于随机惯性权重策略+最优邻域扰动策略+动态转换概率策略的蝴蝶算法求解单目标优化问题附matlab代码IBOA_搜索_02

【蝴蝶算法】基于随机惯性权重策略+最优邻域扰动策略+动态转换概率策略的蝴蝶算法求解单目标优化问题附matlab代码IBOA_搜索_03

⛄ 参考文献

[1] 李彦苍, 卜英乔, 朱海涛,等. 融合最优邻域扰动和反向学习策略的蝴蝶优化算法[J]. 中国科技论文, 2021, 16(11):8.

[2] 刘凯, 代永强. 融合变异策略的自适应蝴蝶优化算法[J].  2022.

[3] 刘景森马义想李煜. 改进蝴蝶算法求解多维复杂函数优化问题[J]. 电子学报, 2021, 049(006):1068-1076.

⛳️ 代码获取关注我

❤️部分理论引用网络文献,若有侵权联系博主删除
❤️ 关注我领取海量matlab电子书和数学建模资料