-
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.
- Loading branch information
1 parent
da551f1
commit e91a453
Showing
75 changed files
with
3,182 additions
and
459 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
107 changes: 107 additions & 0 deletions
107
PlatEMO/Algorithms/Multi-objective optimization/CMOES/CMOES.m
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,107 @@ | ||
classdef CMOES < ALGORITHM | ||
% <multi> <real/integer/label/binary/permutation> <constrained> | ||
% Constrained multi-objective optimization based on even search | ||
% type --- 1 --- Type of operator (1. GA 2. DE) | ||
|
||
%------------------------------- Reference -------------------------------- | ||
% F. Ming, W. Gong, and Y. Jin, Even search in a promising region for | ||
% constrained multi-objective optimization, IEEE/CAA Journal of Automatica | ||
% Sinica, 2024, 11(2): 474-486. | ||
%------------------------------- Copyright -------------------------------- | ||
% Copyright (c) 2024 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". | ||
%-------------------------------------------------------------------------- | ||
|
||
% This function is written by Fei Ming (email: 20151000334@cug.edu.cn) | ||
|
||
methods | ||
function main(Algorithm,Problem) | ||
%% Parameter setting | ||
type = Algorithm.ParameterSet(1); | ||
|
||
%% Generate random population | ||
Population1 = Problem.Initialization(); | ||
Population2 = Problem.Initialization(); | ||
[~,FrontNo,CrowdDis] = EnvironmentalSelection_NSGA2(Population1,Problem.N); | ||
Fitness2 = CalFitness(Population2.objs); | ||
Population3 = Population1; | ||
stage_changed = 0; | ||
Population = [Population1,Population2]; | ||
CV = sum(max(0,Population.cons),2); | ||
max_cv = max(CV); | ||
|
||
%% Optimization | ||
while Algorithm.NotTerminated(Population1) | ||
gen = ceil(Problem.FE/Problem.N); | ||
CV1 = sum(max(0,Population1.cons),2); | ||
num_fea = sum(CV1==0); | ||
if num_fea <= 0 || gen <= 0.2 * ceil(Problem.maxFE/Problem.N) | ||
MatingPool = TournamentSelection(2,2*Problem.N,FrontNo,-CrowdDis); | ||
if type == 1 | ||
Offspring = OperatorGA(Problem,Population1(MatingPool)); | ||
else | ||
Offspring = OperatorDE(Problem,Population1,Population1(MatingPool(1:end/2)),Population1(MatingPool(end/2+1:end))); | ||
end | ||
MatingPool2 = TournamentSelection(2,2*Problem.N,Fitness2); | ||
if type == 1 | ||
Offspring2 = OperatorGAhalf(Problem,Population2(MatingPool2)); | ||
else | ||
Offspring2 = OperatorDE(Problem,Population2,Population2(MatingPool2(1:end/2)),Population2(MatingPool2(end/2+1:end))); | ||
end | ||
[Population1,FrontNo,CrowdDis] = EnvironmentalSelection_NSGA2([Population1,Offspring,Offspring2],Problem.N); | ||
[Population2,Fitness2] = EnvironmentalSelection([Population2,Offspring,Offspring2],Problem.N,false); | ||
Population3 = Population2; | ||
Population = [Population1,Population2]; | ||
CV = sum(max(0,Population.cons),2); | ||
max_cv = max(max_cv,max(CV)); | ||
else | ||
tau = gen/ceil(Problem.maxFE/Problem.N); | ||
Population = [Population1,Population2,Population3]; | ||
CV = sum(max(0,Population.cons),2); | ||
max_cv = max(CV); | ||
if stage_changed == 0 | ||
[~,Fitness2,~,Fitness3] = EvenSearch(Population,Population1(CV1==0),Problem.N,tau,max_cv); | ||
[~,Fitness1] = EnvironmentalSelection(Population1,Problem.N,true); | ||
stage_changed = 1; | ||
end | ||
|
||
if ~isempty(Population2) | ||
MatingPool2 = TournamentSelection(2,2*length(Population2),Fitness2); | ||
if type == 1 | ||
Offspring2 = OperatorGAhalf(Problem,Population2(MatingPool2)); | ||
else | ||
Offspring2 = OperatorDE(Problem,Population2,Population2(MatingPool2(1:end/2)),Population2(MatingPool2(end/2+1:end))); | ||
end | ||
else | ||
Offspring2 = []; | ||
end | ||
if ~isempty(Population3) | ||
MatingPool3 = TournamentSelection(2,2*length(Population3),Fitness3); | ||
if type == 1 | ||
Offspring3 = OperatorGAhalf(Problem,Population3(MatingPool3)); | ||
else | ||
Offspring3 = OperatorDE(Problem,Population3,Population3(MatingPool3(1:end/2)),Population3(MatingPool3(end/2+1:end))); | ||
end | ||
else | ||
Offspring3 = []; | ||
end | ||
MatingPool1 = TournamentSelection(2,2*Problem.N,Fitness1); | ||
if type == 1 | ||
Offspring1 = OperatorGAhalf(Problem,Population1(MatingPool1)); | ||
else | ||
Offspring1 = OperatorDE(Problem,Population1,Population1(MatingPool1(1:end/2)),Population1(MatingPool1(end/2+1:end))); | ||
end | ||
|
||
Offspring = [Offspring1,Offspring2,Offspring3]; | ||
|
||
[Population1,Fitness1] = EnvironmentalSelection([Population,Offspring],Problem.N,true); | ||
[Population2,Fitness2,Population3,Fitness3] = EvenSearch([Population,Offspring],Population1(CV1==0),Problem.N,tau,max_cv); | ||
end | ||
end | ||
end | ||
end | ||
end |
File renamed without changes.
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
29 changes: 29 additions & 0 deletions
29
PlatEMO/Algorithms/Multi-objective optimization/CMOES/EnvironmentalSelection_NSGA2.m
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,29 @@ | ||
function [Population,FrontNo,CrowdDis] = EnvironmentalSelection_NSGA2(Population,N) | ||
% The environmental selection of NSGA-II | ||
|
||
%------------------------------- Copyright -------------------------------- | ||
% Copyright (c) 2024 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". | ||
%-------------------------------------------------------------------------- | ||
|
||
%% 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); | ||
end |
61 changes: 61 additions & 0 deletions
61
PlatEMO/Algorithms/Multi-objective optimization/CMOES/EvenSearch.m
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 [Population2,Fitness,Population3,CV] = EvenSearch(Population,non_dom,N,tau,max_cv) | ||
% Even search for helper population | ||
|
||
%------------------------------- Copyright -------------------------------- | ||
% Copyright (c) 2024 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". | ||
%-------------------------------------------------------------------------- | ||
|
||
% This function is written by Fei Ming (email: 20151000334@cug.edu.cn) | ||
|
||
%% Determine if in promising region (1 is in) | ||
lables = GetLable(Population.objs,non_dom.objs); | ||
Next1 = lables == 1; | ||
First_Population = Population(Next1); | ||
|
||
% first choose non-dominated solutions near UPF | ||
Fitness = CalFitness(First_Population.objs); | ||
Next2 = Fitness < 1; | ||
if sum(Next2) > N | ||
Del = Truncation(First_Population(Next2).objs,sum(Next2)-N); | ||
Temp = find(Next2); | ||
Next2(Temp(Del)) = false; | ||
end | ||
% store non-dominated solutions in former N | ||
Population2 = First_Population(Next2); | ||
Fitness = Fitness(Next2); | ||
|
||
% then choose CV better solutions near or in feasible regions | ||
% first limit the position in the objective space | ||
Second_Population = First_Population; | ||
CV = sum(max(0,Second_Population.cons),2); | ||
epsilon = (max_cv)*(1-tau)^2; | ||
Next3 = CV <= epsilon; | ||
if sum(Next3) > N | ||
Del = Truncation(Second_Population(Next3).objs,sum(Next3)-N); | ||
Temp = find(Next3); | ||
Next3(Temp(Del)) = false; | ||
end | ||
% store more feasible solutions in former N | ||
Population3 = Second_Population(Next3); | ||
CV = CV(Next3); | ||
end | ||
|
||
function Del = Truncation(PopObj,K) | ||
% Select part of the solutions by truncation | ||
|
||
%% Truncation | ||
Distance = pdist2(PopObj,PopObj); | ||
Distance(logical(eye(length(Distance)))) = inf; | ||
Del = false(1,size(PopObj,1)); | ||
while sum(Del) < K | ||
Remain = find(~Del); | ||
Temp = sort(Distance(Remain,Remain),2); | ||
[~,Rank] = sortrows(Temp); | ||
Del(Remain(Rank(1))) = true; | ||
end | ||
end |
30 changes: 30 additions & 0 deletions
30
PlatEMO/Algorithms/Multi-objective optimization/CMOES/GetLable.m
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,30 @@ | ||
function lable = GetLable(Solution,non_dom) | ||
% Get the label of each solution, 1 represents is | ||
|
||
%------------------------------- Copyright -------------------------------- | ||
% Copyright (c) 2024 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". | ||
%-------------------------------------------------------------------------- | ||
|
||
% This function is written by Fei Ming (email: 20151000334@cug.edu.cn) | ||
|
||
N = size(Solution,1); | ||
M = size(non_dom,1); | ||
Lables = zeros(N,M); | ||
|
||
%% Detect the dominance relation between each solution in Data and fns | ||
for i = 1 : N | ||
for j = 1 : M | ||
k = any(Solution(i,:)<non_dom(j,:)) - any(Solution(i,:)>non_dom(j,:)); | ||
if k == 1 || k == 0 | ||
Lables(i,j) = 1; | ||
end | ||
end | ||
end | ||
lable = zeros(1,N); | ||
lable(sum(Lables,2)==M) = 1; | ||
end |
106 changes: 106 additions & 0 deletions
106
PlatEMO/Algorithms/Multi-objective optimization/CMaDPPs/CMaDPPs.m
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,106 @@ | ||
classdef CMaDPPs < ALGORITHM | ||
% <multi/many> <real/integer/label/binary/permutation> <constrained/none> | ||
% Constrained many-objective optimization with determinantal point processes | ||
|
||
%------------------------------- Reference -------------------------------- | ||
% F. Ming, W. Gong, S. Li, L. Wang, and Z. Liao, Handling constrained | ||
% many-objective optimization problems via determinantal point processes, | ||
% Information Sciences, 2023, 643: 119260. | ||
%------------------------------- Copyright -------------------------------- | ||
% Copyright (c) 2024 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". | ||
%-------------------------------------------------------------------------- | ||
|
||
% This function is written by Fei Ming (email: 20151000334@cug.edu.cn) | ||
|
||
methods | ||
function main(Algorithm,Problem) | ||
|
||
%% Parameter setting | ||
theta = Algorithm.ParameterSet(0); | ||
|
||
%% Generate random population | ||
Population = Problem.Initialization(); | ||
CSA = Population; | ||
CV = sum(max(0,Population.cons),2); | ||
[z,znad] = deal(min(Population.objs),max(Population.objs)); | ||
|
||
% parameters for epsilon | ||
CVmax = max(CV); | ||
G = ceil(Problem.maxFE/Problem.N); | ||
Tc = 0.8 * G; | ||
cp = 2; | ||
alpha = 0.95; | ||
tao = 0.05; | ||
epsilon = inf; | ||
|
||
% parameters for change | ||
last_gen = 20; | ||
change_threshold = 1e-1; | ||
max_change = 1; | ||
ideal_points = zeros(ceil(Problem.maxFE/Problem.N),Problem.M); | ||
nadir_points = zeros(ceil(Problem.maxFE/Problem.N),Problem.M); | ||
[Population,Archive] = EnvironmentalSelection(Population,[],[],Problem.N,z,znad,theta,CSA.objs,epsilon); | ||
|
||
%% Optimization | ||
while Algorithm.NotTerminated(Population) | ||
gen = ceil(Problem.FE/Problem.N); | ||
CV = sum(max(0,Population.cons),2); | ||
CV_max = max(CV); | ||
CVmax = max([CV_max,CVmax]); | ||
rf = sum(CV <= 1e-6) / Problem.N; | ||
ideal_points(gen,:) = z; | ||
nadir_points(gen,:) = znad; | ||
|
||
% The maximumrate of change of ideal and nadir points rk is calculated. | ||
if gen >= last_gen | ||
max_change = calc_maxchange(ideal_points,nadir_points,gen,last_gen); | ||
end | ||
|
||
% update epsilon before selection | ||
if max_change > change_threshold && gen < 0.4 * G | ||
epsilon = inf; | ||
else | ||
epsilon = update_epsilon(tao,epsilon,CVmax,rf,alpha,gen,Tc,cp,Problem.M); | ||
end | ||
|
||
ParentC = MatingSelection([Population,Archive],CSA,Problem.N,z,znad); | ||
Offspring = OperatorGA(Problem,ParentC); | ||
|
||
z = min(z,min(Offspring.objs,[],1)); | ||
CSA = UpdateCSA(CSA,Offspring,Problem.N,epsilon); | ||
|
||
[Population,Archive] = EnvironmentalSelection(Population,Offspring,Archive,Problem.N,z,znad,theta,CSA.objs,epsilon); | ||
znad = max(znad,max(Population.objs,[],1)); | ||
if Problem.FE >= Problem.maxFE | ||
Population = Archive; | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
% Calculate the Maximum Rate of Change | ||
function max_change = calc_maxchange(ideal_points,nadir_points,gen,last_gen) | ||
delta_value = 1e-6 * ones(1,size(ideal_points,2)); | ||
rz = abs((ideal_points(gen,:) - ideal_points(gen - last_gen + 1,:)) ./ max(ideal_points(gen - last_gen + 1,:),delta_value)); | ||
nrz = abs((nadir_points(gen,:) - nadir_points(gen - last_gen + 1,:)) ./ max(nadir_points(gen - last_gen + 1,:),delta_value)); | ||
max_change = max([rz, nrz]); | ||
end | ||
|
||
% Update the value of epsilon | ||
function epsilon = update_epsilon(tao,epsilon_k,epsilon_0,rf,alpha,gen,Tc,cp,M) | ||
if gen > Tc | ||
epsilon = 0; | ||
else | ||
if rf < alpha | ||
epsilon = (1 - tao)^cp * epsilon_k; | ||
else | ||
epsilon = cp ^ M * epsilon_0 * ((1 - (gen / Tc)) ^ cp); | ||
end | ||
end | ||
end |
Oops, something went wrong.