Repository navigation
Align TS-NSGA-II's environmental selection with the reference implementation - #46
Conversation
- Stage 2 chose among all 2N solutions, dominated ones included, so it had no convergence pressure. Restrict it to the first non-dominated fronts holding at least N solutions and, as the reference does, take for each reference vector in turn the remaining solution with the largest cosine, normalizing the remaining ones each time. - Stage 1 ranked by the number of SPD-dominators. Peel SPD fronts instead, zero d1 and d2 of the extreme non-dominated solutions, and fill from the last front by d2. - Switch stages at (0.8 + 0.2 * (1 - 3 / M)) * max_fe rather than max_fe / 2, and use the region density as the second mating key in stage 2. - Drop the level computation whose result was discarded; the reference's level sort does not narrow the set either.
Documentation build overview
2 files changed± autoapi/evomo/algorithms/index.html± autoapi/evomo/algorithms/ts_nsga2/index.html |
|
Updated this PR in e1363f6 to preserve PlatEMO's sequential SPD elimination order. SPD dominance is not transitive: candidates eliminated earlier in a front must not participate in later comparisons, and comparisons must stop when the current candidate is eliminated. The graph-peeling fallback has been removed. Also removed Validation with current main (
Mean IGD over seeds 0-4, population 100, and 200 steps after initialization (20,100 evaluations per run; CPU float32). DTLZ1 uses m=3/d=7, DTLZ2/4 m=3/d=12, and ZDT1/2/3 d=30. All columns use the same main mutation behavior; lower is better:
This fixes the SPD reference mismatch and preserves the DTLZ improvement, but it does not resolve the ZDT regressions in these five-seed runs. The existing data-dependent front loop still prevents |
TSNSGAII._environmental_selectiondiffers from PlatEMO's TS-NSGA-II (TSNSGAII.m,EnvironmentalSelection.m,EnvironmentalSelection1.m,SPDSort.m,DensityEstimate.m) in ways that change the results a lot, most visibly on DTLZ1, wheremaindoes not converge (IGD ≈ 171–237).Stage 2
_level_sort_selectiontook, for each weight, the best-cosine solution among all 2N solutions, so dominated solutions were kept and stage 2 had no convergence pressure. The reference first keeps the first non-dominated fronts that hold at least N solutions, then for each reference vector in turn takes the remaining solution with the largest cosine, normalizing the remaining ones each time. This PR does that.torch.max(...).floor()) was computed and discarded. I dropped it rather than wiring it in: in the reference,LevelSort's early exit testssize(levelPopulation,1) >= N, butlevelPopulationis a row of solutions, so that size is always 1 and every level is kept. The level sort therefore does not narrow the set there either.DensityEstimate.m) instead of d2.uniform_samplingreturns fewer reference vectors thanpop_size(91 forpop_size=100,n_objs=3), the vectors are reused in order untilpop_sizesolutions are chosen. The reference instead sets N to the number of vectors.Stage 1
_spd_sortreturned the number of SPD-dominators of each solution, not SPD front numbers. It now peels fronts until at least N solutions are sorted.Stage switch: at
(0.8 + 0.2 * (1 - 3 / M)) * max_fe(0.7 for M = 2, 0.8 for M = 3), as inTSNSGAII.m, instead ofmax_fe // 2. The docstring is updated.IGD after 200 generations,
pop_size=100, seeds 0–4, withmax_fe=20000(the budget actually used):With the default
max_fe=10000the picture is the same (DTLZ1 237.4 → 0.233, DTLZ2 0.0859 → 0.0539, ZDT1 0.159 → 0.095).ZDT is still well above the other algorithms. One contributor I found while checking this, and which I will send separately because it affects ten algorithms:
polynomial_mutation(..., pro_m=1.0 / D)mutates with per-gene probability 1/D², because evox'spolynomial_mutationalready dividespro_mby D.Tests: new
unit_test/algorithms/test_tsnsga2.pycovers SPD front peeling, the same-reference-vector tie break, and stage 2 keeping only non-dominated solutions when there are enough.test_moea_generated.pystill passes.ruff checkis clean.This was prepared with AI assistance (Claude); I reviewed and tested the change.