贪婪的非分层灰狼优化算法(G-NHGWO)(Matlab代码实现)

简介: 贪婪的非分层灰狼优化算法(G-NHGWO)(Matlab代码实现)

💥1 概述

狼优化(GWO)算法是基于灰狼社会等级及其狩猎与合作策略的新兴算法。该算法于2014年推出,已被大量研究人员和设计师使用,因此原始论文的引用次数超过了许多其他算法。在Niu等人最近的一项研究中,介绍了这种算法优化现实世界问题的主要缺点之一。总之,他们表明,随着问题的最佳解决方案从0发散,GWO的性能会下降。


在贪婪非分层灰狼优化器(G-NHGWO)中,通过对原始GWO算法进行直接修改,即忽略其社会等级,我们能够在很大程度上消除这一缺陷,并为该算法的未来使用开辟了新的视角。通过将所提方法应用于基准和实际工程问题,验证了该方法的效率。


文章下载链接:


http://dx.doi.org/10.1049/ell2.12176


📚2 运行结果

部分代码:

clc
clear
global NFE
NFE=0;
nPop=30;    % Number of search agents (Population Number)
MaxIt=1000; % Maximum number of iterations
nVar=30;    % Number of Optimization Variables
Total_Runs=25;
% Pre-allocating vectors and matrices
Cost_Rsult=nan(1,Total_Runs);
Rsult=nan(Total_Runs,MaxIt);
Mean=nan(1,14);
Best=Mean;
Std=Mean;
nfe=Mean;
fitness1=nan(1,nPop);
for nFun=1:14
    NFE=0;
    CostFunction=@(x,nFun) Cost(x,nFun);        % Cost Function
    for run_no=1:Total_Runs
        %% Problem Definition
        VarMin=-100;             % Decision Variables Lower Bound
        if nFun==7
            VarMin=-600;             % Decision Variables Lower Bound
        end
        if nFun==8
            VarMin=-32;             % Decision Variables Lower Bound
        end
        if nFun==9
            VarMin=-5;             % Decision Variables Lower Bound
        end
        if nFun==10
            VarMin=-5;             % Decision Variables Lower Bound
        end
        if nFun==11
            VarMin=-0.5;             % Decision Variables Lower Bound
        end
        if nFun==12
            VarMin=-pi;             % Decision Variables Lower Bound
        end
        if nFun==14
            VarMin=-100;             % Decision Variables Lower Bound
        end
        VarMax= -VarMin;             % Decision Variables Upper Bound
        if nFun==13
            VarMin=-3;             % Decision Variables Lower Bound
            VarMax= 1;             % Decision Variables Upper Bound
        end
        %%   Grey Wold Optimizer (GWO)
        % Initialize Best Solution (Alpha) which will be used for archiving
        Alpha_pos=zeros(1,nVar);
        Alpha_score=inf;
        % Initialize the positions of search agents
        Positions=rand(nPop,nVar).*(VarMax-VarMin)+VarMin;
        Positions1=rand(nPop,nVar).*(VarMax-VarMin)+VarMin;
        BestCosts=zeros(1,MaxIt);
        fitness(1:nPop)=inf;
        iter=0;  % Loop counter
        %% Main loop
        while iter<MaxIt
            for i=1:nPop
                % Return back the search agents that go beyond the boundaries of the search space
                Flag4ub=Positions1(i,:)>VarMax;
                Flag4lb=Positions1(i,:)<VarMin;
                Positions1(i,:)=(Positions1(i,:).*(~(Flag4ub+Flag4lb)))+VarMax.*Flag4ub+VarMin.*Flag4lb;
                % Calculate objective function for each search agent
                fitness1(i)= CostFunction(Positions1(i,:), nFun);
                %  Grey Wolves
                if fitness1(i)<fitness(i)
                    Positions(i,:)=Positions1(i,:);
                    fitness(i) =fitness1(i) ;
                end
                % Update Best Solution (Alpha) for archiving
                if fitness(i)<Alpha_score
                    Alpha_score=fitness(i);
                    Alpha_pos=Positions(i,:);
                end
            end
            a=2-(iter*((2)/MaxIt));  % a decreases linearly fron 2 to 0
            % Update the Position of all search agents
            for i=1:nPop
                for j=1:nVar
                    GGG=randperm(nPop-1,3);
                    ind1= GGG>=i;
                    GGG(ind1)=GGG(ind1)+1;
                    m1=GGG(1);
                    m2=GGG(2);
                    m3=GGG(3);
                    r1=rand;
                    r2=rand;
                    A1=2*a*r1-a;
                    C1=2*r2;
                    D_alpha=abs(C1*Positions(m1,j)-Positions(i,j));
                    X1=Positions(m1,j)-A1*D_alpha;
                    r1=rand;
                    r2=rand;
                    A2=2*a*r1-a;
                    C2=2*r2;
                    D_beta=abs(C2*Positions(m2,j)-Positions(i,j));
                    X2=Positions(m2,j)-A2*D_beta;
                    r1=rand;
                    r2=rand;
                    A3=2*a*r1-a;
                    C3=2*r2;
                    D_delta=abs(C3*Positions(m3,j)-Positions(i,j));
                    X3=Positions(m3,j)-A3*D_delta;
                    Positions1(i,j)=(X1+X2+X3)/3;
                end
            end
            iter=iter+1;
            BestCosts(iter)=Alpha_score;
            fprintf('Func No= %-2.0f,  Run No= %-2.0f,  Iter= %g, Best Cost = %g\n',nFun,run_no,iter,Alpha_score);
        end
        %%% Results
        Cost_Rsult(1, run_no)=Alpha_score;
        Rsult(run_no,:)= BestCosts;
    end
    Mean(nFun)=mean(Cost_Rsult);
    Best(nFun)=min(Cost_Rsult);
    Std(nFun)=std(Cost_Rsult);
    nfe(nFun)=NFE;

