Introduction to chimp Optimization Algorithm (ChOA)

1 Mathematical description of ChOAChimpanzee optimization Algorithm (ChOA) is a new meta-heuristic optimization algorithm proposed by M.Khi She et al in 2020 based on the hunting behavior of chimpanzee groups. ChOA solved the problem by simulating four types of chimpanzee cooperative hunting behaviors: attack, drive, intercept and chase. Compared with other algorithms, ChOA has the characteristics of fast convergence speed and high optimization accuracy. (1) Drive and chase prey. During chimpanzee hunting, hunting duties are usually assigned according to individual intelligence and sexual motivation. Any chimpanzees random changing its position in the space surrounding prey, mathematical description for d = cx prey | (t) – mx chimp (t) | (1) x chimp (t + 1) = x prey (t) – (2) the type of AD: d as chimpanzees and prey spacing; T is the current iteration number; X prey(t) is the prey position vector; X chimp(t) is the chimpanzee position vector; A, m and c are coefficient vectors, a= 2FR 1-F, C =2r 2, m=Chaotic_value(chaotic vectors based on chaotic mapping), f is the nonlinear reduction from 2.0 to 0 in the iterative process, r 1 and R 2 are random vectors within the range of [0, 1]. (2) Attack mode. Chimpanzees can detect the location of prey (by driving, blocking, and chasing) and then surround it. Hunting is usually carried out by attacking chimpanzees, driving them, intercepting them, and chasing them into the hunt. Four species of chimpanzees update their positions by the following formula, other chimpanzees update their positions according to the best chimpanzee position, and prey positions are estimated by the best chimpanzee individual position. Mathematically described asWhere, dAttacker, dBarrier, dChaser and dDriver are the current distances between attacking, intercepting, chasing and driving chimpanzees and their prey respectively. XAttacker, xBarrier, xChaser and xDriver are the position vectors of attacking, intercepting, chasing and driving the chimpanzee relative to the prey, respectively. A1 ~ A4, M1 ~ M4 and C1 ~ C4 are the coefficient vectors of attacking, intercepting, chasing and driving chimpanzee respectively. X1, x2, x3 and X4 are the update vectors of attacking chimpanzee, intercepting chimpanzee, chasing chimpanzee and driving chimpanzee. X is the other chimpanzee position vector. (3) Attack and seek prey. In the final stages of the hunt, chimpanzees on the one hand change their position according to the position of the attacker, the driver, the interceptor and the pursuer, and attack the prey; Chimpanzees, on the other hand, show the exploration process by dispersing their search for prey, a ChOA global search. (4) Social motivation. Social motivation (sex and grooming) causes chimpanzees to abdicate their hunting duties, and this behavior helps ChOA overcome shortcomings such as falling into local optimum and slow convergence when solving high-dimensional problems. During the optimization process, chimpanzee normal position update or chaotic model position update were selected with 50% probability. The mathematical model is expressed asWhere, μ is a random number within the range of [0,1].

Two, some source code

%___________________________________________________________________%

% You can simply define your cost in a seperate file and load its handle to fobj 
% The initial parameters that you need are:
%__________________________________________
% fobj = @YourCostFunction
% dim = number of your variables
% Max_iteration = maximum number of generations
% SearchAgents_no = number of search agents
% lb=[lb1,lb2,...,lbn] where lbn is the lower bound of variable n
% ub=[ub1,ub2,...,ubn] where ubn is the upper bound of variable n
% If all the variables have equal lower bound you can just
% define lb and ub as two single number numbers

%
%__________________________________________

clear all 
clc

SearchAgents_no=30; % Number of search agents
N=SearchAgents_no;
Function_name='F2'; % Name of the test function that can be from F1 to F23 (Table 3.4.5 in the paper)

Max_iteration=500; % Maximum numbef of iterations
Max_iter=Max_iteration;

% Load details of the selected benchmark function
[lb,ub,dim,fobj]=Get_Functions_details(Function_name);


[ABest_scoreChimp,ABest_posChimp,Chimp_curve]=Chimp(SearchAgents_no,Max_iteration,lb,ub,dim,fobj);
[PSO_gBestScore,PSO_gBest,PSO_cg_curve]=PSO(N,Max_iteration,lb,ub,dim,fobj);
[TACPSO_gBestScore,TACPSO_gBest,TACPSO_cg_curve]=TACPSO(N,Max_iteration,lb,ub,dim,fobj);
[MPSO_gBestScore,MPSO_gBest,MPSO_cg_curve]=MPSO(N,Max_iteration,lb,ub,dim,fobj);

% PSO_cg_curve=PSO(SearchAgents_no,Max_iteration,lb,ub,dim,fobj); % run PSO to compare to results

