Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Fantasy-Dzx committed Mar 20, 2024
1 parent 86b4e53 commit 3161828
Show file tree
Hide file tree
Showing 1,514 changed files with 4,576 additions and 1,858 deletions.
70 changes: 40 additions & 30 deletions PlatEMO/Algorithms/ALGORITHM.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
% ALGORITHM properties:
% parameter <any> parameters of the algorithm
% save <scalar> number of populations saved in an execution
% run <scalar> current execution number
% metName <string> Names of metrics to calculate
% outputFcn <function> function called after each generation
% pro <class> problem solved in current execution
% result <cell> populations saved in current execution
Expand All @@ -21,7 +23,7 @@
% ParameterSet <protected> obtain the parameters of the algorithm

%------------------------------- Copyright --------------------------------
% Copyright (c) 2023 BIMK Group. You are free to use the PlatEMO for
% 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
Expand All @@ -32,6 +34,8 @@
properties(SetAccess = protected)
parameter = {}; % Parameters of the algorithm
save = -10; % Number of populations saved in an execution
run = []; % Current execution number
metName = {}; % Names of metrics to calculate
outputFcn = @DefaultOutput; % Function called after each generation
pro; % Problem solved in current execution
result; % Populations saved in current execution
Expand All @@ -51,7 +55,7 @@
% Algorithm = MOEAD('parameter',4,'save',1)

isStr = find(cellfun(@ischar,varargin(1:end-1))&~cellfun(@isempty,varargin(2:end)));
for i = isStr(ismember(varargin(isStr),{'parameter','save','outputFcn'}))
for i = isStr(ismember(varargin(isStr),{'parameter','save','run','metName','outputFcn'}))
obj.(varargin{i}) = varargin{i+1};
end
end
Expand Down Expand Up @@ -145,7 +149,7 @@ function main(obj,Problem)
% Calculate metric values

