Skip to content

Load lunar lander champions saved before #60 (5-field genes) - #121

Merged
TLmaK0 merged 1 commit into
developfrom
issue-104-old-champion-genes
Nov 25, 2026
Merged

TLmaK0 merged 1 commit into
developfrom
issue-104-old-champion-genes

Conversation

@TLmaK0

@TLmaK0 TLmaK0 commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

What changes

  • examples/lunar_lander_common: OrganismData.genes is deserialized with deserialize_genes, which accepts the current 4-field genes (in, out, weight, enabled) and the pre-Sesgo real por neurona #60 5-field genes (in, out, weight, enabled, is_bias). is_bias is dropped; those files have no biases, so every bias loads as 0. Any other number of fields is still an error. Saving always writes the current format.
  • tests/fixtures/champion_pre_60.json: a champion in the format examples/openai_lunar_lander.rs wrote before d18337b (Sesgo real por neurona #60): fitness, generation, neurons_len, 5-field genes, nothing else.
  • tests/lunar_lander_tests.rs: loads the fixture through ChampionFile::load (the path test_champion uses), checks the genes, zero biases, lander dynamics defaults, that it activates with finite outputs and round-trips in the new format; plus a test that 3- and 6-field genes are rejected.
  • README (doc-tested; prose only): old champions load, but behave differently since Entradas como fuentes y salida definida #59 (σ(y+θ) outputs, inputs as sources) and Sesgo real por neurona #60 (real per-neuron bias), so their saved fitness is meaningless and they should be re-evolved.

Verification

  • TDD: the fixture test failed first on develop's code with invalid length 5, expected 4 elements in sequence, then passes.
  • cargo fmt -- --check: ok
  • cargo clippy --release --all-targets -- -D warnings: ok; with --all-features (pyo3 stub): ok
  • cargo build --release --examples: ok
  • cargo test --release --no-fail-fast: 210 passed, 0 failed (incl. README doc-tests)

Closing criterion

Old files load (migration: is_bias dropped, bias defaults to 0) with a test using a fixture in the old format: met — cargo test --release --test lunar_lander_tests champions_saved_before_60 passes. The incompatibility in behaviour is also documented in the README.

ref #104
Part of epic #55

🤖 Generated with Claude Code

Champions written before #60 store each gene as
(in, out, weight, enabled, is_bias). OrganismData now reads genes in
either the current 4-field format or that one: is_bias is dropped and,
since those files have no biases, every bias loads as 0.

- tests/fixtures/champion_pre_60.json: a champion in the pre-#60 format
  (the one written by examples/openai_lunar_lander.rs before d18337b),
  loaded through ChampionFile::load by tests/lunar_lander_tests.rs.
- Genes with any other number of fields are still an error.
- README: old champions load but behave differently since #59/#60
  (sigmoid output, real bias), so they should be evolved again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TLmaK0
TLmaK0 merged commit 990a574 into develop Nov 25, 2026
8 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.

1 participant