figure('Position'[500 500 660 290])
%Draw search space
subplot(1.2.1);
func_plot(Function_name);
title('Parameter space')
xlabel('x_1');
ylabel('x_2');
zlabel([Function_name,'( x_1 , x_2 )'])

%Draw objective space
subplot(1.2.2);
semilogy(MPSO_cg_curve,'Color'.'g')
hold on
semilogy(PSO_cg_curve,'Color'.'b')
hold on
semilogy(TACPSO_cg_curve,'Color'.'y')
hold on
semilogy(Chimp_curve,'--r')


title('Objective space')
xlabel('Iteration');
ylabel('Best score obtained so far');

axis tight
grid on
box on
legend('MPSO'.'PSO'.'TACPSO'.'Chimp')
img =gcf; Print (img,'-dpng'.'-r600'.'./img.png'Display ([dPI] display([dPI]'The best optimal value of the objective funciton found by TACPSO is : ', num2str(TACPSO_gBestScore)]);
display(['The best optimal value of the objective funciton found by PSO is : ', num2str(PSO_gBestScore)]);
display(['The best optimal value of the objective funciton found by PSO is : ', num2str(MPSO_gBestScore)]);
display(['The best optimal value of the objective funciton found by Chimp is : ', num2str(ABest_scoreChimp)]); % % %Chimp Optimization Algorithm (ChOA)Source Codes Version 1.0 Function O=chaos(index,max_iter,Value)

O=zeros(1,max_iter);
x(1) =0.7;
switch index
%Chebyshev map
    case 1
for i=1:max_iter
    x(i+1) =cos(i*acos(x(i)));
    G(i)=((x(i)+1)*Value)/2;
end
    case 2
%Circle map
a=0.5;
b=0.2;
for i=1:max_iter
    x(i+1)=mod(x(i)+b-(a/(2*pi))*sin(2*pi*x(i)),1);
    G(i)=x(i)*Value;
end
    case 3
%Gauss/mouse map
for i=1:max_iter
    if x(i)==0
        x(i+1) =0;
    else
        x(i+1)=mod(1/x(i),1);
    end
    G(i)=x(i)*Value;
end

    case 4
%Iterative map
a=0.7;
for i=1:max_iter
    x(i+1) =sin((a*pi)/x(i));
    G(i)=((x(i)+1)*Value)/2;
end

    case 5
%Logistic map
a=4;
for i=1:max_iter
    x(i+1)=a*x(i)*(1-x(i));
    G(i)=x(i)*Value;
end
    case 6
%Piecewise map
P=0.4;
for i=1:max_iter
    if x(i)>=0 && x(i)<P
        x(i+1)=x(i)/P;
    end
    if x(i)>=P && x(i)< 0.5x(i+1)=(x(i)-P)/(0.5-P);
    end
    if x(i)>=0.5 && x(i)<1-P
        x(i+1)= (1-P-x(i))/(0.5-P);
    end
    if x(i)>=1-P && x(i)< 1x(i+1)= (1-x(i))/P;
    end    
    G(i)=x(i)*Value;
end

    case 7
%Sine map
for i=1:max_iter
     x(i+1) = sin(pi*x(i));
     G(i)=(x(i))*Value;
 end
    case 8
 %Singer map 
 u=1.07;
 for i=1:max_iter
     x(i+1) = u*(7.86*x(i)23.31*(x(i)^2) +28.75*(x(i)^3)13.302875*(x(i)^4));
     G(i)=(x(i))*Value;
 end
    case 9
%Sinusoidal map
 for i=1:max_iter
     x(i+1) = 2.3*x(i)^2*sin(pi*x(i));
     G(i)=(x(i))*Value;
 end
 
    case 10
 %Tent map
 x(1)=0.6;
 for i=1:max_iter
     if x(i)<0.7
         x(i+1)=x(i)/0.7;
     end
     if x(i)>=0.7
         x(i+1) = (10/3) * (1-x(i));
     end
     G(i)=(x(i))*Value;
 end

end
O=G;

Copy the code

3. Operation results

Matlab version and references

1 matlab version 2014A

[1] Yang Baoyang, YU Jizhou, Yang Shan. Intelligent Optimization Algorithm and Its MATLAB Example (2nd Edition) [M]. Publishing House of Electronics Industry, 2016. [2] ZHANG Yan, WU Shuigen. MATLAB Optimization Algorithm source code [M]. Tsinghua University Press, 2017. [3] CHENG Guosen, CUI Dongwen. Application of Chimpanzee optimization algorithm-Extreme Learning Machine Model in classification of water abundance [J]. Yellow River of the People. 211,43(07)