Skip to content

fix: every packaged weight file loads (W4D_100.dat, W4D_165.dat) and NSGA-III reads them (A14, A8) - #361

Merged
NicolasRodriguezUribe merged 2 commits into
mainfrom
fix/weight-vector-files
Nov 19, 2026
Merged

NicolasRodriguezUribe merged 2 commits into
mainfrom
fix/weight-vector-files

Conversation

@NicolasRodriguezUribe

Copy link
Copy Markdown
Contributor

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>.dat showed 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 by optimize either:

File Problem Effect on 1.4.0
W4D_100.dat its 100 vectors twice (200 rows) largest_weighted_population(100, 4) == 84: optimize with 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 comma-separated _packaged_weights(4, 165) raised ValueError: could not convert string '0.0,0.0,0.0,1.0'; optimize never read it (165 is a lattice size), the command line failed
W3D_136.dat components of -5.6e-17 (jMetal's rounding of zero) the command line failed (Weight vectors must be non-negative)
W3D_500/600/800/1000/1200.dat, W5D_1000/1200/1500/1800/2000/2500.dat rows sum to 1 within 2e-6 (jMetal rounds its files), over the 1e-6 tolerance the command line failed (Each weight vector must sum to 1); optimize renormalizes packaged files, so it ran

Where the files come from:

  • W4D_100.dat is jMetalPy's resources/MOEAD_weights/W4D_100.dat (added to jMetalPy in b0a077957f, 2025-11-18), byte-identical, duplication included. jMetal has no W4D_100.dat.
  • W4D_165.dat is jMetal's resources/weightVectorFiles/moead/W4D_165.dat (also in jMetalPy), comma-separated there too. jMetal reads weight files with StringTokenizer (whitespace) in WeightVectorNeighborhood.readWeightsFromFile, so jMetal's own copy cannot be read by jMetal either.
  • W3D_136.dat and the rounded files are identical to jMetal's.

A8: NSGA-III's reference-direction file. reference_directions={"path": ...} was read with np.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.dat keeps its first 100 rows (rows 101 to 200 repeated them exactly); W4D_165.dat is 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_weights and NSGA-III. It accepts whitespace or commas between the components, a row sum within 1e-5 of one (was 1e-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_weights still renormalizes, as before. A path that is not a file raises ConfigurationError.
  • NSGA-III: reference_directions(path=...) goes through the same reader; a path that is not an existing file raises ConfigurationError when the run starts instead of generating and saving a lattice. The builder method has a docstring with the rule.
  • Docs: MOEA/D's tutorial and configuration reference, NSGA-III's tutorial and configuration reference, and the tuning page (four objectives and 100 to 119 individuals), each with Development after 1.4.0:.

Tests

  • tests/engine/test_moead_weight_vectors.py: every packaged W<m>D_<n>.dat loads with shape (n, m), rows summing to 1 within 1e-5 and no negative component, through _packaged_weights and through the reader; largest_weighted_population(100, 4) == 100 (and 119 -> 100, 99 -> 84); MOEA/D with four objectives and 100 individuals runs W4D_100.dat; the packaged directory loads W3D_91, W3D_100, W3D_136, W3D_1000, W4D_100 and W4D_165 as 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 raise ConfigurationError. The old test that asserted W4D_100.dat was skipped is replaced.
  • tests/engine/test_nsgaiii_reference_direction_files.py: NSGA-III runs jMetal's whitespace-separated W3D_100.dat with 100 individuals; comma- and space-separated copies of a file give the same directions; a missing file raises ConfigurationError and writes nothing; a file with more directions than individuals still raises.
  • Checked by hand: vamos --problem dtlz2 --n-obj 4 --algorithm moead --population-size 100, and with --n-obj 3 and 136 or 1000 individuals, run on this branch and fail on main.

Compatibility

  • MOEA/D with four objectives and a population from 100 to 119 now runs the 100 vectors of W4D_100.dat instead of the 84 of the 6-division lattice: other results for those runs, and largest_weighted_population (so vamos 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.
  • The command line's MOEA/D (packaged directory) now runs the 14 sizes that failed.
  • NSGA-III with a reference_directions path that does not exist now raises ConfigurationError where 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.
  • Weight and reference-direction files are more permissive: whitespace or commas, rounding within 1e-5. Previously valid files read the same.

Validation

All on Windows 11, Python 3.12, with PYTHONPATH set to the worktree's src (checked with vamos.__file__).

Command Result
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.py 500 passed, 1 skipped, 2 xfailed
ruff check and ruff format --check on the changed Python passed
python tools/typecheck.py --scope strict / --scope full 0 diagnostics / 0 diagnostics, ratchet new=0, increased=0
python -m compileall on the changed Python; git diff --check passed
python tools/check_agent_docs.py passed
pytest -m "not slow" -n 4 -p no:cacheprovider -rfE 10892 passed, 253 skipped, 9 xfailed, 2 failed (see below)
python tools/health.py all health checks passed
mkdocs build --strict built

The two failures of the fast tier are not this change: tests/experiment/test_cli_ablation.py::test_cli_ablation_runs_and_writes_variants fails under xdist on Windows on untouched main too, and tests/docs/test_docs_smoke.py::test_doc_smoke_cases[journey_prepare_studio_demo] hit a MemoryError while hashing a run file (other jobs were sharing the machine). Both pass when rerun alone.

Changelog entry

Fixed

  • MOEA/D with four objectives and 100 to 119 individuals runs the 100 weight vectors of the packaged W4D_100.dat, which held them twice (as the jMetalPy file it comes from) and was skipped, so VAMOS ran 84 individuals. The packaged W4D_165.dat is 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 reads reference_directions(path=...) with the same reader, so jMetal's whitespace-separated files such as W3D_100.dat work, and a path that is not an existing file raises ConfigurationError instead 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

…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>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T23:42:35.947455Z 99f2eb1 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown
Contributor

VAMOS documentation preview

https://pr-361-vamos-docs-preview.vamos-optimization.workers.dev

Built from 99f2eb1. Canonical metadata points to the production .org domain; the preview itself remains isolated.

@NicolasRodriguezUribe
NicolasRodriguezUribe added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit 02fba6a Nov 19, 2026
15 checks passed
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>
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.

1 participant