A list,

Flower Pollinate Algorithm (FPA), a new meta-heuristic swarm intelligence algorithm, and Targeted mutation (TM) strategy, a new differential evolution mutation strategy, are introduced. Aiming at the problems of FPA, such as slow convergence speed, low optimization accuracy and easy to fall into local optimal, an improved flower pollination algorithm based on mutation strategy, MFPA, was proposed. In order to enhance the local development ability of the algorithm, TM strategy is improved and applied to local search process of FPA.





Ii. Source code

Function/PDD, fmin = pso (c1 and c2, Vmax and Vmin and popmax, popmin, sizepop, maxgen) % UNTITLED2 shown here on the function of the elaborate on PLb = % shown here5.12*ones(1.30);
PUb=5.12*ones(1.30);
pop=zeros(sizepop,30);
V=zeros(1.30);
fitnessP=zeros(1,sizepop);
for i=1:sizepop
    pop(i,:)=PLb+(PUb-PLb)*rand;
    V(i,:)=rands(1.30); fitnessP(i)=Fun(pop(i,:)); end [bestfitness bestindex]=min(fitnessP); zbest=pop(bestindex,:); % gbest=pop; % Individual fitnessgBest =fitnessP; % Individual optimum fitness value fitnesszBest =bestfitness; % Global best fitness value % Ntime11=1	;
% Ntime=Ntime11- 1;
% maxgen=0;
% ptol=0.01;
% while(fitnesszbest>ptol),
for i11=1:maxgen
  
    for j=1Update: sizepop % velocity V (j) = V (j:) + c1 * rand * (gbest (j:) - pop rand (j, :)) + c2 * * (zbest - pop (j:)); V(j,find(V(j,:)>Vmax))=Vmax; V(j,find(V(j,:)<Vmin))=Vmin; % population update pop(j,:)=pop(j,:)+0.2*V(j,:); pop(j,find(pop(j,:)>popmax))=popmax; pop(j,find(pop(j,:)<popmin))=popmin; % adaptive pos=unidrnd(30);
        if rand>0.95
            pop(j,pos)=5.12*rands(1.1); End % fitness % pop(j,:)=simpleboundsP(pop(j,:),PLb,PUb); fitnessP(j)=Fun(pop(j,:)); endfor j=1:sizepop % Individually optimal updateiffitnessP(j) < fitnessgbest(j) gbest(j,:) = pop(j,:); fitnessgbest(j) = fitnessP(j); End % group optimal updateif fitnessP(j) < fitnesszbest
        zbest = pop(j,:);
        fitnesszbest = fitnessP(j);
    end
%         Ntime11=Ntime11+1;
       
  
     
    
    end
%     maxgen=maxgen+1;
%     if maxgen>10000,
%         fitnesszbest=ptol- 1;
%     end
%    if round(i11/30)==i11/30,
     pdd(i11)=fitnesszbest; 
%    end
       
end
fmin =fitnesszbest;
end
% function sfP=simpleboundsP(sfP,PLb,PUb)
%   % Apply the lower bound
%   ns_tmpfP=sfP;
%   IfP=ns_tmpfP<PLb;
%   ns_tmpfP(IfP)=PLb(IfP);
%   
%   % Apply the upper bounds 
%   JfP=ns_tmpfP>PUb;
%   ns_tmpfP(JfP)=PUb(JfP);
%   % Update this new move 
%   sfP=ns_tmpfP;
% end
% ======================================================== % 
% Files of the Matlab programs included in the book:       %
% Xin-She Yang, Nature-Inspired Metaheuristic Algorithms,  %
% Second Edition, Luniver Press, (2010).   www.luniver.com %
% ======================================================== %    

% -------------------------------------------------------- %
% Bat-inspired algorithm for continuous optimization (demo)%
% Programmed by Xin-She Yang @Cambridge University 2010    %
% -------------------------------------------------------- %
% Usage: bat_algorithm([20 0.25 0.5]);                     %

function [pblt,fminbl]=bat_algorithm(nb,A,r,BQmin,BQmax,db,NB)
% Display help
%  help bat_algorithm.m

