Repository navigation
fix(nsgaiii): select parents as configured, at random by default - #364
Merged
Merged
Conversation
NSGA-III accepted any selection, but mapped every method but "tournament"
to a pressure of 2 and always mated by a binary tournament on rank and
crowding distance, as NSGA-II: crowding distance is not part of NSGA-III,
and neither the default nor ("random", {}) ran the published algorithm.
selection("random"), now NSGAIIIConfig.default()'s, draws the parents at
random, as Deb and Jain (2014). With constraint values and feasibility
first, each parent wins a binary tournament on the constraint violation,
drawn between feasible solutions, as Jain and Deb's constrained NSGA-III
and pymoo's comp_by_cv_then_random. selection("tournament", size=k) is
jMetal's NSGA-III tournament (NSGAIIIBuilder at 46fb0a61f): the lowest rank
of k distinct candidates wins, with ties drawn at random, since jMetal's
niche distance is never written. Other methods and options raise
ConfigurationError in the builder, the constructor and from_dict, and when
a configuration mapping reaches NSGAIII.
The NSGA-III tuning spaces choose selection, random (the default) or
tournament with tournament_size, as Evolver's NSGAIIIDouble; an assignment
of an earlier space still builds its tournament. nsgaiii_constrained
passes 100 000 discrete combinations, so its exhaustive build moves to the
slow tier. The parameter-space snapshot and the frozen default of
NSGAIIIConfig are regenerated with their tools.
NSGA-III's results change, by default and with a tournament (a scientific
correction).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The command line built NSGA-III with a tournament sized by --selection-pressure, unlike NSGAIIIConfig.default(). It now selects the parents at random, and a selection in the nsgaiii block of a config file still sets a tournament. --selection-pressure no longer applies to NSGA-III nor is checked against its population; its help names NSGA-II and IBEA, the algorithms whose default tournament it sizes (SMS-EMOA's command line never read it). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The DTLZ2 baseline and the conformance with pymoo already configured
selection("random"), which now runs. Measured again: seed 42 reaches
0.7122 (seeds 0 to 9, 0.7029 to 0.7203; threshold 0.67), and the mean over
seeds 0 to 9 is 0.7372 against pymoo's 0.7378 (0.08 %).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contributor
VAMOS documentation previewhttps://pr-364-vamos-docs-preview.vamos-optimization.workers.dev Built from |
github-merge-queue
Bot
removed this pull request from the merge queue due to a conflict with the base branch
Nov 19, 2026
Keeps both notes of the NSGA-III API page: the selection of this branch and the reference-direction files of #361. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
NicolasRodriguezUribe
added a commit
that referenced
this pull request
Nov 19, 2026
NSGAIIIConfig.__post_init__ keeps both checks: the reference-direction source of this branch and the selection of #364. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Item A9 of VAMOS-Studio's change requests (checked on 1.4.0): NSGA-III ignored its configured parent selection.
NSGAIIIConfigaccepted anyselection,nsgaiii/initialization.pymapped every method other than"tournament"to apressure of 2, and
NSGAIII._generate_offspringalways calledkernel.tournament_selection(ranks, crowding, ...): a binarytournament on rank and crowding distance, as NSGA-II. Crowding distance is not part of NSGA-III.
("random", {})silentlyran that tournament, and so did the default
("tournament", {}), the command line (sized by--selection-pressure) and everypoint of the NSGA-III tuning spaces (which offered only
tournament_size). VAMOS's NSGA-III was therefore not the publishedalgorithm, and a comparison with jMetal's, Evolver's or pymoo's NSGA-III compared another algorithm.
Change
selection("random"), the new default (NSGAIIIConfig.default(), the command line, the tuning spaces): parents aredrawn uniformly at random, as Deb and Jain (2014, Part I). With constraint values and feasibility first
(
constraint_mode="feasibility", noconstraint_handlingtechnique), each parent wins a binary tournament on theconstraint violation, decided at random between two feasible (or equally violated) solutions: the mating selection of
Jain and Deb's constrained NSGA-III (2014, Part II) and of pymoo's NSGA-III. With
constraint_mode="none"or aconstraint-handling technique, parents are drawn uniformly at random.
selection("tournament", size=k)is jMetal's NSGA-III tournament:kdistinct candidates (2 by default), the lowestrank wins, ties at random. The ranks are the non-dominated fronts with feasible solutions first and infeasible ones
compared by violation, or the technique's fronts. No crowding distance.
ConfigurationError(builder method, constructor,from_dict(), and a rawconfiguration mapping given to
NSGAIII) instead of being mapped silently to a tournament.NSGAIIIConfig.builder()gets its own documented
selection()method.--selection-pressureno longer sizes NSGA-III's parents andis no longer checked against an NSGA-III population. A
selectionin thensgaiiiblock of a config file still sets atournament and its size. The
--selection-pressurehelp said it applied to "NSGA-II/III and SMS-EMOA"; it now namesNSGA-II and IBEA (SMS-EMOA's command-line default has been random parents, and its builder never read the pressure).
tournament_sizebyselection:random(thedefault) or
tournamentwith the conditionaltournament_sizein [2, 10], as Evolver'sNSGAIIIDoublespace(
selection/selectionTournamentSize, exchanged byto_evolver/from_evolver). Evolver's space also offersBoltzmann, ranking and SUS, which VAMOS's NSGA-III does not run, so they are not offered. The bridge keeps building a
tournament of the given size from an assignment of an earlier space (only
tournament_size), sotests/engine/data/tuning_assignments_1_3_0.jsonstill builds the configurations it built.nsgaiii_constrainedgrows from 60,480 to 120,960 discrete combinations, so, as
agemoea_constrained, its exhaustive build moves to the slowtier and the fast tier samples it.
nsgaiii.helpers.nsgaiii_parentsreplacesnsgaiii_selection_metricsand computes what the configuredselection needs at mating time (nothing for unconstrained random parents, so the extra non-dominated sort per generation
is gone);
NSGAIIIStateloses its rank/crowding cache and gainsselection_method;build_nsgaiii_algorithmloses itsselection_pressureargument. All internal.tools/update_parameter_spaces.py(the six NSGA-III spaces) andtools/generate_v1_compatibility_snapshots.py, which rewrote only the frozen value ofNSGAIIIConfig.default()'sselection("tournament"to"random"), as the scientific-corrections policy allows for the default of a stableconfiguration.
**Development after 1.4.0:**):docs/algorithms/nsgaiii.md(tutorial code and the "Variants and theireffect" section, with a table of the two selections; caption of the 1.0.0 illustration),
docs/reference/algorithms.md("Where the variants depart from their references": NSGA-III parents are no longer a departure; the Numba table),
docs/reference/api/algorithms/nsgaiii.md,docs/topics/tuning.md,docs/guide/cli.md;examples/journeys/nsgaiii_dtlz2.pyfollows the tutorial.
tests/reference/baselines.mdhas the re-measured reference values.Checks against jMetal and pymoo
mainat 46fb0a61f (the reference VAMOS pins),jmetal-component/.../algorithm/multiobjective/NSGAIIIBuilder.java,defaultSelection:new NaryTournamentSelection<>(2, matingPoolSize, new MultiComparator<>(rank, densityEstimator::value))with a
ReferencePointNicheDistanceEstimator. Its Javadoc says, and the code confirms, that the NSGA-III replacementwrites its niche distances under other keys (
NSGA3_NICHE_DISTANCEinNSGAIIIReplacement, while the estimator readsNICHE_DISTANCE), sovalue()isDouble.MAX_VALUEfor every solution and the tournament compares ranks only. Theoperator draws distinct candidates (
ListUtils.randomSelectionWithoutReplacement) andfindBestSolutionkeeps thefirst of equals, so ties are decided at random.
selection("tournament")is this tournament. jmetal-algorithm's classicNSGAIIItakes its selection from the builder; itsNSGAIIIRunnerpassesBinaryTournamentSelection(RankingAndCrowdingDistanceComparator),but the classic algorithm never computes crowding distance (the estimator returns 0.0 for all), so it also compares ranks
only. Evolver's
BaseNSGAIII.createSelectionuses jMetal's comparator (rank, then the uncomputed niche distance), itsdefault configuration is
--selection tournament --selectionTournamentSize 2, and its space offers tournament (size2..10), random, Boltzmann, ranking and SUS. Two small differences remain: jMetal's first mating sees no ranks (all -1),
so it is uniformly random, while VAMOS ranks the initial population; and jMetal's CDP ranking compares two equally
violated infeasible solutions by dominance, where VAMOS draws.
pymoo/algorithms/moo/nsga3.py:selection=TournamentSelection(func_comp=comp_by_cv_then_random),which compares the constraint violation when one of the two is infeasible and otherwise picks one at random: random
parents on unconstrained problems, and the rule of
selection("random")under constraints.tests/reference/test_external_conformance.py(NSGA-III on DTLZ2, 3 objectives, againstpymoo 0.6.2 over 30 seeds) gives a VAMOS mean over seeds 0-9 of 0.7372 against pymoo's 0.7378 (0.08 %; 0.7385 with the
old tournament; tolerance 3 %).
test_dtlz_convergence(DTLZ2, 5,000 evaluations): seed 42 reaches 0.7122 (0.7192before; threshold 0.67), seeds 0-9 0.7029-0.7203. On ZDT4 (default configuration, 100 individuals, 25,000 evaluations,
seeds 0-9, reference point (1.1, 1.1)) the mean hypervolume goes from 0.8631 (sd 0.0045) on origin/main to 0.8356 (sd
0.0247): the crowding tournament's pressure towards the ends of the front is what made VAMOS's NSGA-III beat jMetal's
and jMetalPy's on ZDT4 in the studio's calibration study.
Compatibility
docs/project/stability-and-versioning.md#scientific-corrections): default runs now select parents at random, and aconfigured
("tournament", ...)now compares ranks only. Every NSGA-III run gives other results than 1.4.0 with the sameseed (Python API, command line, studies, tuning).
randomandtournament, and options other than atournament's
size, raiseConfigurationError; they used to run the crowding tournament silently.--selection-pressureno longer applies to NSGA-III, so a pressure above an NSGA-III population nolonger stops the run.
selection(withtournament_sizeconditional on it), so seeded draws differ;assignments saved from earlier spaces keep building their configurations.
NSGAIIIConfig.default(). No public API, field, schema or CLIoption is added or removed.
Validation
Windows 11, Python 3.12,
PYTHONPATHanchored to this worktree.python -m pytest -q tests/engine/test_nsgaiii_selection.py(new: 31 tests) and the targeted set (test_nsgaiii_behavior,test_algorithm_encodings,test_algorithm_registry,test_algorithms_smoke,test_algorithm_problem_matrix,test_engine_trajectory_parity,test_constraint_handling_*,test_genealogy_tracking,tests/reference,tests/compatibility,tests/docs,test_cli_config_validation, run-artifact replay matrix)pytest "tests/engine/test_operator_combo_validation.py::test_all_discrete_combos_build_config[nsgaiii_constrained_real]"(the exhaustive build, now slow tier) and its fast-tier sampleruff checkandruff format --checkon the changed Pythonpython tools/typecheck.py --scope strictpython tools/typecheck.py --scope fullpython -m compileallon the changed files;git diff --checkpython tools/check_agent_docs.pypython tools/update_parameter_spaces.py --check;python tools/generate_v1_compatibility_snapshots.py --checkpytest -m "not slow" -n 4 -p no:cacheprovider -rfE(CI fast tier)tests/experiment/test_cli_ablation.py::test_cli_ablation_runs_and_writes_variants, the known Windows failure under xdist (a study path over 260 characters), which also fails on untouched origin/main and passes alonepython tools/health.pymkdocs build --strictmain(baec11a, #360, which merged cleanly) with the NSGA-III, archive, reference and compatibility testsThe slow tier's other exhaustive combination builds were not run.
Changelog entry
[Unreleased]→ Fixedbinary tournament on rank and crowding distance, as NSGA-II, whatever its selection, so it was not the published
algorithm.
selection("random"), now the default ofNSGAIIIConfig.default(), the command line and the tuning spaces,draws parents at random, as Deb and Jain (2014); with constraints and feasibility first, each parent wins a binary
tournament on the constraint violation, decided at random between feasible solutions, as Jain and Deb's constrained
NSGA-III and pymoo.
selection("tournament", size=k)is jMetal's NSGA-III tournament on rank, with ties drawn at random.Other selection methods and options raise
ConfigurationError. The NSGA-III tuning spaces chooseselection,randomor
tournamentwithtournament_size, as Evolver's, and assignments of earlier spaces still build their tournament;--selection-pressureno longer applies to NSGA-III. NSGA-III's results change, by default and with a tournament, soexperiments run with NSGA-III should be rerun (fix(nsgaiii): select parents as configured, at random by default #364).
🤖 Generated with Claude Code