10 chaotic map optimization gray wolf algorithms, which can be switched with one key, can be used to optimize all swarm intelligence algorithms. The gray wolf algorithm is used as an example to introduce...

"  This article uses 10 common and uncommon chaotic maps to optimize the swarm intelligence algorithm. The code can be switched with one key and can be used for all intelligent algorithm optimization. This article uses the gray wolf algorithm as an example to introduce "

This article involves 10 kinds of chaotic mapping algorithms, which are used when initializing intelligent algorithm particles. The 10 kinds of chaotic mapping algorithms include: Tent mapping, Logistic mapping, Cubic mapping, chebyshev mapping, Piecewise mapping, sinusoidal mapping, Sine mapping, ICMIC mapping, Circle Mapping, Bernoulli Mapping . Regarding the principle of each method mapping, this article will not introduce them one by one.

01

What is the use of choosing a chaotic map

It has been proved by experiments that the fitness function value of random numbers generated by chaotic maps is significantly improved, and better results can be obtained by replacing conventional uniformly distributed random number generators with chaotic maps, especially when there are many local solutions in the search space. It is easier to search for the global optimal solution. In a word: Chaos mapping can enhance the randomness and diversity of particles.

02

Chaos Map Visualization Picture

Take Tent mapping and Logistic mapping as examples to show the result graph. Of course, there is really no big difference with the naked eye. The results drawn by the other 8 kinds of chaotic maps are similar to this one, so I will not show them one by one.

db87f9d2e1319558db0c574acfcb4c49.png

03

10 kinds of chaotic map optimization gray wolf algorithm

Taking the Logistic chaotic map as an example, it is still tested on the CEC2005 function. Using the Logistic chaotic map to optimize the gray wolf algorithm results are as follows:

902f0d0ccb2c0b76009067ccad72a260.png

d5e365608f0360ebddda91cffd6dae11.png

766f5213fa4eb9d5bc42b71e7f78e2db.png

2845bad7320ae7430fee2a061df51d54.png

d4276c457a67367c701b42a1adaa271b.png

7816ae43ad63c5b08899a519412a147d.png

0ec4bb81e1cebe78f2769dff81d58853.png

4d7bbd9e436cf6862d774fb762e41244.png

186e0bb236ebbb948f0837ad7e665bfc.png

2ef5813106a2a34ae58bd5e304a206df.png

04

Result analysis

    Here, the optimization of 10 functions is selected as the result display. The optimization results of these 10 functions show that the intelligent algorithm of chaos mapping optimization is not effective for every function, such as F6 and F8.

    Here I want to explain in particular that the chaotic map optimization intelligent algorithm, theoretically speaking, only makes the initialized particles more random and diverse, which can indeed speed up the convergence speed of the algorithm, but once the cycle starts, the remaining There is no such thing as chaos optimization.

    In other words, if I directly use the rand function to generate a bunch of particles, there is a certain probability that the particles generated by chaos optimization are better than those generated by chaos optimization. If the effect is not good, don't be discouraged. After all, chaos optimization is only a means of optimizing intelligent algorithms, and you can optimize it together with other means.

05

code display

clear
clc
close all
number='F9'; %选定优化函数,自行替换:F1~F23
% [lb,ub,D,y]:下界、上界、维度、目标函数表达式
[lb,ub,dim,fobj]=CEC2005(number);  


SearchAgents_no=30; %种群规模
Max_iter=1000; %最大迭代次数


%调用灰狼算法
numm = 2; %% numm 混沌映射类型选择,1-10,tent、Logistic、Cubic、chebyshev、Piecewise、sinusoidal、Sine,ICMIC, Circle,Bernoulli,自由切换
[chaosAlpha_score,chaosAlpha_pos,chaosConvergence_curve]=GWO(numm,SearchAgents_no,Max_iter,lb,ub,dim,fobj);


fprintf ('Best solution obtained by chaosGWO: %s\n', num2str(chaosAlpha_pos,'%e  '));
fprintf ('Best objective function value obtained by chaosGWO: %e \n', chaosAlpha_score);


numm = 11;  % numm 混沌映射类型选择,当numm等于11时,采用原始的随机数,也就是最原始的灰狼算法
[Alpha_score,Alpha_pos,Convergence_curve]=GWO(numm,SearchAgents_no,Max_iter,lb,ub,dim,fobj);


fprintf ('Best solution obtained by GWO: %s\n', num2str(Alpha_pos,'%e  '));
fprintf ('Best objective function value obtained by GWO: %e \n', Alpha_score);
%% Figure
figure1 = figure('Color',[1 1 1]);
G1=subplot(1,2,1,'Parent',figure1);
func_plot(number)
title(number)
xlabel('x')
ylabel('y')
zlabel('z')
subplot(1,2,2)
G2=subplot(1,2,2,'Parent',figure1);
CNT=20;
k=round(linspace(1,Max_iter,CNT)); %随机选CNT个点
% 注意:如果收敛曲线画出来的点很少,随机点很稀疏,说明点取少了,这时应增加取点的数量,100、200、300等,逐渐增加
% 相反,如果收敛曲线上的随机点非常密集,说明点取多了,此时要减少取点数量
iter=1:1:Max_iter;
semilogy(iter(k),Convergence_curve(k),'b-*','linewidth',1);
hold on
semilogy(iter(k),chaosConvergence_curve(k),'m-p','linewidth',1);
grid on;
title('收敛曲线')
xlabel('迭代次数');
ylabel('适应度值');
box on
legend('GWO','chaosGWO')
set (gcf,'position', [300,300,800,350])

It can be seen from the code that each code information of the author has made detailed comments. There is a key parameter numm in line 12 of the code. You can manually adjust this variable to realize different intelligent algorithms for chaos mapping optimization.

There are 10 types to choose from, Tent mapping, Logistic mapping, Cubic mapping, chebyshev mapping, Piecewise mapping, sinusoidal mapping, Sine mapping, ICMIC mapping, Circle mapping, Bernoulli mapping.

The author has written these 10 kinds of chaos maps into a script function named " chaos.m" . It is easy to extend to other codes.

Friendly reminder: If you say that the effect of other chaotic mapping optimization is not good, you can manually modify the chaos coefficient of each chaotic mapping method in chaos.m .

Okay, that's all for today. Reply to the keyword in the card below: chaos , get the complete code

If you feel good, leave a little like for the blogger! A little praise from you is the driving force for bloggers to update! Thanks!

Guess you like

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