1 简介
针对基本麻雀搜索算法在迭代后期种群多样性减小,容易陷入局部极值的问题,提出一种融合柯西变异和反向学习的改进麻雀算法(ISSA).首先,采用一种映射折叠次数无限的Sin混沌初始化种群,为全局寻优奠定基础;其次,在发现者位置更新方式中引入上一代全局最优解,提高全局搜索的充分性,同时加入自适应权重,协调局部挖掘和全局探索的能力,并加快收敛速度;然后,融合柯西变异算子和反向学习策略,在最优解位置进行扰动变异,产生新解,增强算法跃出局部空间的能力;最后,与3种基本算法和2种改进的麻雀算法进行对比,对8个基准测试函数进行仿真实验以及Wilcoxon秩和检验,评估ISSA的寻优性能,并对ISSA进行时间复杂度分析.结果表明ISSA与其余5种算法相比,收敛速度更快,精度更高,全局寻优能力得到较大提升.
2 部分代码
%_________________________________________________________________________________ % Salp Swarm Algorithm (SSA) source codes version 1.0 % % 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 % To run SSA: [Best_score,Best_pos,SSA_cg_curve]=SSA(SearchAgents_no,Max_iteration,lb,ub,dim,fobj) %__________________________________________ clear all clc SearchAgents_no=30; % Number of search agents Function_name='F5'; % Name of the test function that can be from F1 to F23 ( Max_iteration=100; % Maximum numbef of iterations % Load details of the selected benchmark function [lb,ub,dim,fobj]=Get_Functions_details(Function_name); [Best_score,Best_pos,SSA_cg_curve]=SSA(SearchAgents_no,Max_iteration,lb,ub,dim,fobj); 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(['( x_1 , x_2 )']) %Draw objective space subplot(1,2,2); semilogy(SSA_cg_curve,'Color','r') title('Objective space') xlabel('Iteration'); ylabel('Best score obtained so far'); axis tight grid on box on legend('SSA') display(['The best solution obtained by SSA is \m ', num2str(Best_pos)]); display(['The best optimal value of the objective funciton found by SSA is \n ', num2str(Best_score)]); img =gcf; %获取当前画图的句柄 print(img, '-dpng', '-r600', './img.png') %即可得到对应格式和期望dpi的图像3 仿真结果
4 参考文献
[1]毛清华, and 张强. "融合柯西变异和反向学习的改进麻雀算法." 计算机科学与探索 15.6(2021):10.
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,有科研问题可私信交流。
部分理论引用网络文献,若有侵权联系博主删除。