【matlab】多种智能优化算法对比

引言

对比DBO(蜣螂优化算法)、WOA(鲸鱼优化算法)、PSO(粒子群优化算法)和GA(遗传算法)这四种智能优化算法,从以下几个方面进行分析:

  1. 算法原理与模拟行为
    • DBO:受蜣螂滚球、跳舞、觅食、偷窃和繁殖行为启发,模拟蜣螂的生存行为来搜索最优解。
    • WOA:基于鲸鱼的群体行为,特别是鲸鱼的捕食策略,模仿鲸鱼追随猎物或随机搜索的行为。
    • PSO:模拟鸟群觅食行为规律,通过粒子间的信息共享和合作,搜索解空间中的最优位置。
    • GA:模拟生物进化过程,通过选择、交叉和变异等操作,在搜索空间中找到最优解。
  2. 算法特点
    • DBO:进化能力强、搜索速度快、寻优能力强,适用于解决连续优化问题。
    • WOA:简单易实现,在某些优化问题上表现良好,但性能受问题复杂度和参数选择影响。
    • PSO:收敛速度快、参数少、算法简单易于实现,但可能陷入局部最优解。
    • GA:全局搜索能力强,具有并行性和鲁棒性,但计算量大,迭代次数多。
  3. 算法性能与应用
    • DBO:在CEC2005函数集等测试中表现出较好的优化性能,适用于求解连续优化问题。
    • WOA:已成功应用于函数优化、参数调整等优化问题。
    • PSO:广泛应用于函数优化、神经网络训练、模糊控制系统等领域。
    • GA:广泛应用于机器学习、组合优化、生产调度等领域,特别适用于解决复杂、非线性、多模态优化问题。

结果展示

  • 在F1和F2单维测试函数中,DBO通过模拟蜣螂的觅食、滚球等自然行为,展现出了出色的搜索能力和寻优能力。其进化能力强、搜索速度快、寻优能力强的特点,使得DBO在这两个单维测试上能够迅速找到全局最优解。
  • 在多维测试函数F6和F7中,DBO同样表现出了优秀的性能。多维问题通常具有更高的复杂性和更多的局部最优解,但DBO通过其独特的搜索策略和进化机制,依然能够有效地找到全局最优解或接近全局最优解的解。

代码实现

clear all 
clc

SearchAgents_no=30; % Number of sEOrch agents
Function_name='F1'; % Name of the test function
Max_iteration=500; % Maximum number of iterations
Run_no=30;         % Number of independent runs 

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

% 初始化变量
WOA_scores = zeros(Run_no, 1);
DBO_scores   = zeros(Run_no, 1);
GA_scores = zeros(Run_no, 1);
PSO_scores = zeros(Run_no, 1);


for run = 1:Run_no
   
    %% WOA 
    [Best_score1,Best_pos1, WOA_cg_curve ] = WOA(SearchAgents_no,Max_iteration,lb,ub,dim,fobj);
    WOA_scores(run,1) = Best_score1;


    %% PSO    
    [Best_score2,Best_pos2,PSO_cg_curve] = PSO(SearchAgents_no,Max_iteration,lb,ub,dim,fobj); % Call PSO
    PSO_scores(run,1) = Best_score2;
   
    
    %% DBO   
    [Best_score3,Best_pos3, DBO_cg_curve ] = DBO(SearchAgents_no,Max_iteration,lb,ub,dim,fobj); 
    DBO_scores(run,1) = Best_score3;
   


    %% GA   
    [Best_score4,Best_pos4, GA_cg_curve ] = GA(SearchAgents_no,Max_iteration,lb,ub,dim,fobj);
    GA_scores(run,1) = Best_score4;
   
    
end

fprintf ('Best solution obtained by WOA in run %d: %s\n', run, num2str(Best_pos1,'%e  '));
display(['The best optimal value of the objective function found by WOA in run ', num2str(run), ' for ', Function_name, ' is: ', num2str(Best_score1)]);

fprintf ('Best solution obtained by PSO: %s\n', num2str(Best_pos2,'%e  '));
display(['The best optimal value of the objective funciton found by PSO  for ' [num2str(Function_name)],'  is : ', num2str(Best_score2)]);

fprintf ('Best solution obtained by DBO in run %d: %s\n', run, num2str(Best_pos3,'%e  '));
display(['The best optimal value of the objective function found by DBO in run ', num2str(run), ' for ', Function_name, ' is: ', num2str(Best_score3)]);

fprintf ('Best solution obtained by GA in run %d: %s\n', run, num2str(Best_pos4,'%e  '));
display(['The best optimal value of the objective function found by GA in run ', num2str(run), ' for ', Function_name, ' is: ', num2str(Best_score4)]);


figure;
t = 1:Max_iteration;
semilogy(t, DBO_cg_curve,'r-^', t, WOA_cg_curve, 'm-p', t, PSO_cg_curve, 'b-d', ...
    t, GA_cg_curve, 'g-s',   ...
    'linewidth', 1.5, 'MarkerSize', 8, 'MarkerIndices', 1:25:Max_iteration);
title(Function_name)
xlabel('Iteration');
ylabel('Best fitness so far');
axis fill
grid on
box on
legend('DBO','WOA','PSO','GA');
   
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值