• 【群智能算法改进】一种改进的鹈鹕优化算法 IPOA算法[2]【Matlab代码#58】



    获取资源请见文章第5节:资源获取】


    1. 原始POA算法

    此算法详细介绍请参考POA算法介绍

    2. 改进后的IPOA算法

    2.1 随机对立学习种群初始化

    采用随机方法初始化POA种群,生成的种群不均匀,影响了收敛速度和精度。为了获得更好的初始种群,本文采用了随机对立学习策略来进行种群初始:
    X i , n e w = ( l + u ) − k X i (1) X_{i,new}=(l+u)-kX_{i}\tag1 Xi,new=(l+u)kXi(1)
    其中, X i X_{i} Xi为原解, X i , n e w X_{i,new} Xi,new为随机对立学习生成的反向解, k k k为[0,1]之间的随机数。
    经过随机对立学习策略后,生成了 N N N个反向解,如果反向解的适应度值优于原解,就用反向解替代原解,否则保留原解。

    2.2 动态权重系数

    基本鹈鹕优化算法的开发阶段,在迭代后期会存在陷入局部最优的情况,使搜索失败。为克服这一弊端,再在其位置更新公式中加入动态权重系数 ω,让它在迭代初期具有较大值,促进全局搜索,迭代后期自适应变小,促进局部搜索并加快收敛速度。

    2.3 透镜成像折射方向学习

    透镜成像折射反向学习策略的思想来自于凸透镜成像的原理。通过基于当前坐标生成一个反向位置来扩展搜索范围,如图1所示。
    在这里插入图片描述

    图1 透镜成像折射反向学习原理图

    在二维坐标中,x轴的搜索范围为(a, b), y轴表示一个凸透镜。假设物体A在x轴上的投影为x,高度为h,通过透镜成像,另一侧的图像为A*, A在x轴上的投影为x,高度为h*。通过以上分析,我们可以得到如下公式:
    ( a + b ) / 2 − x x ∗ − ( a + b ) / 2 = h h ∗ (2) \frac{(a+b)/2-x}{x^{*}-(a+b)/2 }=\frac{h}{h^{*}} \tag2 x(a+b)/2(a+b)/2x=hh(2)
    对公式(2)进行转换,即可得到反向解x*的表达式为:
    x ∗ = a + b 2 + a + b 2 k − x k (3) x^{*} =\frac{a+b}{2}+\frac{a+b}{2k}-\frac{x}{k} \tag3 x=2a+b+2ka+bkx(3)
    其中, k = h / h ∗ k=h/h^{*} k=h/h a a a b b b可以视为某维度的上下限。本文中的 k k k是一个与迭代次数相关的动态自适应值。

    3. 部分代码展示

    %%
    clc
    clear
    close all
    
    %%
    Fun_name='F1'; % number of test functions: 'F1' to 'F23'
    SearchAgents=30;                     % number of Pelicans (population members) 
    Max_iterations=500;                  % maximum number of iteration
    [lb,ub,dim,fobj]=Get_Functions_details(Fun_name); % Object function information
    [Best_score_POA,Best_pos_POA,POA_curve]=POA(SearchAgents,Max_iterations,lb,ub,dim,fobj);   
    [Best_score_SSA,Best_pos_SSA,SSA_curve]=SSA(SearchAgents,Max_iterations,lb,ub,dim,fobj);
    [Best_score_WOA,Best_pos_WOA,WOA_curve]=WOA(SearchAgents,Max_iterations,lb,ub,dim,fobj);
    [Best_score_GWO,Best_pos_GWO,GWO_curve]=GWO(SearchAgents,Max_iterations,lb,ub,dim,fobj);
    [Best_score_IPOA,Best_pos_IPOA,IPOA_curve]=IPOA(SearchAgents,Max_iterations,lb,ub,dim,fobj);
    
    %%
    figure('Position',[454   445   694   297]);
    subplot(1,2,1);
    func_plot(Fun_name);
    title('Parameter space')
    xlabel('x_1');
    ylabel('x_2');
    zlabel([Fun_name,'( x_1 , x_2 )'])
    
    subplot(1,2,2);
    t = 1:Max_iterations;
    semilogy(t, POA_curve, 'b-',    t, SSA_curve, 'k-',    t, WOA_curve, 'g-',  t, GWO_curve, 'm-',  t, IPOA_curve, 'r-','linewidth', 1.5);
    
    title(Fun_name)
    xlabel('Iteration');
    ylabel('Best fitness function');
    axis tight
    legend('POA','SSA','WOA','GWO','IPOA')
    
    display(['The best solution obtained by POA for ' [num2str(Fun_name)],'  is : ', num2str(Best_pos_POA)]);
    display(['The best optimal value of the objective funciton found by POA  for ' [num2str(Fun_name)],'  is : ', num2str(Best_score_POA)]);
    display(['The best solution obtained by SSA for ' [num2str(Fun_name)],'  is : ', num2str(Best_pos_SSA)]);
    display(['The best optimal value of the objective funciton found by SSA  for ' [num2str(Fun_name)],'  is : ', num2str(Best_score_SSA)]);
    display(['The best solution obtained by WOA for ' [num2str(Fun_name)],'  is : ', num2str(Best_pos_WOA)]);
    display(['The best optimal value of the objective funciton found by WOA  for ' [num2str(Fun_name)],'  is : ', num2str(Best_score_WOA)]);
    display(['The best solution obtained by GWO for ' [num2str(Fun_name)],'  is : ', num2str(Best_pos_GWO)]);
    display(['The best optimal value of the objective funciton found by GWO  for ' [num2str(Fun_name)],'  is : ', num2str(Best_score_GWO)]);
    display(['The best solution obtained by IPOA for ' [num2str(Fun_name)],'  is : ', num2str(Best_pos_IPOA)]);
    display(['The best optimal value of the objective funciton found by IPOA  for ' [num2str(Fun_name)],'  is : ', num2str(Best_score_IPOA)]);
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45

    4. 仿真结果展示

    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述

    5. 资源获取

    可以获取完整代码资源。👇👇👇👀名片

  • 相关阅读:
    字符串拆分以及合并--Python
    庆国庆,拟物地图
    【计算情与思】扫地僧、打字员、信息恐慌与奥本海默
    详谈js之面向对象
    大数据(一)背景和概念
    vue转electron项目以及使用fs报错:Module not found: Error: Can‘t resolve ‘fs‘ in解决办法
    [附源码]Python计算机毕业设计SSM康健医药公司进销存管理系统(程序+LW)
    【Python】【技能树评测】【05】数据库操作详细含源码:
    学信息系统项目管理师第4版系列18_采购管理
    MyBatis Generator 代码生成工具
  • 原文地址:https://blog.csdn.net/xiongyajun123/article/details/132745936