A list,

Cuckoo algorithm, English called Cuckoo search (CS algorithm). The mother of this kind of Cuckoo is very lazy. She lays eggs by herself and doesn’t keep them. She usually throws her baby into the nest of other kinds of birds. However, when they hatched, they met the clever mother bird, who knew at first sight that they were not their own, and they were directly killed by the mother bird. So this group of cuckoo babies in order to save their lives, they imitate the bird calls of other species, so that the mother bird with low IQ or eq is mistaken for their own baby, so that it will survive. Cuckoo Search (CS) is an optimization algorithm proposed by Xin-she Yang and Suash Deb in Cuckoo Search via Levy Flights in 2009. Cuckoo algorithm is a swarm intelligent search technology combining the parasitic cuckoo nest and Levy Flights model. It can find an optimal nest to hatch its own eggs by random walk search. This approach can achieve an efficient optimization mode.

1. Nest parasitism of cuckoo 2 Levy’s flight Figure 1. Schematic diagram of simulated Levi’s flight path

3 cuckoo search algorithm implementation process

Ii. Source code

close all;
clear;
clc;
format long;

n=20; %%% Initializes the number of nests pa=0.25; %%% % Probability of an alien bird's egg being found by the Nestor5%%% Probability that the Nestor bird finds parasitic eggs %%%% Maximum number of iterations N_iter=300; REP=[]; RC=[]; R1=[]; %% defines the global variable nd global nd; nd=15; %%% Search dimension Lb=- 5*ones(1,nd); % lower bound Ub =5*ones(1,nd); % upper limit % %%% random initial resolution based on SOBOL sequencefor xh=1:20
    xh
p = sobolset(nd,'Skip'.1e2);
p = scramble(p,'MatousekAffineOwen');
SOBOL = net(p,n);
for i=1:n
    for j=1:nd
        nest(i,j)=Lb(1,j)+(Ub(1,j)-Lb(1,j))*SOBOL(i,j);
    end
end
maxFun=4; % Number of objective function iterations=1; %%% Calculate the initial objective function value % disp('Start computing the initialization objective function...... ')
   
for i=1:n
    cstatisc(1,i)=statisc(nest(i,:));
    ccost(1,i)=costc(nest(i,:));
    ctimec(1,i)=timec(nest(i,:));
    cquality(1,i)=qualityc(nest(i,:));
end
% disp('Initializing objective function computation ends...... ') %% determine the non-inferior solution of particles, treat each particle as a non-inferior solution'Generate ST matrix... ') % is used to store particle informationfor i=1:n
    ST(i,1:nd)=nest(i,:);
end

ST(:,nd+1)=cstatisc(1, :); ST(:,nd+2)=ccost(1, :); ST(:,nd+3)=ctimec(1, :); ST(:,nd+4)=cquality(1, :); ST(:,nd+5) =0; %%STS matrix stores particle information (including four objective function values) STS=ST; % %%%pop for firefly particle % XINXI=ST; % popo=ST; % kk=1; % %%% filters the intelligibility and makes it0.7857
%         while(kk<=size(STS,1))
%             if (STS(kk,nd+2) >3||STS(kk,nd+3) >3)
%                 STS(kk,:)=[];
%                 kk=kk- 1;
%             end
%                 kk=kk+1; % end %%------------- Initialize the external file set --------%% %disp('External archive set initialization... ')