if ~isfield(obj.metric,metName)
obj.metric.(metName) = [cell2mat(obj.result(:,1)),cellfun(@(S)obj.pro.CalMetric(metName,S),obj.result(:,2))];
obj.metric.(metName) = cellfun(@(S)obj.pro.CalMetric(metName,S),obj.result(:,2));
end
Scores = obj.metric.(metName);
end
Expand All @@ -158,41 +162,47 @@ function DefaultOutput(Algorithm,Problem)
clc; fprintf('%s on %d-objective %d-variable %s (%6.2f%%), %.2fs passed...\n',class(Algorithm),Problem.M,Problem.D,class(Problem),Problem.FE/Problem.maxFE*100,Algorithm.metric.runtime);
if Problem.FE >= Problem.maxFE
if Algorithm.save < 0
if isempty(Algorithm.metName)
if Problem.M == 1
Algorithm.metName = {'Min_value','Feasible_rate'};
elseif length(Algorithm.result{end}) >= size(Problem.optimum,1)
Algorithm.metName = {'HV','Feasible_rate'};
else
Algorithm.metName = {'IGD','HV','GD','Feasible_rate'};
end
elseif ~iscell(Algorithm.metName)
Algorithm.metName = {Algorithm.metName};
end
value = Algorithm.CalMetric(Algorithm.metName{1});
figure('NumberTitle','off','Name',sprintf('%s : %.4e Runtime : %.2fs',Algorithm.metName{1},value(end),Algorithm.CalMetric('runtime')));
title(sprintf('%s on %s',class(Algorithm),class(Problem)),'Interpreter','none');
top = uimenu(gcf,'Label','Data source');
if Problem.M > 1
uimenu(top,'Label','Population (obj.)','CallBack',{@(h,~,Pro,P)eval('Draw(gca);Pro.DrawObj(P);cb_menu(h);'),Problem,Algorithm.result{end}});
end
uimenu(top,'Label','Population (dec.)','CallBack',{@(h,~,Pro,P)eval('Draw(gca);Pro.DrawDec(P);cb_menu(h);'),Problem,Algorithm.result{end}});
if Problem.M > 1
Population = Algorithm.result{end};
if length(Population) >= size(Problem.optimum,1); name = 'HV'; else; name = 'IGD'; end
value = Algorithm.CalMetric(name);
figure('NumberTitle','off','Name',sprintf('%s : %.4e Runtime : %.2fs',name,value(end),Algorithm.CalMetric('runtime')));
title(sprintf('%s on %s',class(Algorithm),class(Problem)),'Interpreter','none');
top = uimenu(gcf,'Label','Data source');
g = uimenu(top,'Label','Population (obj.)','CallBack',{@(h,~,Pro,P)eval('Draw(gca);Pro.DrawObj(P);cb_menu(h);'),Problem,Population});
uimenu(top,'Label','Population (dec.)','CallBack',{@(h,~,Pro,P)eval('Draw(gca);Pro.DrawDec(P);cb_menu(h);'),Problem,Population});
uimenu(top,'Label','True Pareto front','CallBack',{@(h,~,P)eval('Draw(gca);Draw(P,{''\it f\rm_1'',''\it f\rm_2'',''\it f\rm_3''});cb_menu(h);'),Problem.optimum});
cellfun(@(s)uimenu(top,'Label',s,'CallBack',{@(h,~,A)eval('Draw(gca);Draw(A.CalMetric(h.Label),''-k.'',''LineWidth'',1.5,''MarkerSize'',10,{''Number of function evaluations'',strrep(h.Label,''_'','' ''),[]});cb_menu(h);'),Algorithm}),{'IGD','HV','GD','Feasible_rate'});
set(top.Children(4),'Separator','on');
g.Callback{1}(g,[],Problem,Population);
else
best = Algorithm.CalMetric('Min_value');
if isempty(best); best = nan; end
figure('NumberTitle','off','Name',sprintf('Min value : %.4e Runtime : %.2fs',best(end),Algorithm.CalMetric('runtime')));
title(sprintf('%s on %s',class(Algorithm),class(Problem)),'Interpreter','none');
top = uimenu(gcf,'Label','Data source');
uimenu(top,'Label','Population (dec.)','CallBack',{@(h,~,Pro,P)eval('Draw(gca);Pro.DrawDec(P);cb_menu(h);'),Problem,Algorithm.result{end}});
cellfun(@(s)uimenu(top,'Label',s,'CallBack',{@(h,~,A)eval('Draw(gca);Draw(A.CalMetric(h.Label),''-k.'',''LineWidth'',1.5,''MarkerSize'',10,{''Number of function evaluations'',strrep(h.Label,''_'','' ''),[]});cb_menu(h);'),Algorithm}),{'Min_value','Feasible_rate'});
set(top.Children(2),'Separator','on');
top.Children(2).Callback{1}(top.Children(2),[],Algorithm);
end
cellfun(@(s)uimenu(top,'Label',s,'CallBack',{@(h,~,A)eval('Draw(gca);Draw([cell2mat(A.result(:,1)),A.CalMetric(h.Label)],''-k.'',''LineWidth'',1.5,''MarkerSize'',10,{''Number of function evaluations'',strrep(h.Label,''_'','' ''),[]});cb_menu(h);'),Algorithm}),Algorithm.metName);
set(top.Children(length(Algorithm.metName)),'Separator','on');
top.Children(end).Callback{1}(top.Children(end),[],Problem,Algorithm.result{end});
elseif Algorithm.save > 0
for i = 1 : length(Algorithm.metName)
Algorithm.CalMetric(Algorithm.metName{i});
end
result = Algorithm.result;
metric = Algorithm.metric;
folder = fullfile('Data',class(Algorithm));
[~,~] = mkdir(folder);
file = fullfile(folder,sprintf('%s_%s_M%d_D%d_',class(Algorithm),class(Problem),Problem.M,Problem.D));
runNo = 1;
while exist([file,num2str(runNo),'.mat'],'file') == 2
runNo = runNo + 1;
if isempty(Algorithm.run)
Algorithm.run = 1;
while exist([file,num2str(Algorithm.run),'.mat'],'file') == 2
Algorithm.run = Algorithm.run + 1;
end
end
result = Algorithm.result;
metric = Algorithm.metric;
save([file,num2str(runNo),'.mat'],'result','metric');
save([file,num2str(Algorithm.run),'.mat'],'result','metric');
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
% Handling constraints and extending to an adaptive approach, IEEE
% Transactions on Evolutionary Computation, 2014, 18(4): 602-622.
%------------------------------- Copyright --------------------------------
% Copyright (c) 2023 BIMK Group. You are free to use the PlatEMO for
% 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
% Addition and deletion of reference points

%------------------------------- Copyright --------------------------------
% Copyright (c) 2023 BIMK Group. You are free to use the PlatEMO for
% 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
% The environmental selection of NSGA-III

%------------------------------- Copyright --------------------------------
% Copyright (c) 2023 BIMK Group. You are free to use the PlatEMO for
% 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
% approach to surrogate-assisted evolutionary multi-objective optimization.
% Information Sciences, 2020, 519: 317-331.
%------------------------------- Copyright --------------------------------
% Copyright (c) 2023 BIMK Group. You are free to use the PlatEMO for
% 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
% The environmental selection of K-RVEA

