基于增强蛇优化算法求解单目标优化问题附matlab代码

✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。

🍎个人主页:Matlab科研工作室

🍊个人信条:格物致知。

更多Matlab仿真内容点击👇

智能优化算法  神经网络预测 雷达通信  无线传感器

信号处理 图像处理 路径规划 元胞自动机 无人机  电力系统

⛄ 内容介绍

近年来,在工程和科学领域引入了几种元启发式算法来解决现实生活中的优化问题。在这项研究中,提出了一种新的受自然启发的元启发式算法,称为蛇优化器 (SO),以解决模仿蛇特殊交配行为的各种优化任务。如果存在的食物量足够且温度低,每条蛇(雄性/雌性)都会争夺最佳伴侣。这项研究在数学上模拟和模拟了觅食和繁殖行为和模式,以提出一种简单有效的优化算法。为了验证所提出方法的有效性和优越性,SO 在 29 个无约束的进化计算大会 (CEC) 2017 基准函数和四个受约束的现实世界工程问题上进行了测试。将 SO 与其他 9 种著名的和新开发的算法进行比较,例如线性种群大小减少-差分进化的成功历史适应 (L-SHADE)、与 L-SHADE 结合的集成正弦曲线 (LSHADE-EpSin)、协方差矩阵适应进化策略 (CMAES)、土狼优化算法 (COA)、蛾火焰优化、哈里斯鹰优化器、热交换优化、蚱蜢优化算法和鲸鱼优化算法。实验结果和统计比较证明了 SO 在不同景观上的勘探开发平衡和收敛曲线速度的有效性和效率。

⛄ 部分代码

%_______________________________________________________________________________%

​our 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 ESO:  [Xfood, fval,Convergence_curve,Trajectories,fitness_history, position_history]=ESO(N,T,lb,ub,dim,fobj);

%__________________________________________________

clear all 

clc

close  all

N=30; % Number of search agents

Function_name='F4'; % Name of the test function that can be from F1 to F23 (Table 1,2,3 in the paper)

T=200; % Maximum numbef of iterations

Load details of the selected benchmark function

[lb,ub,dim,fobj]=Get_Functions_details(Function_name);

  [Xfood, fval,Convergence_curve,Trajectories,fitness_history, position_history]=ESO(N,T,lb,ub,dim,fobj); %¿ªÊ¼ÓÅ»¯

  [Best_pos,Best_score,SO_curve]=SO(N,T,lb,ub,dim,fobj); 

 figure('Position',[39         479        1727         267])

color1 = [205 205 0];

color2 = [139 101 8];

color3 = [205 155 155];

color4 = [238 121 66];

%Draw search space

subplot(1,5,1);

func_plot(Function_name);

title('Parameter space')

xlabel('x_1');

ylabel('x_2');

zlabel([Function_name,'( x_1 , x_2 )'])

box on

axis tight

subplot(1,5,2);

semilogy(Convergence_curve,'Color','r','linewidth',1.5)

hold on

semilogy(SO_curve,'Color','b','linewidth',1.5)

title('Convergence curve')

xlabel('Iteration#');

ylabel('Best score obtained so far');

box on

legend('ESO','SO')

axis tight

subplot(1,5,3);

hold on

semilogy(Trajectories(1,:),'Color',color4/255,'linewidth',1.5);

title('Trajectory ')

xlabel('Iteration#')

box on

axis tight

subplot(1,5,4);

hold on

a=mean(fitness_history);

semilogy(a,'Color',color2/255,'linewidth',1.5);

title('Average Fitness ')

xlabel('Iteration#')

box on

axis tight

subplot(1,5,5);

hold on

for k1 = 1: size(position_history,1)

    for k2 = 1: size(position_history,2)

        plot(position_history(k1,k2,1),position_history(k1,k2,2),'.','markersize',1,'MarkerEdgeColor','k','markerfacecolor','k');

    end

end

plot(Xfood(1),Xfood(2),'.','markersize',10,'MarkerEdgeColor','r','markerfacecolor','r','linewidth',2);

title('Search history (x1 and x2 only)')

xlabel('x1')

ylabel('x2')

box on

axis tight

subplot(1,5,5);

hold on

func_plot1(Function_name)

⛄ 运行结果

⛄ 参考文献

⛄ Matlab代码关注

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

❤️ 关注我领取海量matlab电子书和数学建模资料

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

matlab科研助手

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

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

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

打赏作者

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

抵扣说明:

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

余额充值