-
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.
2. add New Algorithms and Problems
- Loading branch information
Showing
26 changed files
with
1,023 additions
and
11 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
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
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,38 @@ | ||
function [Population,Dec,Mask,FrontNo,CrowdDis] = EnvironmentalSelection(Population,Dec,Mask,N) | ||
% The environmental selection of SparseEA | ||
|
||
%------------------------------- 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". | ||
%-------------------------------------------------------------------------- | ||
|
||
%% Delete duplicated solutions | ||
[~,uni] = unique(Population.objs,'rows'); | ||
Population = Population(uni); | ||
Dec = Dec(uni,:); | ||
Mask = Mask(uni,:); | ||
N = min(N,length(Population)); | ||
|
||
%% Non-dominated sorting | ||
[FrontNo,MaxFNo] = NDSort(Population.objs,Population.cons,N); | ||
Next = FrontNo < MaxFNo; | ||
|
||
%% Calculate the crowding distance of each solution | ||
CrowdDis = CrowdingDistance(Population.objs,FrontNo); | ||
|
||
%% Select the solutions in the last front based on their crowding distances | ||
Last = find(FrontNo==MaxFNo); | ||
[~,Rank] = sort(CrowdDis(Last),'descend'); | ||
Next(Last(Rank(1:N-sum(Next)))) = true; | ||
|
||
%% Population for next generation | ||
Population = Population(Next); | ||
FrontNo = FrontNo(Next); | ||
CrowdDis = CrowdDis(Next); | ||
Dec = Dec(Next,:); | ||
Mask = Mask(Next,:); | ||
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,61 @@ | ||
function [OffDec,OffMask] = Operator(ParentDec,ParentMask,Fitness,REAL) | ||
% The operator of SparseEA | ||
|
||
%------------------------------- 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 | ||
[N,D] = size(ParentDec); | ||
Parent1Mask = ParentMask(1:N/2,:); | ||
Parent2Mask = ParentMask(N/2+1:end,:); | ||
|
||
%% Crossover for mask | ||
OffMask = Parent1Mask; | ||
for i = 1 : N/2 | ||
if rand < 0.5 | ||
index = find(Parent1Mask(i,:)&~Parent2Mask(i,:)); | ||
index = index(TS(-Fitness(index))); | ||
OffMask(i,index) = 0; | ||
else | ||
index = find(~Parent1Mask(i,:)&Parent2Mask(i,:)); | ||
index = index(TS(Fitness(index))); | ||
OffMask(i,index) = Parent2Mask(i,index); | ||
end | ||
end | ||
|
||
%% Mutation for mask | ||
for i = 1 : N/2 | ||
if rand < 0.5 | ||
index = find(OffMask(i,:)); | ||
index = index(TS(-Fitness(index))); | ||
OffMask(i,index) = 0; | ||
else | ||
index = find(~OffMask(i,:)); | ||
index = index(TS(Fitness(index))); | ||
OffMask(i,index) = 1; | ||
end | ||
end | ||
|
||
%% Crossover and mutation for dec | ||
if REAL | ||
OffDec = GAhalf(ParentDec); | ||
else | ||
OffDec = ones(N/2,D); | ||
end | ||
end | ||
|
||
function index = TS(Fitness) | ||
% Binary tournament selection | ||
|
||
if isempty(Fitness) | ||
index = []; | ||
else | ||
index = TournamentSelection(2,1,Fitness); | ||
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,58 @@ | ||
function SparseEA(Global) | ||
% <algorithm> <S> | ||
% Evolutionary algorithm for sparse multi-objective optimization problems | ||
|
||
%------------------------------- Reference -------------------------------- | ||
% Y. Tian, X. Zhang, C. Wang, and Y. Jin, An evolutionary algorithm for | ||
% large-scale sparse multi-objective optimization problems, IEEE | ||
% Transactions on Evolutionary Computation, 2019. | ||
%------------------------------- 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". | ||
%-------------------------------------------------------------------------- | ||
|
||
%% Population initialization | ||
% Calculate the fitness of each decision variable | ||
TDec = []; | ||
TMask = []; | ||
TempPop = []; | ||
Fitness = zeros(1,Global.D); | ||
REAL = ~strcmp(Global.encoding,'binary'); | ||
for i = 1 : 1+4*REAL | ||
if REAL | ||
Dec = unifrnd(repmat(Global.lower,Global.D,1),repmat(Global.upper,Global.D,1)); | ||
else | ||
Dec = ones(Global.D,Global.D); | ||
end | ||
Mask = eye(Global.D); | ||
Population = INDIVIDUAL(Dec.*Mask); | ||
TDec = [TDec;Dec]; | ||
TMask = [TMask;Mask]; | ||
TempPop = [TempPop,Population]; | ||
Fitness = Fitness + NDSort([Population.objs,Population.cons],inf); | ||
end | ||
% Generate initial population | ||
if REAL | ||
Dec = unifrnd(repmat(Global.lower,Global.N,1),repmat(Global.upper,Global.N,1)); | ||
else | ||
Dec = ones(Global.N,Global.D); | ||
end | ||
Mask = zeros(Global.N,Global.D); | ||
for i = 1 : Global.N | ||
Mask(i,TournamentSelection(2,ceil(rand*Global.D),Fitness)) = 1; | ||
end | ||
Population = INDIVIDUAL(Dec.*Mask); | ||
[Population,Dec,Mask,FrontNo,CrowdDis] = EnvironmentalSelection([Population,TempPop],[Dec;TDec],[Mask;TMask],Global.N); | ||
|
||
%% Optimization | ||
while Global.NotTermination(Population) | ||
MatingPool = TournamentSelection(2,2*Global.N,FrontNo,-CrowdDis); | ||
[OffDec,OffMask] = Operator(Dec(MatingPool,:),Mask(MatingPool,:),Fitness,REAL); | ||
Offspring = INDIVIDUAL(OffDec.*OffMask); | ||
[Population,Dec,Mask,FrontNo,CrowdDis] = EnvironmentalSelection([Population,Offspring],[Dec;OffDec],[Mask;OffMask],Global.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
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
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
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
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
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
Binary file not shown.
Binary file not shown.
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,57 @@ | ||
classdef SMOP1 < PROBLEM | ||
% <problem> <Sparse MOP> | ||
% Benchmark MOP with sparse Pareto optimal solutions | ||
% theta --- 0.1 --- Sparsity of the Pareto set | ||
|
||
%------------------------------- Reference -------------------------------- | ||
% Y. Tian, X. Zhang, C. Wang, and Y. Jin, An evolutionary algorithm for | ||
% large-scale sparse multi-objective optimization problems, IEEE | ||
% Transactions on Evolutionary Computation, 2019. | ||
%------------------------------- 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) | ||
theta = 0.1; % Sparsity of the Pareto set | ||
end | ||
methods | ||
%% Initialization | ||
function obj = SMOP1() | ||
obj.theta = obj.Global.ParameterSet(0.1); | ||
if isempty(obj.Global.M) | ||
obj.Global.M = 2; | ||
end | ||
if isempty(obj.Global.D) | ||
obj.Global.D = 100; | ||
end | ||
obj.Global.lower = [zeros(1,obj.Global.M-1)+0,zeros(1,obj.Global.D-obj.Global.M+1)-1]; | ||
obj.Global.upper = [zeros(1,obj.Global.M-1)+1,zeros(1,obj.Global.D-obj.Global.M+1)+2]; | ||
obj.Global.encoding = 'real'; | ||
end | ||
%% Calculate objective values | ||
function PopObj = CalObj(obj,X) | ||
[N,D] = size(X); | ||
M = obj.Global.M; | ||
K = ceil(obj.theta*(D-M+1)); | ||
g = sum(g1(X(:,M:M+K-1),pi/3),2) + sum(g2(X(:,M+K:end),0),2); | ||
PopObj = repmat(1+g/(D-M+1),1,M).*fliplr(cumprod([ones(N,1),X(:,1:M-1)],2)).*[ones(N,1),1-X(:,M-1:-1:1)]; | ||
end | ||
%% Sample reference points on Pareto front | ||
function P = PF(obj,N) | ||
P = UniformPoint(N,obj.Global.M); | ||
end | ||
end | ||
end | ||
|
||
function g = g1(x,t) | ||
g = (x-t).^2; | ||
end | ||
|
||
function g = g2(x,t) | ||
g = 2*(x-t).^2 + sin(2*pi*(x-t)).^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,57 @@ | ||
classdef SMOP2 < PROBLEM | ||
% <problem> <Sparse MOP> | ||
% Benchmark MOP with sparse Pareto optimal solutions | ||
% theta --- 0.1 --- Sparsity of the Pareto set | ||
|
||
%------------------------------- Reference -------------------------------- | ||
% Y. Tian, X. Zhang, C. Wang, and Y. Jin, An evolutionary algorithm for | ||
% large-scale sparse multi-objective optimization problems, IEEE | ||
% Transactions on Evolutionary Computation, 2019. | ||
%------------------------------- 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) | ||
theta = 0.1; % Sparsity of the Pareto set | ||
end | ||
methods | ||
%% Initialization | ||
function obj = SMOP2() | ||
obj.theta = obj.Global.ParameterSet(0.1); | ||
if isempty(obj.Global.M) | ||
obj.Global.M = 2; | ||
end | ||
if isempty(obj.Global.D) | ||
obj.Global.D = 100; | ||
end | ||
obj.Global.lower = [zeros(1,obj.Global.M-1)+0,zeros(1,obj.Global.D-obj.Global.M+1)-1]; | ||
obj.Global.upper = [zeros(1,obj.Global.M-1)+1,zeros(1,obj.Global.D-obj.Global.M+1)+2]; | ||
obj.Global.encoding = 'real'; | ||
end | ||
%% Calculate objective values | ||
function PopObj = CalObj(obj,X) | ||
[N,D] = size(X); | ||
M = obj.Global.M; | ||
K = ceil(obj.theta*(D-M+1)); | ||
g = sum(g2(X(:,M:M+K-1),pi/3),2) + sum(g3(X(:,M+K:end),0),2); | ||
PopObj = repmat(1+g/(D-M+1),1,M).*fliplr(cumprod([ones(N,1),X(:,1:M-1)],2)).*[ones(N,1),1-X(:,M-1:-1:1)]; | ||
end | ||
%% Sample reference points on Pareto front | ||
function P = PF(obj,N) | ||
P = UniformPoint(N,obj.Global.M); | ||
end | ||
end | ||
end | ||
|
||
function g = g2(x,t) | ||
g = 2*(x-t).^2 + sin(2*pi*(x-t)).^2; | ||
end | ||
|
||
function g = g3(x,t) | ||
g = 4-(x-t)-4./exp(100*(x-t).^2); | ||
end |
Oops, something went wrong.