for i=1:size(STS,1)
    if (isempty(REP))
        REP(1,:)=ST(i,:);
        RC=[RC;ST(i,:)];
    else
         for k=1:size(REP,1) % %ifThe ith cuckoo STS(I, :) dominates the KTH cuckoo in the elite pool REP, delete the KTH cuckooif (((STS(i,nd+1)>=REP(k,nd+1))&&(STS(i,nd+2)<=REP(k,nd+2))&&(STS(i,nd+3)<=REP(k,nd+3))&&(STS(i,nd+4)>=REP(k,nd+4)))&&((STS(i,nd+1)>REP(k,nd+1))||(STS(i,nd+2)<REP(k,nd+2))||(STS(i,nd+3)<REP(k,nd+3))||(STS(i,nd+4)>REP(k,nd+4))))
                REP(k,1) =9999; %%% one of the domination flags, indicating that the ith cuckoo information STS(I,:) dominates REP (k, :). To delete REP (k, :), save STS(I,:) insert_flag=1; The %%elseif condition is used to determine that the ith cuckoo does not dominate rule K in the elite pool. This rule does not need to be removed from the elite pool elseif ((STS(I,nd+)1)<=REP(k,nd+1))&&(STS(i,nd+2)>=REP(k,nd+2))&&(STS(i,nd+3)>=REP(k,nd+3))&&(STS(i,nd+4)<=REP(k,nd+4)))&&((STS(i,nd+1)<REP(k,nd+1))||(STS(i,nd+2)>REP(k,nd+2))||(STS(i,nd+3)>REP(k,nd+3))||(STS(i,nd+4)<REP(k,nd+4))))
                    insert_flag=0; If the ith cuckoo does not dominate REP(k,:), this rule is not removedbreak; %%% determine whether STS(I,:) and REP(k,:) are repeated elseif((((STS(I,nd+1)==REP(k,nd+1))&&(STS(i,nd+2)==REP(k,nd+2))&&(STS(i,nd+3)==REP(k,nd+3))&&(STS(i,nd+4)==REP(k,nd+4))))) %%% STS(I,1Nd with the REP (k,1Before: nd)1: whether the nd dimension elements are equal, if so, STS(I,1Nd with the REP (k,1:nd) repeat %%%% without changing STS(I,1:nd) join REP or join elite poolif ((STS(i,nd+1) = =0)||(STS(i,nd+2) = =0)||(STS(i,nd+3) = =0)||(STS(i,nd+4) = =0))
                            insert_flag=0;
                    elseif (isempty(setdiff(STS(i,1:nd),REP(k,1:nd))))
                            insert_flag=0; %%% repeat, do not add STS(I,:) to elite pool REPelse
                            insert_flag=0; %%% if not repeated, join elite pool REP// It should be insert_flag=1
                    end
            elseThe %%% code determines that STS and REP are not owned by each other when one of the target functions is0This rule does not need to be added to the elite pool, otherwise it will be addedif ((STS(i,nd+1) ~ =0)&&(STS(i,nd+2) ~ =0)&&(STS(i,nd+3) ~ =0)&&(STS(i,nd+4) ~ =0))
                    insert_flag=1;
                 elseif((STS(i,nd+1) = =0)||(STS(i,nd+2) = =0)||(STS(i,nd+3) = =0)||(STS(i,nd+4) = =0))
                     insert_flag=0;
                 end
            end
        end
        k1=1; % % %while(k1<=size(REP,1))
            if (REP(k1,1) = =9999)
                REP(k1,:)=[];
                k1=k1- 1;
            end
                k1=k1+1;
        end
        
        if (insert_flag==1)
            REP((size(REP,1) +1:)),=STS(i,:); RC=[RC;STS(i,:)]; %%% cuckoo information that has been placed in the elite poolend
    end
end
disp('Officially entering the main loop --')
iterations=2;
tic
while(iterations<N_iter)
    gbestpool= [];if (size(REP,1) >2)
        for f=1: maxFun % sortfor i=1:(size(REP,1)- 1)
                for j=(i+1):(size(REP,1))
                    if(REP(i,nd+f)<REP(j,nd+f)) temp=REP(i,:); REP(i,:)=REP(j,:); REP(j,:)=temp; End end end % sort end REP(1,nd+5) =10;
            REP(size(REP,1),nd+5) =10; % find the maximum and minimum objective function values fmax=0;
            for i=1:size(REP,1)
                if (REP(i,nd+f)>fmax)
                    fmax=REP(i,nd+f);
                end
            end
             fmin=10;
            for i=1:size(REP,1)
                if(REP(i,nd+f)<fmin) fmin=REP(i,nd+f); End end % Find maximum and minimum objective function values end % crowding distancefor i=2:(size(REP,1)- 1)
                REP(i,nd+5)= REP(i,nd+5) +abs((REP(i+1,nd+f)-REP(i- 1,nd+f))/(fmax-fmin));
            end   
        end    
    else 
        REP(1,nd+5)=10; End % Calculates crowding distance End % Sorts by crowding distancefor i=1:(size(REP,1)- 1)
            for j=(i+1):size(REP,1)
                if (REP(i,nd+5)<REP(j,nd+5)) temp=REP(i,:); REP(i,:)=REP(j,:); REP(j,:)=temp; End end end % Sort end by congestion distance % Select before10% of particles are stored in gBestPoolfor i=1:ceil(size(REP,1) *0.1) gbestpool=[gbestpool;REP(i,:)]; End % Before selection10End %% Randomly select one as the best solution GB = gBestPool (fix(1+(size(gbestpool,1)- 1)*rand),:);
        best=gb(1.1:nd); New_nest =get_cuckoos_levy(nest,best,Lb,Ub); %%% found and randomly selectedfor i=1:n
    fitness(1,i)=statisc(new_nest(i,:));
    fitness(2,i)=costc(new_nest(i,:));
    fitness(3,i)=timec(new_nest(i,:));
   fitness(4,i)=qualityc(new_nest(i,:)); End the first t + % %1The substitution is compared to the t-th substitution, iffor i=1:n
    if fitness(1,i)>=cstatisc(iterations- 1,i)&&fitness(2,i)<=ccost(iterations- 1,i)&&fitness(3,i)<= ctimec(iterations- 1,i)&& fitness(4,i)>=cquality(iterations- 1,i)
         best_new_nest(i,:)=new_nest(i,:);
    else
         best_new_nest(i,:)=nest(i,:);
    end
    
end 
Copy the code

Third, the operation result

Fourth, note

Version: 2014 a