多目标优化算法之灰狼优化算法(MOGWO)

多目标优化算法的最终目标是找到具有最高多样性的真实帕累托最优解的非常精确的近似。这使得决策者可以有多样化的设计方案。

多目标灰狼算法MOGWO,代码写的很清楚,建议新手可以从这篇代码学起。

为了将 GWO 用于多目标优化,代码中集成了两个新组件。采用的组件与MOPSO(Coello 等人,2004)的组件非常相似。其一是存档,负责存储到目前为止获得的非支配性帕累托最优解。其二是一个领导者选择策略,协助选择 alpha、beta 和 delta 的解,作为从存档中获得的狩猎过程的领导者。

MOGWO 算法的伪代码如下:

bc786116ba0902a871d73ae17eefef85.png

MOGWO 的源代码在http://www.alimirjalili.com/GWO.html 上公开提供。

MOGWO 算法的收敛性是有保证的,因为它利用了相同的数学模型来搜索最优解。事实证明,GWO 要求搜索智能体在优化的初期突然改变位置,在优化的后期逐渐改变位置。MOGWO算法继承了 GWO 的所有特征,这意味着搜索智能体以相同的方式探索和开发搜索空间。主要的区别是,MOGWO 围绕一组存档个体进行搜索(即使存档没有变化,也可能不同),而 GWO 只保存和改进三个最好的解。

MOGWO采用的是网格机制,想要非支配排序机制的多目标优化算法的小伙伴,可以关注多目标猫群优化和多目标鲸鱼优化,后续会陆续发布。

MOGWO在CEC2009多目标函数ZDT3上的表现如下图所示:

c3e2f3f76a501e0bbd8d1280fbf496ad.gif

代码:

clear all
clc
drawing_flag = 1;
nVar=5;
fobj=@(x) ZDT3(x);
% Lower bound and upper bound
lb=zeros(1,5);
ub=ones(1,5);
VarSize=[1 nVar];
GreyWolves_num=100;
MaxIt=50;  % Maximum Number of Iterations
Archive_size=100;   % Repository Size


