【智能优化算法】一种改进的灰狼算法附matlab代码

简介: 【智能优化算法】一种改进的灰狼算法附matlab代码

 1 简介

Grey wolf optimization (GWO) algorithm is a new emerging algorithm that is based on the social hierarchy of grey wolves as well as their hunting and cooperation strategies. Introduced in 2014, this algorithm has been used by a large number of researchers and designers, such that the number of citations to the original paper exceeded many other algorithms. In a recent study by Niu et al., one of the main drawbacks of this algorithm for optimizing real﹚orld problems was introduced. In summary, they showed that GWO's performance degrades as the optimal solution of the problem diverges from 0. In this paper, by introducing a straightforward modification to the original GWO algorithm, that is, neglecting its social hierarchy, the authors were able to largely eliminate this defect and open a new perspective for future use of this algorithm. The efficiency of the proposed method was validated by applying it to benchmark and real﹚orld engineering problems.

2 部分代码

clcclearglobal NFENFE=0;nPop=30;    % Number of search agents (Population Number)MaxIt=1000; % Maximum number of iterationsnVar=30;    % Number of Optimization Variables nFun=1;     % Function No, select any integer number from 1 to 14CostFunction=@(x,nFun) Cost(x,nFun);        % Cost Function%% Problem DefinitionVarMin=-100;             % Decision Variables Lower Boundif nFun==7    VarMin=-600;             % Decision Variables Lower Boundendif nFun==8    VarMin=-32;             % Decision Variables Lower Boundendif nFun==9    VarMin=-5;             % Decision Variables Lower Boundendif nFun==10    VarMin=-5;             % Decision Variables Lower Boundendif nFun==11    VarMin=-0.5;             % Decision Variables Lower Boundendif nFun==12    VarMin=-pi;             % Decision Variables Lower Boundendif nFun==14    VarMin=-100;             % Decision Variables Lower BoundendVarMax= -VarMin;             % Decision Variables Upper Boundif nFun==13    VarMin=-3;             % Decision Variables Lower Bound    VarMax= 1;             % Decision Variables Upper Boundend%%   Grey Wold Optimizer (GWO)% Initialize Alpha, Beta, and DeltaAlpha_pos=zeros(1,nVar);Alpha_score=inf;Beta_pos=zeros(1,nVar);Beta_score=inf;Delta_pos=zeros(1,nVar);Delta_score=inf;%Initialize the positions of search agentsPositions=rand(nPop,nVar).*(VarMax-VarMin)+VarMin;BestCosts=zeros(1,MaxIt);fitness=nan(1,nPop);iter=0;  % Loop counter%% Main loopwhile iter<MaxIt    for i=1:nPop                % Return back the search agents that go beyond the boundaries of the search space        Flag4ub=Positions(i,:)>VarMax;        Flag4lb=Positions(i,:)<VarMin;        Positions(i,:)=(Positions(i,:).*(~(Flag4ub+Flag4lb)))+VarMax.*Flag4ub+VarMin.*Flag4lb;                % Calculate objective function for each search agent        fitness(i)= CostFunction(Positions(i,:), nFun);                % Update Alpha, Beta, and Delta        if fitness(i)<Alpha_score            Alpha_score=fitness(i);  % Update Alpha            Alpha_pos=Positions(i,:);        end                if fitness(i)>Alpha_score && fitness(i)<Beta_score            Beta_score=fitness(i);  % Update Beta            Beta_pos=Positions(i,:);        end                if fitness(i)>Alpha_score && fitness(i)>Beta_score && fitness(i)<Delta_score            Delta_score=fitness(i);  % Update Delta            Delta_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                        r1=rand;            r2=rand;                        A1=2*a*r1-a;            C1=2*r2;                        D_alpha=abs(C1*Alpha_pos(j)-Positions(i,j));            X1=Alpha_pos(j)-A1*D_alpha;                        r1=rand;            r2=rand;                        A2=2*a*r1-a;            C2=2*r2;                        D_beta=abs(C2*Beta_pos(j)-Positions(i,j));            X2=Beta_pos(j)-A2*D_beta;                        r1=rand;            r2=rand;                        A3=2*a*r1-a;            C3=2*r2;                        D_delta=abs(C3*Delta_pos(j)-Positions(i,j));            X3=Delta_pos(j)-A3*D_delta;                        Positions(i,j)=(X1+X2+X3)/3;                    end    end        iter=iter+1;    BestCosts(iter)=Alpha_score;        fprintf('Iter= %g,  NFE= %g,  Best Cost = %g\n',iter,NFE,Alpha_score); end

