【智能优化算法-麻雀搜索算法】基于萤火虫结合麻雀搜索算法求解单目标优化问题附matlab代码

该博客介绍了将萤火虫扰动引入麻雀搜索算法的优化方法,通过扰动提高麻雀搜索性能。在每次迭代中,所有麻雀的位置基于萤火虫扰动更新,若更新后的位置更优则保留。代码示例展示了算法的使用流程,并给出了优化过程的搜索空间和目标空间图像。最后,列举了相关参考文献。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1 内容介绍

该改进主要是在麻雀搜索后,利用萤火虫扰动对麻雀进行萤火虫扰动,将所有麻雀与最优麻雀利用萤火虫扰动方式,进行位置更新,提高其搜索性,扰动后的麻雀与扰动前的麻雀进行对比,如果更优则更新麻雀位置。

2 部分代码

% 使用方法

%__________________________________________

% 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_pos,Best_score,curve]=SSA(pop,Max_iter,lb,ub,dim,fobj)

%__________________________________________

clear all 

clc

close all

rng('default');

SearchAgents_no=50; % 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=300;

% Load details of the selected benchmark function

[lb,ub,dim,fobj]=Get_Functions_details(Function_name);  %设定边界以及优化函数

[Best_pos,Best_score,SSA_curve]=SSANew(SearchAgents_no,Max_iteration,lb,ub,dim,fobj); %开始优化

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);

plot(SSA_curve,'Color','r','linewidth',2)

hold on;

title('Objective space')

xlabel('迭代');

ylabel('Best score obtained so far');

axis tight

grid on

box on

legend('FASSA')

3 运行结果

4 参考文献

[1]肖海飞, 曾国辉, 杜涛,等. 基于麻雀搜索算法的PMSM智能控制器设计[J]. 电力电子技术, 2022(056-001).​

博主简介:擅长智能优化算法神经网络预测信号处理元胞自动机图像处理路径规划无人机雷达通信无线传感器等多种领域的Matlab仿真,相关matlab代码问题可私信交流。

部分理论引用网络文献,若有侵权联系博主删除。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

matlab科研助手

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值