Skip to content

Align GrEA's grid ranking and selection with the reference - #43

Merged
Zhenyu2Liang merged 2 commits into
EMI-Group:mainfrom
flyingdoubleG:fix-grea-selection
Oct 26, 2026
Merged

Zhenyu2Liang merged 2 commits into
EMI-Group:mainfrom
flyingdoubleG:fix-grea-selection

Conversation

@flyingdoubleG

Copy link
Copy Markdown
Contributor

Description

GrEA's environmental selection does not implement GrEA's grid ranking. On ZDT1 it ends at IGD ≈ 0.036, against ≈ 0.005 for NSGA-II under the same budget.

What GrEA does (Yang et al., 2013; PlatEMO's GrEA/EnvironmentalSelection.m). The last front is filled one solution at a time. At each step it picks the best remaining solution by:

  • grid ranking GR(x) = Σ_k G_k(x), the sum of the grid coordinates;
  • ties broken by grid crowding distance GCD, which accumulates max(M − GD, 0) over the solutions already chosen;
  • then by the grid coordinate point distance GCPD.

After each choice it adjusts GR to keep the chosen set spread out:

  • +(M+2) for solutions in the same cell;
  • +M for solutions grid-dominated by the chosen one;
  • a distance-based penalty PD = M − GD for its other neighbours, propagated to the solutions those neighbours grid-dominate.

What the implementation did.

  • GR was defined as the number of grid dominators plus the number of neighbours, not Σ_k G_k.
  • Solutions were removed one by one by max(GR, GCD, GCPD), with different update rules and without the PD penalty.
  • The grid cell width was (f_max − f_min)/div instead of (ub − lb)/div with half-cell padding.
  • div defaulted to 10 for every number of objectives. GrEA's recommended settings are 45 for two objectives, 15 for three, and so on.
  • Mating used a tournament on (rank, GR, GCD) rather than Pareto dominance, then grid dominance, then GCD.

This PR

  • ports the last-front selection, the grid setting and the mating selection;
  • defaults div to the recommended value for n_objs (45, 15, 10, 9, 9, 8, 8, 10, 12 for 2–10 objectives, as in PlatEMO). An explicit div still overrides it.
  • vectorizes the PD propagation using the transitivity of grid dominance: PD(r) is the largest direct penalty among the neighbours that grid-dominate r. The selection is still a loop over the solutions to choose, like the previous peeling loop.

Effect (IGD after 200 generations, pop_size=100, seeds 0–2):

before (div=10) before, with the recommended div after
ZDT1 (n=30) 0.0389 / 0.0385 / 0.0319 0.0097 / 0.0087 / 0.0085 0.0068 / 0.0068 / 0.0067
DTLZ2 (m=3, d=12) 0.0875 / 0.1004 / 0.0927 0.0796 / 0.0690 / 0.0744 0.0637 / 0.0631 / 0.0677

Tests

  • test_grea_last_selection_matches_reference compares _last_selection with a direct port of the sequential reference loop, including the order-dependent PD propagation. It covers 30 random cases, half of them with coarse values to create shared cells and ties. The same comparison over 300 random cases (2–4 objectives, up to 40 solutions) gave no mismatches.
  • test_grea_default_div checks the per-objective defaults.
  • unit_test/algorithms/test_moea_generated.py passes.

Checklist

  • I have formatted my Python code with ruff.
  • I have good commit messages.
  • If adding new algorithms, problems, operators:
    • Added related test cases.
    • Added docstring to explain important parameters.

GrEA ranks the last front with grid ranking GR(x) = sum_k G_k(x), grid
crowding distance and grid coordinate point distance, choosing solutions one
by one and penalizing the GR of solutions in the same cell (+M+2), grid
dominated by the chosen one (+M) or near it (distance-based PD). The
implementation instead defined GR as the number of grid dominators plus
neighbours and removed solutions one by one with different update rules.

Port the last-front selection, the grid setting (lower bound and cell width
padded by half a cell) and the mating selection (Pareto dominance, then grid
dominance, then GCD) from the reference, and default div to the values
recommended per number of objectives (45 for 2, 15 for 3, ...) instead of 10.
The PD propagation is vectorized using the transitivity of grid dominance;
a test checks it against a direct port of the sequential loop.
@read-the-docs-community

read-the-docs-community Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Documentation build overview

📚 evomo | 🛠️ Build #35406959 | 📁 Comparing 15fe629 against latest (c2d7930)

  🔍 Preview build  

2 files changed
± autoapi/evomo/algorithms/index.html
± autoapi/evomo/algorithms/grea/index.html

@Zhenyu2Liang
Zhenyu2Liang merged commit f8e95b8 into EMI-Group:main Oct 26, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants