【智能优化算法】卷尾猴搜索算法(Capuchin search algorithm,CapSA)是期刊“NEURAL COMPUTING & APPLICATIONS”(IF 6.0)的2021年智能优化算法

01.引言

【智能优化算法】卷尾猴搜索算法(Capuchin search algorithm,CapSA)用于解决约束和全局优化问题。CapSA的主要灵感来自卷尾猴的动态行为。该算法的基本优化特征是通过模拟卷尾猴在森林中寻找食物来源时在树木和河岸上徘徊和觅食的社会行为来设计的。卷尾猴在觅食过程中的一些常见行为是在这个算法中实现的,包括跳跃、摇摆和攀爬。跳跃是卷尾猴从一棵树跳到另一棵树的有效机制。卷尾猴的另一种觅食机制是摇摆和攀爬,它允许卷尾猴在树木、树枝和树枝的末端上移动一小段距离。这些运动机制最终导致全局优化问题的可行解。该算法在23个著名的基准函数上进行了基准测试,并解决了一些具有挑战性和计算成本高的工程问题。我们进行了一项广泛的比较研究,以证明CapSA在优化精度和统计检验分析方面优于几种突出的元启发式算法。总体结果表明,与竞争的元启发式方法相比,CapSA提供了更精确的解,具有更高的收敛速度。

02.优化算法的流程

【智能优化算法】卷尾猴搜索算法(Capuchin search algorithm,CapSA)-LMLPHP

【智能优化算法】卷尾猴搜索算法(Capuchin search algorithm,CapSA)-LMLPHP

【智能优化算法】卷尾猴搜索算法(Capuchin search algorithm,CapSA)-LMLPHP

03.论文中算法对比图

【智能优化算法】卷尾猴搜索算法(Capuchin search algorithm,CapSA)-LMLPHP

04.部分代码

function [fitCapSA,CapPos,cg_curve]=CapSA(noP,maxite,LB,UB,dim,fobj)
 
warning off; format long;
%%%%* 1
% if size(UB,2)==1
%     UB=ones(1,dim)*UB;
%     LB=ones(1,dim)*LB;
% end
 
% if size(UB,1)==1
%     UB=ones(dim,1)*UB;
%     LB=ones(dim,1)*LB;
% end
% % % CapSA main program
% f1 =  figure (1);
% set(gcf,'color','w');
% hold on
% xlabel('Iteration','interpreter','latex','FontName','Times','fontsize',10)
% ylabel('Fit value','interpreter','latex','FontName','Times','fontsize',10); 
% grid;
%  
cg_curve=zeros(1,maxite);
%% % CapSA initialization
%Initialize the Pos of Caps in the space
CapPos=initialization(noP,dim,UB,LB);
v=0.1*CapPos;% initial velocity
v0=zeros(noP,dim); 
CapFit=zeros(noP,1);
% Calculate the Fit of initialCaps
    for i=1:noP
        CapFit(i,1)=fobj(CapPos(i,:));
    end
 
% Initial Fit of the random Pos
Fit = CapFit;
[fitCapSA,index]=min(CapFit);
CapBestPos = CapPos; % Best Pos initialization
Pos= CapPos; 
gFoodPos = CapPos(index,:); % initial global Pos 
%% % CapSA Parameters
bf=0.70;%Balance factor
cr=11.0;  %Modulus of elasticity
g=9.81;
% CapSA velocity updates
a1=1.250; a2=1.5;   
beta=[2 11 2];
wmax=0.8;
wmin=0.1;
 
%% % CapSA Main loop
  
for t = 1 : maxite
    % Life time convergence
        tau = beta(1) * exp(-beta(2) * t/maxite)^beta(3);
        w   = wmax-(wmax-wmin)*(t/maxite); 
        fol=ceil((noP-1).*rand(noP,1))'; %  
        % CapSA velocity update
for i=1:noP 
    for j=1:dim
        v(i,j)=  w* v(i,j) + ...
                           a1*(CapBestPos(i,j)- CapPos(i,j))*rand + ...
                           a2*(gFoodPos(j)  - CapPos(i,j))*rand;      
    end
end
     
% CapSA Pos update
for i=1:noP
   if i<noP/2
          if (rand()>=0.1)
               r=rand;
              if r<=0.15
                 CapPos(i,:) =  gFoodPos +    bf*((v(i,:).^2)*sin(2*rand()*1.5))/g;  % Jumping (Projection)
              elseif   r>0.15 && r<=0.30  
                  CapPos(i,:) =  gFoodPos +   cr*bf*((v(i,:).^2)*sin(2*rand()*1.5))/g;  % Jumping (Land)  
              elseif   r>0.30 && r<=0.9      
                  CapPos(i,:) =    CapPos(i,:) +  v(i,:); % Movement on the ground    
              elseif  r>0.9 && r<=0.95 
                 CapPos(i,:) =      gFoodPos   +  bf*sin(rand()*1.5);   % Swing % Local search  
              elseif   r>0.95 
                CapPos(i,:) =       gFoodPos   +  bf*(v(i,:)- v0(i,:));    % Climbing   % Local search
              end
          else
               CapPos(i,:) =           tau*(LB  + rand *(UB- LB));   
      end
    
% Let the followers follow the leaders (update their Pos)
elseif i>=noP/2 && i<=noP 
            
           eps=((rand()+2*rand())-(3*rand()))/(1+rand()); 
     
           Pos(i,:)=gFoodPos+2*(CapBestPos(fol(i),:)-CapPos(i,:))*eps +...
                                 2*(CapPos(i,:)-CapBestPos(i,:))*eps;      
 
          CapPos(i,:)=(Pos(i,:)+ CapPos(i-1,:))/(2); 
    
   end
end 
v0 = v;   
 
for i=1:noP % relocation (Update, exploration)
        u=UB-CapPos(i,:)<0;
        l=LB-CapPos(i,:)>0;
     
         CapPos(i,:)= LB.*l+UB.*u+CapPos(i,:).*~xor(u,l);
    
         CapFit(i,1)=fobj (CapPos(i,:)) ;
         
            if CapFit(i,1)<Fit(i)
                CapBestPos(i,:)=CapPos(i,:);
                Fit(i)=CapFit(i,1);
                
            end 
end
%% Evaluate the new Pos
[fmin,index]=min(Fit); % finding out the best Pos  
% Updating gPos and best Fit
if fmin < fitCapSA
    gFoodPos = CapBestPos(index,:); % Update the global best Pos
    fitCapSA = fmin;
end
% %     % Display the iterative results
% 
%          disp(['Iteration# ', num2str(t) , '  Fit= ' , num2str(fitCapSA)]);
% %    
   % Obtain the convergence curve
     cg_curve(t)=fitCapSA;
     
%  if t>2
%      set(0, 'CurrentFigure', f1)
% 
%         line([t-1 t], [cg_curve(t-1) cg_curve(t)],'Color','b'); 
%         xlabel('Iteration');
%         ylabel('Best score obtained so far');
%         drawnow 
%  end
%   
   
end
fitCapSA =fobj(gFoodPos);
end

04.本代码效果图

【智能优化算法】卷尾猴搜索算法(Capuchin search algorithm,CapSA)-LMLPHP

获取代码请关注MATLAB科研小白的个人公众号(即文章下方二维码),并回复智能优化算法本公众号致力于解决找代码难,写代码怵。各位有什么急需的代码,欢迎后台留言~不定时更新科研技巧类推文,可以一起探讨科研,写作,文献,代码等诸多学术问题,我们一起进步。

05-11 04:31