• 大小: 5KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-16
  • 语言: Matlab
  • 标签: 鸟群算法  

资源简介

Chicken Swarm Optimization(CSO)鸡群优化算法,2014年提出的群智能优化算法。 Bird Swarm Algorithm(BSA)鸟群算法,2015年最新的群智能优化算法。 作为两种全新的群智能优化算法,CSO和BSA都具有简单,良好扩展性的特点,是天然的多种群算法! http://cn.mathworks.com/matlabce ... 7597-xian-bing-meng 有关算法信息,可在上述网站查询。 希望对大家有用!

资源截图

代码片段和文件信息

% ------------------------------------------------------------------------
% Bird Swarm Algorithm (BSA) (demo)
% Programmed by Xian-Bing Meng
% Updated at Jun 19 2015.    
% Email: x.b.meng12@gmail.com
%
% This is a simple demo version only implemented the basic idea of BSA for        
% solving the unconstrained problem namely Sphere function.  
%
% The details about BSA are illustratred in the following paper.    
% Xian-Bing Meng et al (2015): A new bio-inspXred optimisation algorithm: 
% Bird Swarm Algorithm Journal of Experimental & Theoretical
% Artificial Intelligence DOI: 10.1080/0952813X.2015.1042530
%
% The parameters in BSA are presented as follows.
% FitFunc    % The objective function
% M          % Maxmimal generations (iterations)
% pop        % Population size
% dim        % Dimension
% FQ         % The frequency of birds‘ flight behaviours 
% c1         % Cognitive accelerated coefficient
% c2         % Social accelerated coefficient
% a1 a2     % Two paramters which are related to the indirect and direct 
%              effect on the birds‘ vigilance bahaviors.
%
% Using the default value BSA can be executed using the following code.
% [ bestX fMin ] = BSA
% ------------------------------------------------------------------------
 
% Main programs

function [ bestX fMin ] = BSA( FitFunc M pop dim FQ c1 c2 a1 a2 )
% Display help
help BSA.m
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% set the default parameters
if nargin < 1
    FitFunc = @Sphere;
    M = 1000;   
    pop = 30;  
    dim = 20;   
    FQ = 10;   
    c1 = 1.5;
    c2 = 1.5;
    a1 = 1;
    a2 = 1;
end

% set the parameters
lb= -100*ones( 1dim );   % Lower bounds
ub= 100*ones( 1dim );    % Upper bounds
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Initialization

for i = 1 : pop
    x( i : ) = lb + (ub - lb) .* rand( 1 dim ); 
    fit( i ) = FitFunc( x( i : ) ); 
end
pFit = fit; % The individual‘s best fitness value
pX = x;     % The individual‘s best position corresponding to the pFit

[ fMin bestIndex ] = min( fit );  % fMin denotes the global optimum
% bestX denotes the position corresponding to fMin
bestX = x( bestIndex : );   

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Start the iteration.

 for iteration = 1 : M
     
    prob = rand( pop 1 ) .* 0.2 + 0.8;%The probability of foraging for food
    
    if( mod( iteration FQ ) ~= 0 )         
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        % Birds forage for food or keep vigilance
        sumPfit = sum( pFit );
        meanP = mean( pX );
        for i = 1 : pop
            if rand < prob(i)
                x( i : ) = x( i : ) + c1 * rand.*(bestX - x( i : ))+ ...
                    c2 * rand.*( pX(i:) - x( i : ) );
            else
                person = randiTabu(

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      10236  2015-06-21 12:53  CSO.m

     文件       7744  2015-06-21 10:39  BSA.m

----------- ---------  ---------- -----  ----

                17980                    2


评论

共有 条评论