Skip to content
Open

AGEA #177

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions PlatEMO/Algorithms/Multi-objective optimization/AGEA/AGEA.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
classdef AGEA < ALGORITHM
% <multi> <real/binary/permutation>
% Adaptive grid based evolutionary algorithm
% limit --- 1 --- limit output solutions number to N (1. limit 0. no limit)
% div --- 10 --- initial number of grid divisions

%------------------------------- Reference --------------------------------
% Z. Liu, F. Han, Q. Ling, H. Han, J. Jiang, and Q. Liu, A multi-objective
% evolutionary algorithm based on a grid with adaptive divisions for
% multi-objective optimization with irregular Pareto fronts, Applied Soft
% Computing, 2025, 176: 113106.
%------------------------------- 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 Zhe Liu

methods
function main(Algorithm,Problem)
%% Parameter setting
[limit, div]= Algorithm.ParameterSet(1, 10);
%% Generate random population
Population = Problem.Initialization();
Grid = Population;
zmin = min(Population.objs,[],1);
zmax = max(max(Population.objs, [], 1), zmin + 1e-10);
gmax = zmax;
while Algorithm.NotTerminated(Grid)
%% Optimization
MatingPool = randperm(length(Population));
Offspring = OperatorGA(Problem, Population(MatingPool));
Population = [Grid, Offspring];
[FrontNo, ~] = NDSort(roundn(Population.objs, -10), Problem.N);
Grid = Population(FrontNo ~= inf);
NDPop = Population(FrontNo == 1);
zmin = min(zmin, min(Grid.objs,[],1));
gmax = GridStabilization(NDPop, zmin, gmax, div);
[Grid, GridIndex, div] = GridAdaptiveAdjustment(Grid, zmin, gmax, div, Problem.N);
Population = PopulationReselection(Grid, GridIndex, Problem.N);
%% limit output solutions number to N
if limit ~= 0 && length(Grid) > Problem.N
if Problem.FE >= Problem.maxFE
Grid = EnvironmentalSelection_SPEA2(Grid, Problem.N);
end
end
end
end
end
end


Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
function [Grid, GridIndex] = EnvironmentalSelection_AGEA(Grid, zmin, gmax, div)
PopObj = Grid.objs;
[N, M] = size(PopObj);
GridIndex = zeros(N, M);
GridCorner = zeros(N, M);
delta = ones(N, M); % The blow-up factor
side_length = (gmax - zmin) / (div - 1);
lower_boundary = zmin - 0.5 * side_length;
for i = 1: N
for j = 1: M
GridIndex(i, j) = floor((PopObj(i, j) - lower_boundary(j)) / side_length(j));
GridCorner(i, j) = lower_boundary(j) + side_length(j) * GridIndex(i, j);
if GridIndex(i, j) == 0
delta(i, j) = 1e+6;
end
end
end
normalized_obj = (PopObj - zmin) ./ (gmax - zmin);
normalized_GridCorner = (GridCorner - zmin) ./ (gmax - zmin);
Loser = false(N, 1);
fitness = sum(((normalized_obj - normalized_GridCorner) .* delta) .^ 2, 2);
for i = 1: N - 1
for j = i + 1: N
if GridIndex(i,:) == GridIndex(j,:)
if fitness(i) <= fitness(j)
Loser(j) = true;
else
Loser(i) = true;
end
end
end
end
Grid = Grid(~Loser);
GridIndex = GridIndex(~Loser, :);
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
function Archive = EnvironmentalSelection_SPEA2(Archive, N)
ArchiveObj = Archive.objs;
[ArchiveSize, ~] = size(Archive.objs);
ideal_point = min(ArchiveObj,[],1);
worst_point = max(ArchiveObj,[],1);
nf = worst_point - ideal_point;
nf(nf < 1e-100) = 1e-100;
normalized_obj = ArchiveObj ./ nf;
Distance = pdist2(normalized_obj, normalized_obj);
Distance(logical(eye(length(Distance)))) = inf;
Del = false(1,ArchiveSize);
while sum(Del) < ArchiveSize - N
Remain = find(~Del);
Temp = sort(Distance(Remain,Remain),2);
[~,Rank] = sortrows(Temp);
Del(Remain(Rank(1))) = true;
end
Archive = Archive(~Del);
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
function [Grid, Grid_index, div] = GridAdaptiveAdjustment(Grid, zmin, gmax, div, N)
[Grid, Grid_index] = EnvironmentalSelection_AGEA(Grid, zmin, gmax, div);
if length(Grid) > N && div > 2
div = div - 1;
[Grid_temp, Grid_index_temp] = EnvironmentalSelection_AGEA(Grid, zmin, gmax, div);
if length(Grid_temp) > N && div >= 2
Grid = Grid_temp;
Grid_index = Grid_index_temp;
else
div = div + 1;
end
end
if length(Grid) < N && div < 200
div = div + 1;
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function gmax = GridStabilization(NDPop, zmin, gmax, div)
[~, M] = size(NDPop.objs);
zmax = max(max(NDPop.objs, [], 1), zmin + 1e-10);
side_length = (gmax - zmin) / (div - 1);
for i = 1: M
if abs(zmax(i) - gmax(i)) > 0.5*side_length(i)
gmax(i) = zmax(i);
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function Population = PopulationReselection(Grid, GridIndex, N)
[FrontNo, ~] = NDSort(roundn(Grid.objs, -10), N);
[~, M] = size(Grid.objs);
D = pdist2(GridIndex, GridIndex, 'chebychev');
D(D>1) = 0;
crowding = sum(D, 2).^(1/M);
fitness = crowding / max(max(crowding), 1e-10) * (N-1) + 1;
fitness(FrontNo > 1) = fitness(FrontNo > 1) + max(fitness);
Population = Grid(RouletteWheelSelection(N, fitness));
end