在标准粒子群算法的基础上,引入基于莱维飞行的觅食生境选择策略,提出了改进的基于觅食生境选择的粒子群算法(feeding habitat selection particle swarm optimization,FHSPSO).改进的算法中,粒子搜索策略包括粒子无干扰觅食和受到惊扰飞至新的觅食位置两个阶段.应用6个典型的高维标准测试函数对算法进行测试,结果表明,FHSPSO算法的性能相对标准粒子群算法有很大提升.
clear all
clc
SearchAgents_no=30; % Number of search agents 种群数量
Function_name='F2'; % Name of the test function that can be from F1 to F23 (Table 1,2,3 in the paper) 设定适应度函数
Max_iteration=100; % Maximum numbef of iterations 设定最大迭代次数
% Load details of the selected benchmark function
[lb,ub,dim,fobj]=Get_Functions_details(Function_name); %设定边界以及优化函数
%速度范围设定
Vmax = 2;
Vmin = -2;
%原始粒子群结果
[Best_pos,Best_score,PSO_curve]=PSO(SearchAgents_no,Max_iteration,lb,ub,dim,fobj,Vmax,Vmin); %开始优化
%改进粒子群结果
[Best_pos1,Best_score1,ASAPSO_curve1]=ASAPSO(SearchAgents_no,Max_iteration,lb,ub,dim,fobj,Vmax,Vmin); %开始优化
figure('Position',[269 240 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(PSO_curve,'Color','b','linewidth',1.5)
hold on
semilogy(ASAPSO_curve1,'Color','r','linewidth',1.5);
title('Objective space')
xlabel('Iteration');
ylabel('Best score obtained so far');
legend('PSO','FHSPSO');
axis tight
grid on
box on
display(['The best solution obtained by PSO is : ', num2str(Best_pos)]);
display(['The best optimal value of the objective funciton found by PSO is : ', num2str(Best_score)]);
[1]陈子廓, 史宪睿. 基于觅食生境选择的改进粒子群算法[J]. 辽宁工业大学学报:自然科学版, 2022, 42(1):3.