多目标蜉蝣优化算法(Matlab代码实现)
原创
©著作权归作者所有:来自51CTO博客作者荔枝科研社的原创作品,请联系作者获取转载授权,否则将追究法律责任
💥1 概述
蜉蝣算法 (MA)由Konstantinos Zervoudakis于2020年提出的新方法来解决优化问题。受蜉蝣飞行行为和交配过程的启发,该算法结合了群体智能和进化算法的主要优点。为了评估所提出算法的性能,使用了 38 个数学基准函数,包括 13 个 CEC2017 测试函数,并将结果与七种最先进的著名元启发式优化方法的结果进行了比较。MA 的性能还通过多目标优化中的收敛行为以及使用现实世界的离散流水车间调度问题进行评估。比较结果证明了所提方法在收敛速度和收敛速度方面的优越性。婚礼舞蹈和随机飞行的过程增强了算法探索和利用属性之间的平衡,并帮助其摆脱局部最优。
📚2 运行结果
![多目标蜉蝣优化算法(Matlab代码实现)_matlab代码](https://s2.51cto.com/images/blog/202211/05023258_63655ada997ac34849.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_30,g_se,x_10,y_10,shadow_20,type_ZmFuZ3poZW5naGVpdGk=/resize,m_fixed,w_1184)
![多目标蜉蝣优化算法(Matlab代码实现)_多目标蜉蝣优化算法_02](https://s2.51cto.com/images/blog/202211/05023259_63655adb1d4c47785.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_30,g_se,x_10,y_10,shadow_20,type_ZmFuZ3poZW5naGVpdGk=/resize,m_fixed,w_1184)
部分代码:
clc; clear; close all;
%% Problem Definition
% Objective Functions
ANSWER=listdlg('PromptString','Choose Objective Function','SelectionMode','single', 'ListString', {'1. ZDT', '2. ZDT2', '3. ZDT3'});
if eq(ANSWER,1); ObjectiveFunction=@(x) ZDT(x); funcname='ZDT';
elseif eq(ANSWER,2); ObjectiveFunction=@(x) ZDT2(x); funcname='ZDT2';
elseif eq(ANSWER,3); ObjectiveFunction=@(x) ZDT3(x); funcname='ZDT3';
else; disp('Terminated'); return
end
ProblemSize=[1 10]; % Decision Variables Size
LowerBound=0; % Decision Variables Lower Bound
UpperBound=1; % Decision Variables Upper Bound
%% Mayfly Parameters
methname='Mayfly Algorithm';
MaxIt=1000; % Maximum Number of Iterations
nPop=20; nPopf=20; % Population Size (males and females)
nPareto=50; % Repository Size
g=0.8; % Inertia Weight
gdamp=1; % Inertia Weight Damping Ratio
a1=1.0; % Personal Learning Coefficient
a2=1.5; a3=1.5; % Global Learning Coefficient
beta=2; % Distance sight Coefficient
dance=0.77; % Mutation Coefficient
dance_damp=0.99; % Mutation Coefficient Damping Ratio
fl=0.77; % Random flight
fl_damp=0.99;
% Mating Parameters
nCrossover=20; % Number of Parnets (Offsprings)
nMutation=round(0.5*nPop); % Number of Mutants
mu=0.02; % Mutation Rate
% Velocity Limits
VelMax=1*(UpperBound-LowerBound)*5; VelMin=-VelMax;
%% Initialization
%run initial
empty_mayfly.Position=[];
empty_mayfly.Velocity=[];
empty_mayfly.Cost=[];
empty_mayfly.Best.Position=[];
empty_mayfly.Best.Cost=[];
empty_mayfly.Rank=[];
empty_mayfly.DominationSet=[];
empty_mayfly.DominatedCount=[];
empty_mayfly.CrowdingDistance=[];
Mayfly=repmat(empty_mayfly,nPop,1);
Mayflyf=repmat(empty_mayfly,nPopf,1);
for i=1:nPop
% Initialize Male Position
Mayfly(i).Position=unifrnd(LowerBound,UpperBound,ProblemSize);
% Initialize Velocity
Mayfly(i).Velocity=zeros(ProblemSize);
% Evaluation
Mayfly(i).Cost=ObjectiveFunction(Mayfly(i).Position);
% Update Personal Best
Mayfly(i).Best.Position=Mayfly(i).Position;
Mayfly(i).Best.Cost=Mayfly(i).Cost;
% Initialize female Position
if i<=nPopf
Mayflyf(i).Position=unifrnd(LowerBound,UpperBound,ProblemSize);
Mayflyf(i).Velocity=zeros(ProblemSize);
Mayflyf(i).Cost=ObjectiveFunction(Mayflyf(i).Position);
Mayflyf(i).Best.Position=Mayflyf(i).Position;
Mayflyf(i).Best.Cost=Mayflyf(i).Cost;
end
end
🎉3 参考文献
[1]Zervoudakis, K., & Tsafarakis, S. (2020). A mayfly optimization algorithm. Computers & Industrial Engineering, 145, 106559. https://doi.org/10.1016/j.cie.2020.106559
![多目标蜉蝣优化算法(Matlab代码实现)_matlab_03](https://s2.51cto.com/images/blog/202211/05023259_63655adb7367a41032.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_30,g_se,x_10,y_10,shadow_20,type_ZmFuZ3poZW5naGVpdGk=/resize,m_fixed,w_1184)
🌈4 Matlab代码实现