The Sparrow optimization algorithm that combines Osprey and Cauchy mutation takes off with great results! Improved Sparrow, highly recommended!

Friends often leave messages in the background asking:

Can the algorithm improved by the author be used to write a paper?

The answer is: of course!

If my article can help you write a paper, it would be the author's honor!

The Osprey-Cauchy-Sparrow Search Algorithm (OCSSA) algorithm brought to you today, which combines Osprey and Cauchy mutations, directly outperforms excellent algorithms such as dung beetle, sparrow, and subtractive optimizer, and is also outstanding. It will increase the complexity of the algorithm. In the main loop, the fitness function is only called once, so it can be used for the optimization of complex projects. The running time will not rise as sharply as some improved algorithms that incorporate reverse learning, greedy strategies, etc.

Based on the Sparrow algorithm, the improvements are as follows:

① Use Logistic chaos mapping to initialize the diversity of the population.

②The global exploration strategy of the Osprey optimization algorithm in the first stage is used to replace the explorer position update formula of the original Sparrow algorithm. The Osprey optimization algorithm can make up for the sparrow algorithm's over-reliance on the update method of the sparrow position of the previous generation, by randomly detecting the position of one of the foods and attacking it. The position update method of the explorer in the Sparrow algorithm is updated based on the movement simulation method of osprey to fish. The global exploration strategy formula of the Osprey optimization algorithm in the first stage is as follows:

004f68f3ee227037ae32ee73cb9d6378.png

③The Cauchy mutation strategy is used to replace the follower position update formula of the original Sparrow algorithm. The Cauchy distribution is similar to the standard normal distribution. It is a continuous probability distribution with a small value at the origin, long and flat ends, and a slow approach to zero. Therefore, it can produce greater disturbances than the normal distribution. Therefore, Cauchy mutation is used to perturb the individuals in the sparrow position update, thereby expanding the search scale of the sparrow algorithm and thereby improving the algorithm's ability to jump out of the local optimum.

Tested on the CEC2005 function set, the results are as follows: OCSSA is the improved algorithm proposed in this article, SSA is the original sparrow optimization algorithm, DBO is the dung beetle optimization algorithm, SABO is the subtractive average optimizer algorithm, and GTO is the artificial gorilla troop optimization algorithm.

The algorithm is iterated 1000 times, and the number of particles for each algorithm is set to 100.

CEC2005 test results

c8644542b702e1bb3077a253dbe2c97f.png

49112bd37901d03ad0d381d06043805b.png

3b6bbf23d9678b77ab0dfe56ae624a35.png

946969d4aced9f31d6670ee3a4368652.png

619f88782d5e4ed2ed214de6461c6b60.png

4c26970688d93144f5bb5ea2801caa0e.png

CEC2021 test results

8c97a6d1ee2c08662993dd5bedac168a.png

3b45b1f2691c7df301d20f77e416c361.png

4059f653f8983a3da4c19959497b63d6.png

8365d96be773ab0a1caca841cb6eb901.png

5700a01280848843ceaac9b480155523.png

Friendly reminder: If you find that some legends have only one point in the curve, such as the F3 function of the CEC2021 test set, it proves that this algorithm converges very quickly and has converged to 0 in the early stage!

Result analysis : In the test of single-peak function and multi-peak function, we can see that the optimization effect of the Sparrow algorithm integrating Osprey and Cauchy mutation Sparrow optimization is really good!

Code display

clear
clc
close all
dim = 20; % 维度,可选 10, 20
number= 9;  % 函数名:1 - 10
[lower_bound,upper_bound,variables_no,fobj] = Get_Functions_cec2021(number,dim);
% [lower_bound,upper_bound,variables_no,fobj]=CEC2005(number);  % [lb,ub,D,y]:下界、上界、维度、目标函数表达式
pop_size=50;                      % population members 
max_iter=1000;                  % maximum number of iteration
%% OOA
[DBO_Best_score,Best_pos,DBO_curve]=DBO(pop_size,max_iter,lower_bound,upper_bound,variables_no,fobj);  % Calculating the solution of the given problem using OOA 
display(['The best optimal value of the objective funciton found by DBO  for ' [num2str(number)],'  is : ', num2str(DBO_Best_score)]);
%% GTO
[GTO_Best_score,~,GTO_curve]=GTO(pop_size,max_iter,lower_bound,upper_bound,variables_no,fobj);
display(['The best optimal value of the objective funciton found by GTO  for ' [num2str(number)],'  is : ', num2str(GTO_Best_score)]);
%% SSA
[SSA_Best_score,~,SSA_curve]=SSA(pop_size,max_iter,lower_bound,upper_bound,variables_no,fobj);
display(['The best optimal value of the objective funciton found by SSA  for ' [num2str(number)],'  is : ', num2str(SSA_Best_score)]);
%% SABO
[SABO_Best_score,~,SABO_curve]=SABO(pop_size,max_iter,lower_bound,upper_bound,variables_no,fobj);
display(['The best optimal value of the objective funciton found by SABO  for ' [num2str(number)],'  is : ', num2str(SABO_Best_score)]);
%% OCSSA
[OCSSA_Best_score,~,OCSSA_curve]=OCSSA(pop_size,max_iter,lower_bound,upper_bound,variables_no,fobj);
display(['The best optimal value of the objective funciton found by OCSSA  for ' [num2str(number)],'  is : ', num2str(OCSSA_Best_score)]);
 %% Figure
figure
CNT=20;
k=round(linspace(1,max_iter,CNT)); %随机选CNT个点
% 注意:如果收敛曲线画出来的点很少,随机点很稀疏,说明点取少了,这时应增加取点的数量,100、200、300等,逐渐增加
% 相反,如果收敛曲线上的随机点非常密集,说明点取多了,此时要减少取点数量
iter=1:1:max_iter;
   semilogy(iter(k),SSA_curve(k),'k-o','linewidth',1);
    hold on
    semilogy(iter(k),DBO_curve(k),'b-^','linewidth',1);
    hold on
    semilogy(iter(k),SABO_curve(k),'r-x','linewidth',1);
    hold on
    semilogy(iter(k),GTO_curve(k),'m-*','linewidth',1);
    hold on
    semilogy(iter(k),OCSSA_curve(k),'g-p','linewidth',1);
grid on;
title(['F',num2str(number),'收敛曲线'])
xlabel('迭代次数');
ylabel('适应度值');
box on
legend('SSA','DBO','SABO','GTO','OCSSA')
set (gcf,'position', [300,300,600,330]

How to obtain the complete code and reply keywords in the background. Key words:

OCSSA

Guess you like

Origin blog.csdn.net/woaipythonmeme/article/details/132614236