%------------------------------- Copyright --------------------------------
% Copyright (c) 2023 BIMK Group. You are free to use the PlatEMO for
% 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
% expensive multiobjective optimization, Complex & Intelligent Systems,
% 2022, 8(1): 271¨C285.
%------------------------------- Copyright --------------------------------
% Copyright (c) 2023 BIMK Group. You are free to use the PlatEMO for
% 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function [Population,FrontNo,CrowdDis] = EnvironmentalSelection(Population,N)

%------------------------------- Copyright --------------------------------
% Copyright (c) 2023 BIMK Group. You are free to use the PlatEMO for
% 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function Offspring = Operator(Problem,Arc,k,beta,N_a,N_s)

%------------------------------- Copyright --------------------------------
% Copyright (c) 2023 BIMK Group. You are free to use the PlatEMO for
% 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function Offspring = Reproduction(Problem,Particle,RBF_para,Index_dif)

%------------------------------- Copyright --------------------------------
% Copyright (c) 2023 BIMK Group. You are free to use the PlatEMO for
% 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
% multi-objective algorithm, Proceedings of the Annual Conference on
% Genetic and Evolutionary Computation, 2013, 687-694.
%------------------------------- Copyright --------------------------------
% Copyright (c) 2023 BIMK Group. You are free to use the PlatEMO for
% 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
% The environmental selection of AGE-II

%------------------------------- Copyright --------------------------------
% Copyright (c) 2023 BIMK Group. You are free to use the PlatEMO for
% 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
% The mating selection of AGE-II

%------------------------------- Copyright --------------------------------
% Copyright (c) 2023 BIMK Group. You are free to use the PlatEMO for
% 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
% Update the archive

%------------------------------- Copyright --------------------------------
% Copyright (c) 2023 BIMK Group. You are free to use the PlatEMO for
% 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
% scale many-objective optimization, Proceedings of the Genetic and
% Evolutionary Computation Conference, 2022.
%------------------------------- Copyright --------------------------------
% Copyright (c) 2023 BIMK Group. You are free to use the PlatEMO for
% 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function [p] = ComputeGeometry(front, m, n)

%------------------------------- Copyright --------------------------------
% Copyright (c) 2023 BIMK Group. You are free to use the PlatEMO for
% 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
Expand All @@ -11,13 +11,13 @@

% This function is written by Annibale Panichella

d = pdist2(front, zeros(1,n));
Extreme = FindCornerSolutions(front);
d(Extreme) = Inf;
[~, index] = min(d);
d = pdist2(front, zeros(1,n));
Extreme = FindCornerSolutions(front);
d(Extreme) = Inf;
[~, index] = min(d);

point = front(index,:);
x = NewtonRaphsonMethod(point, 0.001);
point = front(index,:);
x = NewtonRaphsonMethod(point, 0.001);
if isnan(x) || x<=0
p = 1;
else
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function CrowdDis = ConvergenceScore(front, p)

%------------------------------- Copyright --------------------------------
% Copyright (c) 2023 BIMK Group. You are free to use the PlatEMO for
% 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
Expand All @@ -11,10 +11,10 @@

% This function is written by Annibale Panichella

[m,~] = size(front);
CrowdDis = zeros(1,m);
[m,~] = size(front);
CrowdDis = zeros(1,m);

for i=1:m
CrowdDis(i) = -norm(front(i,:),p);
end
for i=1:m
CrowdDis(i) = -norm(front(i,:),p);
end
end
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function [Population,FrontNo,CrowdDis] = EnvironmentalSelection(Population,N)

%------------------------------- Copyright --------------------------------
% Copyright (c) 2023 BIMK Group. You are free to use the PlatEMO for
% 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function [indexes] = FindCornerSolutions(front)

%------------------------------- Copyright --------------------------------
% Copyright (c) 2023 BIMK Group. You are free to use the PlatEMO for
% 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
Expand All @@ -12,21 +12,20 @@
% This function is written by Annibale Panichella


[m,n] = size(front);
[m,n] = size(front);

%% let's normalize the objectives
if m<=n
indexes = 1:m;
return
end

%% let's define the axes of the n-dimensional spaces
W = eye(n);
[r,~]= size(W);
indexes = zeros(1,n);
for i=1:r
[~, index] = min(Point2LineDistance(front, zeros(1,n), W(i,:)));
indexes(i) = index;
end
%% let's normalize the objectives
if m<=n
indexes = 1:m;
return
end

%% let's define the axes of the n-dimensional spaces
W = eye(n);
[r,~]= size(W);
indexes = zeros(1,n);
for i=1:r
[~, index] = min(Point2LineDistance(front, zeros(1,n), W(i,:)));
indexes(i) = index;
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
% The Newton-Raphson method

%------------------------------- Copyright --------------------------------
% Copyright (c) 2023 BIMK Group. You are free to use the PlatEMO for
% 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
Expand Down
Loading

0 comments on commit 3161828

Please sign in to comment.