Repository navigation
fix: every packaged weight file loads (W4D_100.dat, W4D_165.dat) and NSGA-III reads them (A14, A8) - #361
Merged
Conversation
…0 vectors W4D_100.dat held its 100 vectors twice (rows 101-200 repeat rows 1-100), as the jMetalPy file it comes from (resources/MOEAD_weights/W4D_100.dat; jMetal has no such file), so VAMOS skipped it and MOEA/D with four objectives and 100 to 119 individuals ran the 84 vectors of the 6-division lattice. The file now keeps its first 100 rows. W4D_165.dat is comma-separated in jMetal, whose own reader splits on whitespace; VAMOS ships it space-separated, with the same values. Through a directory, as the command line passes the packaged one, 14 of the 31 files failed: these two, W3D_136.dat (components of -5.6e-17) and the W3D_500-1200 and W5D_1000-2500 files, whose rows jMetal rounds to sum to 1 within 2e-6. One reader, read_weight_vectors, now takes whitespace or commas, accepts jMetal's rounding (1e-5) and reads a negative component within it as zero. Rows are not renormalized, so every file that loaded before gives the same vectors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…a missing one reference_directions(path=...) was read with np.loadtxt(delimiter=","), so jMetal's whitespace-separated weight files, which VAMOS ships (W3D_100.dat), failed, and a path that did not exist silently generated the lattice and saved it there. NSGA-III now reads the file with MOEA/D's reader (whitespace or commas, jMetal's rounding), and a path that is not an existing file raises ConfigurationError when the run starts. 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-361-vamos-docs-preview.vamos-optimization.workers.dev Built from |
NicolasRodriguezUribe
added a commit
that referenced
this pull request
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>
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
Two items of the VAMOS-Studio change requests (2026-11-18), A14 and A8.
A14: packaged weight files that cannot be read. Checking every packaged
W<m>D_<n>.datshowed that 14 of the 31 could not be read through a directory, which is how the command line passes them to MOEA/D (weight_vectors(path=<packaged directory>)), and two could not be read byoptimizeeither:W4D_100.datlargest_weighted_population(100, 4) == 84:optimizewith four objectives and 100 to 119 individuals silently ran 84 (the lattice of 6 divisions); the command line failed (Expected 100 weight vectors ..., got 200)W4D_165.dat_packaged_weights(4, 165)raisedValueError: could not convert string '0.0,0.0,0.0,1.0';optimizenever read it (165 is a lattice size), the command line failedW3D_136.dat-5.6e-17(jMetal's rounding of zero)Weight vectors must be non-negative)W3D_500/600/800/1000/1200.dat,W5D_1000/1200/1500/1800/2000/2500.dat2e-6(jMetal rounds its files), over the1e-6toleranceEach weight vector must sum to 1);optimizerenormalizes packaged files, so it ranWhere the files come from:
W4D_100.datis jMetalPy'sresources/MOEAD_weights/W4D_100.dat(added to jMetalPy in b0a077957f, 2025-11-18), byte-identical, duplication included. jMetal has noW4D_100.dat.W4D_165.datis jMetal'sresources/weightVectorFiles/moead/W4D_165.dat(also in jMetalPy), comma-separated there too. jMetal reads weight files withStringTokenizer(whitespace) inWeightVectorNeighborhood.readWeightsFromFile, so jMetal's own copy cannot be read by jMetal either.W3D_136.datand the rounded files are identical to jMetal's.A8: NSGA-III's reference-direction file.
reference_directions={"path": ...}was read withnp.loadtxt(delimiter=","), so the whitespace-separated jMetal files that VAMOS ships (W3D_100.dat) failed, and a path that did not exist silently generated a lattice and saved it at that path (nsgaiii/initialization.py, around line 127).Change
W4D_100.datkeeps its first 100 rows (rows 101 to 200 repeated them exactly);W4D_165.datis space-separated, with the same values as jMetal's file.weight_vectors.py: one reader,read_weight_vectors(path, n_obj), used by MOEA/D,_packaged_weightsand NSGA-III. It accepts whitespace or commas between the components, a row sum within1e-5of one (was1e-6), and reads a negative component within that rounding as zero. Rows are not renormalized, so a file that loaded before gives exactly the same vectors (and the same results);_packaged_weightsstill renormalizes, as before. A path that is not a file raisesConfigurationError.reference_directions(path=...)goes through the same reader; a path that is not an existing file raisesConfigurationErrorwhen the run starts instead of generating and saving a lattice. The builder method has a docstring with the rule.Tests
tests/engine/test_moead_weight_vectors.py: every packagedW<m>D_<n>.datloads with shape(n, m), rows summing to 1 within1e-5and no negative component, through_packaged_weightsand through the reader;largest_weighted_population(100, 4) == 100(and 119 -> 100, 99 -> 84); MOEA/D with four objectives and 100 individuals runsW4D_100.dat; the packaged directory loadsW3D_91,W3D_100,W3D_136,W3D_1000,W4D_100andW4D_165as the command line reads them; whitespace, comma, comma-space and tab separators give the same vectors; files off the simplex, with the wrong number of columns or with NaN are rejected; a missing path and a directory raiseConfigurationError. The old test that assertedW4D_100.datwas skipped is replaced.tests/engine/test_nsgaiii_reference_direction_files.py: NSGA-III runs jMetal's whitespace-separatedW3D_100.datwith 100 individuals; comma- and space-separated copies of a file give the same directions; a missing file raisesConfigurationErrorand writes nothing; a file with more directions than individuals still raises.vamos --problem dtlz2 --n-obj 4 --algorithm moead --population-size 100, and with--n-obj 3and 136 or 1000 individuals, run on this branch and fail onmain.Compatibility
W4D_100.datinstead of the 84 of the 6-division lattice: other results for those runs, andlargest_weighted_population(sovamos tune's effective population) returns 100 for them. Runs of every other size give the same results: a file that loaded before loads the same vectors.reference_directionspath that does not exist now raisesConfigurationErrorwhere VAMOS 1.4.0 silently generated a lattice and saved it there: a silent fallback becomes an error. Study planning already rejected NSGA-III paths, so studies are unaffected.1e-5. Previously valid files read the same.Validation
All on Windows 11, Python 3.12, with
PYTHONPATHset to the worktree'ssrc(checked withvamos.__file__).pytest -q -n 4 tests/engine/test_moead_weight_vectors.py tests/engine/test_nsgaiii_reference_direction_files.py tests/engine/test_moead_weight_provenance.py tests/engine/test_nsgaiii_behavior.py tests/engine/test_tuning_population_setting.py tests/experiment/study_manifest/test_plan_preflight.py tests/experiment/test_cli_api_parity.py tests/reference/test_scientific_defaults.pyruff checkandruff format --checkon the changed Pythonpython tools/typecheck.py --scope strict/--scope fullpython -m compileallon the changed Python;git diff --checkpython tools/check_agent_docs.pypytest -m "not slow" -n 4 -p no:cacheprovider -rfEpython tools/health.pymkdocs build --strictThe two failures of the fast tier are not this change:
tests/experiment/test_cli_ablation.py::test_cli_ablation_runs_and_writes_variantsfails under xdist on Windows on untouchedmaintoo, andtests/docs/test_docs_smoke.py::test_doc_smoke_cases[journey_prepare_studio_demo]hit aMemoryErrorwhile hashing a run file (other jobs were sharing the machine). Both pass when rerun alone.Changelog entry
Fixed
W4D_100.dat, which held them twice (as the jMetalPy file it comes from) and was skipped, so VAMOS ran 84 individuals. The packagedW4D_165.datis space-separated, and weight files may separate their components with whitespace or commas and depart from the simplex by jMetal's rounding (1e-5), so all 31 packaged files load, also from the command line, where 14 of them failed. NSGA-III readsreference_directions(path=...)with the same reader, so jMetal's whitespace-separated files such asW3D_100.datwork, and a path that is not an existing file raisesConfigurationErrorinstead of generating a lattice and saving it there. Results change for MOEA/D with four objectives and 100 to 119 individuals; NSGA-III runs whose path was missing now fail.🤖 Generated with Claude Code