alpha=0.1;  % Grid Inflation Parameter
nGrid=10;   % Number of Grids per each Dimension
beta=4; %=4;    % Leader Selection Pressure Parameter
gamma=2;    % Extra (to be deleted) Repository Member Selection Pressure
% Initialization
GreyWolves=CreateEmptyParticle(GreyWolves_num);
for i=1:GreyWolves_num
    GreyWolves(i).Velocity=0;
    GreyWolves(i).Position=zeros(1,nVar);
    for j=1:nVar
        GreyWolves(i).Position(1,j)=unifrnd(lb(j),ub(j),1);
    end
    GreyWolves(i).Cost=fobj(GreyWolves(i).Position')';
    GreyWolves(i).Best.Position=GreyWolves(i).Position;
    GreyWolves(i).Best.Cost=GreyWolves(i).Cost;
end


GreyWolves=DetermineDomination(GreyWolves);


Archive=GetNonDominatedParticles(GreyWolves);


Archive_costs=GetCosts(Archive);
G=CreateHypercubes(Archive_costs,nGrid,alpha);


for i=1:numel(Archive)
    [Archive(i).GridIndex Archive(i).GridSubIndex]=GetGridIndex(Archive(i),G);
end


% MOGWO main loop


for it=1:MaxIt
    a=2-it*((2)/MaxIt);
    for i=1:GreyWolves_num
        
        clear rep2
        clear rep3
        
        % Choose the alpha, beta, and delta grey wolves
        Delta=SelectLeader(Archive,beta);
        Beta=SelectLeader(Archive,beta);
        Alpha=SelectLeader(Archive,beta);
        
        % If there are less than three solutions in the least crowded
        % hypercube, the second least crowded hypercube is also found
        % to choose other leaders from.
        if size(Archive,1)>1
            counter=0;
            for newi=1:size(Archive,1)
                if sum(Delta.Position~=Archive(newi).Position)~=0
                    counter=counter+1;
                    rep2(counter,1)=Archive(newi);
                end
            end
            Beta=SelectLeader(rep2,beta);
        end
        
        % This scenario is the same if the second least crowded hypercube
        % has one solution, so the delta leader should be chosen from the
        % third least crowded hypercube.
        if size(Archive,1)>2
            counter=0;
            for newi=1:size(rep2,1)
                if sum(Beta.Position~=rep2(newi).Position)~=0
                    counter=counter+1;
                    rep3(counter,1)=rep2(newi);
                end
            end
            Alpha=SelectLeader(rep3,beta);
        end
        
        % Eq.(3.4) in the paper
        c=2.*rand(1, nVar);
        % Eq.(3.1) in the paper
        D=abs(c.*Delta.Position-GreyWolves(i).Position);
        % Eq.(3.3) in the paper
        A=2.*a.*rand(1, nVar)-a;
        % Eq.(3.8) in the paper
        X1=Delta.Position-A.*abs(D);
        
        
        % Eq.(3.4) in the paper
        c=2.*rand(1, nVar);
        % Eq.(3.1) in the paper
        D=abs(c.*Beta.Position-GreyWolves(i).Position);
        % Eq.(3.3) in the paper
        A=2.*a.*rand()-a;
        % Eq.(3.9) in the paper
        X2=Beta.Position-A.*abs(D);
        
        
        % Eq.(3.4) in the paper
        c=2.*rand(1, nVar);
        % Eq.(3.1) in the paper
        D=abs(c.*Alpha.Position-GreyWolves(i).Position);
        % Eq.(3.3) in the paper
        A=2.*a.*rand()-a;
        % Eq.(3.10) in the paper
        X3=Alpha.Position-A.*abs(D);
        
        % Eq.(3.11) in the paper
        GreyWolves(i).Position=(X1+X2+X3)./3;
        
        % Boundary checking
        GreyWolves(i).Position=min(max(GreyWolves(i).Position,lb),ub);
        
        GreyWolves(i).Cost=fobj(GreyWolves(i).Position')';
    end
    
    GreyWolves=DetermineDomination(GreyWolves);
    non_dominated_wolves=GetNonDominatedParticles(GreyWolves);
    
    Archive=[Archive
        non_dominated_wolves];
    
    Archive=DetermineDomination(Archive);
    Archive=GetNonDominatedParticles(Archive);
    
    for i=1:numel(Archive)
        [Archive(i).GridIndex Archive(i).GridSubIndex]=GetGridIndex(Archive(i),G);
    end
    
    if numel(Archive)>Archive_size
        EXTRA=numel(Archive)-Archive_size;
        Archive=DeleteFromRep(Archive,EXTRA,gamma);
        
        Archive_costs=GetCosts(Archive);
        G=CreateHypercubes(Archive_costs,nGrid,alpha);
        
    end
    
    disp(['In iteration ' num2str(it) ': Number of solutions in the archive = ' num2str(numel(Archive))]);
    save results
    
    % Results
    
    costs=GetCosts(GreyWolves);
    Archive_costs=GetCosts(Archive);
    
    if drawing_flag==1
        hold off
        plot(costs(1,:),costs(2,:),'k.');
        hold on
        plot(Archive_costs(1,:),Archive_costs(2,:),'rd');
        legend('Grey wolves','Non-dominated solutions');
        drawnow
    end  
end

免费完整代码获取,后台回复关键词:

多目标02

  • 2
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
### 回答1: 多目标灰狼优化算法MOGWO)是一种基于自然界中灰狼群体行为的优化算法,用于解决多目标优化问题。其灵感来源于狼群中的社会行为、群体协作和个体竞争的特点。 MOGWO算法的基本流程如下:首先,根据问题的需求,初始化一群随机位置的灰狼个体。然后,通过计算每个个体的目标函数值,确定个体的适应度。根据适应度对个体进行排序,找到适应度最高的个体作为当前最优解。接下来,利用方程式模拟灰狼个体间的协作与竞争的过程,更新每个个体的位置和速度。在更新位置过程中,采用约束函数保证灰狼个体的搜索范围。重复进行上述步骤,直到达到停止准则或迭代次数达到设定值。 MOGWO算法具有以下特点和优势:首先,模拟了灰狼个体间的协作与竞争过程,使搜索能力增强,有助于更好地寻找最优解。其次,采用多目标优化方法,可以处理多个相互冲突的目标函数,得到Pareto最优解集。此外,MOGWO算法具有较好的全局搜索能力和较快的收敛速度,使得问题的解得到更好的优化。 总之,多目标灰狼优化算法MOGWO)是一种基于灰狼群体行为的优化算法,通过模拟协作与竞争的过程,以多目标优化方法寻找最优解。其具有搜索能力强、可处理多目标冲突、全局搜索能力强和收敛速度快等优势。 ### 回答2: 多目标灰狼优化算法(MOGWO)是一种基于自然灵触源、仿生智能的优化算法。灰狼是一种高度社交性的动物,具有优秀的协作和适应能力,这些特点被运用到MOGWO算法中,以解决多目标优化问题。 MOGWO的灵感源自灰狼的社会行为。算法通过模拟灰狼族群中的“α狼”、“β狼”、“δ狼”等个体的行为,来表示候选解的状态。在每一代演化中,灰狼根据自身适应度和紧邻狼的适应度来调整自己的位置和行为策略。 MOGWO算法的核心思想在于通过仿真灰狼的协作行为来求解多目标优化问题。每个个体都有自己的优劣势和受限制条件,通过相互合作和竞争,整个种群能够从多个角度进行探索,并找到全局和局部最优解。 MOGWO算法包括五个步骤:初始化种群、计算适应度、更新灰狼位置、限制位置范围、更新搜索半径和种群的大小。在每一代中,个体通过搜寻周围个体的位置和适应度信息来更新自己的位置和搜索半径。 MOGWO算法的优势在于能够处理复杂的多目标问题并同时优化多个目标。相较于使用传统单目标优化算法MOGWO算法具有更好的收敛速度和解的全局性。此外,MOGWO算法的设计简单,易于实现,并且对初始参数的敏感度较低。 总之,MOGWO算法通过灵活的调整个体位置和搜索半径,通过灰狼开展合作和竞争行为来求解多目标优化问题。它是一种有效的优化算法,能够找到多个目标的最优解,并在许多实际问题中得到了成功的应用。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

今天吃饺子

不想刀我的可以选择爱我

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值