基于增强蛇优化算法求解单目标优化问题附matlab代码
创始人
2024-03-15 22:09:10
0

✅作者简介:热爱科研的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电子书和数学建模资料

相关内容

热门资讯

汽车油箱结构是什么(汽车油箱结... 本篇文章极速百科给大家谈谈汽车油箱结构是什么,以及汽车油箱结构原理图解对应的知识点,希望对各位有所帮...
美国2年期国债收益率上涨15个... 原标题:美国2年期国债收益率上涨15个基点 美国2年期国债收益率上涨15个基...
嵌入式 ADC使用手册完整版 ... 嵌入式 ADC使用手册完整版 (188977万字)💜&#...
重大消息战皇大厅开挂是真的吗... 您好:战皇大厅这款游戏可以开挂,确实是有挂的,需要了解加客服微信【8435338】很多玩家在这款游戏...
盘点十款牵手跑胡子为什么一直... 您好:牵手跑胡子这款游戏可以开挂,确实是有挂的,需要了解加客服微信【8435338】很多玩家在这款游...
senator香烟多少一盒(s... 今天给各位分享senator香烟多少一盒的知识,其中也会对sevebstars香烟进行解释,如果能碰...
终于懂了新荣耀斗牛真的有挂吗... 您好:新荣耀斗牛这款游戏可以开挂,确实是有挂的,需要了解加客服微信8435338】很多玩家在这款游戏...
盘点十款明星麻将到底有没有挂... 您好:明星麻将这款游戏可以开挂,确实是有挂的,需要了解加客服微信【5848499】很多玩家在这款游戏...
总结文章“新道游棋牌有透视挂吗... 您好:新道游棋牌这款游戏可以开挂,确实是有挂的,需要了解加客服微信【7682267】很多玩家在这款游...
终于懂了手机麻将到底有没有挂... 您好:手机麻将这款游戏可以开挂,确实是有挂的,需要了解加客服微信【8435338】很多玩家在这款游戏...