【智能优化算法-麻雀算法】自适应麻雀算法matlab代码

文章提出了一种改进的麻雀搜索算法(IssA),通过使用偏斜帐篷映射的混沌方法生成初始种群以提高收敛质量。引入非线性递减权重来平衡搜索空间的探索与开发,并采用突变策略更新低能量麻雀的位置,结合混沌搜索和局部利用增强种群多样性,防止陷入局部最优。实验结果显示,IssA在精度、速度和稳定性方面优于或至少与原始ssA竞争。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

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

🍊个人信条:格物致知。

更多Matlab仿真内容点击👇

智能优化算法       神经网络预测       雷达通信       无线传感器        电力系统

信号处理              图像处理               路径规划       元胞自动机        无人机 

⛄ 内容介绍

The sparrow search algorithm (ssA) is a relatively new   swarm   intelligence   heuristic   algorithm.   It   has   fast convergence   speed,   strong   optimization   ability   and   more extensive   application   scenarios   compared   with   traditional heuristic search methods. And thus, the ssA is attracting the attention of researchers in different fields. However, there are deficiencies  of initial  population  quality,  search  ability,  and population diversity in the ssA. Therefore, this paper proposes an improved sparrow search algorithm (IssA). The IssA uses skew   tent   map-based   chaotic   method   to   produce   initial population   for   a   higher   quality   of  convergence.   For   the location update of the producer sparrows during the iterations, the IssA introduces a non-linear decreasing weight, promoting both  exploration  and  exploitation  of  the  search  space,  to improve   the   convergence   and   search   precision.   And   the mutation  strategy  is  employed  to  update  the  location  of the scrounger sparrows with lower energy and the chaotic search is combined with the local exploitation for the scroungers with higher  energy,  which  can  enhance  the  diversity  and  avoid trapping in local optimum. simulation experiments are carriedout on 26 benchmark test functions. And the results show that the IssA is superior to or at least competitive to the ssA in the convergence properties of accuracy, speed, and stability.

⛄ 部分代码

function [fMin , bestX,Convergence_curve ] = SSA(pop, M,c,d,dim,fobj  )

        

   P_percent = 0.2;    % The population size of producers accounts for "P_percent" percent of the total population size       

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

pNum = round( pop *  P_percent );    % The population size of the producers   

lb= c.*ones( 1,dim );    % Lower limit/bounds/     a vector

ub= d.*ones( 1,dim );    % Upper limit/bounds/     a vector

%Initialization

for i = 1 : pop

    

    x( i, : ) = lb + (ub - lb) .* rand( 1, dim );  

    fit( i ) = fobj( x( i, : ) ) ;                       

end

pFit = fit;                      

pX = x;                            % The individual's best position corresponding to the pFit

[ fMin, bestI ] = min( fit );      % fMin denotes the global optimum fitness value

bestX = x( bestI, : );             % bestX denotes the global optimum position corresponding to fMin

 % Start updating the solutions.

for t = 1 : M    

  

      

  [ ans, sortIndex ] = sort( pFit );% Sort.

     

  [fmax,B]=max( pFit );

   worse= x(B,:);  

         

   r2=rand(1);

if(r2<0.8)

    for i = 1 : pNum                                                   % Equation (3)

         r1=rand(1);

        x( sortIndex( i ), : ) = pX( sortIndex( i ), : )*exp(-(i)/(r1*M));

        x( sortIndex( i ), : ) = Bounds( x( sortIndex( i ), : ), lb, ub );

        fit( sortIndex( i ) ) = fobj( x( sortIndex( i ), : ) );   

    end

  else

  for i = 1 : pNum   

          

  x( sortIndex( i ), : ) = pX( sortIndex( i ), : )+randn(1)*ones(1,dim);

  x( sortIndex( i ), : ) = Bounds( x( sortIndex( i ), : ), lb, ub );

  fit( sortIndex( i ) ) = fobj( x( sortIndex( i ), : ) );

       

  end

      

end

 [ fMMin, bestII ] = min( fit );      

  bestXX = x( bestII, : );            

   for i = ( pNum + 1 ) : pop                     % Equation (4)

     

         A=floor(rand(1,dim)*2)*2-1;

         

          if( i>(pop/2))

           x( sortIndex(i ), : )=randn(1)*exp((worse-pX( sortIndex( i ), : ))/(i)^2);

          else

        x( sortIndex( i ), : )=bestXX+(abs(( pX( sortIndex( i ), : )-bestXX)))*(A'*(A*A')^(-1))*ones(1,dim);  

         end  

        x( sortIndex( i ), : ) = Bounds( x( sortIndex( i ), : ), lb, ub );

        fit( sortIndex( i ) ) = fobj( x( sortIndex( i ), : ) );

        

   end

  c=randperm(numel(sortIndex));

   b=sortIndex(c(1:20));

    for j =  1  : length(b)      % Equation (5)

    if( pFit( sortIndex( b(j) ) )>(fMin) )

        x( sortIndex( b(j) ), : )=bestX+(randn(1,dim)).*(abs(( pX( sortIndex( b(j) ), : ) -bestX)));

        else

        x( sortIndex( b(j) ), : ) =pX( sortIndex( b(j) ), : )+(2*rand(1)-1)*(abs(pX( sortIndex( b(j) ), : )-worse))/ ( pFit( sortIndex( b(j) ) )-fmax+1e-50);

          end

        x( sortIndex(b(j) ), : ) = Bounds( x( sortIndex(b(j) ), : ), lb, ub );

       

       fit( sortIndex( b(j) ) ) = fobj( x( sortIndex( b(j) ), : ) );

 end

    for i = 1 : pop 

        if ( fit( i ) < pFit( i ) )

            pFit( i ) = fit( i );

            pX( i, : ) = x( i, : );

        end

        

        if( pFit( i ) < fMin )

           fMin= pFit( i );

            bestX = pX( i, : );

         

            

        end

    end

  

    Convergence_curve(t)=fMin;

  

end

% Application of simple limits/bounds

function s = Bounds( s, Lb, Ub)

  % Apply the lower bound vector

  temp = s;

  I = temp < Lb;

  temp(I) = Lb(I);

  

  % Apply the upper bound vector 

  J = temp > Ub;

  temp(J) = Ub(J);

  % Update this new move 

  s = temp;

%---------------------------------------------------------------------------------------------------------------------------

⛄ 运行结果

⛄ 参考文献

⛳️ 代码获取关注我

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

❤️ 关注我领取海量matlab电子书和数学建模资料

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

matlab科研助手

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值