3 仿真结果

image.gif编辑

4 参考文献

[1] Akbari E ,  Rahimnejad A ,  Gadsden S A . A greedy non﹉ierarchical grey wolf optimizer for real﹚orld optimization[J]. Electronics Letters, 2021(1).

博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。

部分理论引用网络文献,若有侵权联系博主删除。

5 代码下载

相关文章
|
24天前
|
机器学习/深度学习 传感器 算法
【无人车路径跟踪】基于神经网络的数据驱动迭代学习控制(ILC)算法,用于具有未知模型和重复任务的非线性单输入单输出(SISO)离散时间系统的无人车的路径跟踪(Matlab代码实现)
【无人车路径跟踪】基于神经网络的数据驱动迭代学习控制(ILC)算法,用于具有未知模型和重复任务的非线性单输入单输出(SISO)离散时间系统的无人车的路径跟踪(Matlab代码实现)
|
24天前
|
canal 算法 vr&ar
【图像处理】基于电磁学优化算法的多阈值分割算法研究(Matlab代码实现)
【图像处理】基于电磁学优化算法的多阈值分割算法研究(Matlab代码实现)
|
24天前
|
机器学习/深度学习 存储 算法
【微电网调度】考虑需求响应的基于改进多目标灰狼算法的微电网优化调度研究(Matlab代码实现)
【微电网调度】考虑需求响应的基于改进多目标灰狼算法的微电网优化调度研究(Matlab代码实现)
|
24天前
|
传感器 机器学习/深度学习 编解码
MATLAB|主动噪声和振动控制算法——对较大的次级路径变化具有鲁棒性
MATLAB|主动噪声和振动控制算法——对较大的次级路径变化具有鲁棒性
142 3
|
29天前
|
存储 编解码 算法
【多光谱滤波器阵列设计的最优球体填充】使用MSFA设计方法进行各种重建算法时,图像质量可以提高至多2 dB,并在光谱相似性方面实现了显著提升(Matlab代码实现)
【多光谱滤波器阵列设计的最优球体填充】使用MSFA设计方法进行各种重建算法时,图像质量可以提高至多2 dB,并在光谱相似性方面实现了显著提升(Matlab代码实现)
|
1月前
|
传感器 机器学习/深度学习 算法
【使用 DSP 滤波器加速速度和位移】使用信号处理算法过滤加速度数据并将其转换为速度和位移研究(Matlab代码实现)
【使用 DSP 滤波器加速速度和位移】使用信号处理算法过滤加速度数据并将其转换为速度和位移研究(Matlab代码实现)
120 1
|
1月前
|
传感器 机器学习/深度学习 算法
【UASNs、AUV】无人机自主水下传感网络中遗传算法的路径规划问题研究(Matlab代码实现)
【UASNs、AUV】无人机自主水下传感网络中遗传算法的路径规划问题研究(Matlab代码实现)
|
18天前
|
机器学习/深度学习 算法 数据可视化
基于MVO多元宇宙优化的DBSCAN聚类算法matlab仿真
本程序基于MATLAB实现MVO优化的DBSCAN聚类算法,通过多元宇宙优化自动搜索最优参数Eps与MinPts,提升聚类精度。对比传统DBSCAN,MVO-DBSCAN有效克服参数依赖问题,适应复杂数据分布,增强鲁棒性,适用于非均匀密度数据集的高效聚类分析。
|
18天前
|
开发框架 算法 .NET
基于ADMM无穷范数检测算法的MIMO通信系统信号检测MATLAB仿真,对比ML,MMSE,ZF以及LAMA
简介:本文介绍基于ADMM的MIMO信号检测算法,结合无穷范数优化与交替方向乘子法,降低计算复杂度并提升检测性能。涵盖MATLAB 2024b实现效果图、核心代码及详细注释,并对比ML、MMSE、ZF、OCD_MMSE与LAMA等算法。重点分析LAMA基于消息传递的低复杂度优势,适用于大规模MIMO系统,为通信系统检测提供理论支持与实践方案。(238字)
|
29天前
|
机器学习/深度学习 传感器 算法
【高创新】基于优化的自适应差分导纳算法的改进最大功率点跟踪研究(Matlab代码实现)
【高创新】基于优化的自适应差分导纳算法的改进最大功率点跟踪研究(Matlab代码实现)
147 14

热门文章

最新文章