-
Notifications
You must be signed in to change notification settings - Fork 479
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add new algorithms, problems and metrics
- Loading branch information
Showing
13 changed files
with
687 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
function FRR = CreditAssignment(SW,D) | ||
% Credit assignment | ||
|
||
%------------------------------- Copyright -------------------------------- | ||
% Copyright (c) 2018-2019 BIMK Group. You are free to use the PlatEMO for | ||
% research purposes. All publications which use this platform or any code | ||
% in the platform should acknowledge the use of "PlatEMO" and reference "Ye | ||
% Tian, Ran Cheng, Xingyi Zhang, and Yaochu Jin, PlatEMO: A MATLAB platform | ||
% for evolutionary multi-objective optimization [educational forum], IEEE | ||
% Computational Intelligence Magazine, 2017, 12(4): 73-87". | ||
%-------------------------------------------------------------------------- | ||
|
||
K = 4; % Number of operators | ||
Reward = zeros(1,K); | ||
for i = 1 : K | ||
Reward(i) = sum(SW(2,SW(1,:)==i)); | ||
end | ||
[~,Rank] = sort(Reward,'descend'); | ||
[~,Rank] = sort(Rank); | ||
Decay = D.^Rank.*Reward; | ||
FRR = Decay./sum(Decay); | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
function op = FRRMAB(FRR,SW,C) | ||
% Bandit-based operator selection | ||
|
||
%------------------------------- Copyright -------------------------------- | ||
% Copyright (c) 2018-2019 BIMK Group. You are free to use the PlatEMO for | ||
% research purposes. All publications which use this platform or any code | ||
% in the platform should acknowledge the use of "PlatEMO" and reference "Ye | ||
% Tian, Ran Cheng, Xingyi Zhang, and Yaochu Jin, PlatEMO: A MATLAB platform | ||
% for evolutionary multi-objective optimization [educational forum], IEEE | ||
% Computational Intelligence Magazine, 2017, 12(4): 73-87". | ||
%-------------------------------------------------------------------------- | ||
|
||
if any(FRR==0) || any(SW(1,:)==0) | ||
op = randi(length(FRR)); | ||
else | ||
n = hist(SW(1,:),1:length(FRR)); | ||
[~,op] = max(FRR+C*sqrt(2*log(sum(n))./n)); | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
function Offspring = FourDE(op,x,x1,x2,x3,x4,x5) | ||
% Four different DE operators | ||
|
||
%------------------------------- Copyright -------------------------------- | ||
% Copyright (c) 2018-2019 BIMK Group. You are free to use the PlatEMO for | ||
% research purposes. All publications which use this platform or any code | ||
% in the platform should acknowledge the use of "PlatEMO" and reference "Ye | ||
% Tian, Ran Cheng, Xingyi Zhang, and Yaochu Jin, PlatEMO: A MATLAB platform | ||
% for evolutionary multi-objective optimization [educational forum], IEEE | ||
% Computational Intelligence Magazine, 2017, 12(4): 73-87". | ||
%-------------------------------------------------------------------------- | ||
|
||
%% Parameter setting | ||
[CR,F,proM,disM,K] = deal(1,0.5,1,20,0.5); | ||
D = length(x.dec); | ||
Global = GLOBAL.GetObj(); | ||
|
||
%% Differental evolution | ||
switch op | ||
case 1 | ||
% DE/rand/1 | ||
v = x.dec + F*(x1.dec-x2.dec); | ||
case 2 | ||
% DE/rand/2 | ||
v = x.dec + F*(x1.dec-x2.dec) + F*(x3.dec-x4.dec); | ||
case 3 | ||
% DE/current-to-rand/2 | ||
v = x.dec + K*(x.dec-x1.dec) + F*(x2.dec-x3.dec) + F*(x4.dec-x5.dec); | ||
case 4 | ||
% DE/current-to-rand/1 | ||
v = x.dec + K*(x.dec-x1.dec) + F*(x2.dec-x3.dec); | ||
end | ||
Offspring = x.dec; | ||
Site = rand(1,D) < (CR+(op>2)); | ||
Offspring(Site) = v(Site); | ||
|
||
%% Polynomial mutation | ||
Lower = Global.lower; | ||
Upper = Global.upper; | ||
Site = rand(1,D) < proM/D; | ||
mu = rand(1,D); | ||
temp = Site & mu<=0.5; | ||
Offspring = min(max(Offspring,Lower),Upper); | ||
Offspring(temp) = Offspring(temp)+(Upper(temp)-Lower(temp)).*((2.*mu(temp)+(1-2.*mu(temp)).*... | ||
(1-(Offspring(temp)-Lower(temp))./(Upper(temp)-Lower(temp))).^(disM+1)).^(1/(disM+1))-1); | ||
temp = Site & mu>0.5; | ||
Offspring(temp) = Offspring(temp)+(Upper(temp)-Lower(temp)).*(1-(2.*(1-mu(temp))+2.*(mu(temp)-0.5).*... | ||
(1-(Upper(temp)-Offspring(temp))./(Upper(temp)-Lower(temp))).^(disM+1)).^(1/(disM+1))); | ||
Offspring = INDIVIDUAL(Offspring); | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
function MOEADFRRMAB(Global) | ||
% <algorithm> <M> | ||
% MOEA/D with fitness-rate-rank-based multiarmed bandit | ||
% C --- 5 --- Scaling factor in bandit-based operator selection | ||
% W --- --- Size of sliding window | ||
% D --- 1 --- Decaying factor in calculating credit value | ||
|
||
%------------------------------- Reference -------------------------------- | ||
% K. Li, A. Fialho, S. Kwong, and Q. Zhang, Adaptive operator selection | ||
% with bandits for a multiobjective evolutionary algorithm based on | ||
% decomposition, IEEE Transactions on Evolutionary Computation, 2014, | ||
% 18(1): 114-130. | ||
%------------------------------- Copyright -------------------------------- | ||
% Copyright (c) 2018-2019 BIMK Group. You are free to use the PlatEMO for | ||
% research purposes. All publications which use this platform or any code | ||
% in the platform should acknowledge the use of "PlatEMO" and reference "Ye | ||
% Tian, Ran Cheng, Xingyi Zhang, and Yaochu Jin, PlatEMO: A MATLAB platform | ||
% for evolutionary multi-objective optimization [educational forum], IEEE | ||
% Computational Intelligence Magazine, 2017, 12(4): 73-87". | ||
%-------------------------------------------------------------------------- | ||
|
||
%% Parameter setting | ||
[C,W,D] = Global.ParameterSet(5,ceil(Global.N/2),1); | ||
|
||
%% Generate the weight vectors | ||
[Weight,Global.N] = UniformPoint(Global.N,Global.M); | ||
% Size of neighborhood | ||
T = 20; | ||
% Maximum number of solutions replaced by each offspring | ||
nr = 2; | ||
|
||
%% Detect the neighbours of each solution | ||
B = pdist2(Weight,Weight); | ||
[~,B] = sort(B,2); | ||
B = B(:,1:T); | ||
|
||
%% Generate random population | ||
Population = Global.Initialization(); | ||
Z = min(Population.objs,[],1); | ||
% Utility for each subproblem | ||
Pi = ones(Global.N,1); | ||
% Old Tchebycheff function value of each solution on its subproblem | ||
oldObj = max(abs((Population.objs-repmat(Z,Global.N,1)).*Weight),[],2); | ||
|
||
%% Optimization | ||
FRR = zeros(1,4); % Credit value of each operator | ||
SW = zeros(2,W); % Sliding window | ||
while Global.NotTermination(Population) | ||
for subgeneration = 1 : 5 | ||
% Choose I | ||
Bounday = find(sum(Weight<1e-3,2)==Global.M-1)'; | ||
I = [Bounday,TournamentSelection(10,floor(Global.N/5)-length(Bounday),-Pi)]; | ||
|
||
% For each solution in I | ||
for i = I | ||
% Bandit-based operator selection | ||
op = FRRMAB(FRR,SW,C); | ||
|
||
% Choose the parents | ||
if rand < 0.9 | ||
P = B(i,randperm(end)); | ||
else | ||
P = randperm(Global.N); | ||
end | ||
|
||
% Generate an offspring | ||
Offspring = FourDE(op,Population(i),Population(P(1)),Population(P(2)),Population(P(3)),Population(P(4)),Population(P(5))); | ||
|
||
% Update the ideal point | ||
Z = min(Z,Offspring.obj); | ||
|
||
% Update the solutions in P by Tchebycheff approach | ||
g_old = max(abs(Population(P).objs-repmat(Z,length(P),1)).*Weight(P,:),[],2); | ||
g_new = max(repmat(abs(Offspring.obj-Z),length(P),1).*Weight(P,:),[],2); | ||
replace = find(g_old>=g_new,nr); | ||
Population(P(replace)) = Offspring; | ||
FIR = sum((g_old(replace)-g_new(replace))./g_old(replace)); | ||
SW = [SW(1,2:end),op;SW(2,2:end),FIR]; | ||
FRR = CreditAssignment(SW,D); | ||
end | ||
end | ||
if ~mod(Global.gen,10) | ||
% Update Pi for each solution | ||
newObj = max(abs((Population.objs-repmat(Z,Global.N,1)).*Weight),[],2); | ||
DELTA = (oldObj-newObj)./oldObj; | ||
Temp = DELTA < 0.001; | ||
Pi(~Temp) = 1; | ||
Pi(Temp) = (0.95+0.05*DELTA(Temp)/0.001).*Pi(Temp); | ||
oldObj = newObj; | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
function Score = CPF(PopObj,PF) | ||
% <metric> <max> | ||
% Coverage of Pareto front | ||
|
||
%------------------------------- Copyright -------------------------------- | ||
% Copyright (c) 2018-2019 BIMK Group. You are free to use the PlatEMO for | ||
% research purposes. All publications which use this platform or any code | ||
% in the platform should acknowledge the use of "PlatEMO" and reference "Ye | ||
% Tian, Ran Cheng, Xingyi Zhang, and Yaochu Jin, PlatEMO: A MATLAB platform | ||
% for evolutionary multi-objective optimization [educational forum], IEEE | ||
% Computational Intelligence Magazine, 2017, 12(4): 73-87". | ||
%-------------------------------------------------------------------------- | ||
|
||
if size(PF,1) > 1 | ||
%% Normalization | ||
fmin = min(PF,[],1); | ||
fmax = max(PF,[],1); | ||
PopObj = (PopObj-repmat(fmin,size(PopObj,1),1))./repmat(fmax-fmin,size(PopObj,1),1); | ||
PF = (PF-repmat(fmin,size(PF,1),1))./repmat(fmax-fmin,size(PF,1),1); | ||
|
||
%% Map to the Pareto front | ||
[~,Close] = min(pdist2(PopObj,PF),[],2); | ||
PopObj = PF(Close,:); | ||
|
||
%% Calculate the indicator value | ||
VPF = Coverage(map(PF,PF),inf); | ||
V = Coverage(map(PopObj,PF),VPF/size(PopObj,1)); | ||
Score = V./VPF; | ||
else | ||
fmin = min(PopObj,[],1); | ||
fmax = max(PopObj,[],1); | ||
PopObj = (PopObj-repmat(fmin,size(PopObj,1),1))./repmat(fmax-fmin,size(PopObj,1),1); | ||
Score = Coverage(map(PopObj,PopObj),1/size(PopObj,1)); | ||
end | ||
end | ||
|
||
function y = map(x,PF) | ||
% Project the points in an (M-1)-d manifold to an (M-1)-d unit hypercube | ||
|
||
[N,M] = size(x); | ||
x = x - repmat((sum(x,2)-1)/M,1,M); | ||
PF = PF - repmat((sum(PF,2)-1)/M,1,M); | ||
x = x - min(PF); | ||
x = x./repmat(sum(x,2),1,M); | ||
x = max(1e-6,x); | ||
y = zeros(N,M-1); | ||
for i = 1 : N | ||
c = ones(1,M); | ||
k = find(x(i,:)~=0,1); | ||
for j = k+1 : M | ||
temp = x(i,j)/x(i,k)*prod(c(M-j+2:M-k)); | ||
c(M-j+1) = 1/(temp+1); | ||
end | ||
y(i,:) = c(1:M-1); | ||
end | ||
y = y.^repmat(M-1:-1:1,N,1); | ||
end | ||
|
||
function V = Coverage(P,maxv) | ||
% Calculate the hypervolume of each point's monopolized hypercube | ||
|
||
[N,M] = size(P); | ||
L = zeros(N,1); | ||
for x = 1 : N | ||
P1 = P; | ||
P1(x,:) = inf; | ||
L(x) = min(max(abs(P1-repmat(P(x,:),N,1)),[],2)); | ||
end | ||
L = min(L,maxv.^(1/M)); | ||
Lower = max(0,P-repmat(L/2,1,M)); | ||
Upper = min(1,P+repmat(L/2,1,M)); | ||
V = sum(prod(Upper-Lower,2)); | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
classdef IMOP1 < PROBLEM | ||
% <problem> <IMOP> | ||
% Benchmark MOP with irregular Pareto front | ||
% a1 --- 0.05 --- Parameter a1 | ||
% K --- 5 --- Parameter K | ||
|
||
%------------------------------- Copyright -------------------------------- | ||
% Copyright (c) 2018-2019 BIMK Group. You are free to use the PlatEMO for | ||
% research purposes. All publications which use this platform or any code | ||
% in the platform should acknowledge the use of "PlatEMO" and reference "Ye | ||
% Tian, Ran Cheng, Xingyi Zhang, and Yaochu Jin, PlatEMO: A MATLAB platform | ||
% for evolutionary multi-objective optimization [educational forum], IEEE | ||
% Computational Intelligence Magazine, 2017, 12(4): 73-87". | ||
%-------------------------------------------------------------------------- | ||
|
||
properties(Access = private) | ||
a1 = 0.05; % Parameter a1 | ||
K = 5; % Parameter K | ||
end | ||
methods | ||
%% Initialization | ||
function obj = IMOP1() | ||
[obj.a1,obj.K] = obj.Global.ParameterSet(0.05,5); | ||
obj.Global.M = 2; | ||
if isempty(obj.Global.D) | ||
obj.Global.D = 10; | ||
end | ||
obj.Global.lower = zeros(1,obj.Global.D); | ||
obj.Global.upper = ones(1,obj.Global.D); | ||
obj.Global.encoding = 'real'; | ||
end | ||
%% Calculate objective values | ||
function PopObj = CalObj(obj,PopDec) | ||
y1 = mean(PopDec(:,1:obj.K),2).^obj.a1; | ||
g = sum((PopDec(:,obj.K+1:end)-0.5).^2,2); | ||
PopObj(:,1) = g + cos(y1*pi/2).^8; | ||
PopObj(:,2) = g + sin(y1*pi/2).^8; | ||
end | ||
%% Sample reference points on Pareto front | ||
function P = PF(obj,N) | ||
x = linspace(0.5^4,1,floor(N/2))'; | ||
P(:,1) = [x;(1-x.^0.25).^4]; | ||
P(:,2) = [(1-x.^0.25).^4;x]; | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
classdef IMOP2 < PROBLEM | ||
% <problem> <IMOP> | ||
% Benchmark MOP with irregular Pareto front | ||
% a1 --- 0.05 --- Parameter a1 | ||
% K --- 5 --- Parameter K | ||
|
||
%------------------------------- Copyright -------------------------------- | ||
% Copyright (c) 2018-2019 BIMK Group. You are free to use the PlatEMO for | ||
% research purposes. All publications which use this platform or any code | ||
% in the platform should acknowledge the use of "PlatEMO" and reference "Ye | ||
% Tian, Ran Cheng, Xingyi Zhang, and Yaochu Jin, PlatEMO: A MATLAB platform | ||
% for evolutionary multi-objective optimization [educational forum], IEEE | ||
% Computational Intelligence Magazine, 2017, 12(4): 73-87". | ||
%-------------------------------------------------------------------------- | ||
|
||
properties(Access = private) | ||
a1 = 0.05; % Parameter a1 | ||
K = 5; % Parameter K | ||
end | ||
methods | ||
%% Initialization | ||
function obj = IMOP2() | ||
[obj.a1,obj.K] = obj.Global.ParameterSet(0.05,5); | ||
obj.Global.M = 2; | ||
if isempty(obj.Global.D) | ||
obj.Global.D = 10; | ||
end | ||
obj.Global.lower = zeros(1,obj.Global.D); | ||
obj.Global.upper = ones(1,obj.Global.D); | ||
obj.Global.encoding = 'real'; | ||
end | ||
%% Calculate objective values | ||
function PopObj = CalObj(obj,PopDec) | ||
y1 = mean(PopDec(:,1:obj.K),2).^obj.a1; | ||
g = sum((PopDec(:,obj.K+1:end)-0.5).^2,2); | ||
PopObj(:,1) = g + cos(y1*pi/2).^0.5; | ||
PopObj(:,2) = g + sin(y1*pi/2).^0.5; | ||
end | ||
%% Sample reference points on Pareto front | ||
function P = PF(obj,N) | ||
x = linspace(0,0.5^0.25,floor(N/2))'; | ||
P(:,1) = [x;(1-x.^4).^0.25]; | ||
P(:,2) = [(1-x.^4).^0.25;x]; | ||
end | ||
end | ||
end |
Oops, something went wrong.