🌈3 Matlab代码实现

🎉4 参考文献

部分理论来源于网络,如有侵权请联系删除。


[1]Ebrahim Akbari (2022). Greedy Non‐Hierarchical Grey Wolf Optimizer (G-NHGWO)


[2]Akbari, Ebrahim, et al. “A Greedy Non-Hierarchical Grey Wolf Optimizer for Real-World Optimization.” Electronics Letters, Institution of Engineering and Technology (IET), Apr. 2021, doi:10.1049/ell2.12176.

相关文章
|
算法 定位技术 计算机视觉
【水下图像增强】基于波长补偿与去雾的水下图像增强研究(Matlab代码实现)
【水下图像增强】基于波长补偿与去雾的水下图像增强研究(Matlab代码实现)
1380 0
|
算法 机器人 计算机视觉
【图像处理】水下图像增强的颜色平衡与融合技术研究(Matlab代码实现)
【图像处理】水下图像增强的颜色平衡与融合技术研究(Matlab代码实现)
472 0
|
机器学习/深度学习 算法 机器人
使用哈里斯角Harris和SIFT算法来实现局部特征匹配(Matlab代码实现)
使用哈里斯角Harris和SIFT算法来实现局部特征匹配(Matlab代码实现)
647 8
|
机器学习/深度学习 编解码 算法
基于OFDM技术的水下声学通信多径信道图像传输研究(Matlab代码实现)
基于OFDM技术的水下声学通信多径信道图像传输研究(Matlab代码实现)
587 8
|
机器学习/深度学习 算法 机器人
【水下图像增强融合算法】基于融合的水下图像与视频增强研究(Matlab代码实现)
【水下图像增强融合算法】基于融合的水下图像与视频增强研究(Matlab代码实现)
1211 0
|
数据采集 分布式计算 并行计算
mRMR算法实现特征选择-MATLAB
mRMR算法实现特征选择-MATLAB
654 2
|
存储 编解码 算法
【多光谱滤波器阵列设计的最优球体填充】使用MSFA设计方法进行各种重建算法时,图像质量可以提高至多2 dB,并在光谱相似性方面实现了显著提升(Matlab代码实现)
【多光谱滤波器阵列设计的最优球体填充】使用MSFA设计方法进行各种重建算法时,图像质量可以提高至多2 dB,并在光谱相似性方面实现了显著提升(Matlab代码实现)
478 6
|
传感器 机器学习/深度学习 编解码
MATLAB|主动噪声和振动控制算法——对较大的次级路径变化具有鲁棒性
MATLAB|主动噪声和振动控制算法——对较大的次级路径变化具有鲁棒性
574 3
|
机器学习/深度学习 算法 自动驾驶
基于导向滤波的暗通道去雾算法在灰度与彩色图像可见度复原中的研究(Matlab代码实现)
基于导向滤波的暗通道去雾算法在灰度与彩色图像可见度复原中的研究(Matlab代码实现)
852 8
|
机器学习/深度学习 传感器 算法
【高创新】基于优化的自适应差分导纳算法的改进最大功率点跟踪研究(Matlab代码实现)
【高创新】基于优化的自适应差分导纳算法的改进最大功率点跟踪研究(Matlab代码实现)
516 14

热门文章

最新文章