算法,请一次性带走!"/>
十二生肖智能算法,请一次性带走!
概述
今天为大家带来一期---十二生肖智能算法
子鼠---鼠群RSO(Rat Swarm Optimizer)--2020年
丑牛---天牛须搜索BAS(Beetle Antenna Searching)--2017年
寅虎---蜂虎狩猎BEH(Bee-Eater-Hunting)--2022年
卯兔---人工兔ARO(Artificial Rabbits Optimization)--2022年
辰龙---变色龙CSA(Chameleon Swarm Algorithm)--2021年
巳蛇---蛇SO(Snake Optimizer)--2022年
午马---野马WHO((Wild Horse Optimizer)--2021年
未羊---羚羊优化算法GOA(Gazelle Optimization Algorithm)--2022年
申猴---卷尾猴搜索CapSA(capuchin search algorithm)--2020年
酉鸡---白骨顶鸡COOT(Coot optimization algorithm)--2021年
戌狗---澳洲野狗优化算法DOA(Dingo Optimization Algorithm)--2021年
亥猪---跳蛛优化算法JSOA(Jumping Spider Optimization Algorithm)--2021年
01
① 为了凑齐十二生肖,作者无奈只能先将跳蛛算法拿过来充当“亥猪”了,因为作者实在搜不到关于“猪”的优化算法。(难道是嫌弃猪太笨,所以没人研究?为此作者还特意查了查,有研究表明:猪是世界上仅次于黑猩猩和宽吻海豚之后第三聪明的动物,哈哈哈为猪澄清!)
② 凑齐十二生肖算法,还将十二生肖算法放在一起PK,纯属娱乐!大家各取所需即可!
③ 作者已经将各自算法都放在一个单独文件夹内,文件夹截图如下所示。想要让12生肖进行PK,直接运行PKmain.m文件即可。若只想运行单独的算法,打开各自的文件夹运行相应的main文件即可。
02结果展示
十二种算法作者均将其整理为标准的算法套用,方便大家对其更改!
[Best_score,Best_pos,curve]=算法名称(SearchAgents,Max_iterations,lowerbound,upperbound,dimension,fitness)
依旧是在CEC2005函数中测试,粒子个数设置为30个,迭代次数为1000次,结果图:
03
核心代码展示:在这里附上PKmain.m文件代码:
clear all
clc
close all
addpath(genpath(pwd))
SearchAgents=30;
Fun_name='F10';
Max_iterations=1000;
[lowerbound,upperbound,dimension,fitness]=fun_info(Fun_name);%% 鼠群RSO(Rat Swarm Optimizer)--2020年
[~,~,RSO_curve]=rso(SearchAgents,Max_iterations,lowerbound,upperbound,dimension,fitness);
%% 丑牛---天牛须搜索BAS(Beetle Antenna Searching)--2017年
[~,~,BAS_curve]=BAS(SearchAgents,Max_iterations,lowerbound,upperbound,dimension,fitness);
%% 寅虎---蜂虎狩猎BEH(Bee-Eater-Hunting)--2022年
[~,~,BEH_curve]=BEH(SearchAgents,Max_iterations,lowerbound,upperbound,dimension,fitness);
%% 卯兔---人工兔ARO(Artificial Rabbits Optimization)--2022年
[BestX,BestF,ARO_curve]=ARO(Fun_name,Max_iterations,SearchAgents,lowerbound,upperbound,dimension,fitness);
%% 辰龙---变色龙CSA(Chameleon Swarm Algorithm)--2021年
[~,~,CSA_curve]=Chameleon(SearchAgents,Max_iterations,lowerbound,upperbound,dimension,fitness);
%% 巳蛇---蛇SO(Snake Optimizer)--2022年
[Xfood, Xvalue,SO_curve] = SO(SearchAgents,Max_iterations,fitness, dimension,lowerbound,upperbound); % Calculating the solution of the given problem using SO
%% 午马---野马WHO((Wild Horse Optimizer)--2021年
[~,~,WHO_curve]=WHO(SearchAgents,Max_iterations,lowerbound,upperbound,dimension,fitness);
%% 未羊---羚羊优化算法GOA(Gazelle Optimization Algorithm)--2022年
[~,~,GOA_curve]=GOAmain(SearchAgents,Max_iterations,lowerbound,upperbound,dimension,fitness);
%% 申猴---卷尾猴搜索CapSA(capuchin search algorithm)--2020年
[~,~,CapSA_curve]=CapSA(SearchAgents,Max_iterations,lowerbound,upperbound,dimension,fitness);
%% 酉鸡---白骨顶鸡COOT(Coot optimization algorithm)--2021年
[~,~,COOT_curve]=COOT(SearchAgents,Max_iterations,lowerbound,upperbound,dimension,fitness);
%% 戌狗---澳洲野狗优化算法DOA(Dingo Optimization Algorithm)--2021年
[~,~,DOA_curve]=DOA(SearchAgents,Max_iterations,lowerbound,upperbound,dimension,fitness);
%% 亥猪---跳蛛优化算法JSOA(Jumping Spider Optimization Algorithm)--2021年
parameters.SearchAgents= SearchAgents; % Number of jumping Spiders
parameters.Function=Fun_name; %Function_name
parameters.maxIteration=Max_iterations; % Maximum numbef of iterations
[parameters.lb,parameters.ub,parameters.dim,parameters.fobj]=FunctionsDetails(parameters.Function);
[vMin,theBestVct,JSOA_curve]=JSOA(parameters);
%% 画图
figure('Position',[500 500 660 290])
%Draw search space
subplot(1,2,1);
fun_plot(Fun_name);
title('Parameter space')
xlabel('x_1');
ylabel('x_2');
zlabel([Fun_name,'( x_1 , x_2 )'])%Draw objective space
subplot(1,2,2);semilogy(RSO_curve,'Color',[0.33 0.66 0.7410],'linewidth',1);
hold on
semilogy(BAS_curve,'Color',[0.02 0.4470 0.3],'linewidth',1);
hold on
semilogy(BEH_curve,'r','linewidth',1);
hold on
semilogy(ARO_curve,'Color',[0 0 0],'linewidth',1);
hold on
semilogy(CSA_curve,'g','linewidth',1);
hold on
semilogy(SO_curve,'b','linewidth',1);
hold on
semilogy(WHO_curve,'y','linewidth',1);
hold on
semilogy(GOA_curve,'c','linewidth',1);
hold on
semilogy(CapSA_curve,'Color',[0.4 0.10 0.910],'linewidth',1);
hold on
semilogy(COOT_curve,'Color',[0.4940 0.1840 0.5560],'linewidth',1);
hold on
semilogy(DOA_curve,'Color',[0.9290 0.6940 0.1250],'linewidth',1);
hold on
semilogy(JSOA_curve,'Color',[0.6350 0.0780 0.1840],'linewidth',1);grid on;
title('收敛曲线')
xlabel('迭代次数');
ylabel('适应度值');
box on
legend('RSO','BSA','BEH','ARO','CSA','SO','WHO','GOA','CapSA','COOT','DOA','JSOA')
set (gcf,'position', [300,300,900,380])
if strcmp(Fun_name, 'F8')ylim([-13000 -1000])
end
04代码获取
完整代码获取,点击下方卡片回复关键词:
十二生肖
更多推荐
十二生肖智能算法,请一次性带走!
发布评论