0
点赞
收藏
分享

微信扫一扫

【智能优化算法】基于粒子群结合蝴蝶算法求解单目标优化问题附matlab代码

一条咸鱼的干货 2022-02-19 阅读 58

1 简介

: In order to solve the problem that the butterflfly optimization algorithm (BOA) is prone to lowaccuracy and slow convergence, the trend of study is to hybridize two or more algorithms to obtain asuperior solution in the fifield of optimization problems. A novel hybrid algorithm is proposed, namelyHPSOBOA, and three methods are introduced to improve the basic BOA. Therefore, the initializationof BOA using a cubic one-dimensional map is introduced, and a nonlinear parameter control strategyis also performed. In addition, the particle swarm optimization (PSO) algorithm is hybridized withBOA in order to improve the basic BOA for global optimization. There are two experiments (including26 well-known benchmark functions) that were conducted to verify the effffectiveness of the proposedalgorithm. The comparison results of experiments show that the hybrid HPSOBOA converges quicklyand has better stability in numerical optimization problems with a high dimension compared withthe PSO, BOA, and other kinds of well-known swarm optimization algorithms.

2 部分代码

%_____________________________________________________________________________________________ %                               %%___________________________________________________________________________________________   %%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.6;                    % probabibility switchpower_exponent=0.1;       %initial value of asensory_modality=0.01;    %initial value of c%Initialize the positions of search agentsSol=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);            Flag4Ub=S(i,:)>Ub;              Flag4Lb=S(i,:)<Lb;              S(i,:)=(S(i,:).*(~(Flag4Ub+Flag4Lb)))+Ub.*Flag4Ub+Lb.*Flag4Lb;                       % 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);endend% % 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));end

3 仿真结果

4 参考文献

[1]张孟健, 汪敏, 王霄,等. 混合粒子群-蝴蝶算法的WSN节点部署研究. 

博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。

部分理论引用网络文献,若有侵权联系博主删除。

举报

相关推荐

0 条评论