获取资源
请见文章第5节:资源获取】此算法详细介绍请参考POA算法介绍
采用随机方法初始化POA种群,生成的种群不均匀,影响了收敛速度和精度。为了获得更好的初始种群,本文采用了随机对立学习策略来进行种群初始:
X i , n e w = ( l + u ) − k X i (1) X_{i,new}=(l+u)-kX_{i}\tag1 Xi,new=(l+u)−kXi(1)
其中, X i X_{i} Xi为原解, X i , n e w X_{i,new} Xi,new为随机对立学习生成的反向解, k k k为[0,1]之间的随机数。
经过随机对立学习策略后,生成了 N N N个反向解,如果反向解的适应度值优于原解,就用反向解替代原解,否则保留原解。
基本鹈鹕优化算法的开发阶段,在迭代后期会存在陷入局部最优的情况,使搜索失败。为克服这一弊端,再在其位置更新公式中加入动态权重系数 ω,让它在迭代初期具有较大值,促进全局搜索,迭代后期自适应变小,促进局部搜索并加快收敛速度。
透镜成像折射反向学习策略的思想来自于凸透镜成像的原理。通过基于当前坐标生成一个反向位置来扩展搜索范围,如图1所示。
在二维坐标中,x轴的搜索范围为(a, b), y轴表示一个凸透镜。假设物体A在x轴上的投影为x,高度为h,通过透镜成像,另一侧的图像为A*, A在x轴上的投影为x,高度为h*。通过以上分析,我们可以得到如下公式:
( a + b ) / 2 − x x ∗ − ( a + b ) / 2 = h h ∗ (2) \frac{(a+b)/2-x}{x^{*}-(a+b)/2 }=\frac{h}{h^{*}} \tag2 x∗−(a+b)/2(a+b)/2−x=h∗h(2)
对公式(2)进行转换,即可得到反向解x*的表达式为:
x ∗ = a + b 2 + a + b 2 k − x k (3) x^{*} =\frac{a+b}{2}+\frac{a+b}{2k}-\frac{x}{k} \tag3 x∗=2a+b+2ka+b−kx(3)
其中, k = h / h ∗ k=h/h^{*} k=h/h∗, a a a和 b b b可以视为某维度的上下限。本文中的 k k k是一个与迭代次数相关的动态自适应值。
%%
clc
clear
close all
%%
Fun_name='F1'; % number of test functions: 'F1' to 'F23'
SearchAgents=30; % number of Pelicans (population members)
Max_iterations=500; % maximum number of iteration
[lb,ub,dim,fobj]=Get_Functions_details(Fun_name); % Object function information
[Best_score_POA,Best_pos_POA,POA_curve]=POA(SearchAgents,Max_iterations,lb,ub,dim,fobj);
[Best_score_SSA,Best_pos_SSA,SSA_curve]=SSA(SearchAgents,Max_iterations,lb,ub,dim,fobj);
[Best_score_WOA,Best_pos_WOA,WOA_curve]=WOA(SearchAgents,Max_iterations,lb,ub,dim,fobj);
[Best_score_GWO,Best_pos_GWO,GWO_curve]=GWO(SearchAgents,Max_iterations,lb,ub,dim,fobj);
[Best_score_IPOA,Best_pos_IPOA,IPOA_curve]=IPOA(SearchAgents,Max_iterations,lb,ub,dim,fobj);
%%
figure('Position',[454 445 694 297]);
subplot(1,2,1);
func_plot(Fun_name);
title('Parameter space')
xlabel('x_1');
ylabel('x_2');
zlabel([Fun_name,'( x_1 , x_2 )'])
subplot(1,2,2);
t = 1:Max_iterations;
semilogy(t, POA_curve, 'b-', t, SSA_curve, 'k-', t, WOA_curve, 'g-', t, GWO_curve, 'm-', t, IPOA_curve, 'r-','linewidth', 1.5);
title(Fun_name)
xlabel('Iteration');
ylabel('Best fitness function');
axis tight
legend('POA','SSA','WOA','GWO','IPOA')
display(['The best solution obtained by POA for ' [num2str(Fun_name)],' is : ', num2str(Best_pos_POA)]);
display(['The best optimal value of the objective funciton found by POA for ' [num2str(Fun_name)],' is : ', num2str(Best_score_POA)]);
display(['The best solution obtained by SSA for ' [num2str(Fun_name)],' is : ', num2str(Best_pos_SSA)]);
display(['The best optimal value of the objective funciton found by SSA for ' [num2str(Fun_name)],' is : ', num2str(Best_score_SSA)]);
display(['The best solution obtained by WOA for ' [num2str(Fun_name)],' is : ', num2str(Best_pos_WOA)]);
display(['The best optimal value of the objective funciton found by WOA for ' [num2str(Fun_name)],' is : ', num2str(Best_score_WOA)]);
display(['The best solution obtained by GWO for ' [num2str(Fun_name)],' is : ', num2str(Best_pos_GWO)]);
display(['The best optimal value of the objective funciton found by GWO for ' [num2str(Fun_name)],' is : ', num2str(Best_score_GWO)]);
display(['The best solution obtained by IPOA for ' [num2str(Fun_name)],' is : ', num2str(Best_pos_IPOA)]);
display(['The best optimal value of the objective funciton found by IPOA for ' [num2str(Fun_name)],' is : ', num2str(Best_score_IPOA)]);
可以获取完整代码资源。