% Default parameters
% if nargin<1,  para=[10 0.25 0.5];  end
% nb=para(1);      % Population size, typically 10 to 25
% A=para(2);      % Loudness  (constant or decreasing)
% r=para(3);      % Pulse rate (constant or decreasing)
% % This frequency range determines the scalings
% BQmin=0;         % Frequency minimum
% BQmax=2;         % Frequency maximum
% % Iteration parameters
%  % Stop tolerance
% N_iter=0;       % Total number of function evaluations
% Dimension of the search variables
% db=5;
% Initial arrays
BLb=5.12*ones(1,db);
BUb=5.12*ones(1,db);
Q=zeros(nb,1);   % Frequency
v=zeros(nb,db);   % Velocities
Solb=zeros(nb,db);
Fitnessb=zeros(1,nb);
Sb=zeros(nb,db);
% Initialize the population/solutions
for i=1:nb,
  Solb(i,:)=BLb+(BUb-BLb)*rand;
  Fitnessb(i)=Fun(Solb(i,:));
end
% Find the current best
[fminb,Ib]=min(Fitnessb);
bestb=Solb(Ib,:);

% ======================================================  %
% Note: As this is a demo, here we did not implement the  %
% reduction of loudness and increase of emission rates.   %
% Interested readers can do some parametric studies       %
% and also implementation various changes of A and r etc  %
% ======================================================  %
% btol=0.01;
% NB=0;
% Start the iterations -- Bat Algorithm
% while(fminb>btol),
for tb =1: NB,
        % Loop over all bats/solutions
        for i=1:nb,
          Q(i)=BQmin+(BQmin-BQmax)*rand;
          v(i,:)=v(i,:)+(Solb(i,:)-bestb)*Q(i);
          Sb(i,:)=Solb(i,:)+v(i,:);
          % Pulse rate
          if rand>r
              Sb(i,:)=bestb+0.01*randn(1,db);
          end

     % Evaluate new solutions
       Sb(i,:)=BsimpleboundsP(Sb(i,:),BLb,BUb);
           Fnewb=Fun(Sb(i,:));
     % If the solution improves or not too loudness
           if (Fnewb<=Fitnessb(i)) & (rand<A) ,
                Solb(i,:)=Sb(i,:);
                Fitnessb(i)=Fnewb;
           end

          % Update the current best
          ifFnewb<=fminb, bestb=Sb(i,:); fminb=Fnewb; End end function [aa,fminf,Ntime] = fpa(n,p,N_iter,d) %UNTITLED3 Lb=- 600.*ones(1,d);
Ub=600*ones(1,d);
 Sol=zeros(n,d);
  Fitness=zeros(1,n);
for i=1:n,
  Sol(i,:)=Lb+(Ub-Lb)*rand;
  Fitness(i)=Fun(Sol(i,:));
end

% Find the current best
[fmin,I]=min(Fitness);
best=Sol(I,:);
S=Sol;
 Ntime=1;
  Ntime= Ntime- 1;
for t=1:N_iter,
        % Loop over all bats/solutions
        for i=1:n,
          % Pollens are carried by insects and thus can move in
          % large scale, large distance.
          % This L should replace by Levy flights  
          % Formula: x_i^{t+1}=x_i^t+ L (x_i^t-gbest)
          if rand<p,
          %% L=rand;
          L=Levy(d);
          
          dS=L.*(Sol(i,:)-best);
          S(i,:)=Sol(i,:)+dS;
          
          % Check if the simple limits/bounds are OK
          S(i,:)=simplebounds(S(i,:),Lb,Ub);
          
          % If not, then local pollenation of neighbor flowers 
          else
              epsilon=rand;
              % Find random flowers in the neighbourhood
              JK=randperm(n);
             

%               end
              % As they are random, the first two entries also random
              % If the flower are the same or similar species, then
              % they can be pollenated, otherwise, no action.
              % Formula: x_i^{t+1}+epsilon*(x_j^t-x_k^t)
%            
               S(i,:)=S(i,:)+epsilon*(Sol(JK(1))-Sol(JK(2)));
%               
              % Check if the simple limits/bounds are OK
              S(i,:)=simplebounds(S(i,:),Lb,Ub);
          end
Copy the code

3. Operation results

Fourth, note

Version: 2014 a