暂无图片
暂无图片
2
暂无图片
暂无图片
暂无图片

群智能开源第二期-蝴蝶优化算法(BOA)

了不起的群智能 2021-07-22
3571


第一期开源文章:

群智能开源第一期-麻雀搜索算法(SSA) (qq.com)



所分享的的内容 全部提供硬核开源代码!!!欢迎大家与我交流 


1

蝴蝶优化算法简介

   

    蝴 蝶 优 化 算 法 (butterfly optimization algorithm,BOA)模拟自然界中的蝴蝶采食花蜜以及求偶的行为,由印度学者Arora S, Singh S与2018年提出。BOA 算法调节参数少,原理简单,易于实现,与常见的群智能优化算法一样容易陷入局部最优,后期迭代收敛速度较慢的特点。改进思路可看文末给出的参考文献。


2

BOA算法原理


    真实的蝴蝶觅食和寻偶行为有很多不确定的因素,无法在算法中体现出来,因此蝴蝶优化算法建立在两个理想化的条件下。假设每只蝴蝶都能产生不同程度的香味(适应度值)并且能嗅到来自不同方向的香味。

    

    蝴蝶的香味浓度f的大小取决于以 下三个因 素:分 别 是感 知 形 态c激强度I幂 指 数a用方程表示如下:



    全局搜索阶段(可加入levy飞行、动态收敛因子等方法进行改进),蝴蝶朝向最优蝴蝶位置移动:



    局部搜索阶段(需要改进的地方),蝴蝶将随机移动,蝴蝶位置更新公式如下:



    算法的伪代码:


3

BOA算法源代码



    % BOA.m
    %—————————————————感谢关注了不起的群智能
    %
    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 iterations
    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,:); %Eq. (2) in paper
    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; %Eq. (3) in paper
    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));



    4

    BOA仿真实验





    5


    相关参考文献



    [1]AroraS,SinghS.Butterflyoptimizationalgorithm:Anovel approachforglobaloptimization [J].SoftComputing,2019,23 (3):715-734.

    [2]Hosseinzadeh Mehdi,Masdari Mohammad,Rahmani Amir Masoud,Mohammadi Mokhtar,Aldalwie Adil Hussain Mohammed,Majeed Mohammed Kamal,Taher Karim Sarkhel H.. Correction to: Improved Butterfly Optimization Algorithm for Data Placement and Scheduling in Edge Computing Environments[J]. Journal of Grid Computing,2021,19(3):

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

    [4]郑洪清,冯文健,周永权.融合正弦余弦算法的蝴蝶优化算法[J].广西科学,2021,28(02):152-159.

    [5]郭德龙,周锦程,周永权.基于Levy飞行改进蝴蝶优化算法[J].数学的实践与认识,2021,51(12):130-137.


    6

    代码获取方式


    后台回复   BOA


    详细代码+中文注释


    下期更新海洋捕食者算法


    文章转载自了不起的群智能,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

    评论