Repository navigation
Lunar lander: workers use the population's CTRNN settings; expose new mutation config - #111
Merged
Merged
Conversation
… config, ref #94 - Python workers built organisms with Organism::new (tau 0.01, step_time 0.1) while the population and test_champion use tau 0.1, step_time 0.5. The genome dict now carries the organism's tau, dt, step_time and output activation, and create_organism requires them. - The construction logic (OrganismData, ChampionFile, ConfigFile) moves to examples/lunar_lander_common, shared by openai_lunar_lander and test_champion and tested without Python in tests/lunar_lander_tests.rs: worker-built organisms give bit-identical outputs to the population's for every organism of an evolved population. - best_config.json exposes every MutationConfig parameter; new ones default to MutationConfig::default(), missing fields take defaults, unknown fields are ignored, and an invalid file is reported instead of silently ignored. - weight_mutate_power for the lander: 0.87 (gaussian sigma), the standard deviation of the old uniform +-1.5 perturbation. - champion.json stores the CTRNN settings (old files load with the lander values) and serde_json uses float_roundtrip so weights load back exactly. - serde/serde_json as dev-dependencies for the test. 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.
What changes
Organism::new(τ 0.01, step_time 0.1), but the population andtest_championused τ 0.1 and step_time 0.5. The genome dict sent to the workers now carries the organism'stau,dt,step_timeandoutput_activation.create_organismrequires all of them, so a missing setting fails instead of falling back to the defaults.OrganismData(snapshot → rebuild),ChampionFileandConfigFilemove toexamples/lunar_lander_common/mod.rs.openai_lunar_landerandtest_championboth use it, andtests/lunar_lander_tests.rsincludes it through#[path]. That test file is compiled in the default CI and does not need pyo3.create_organismonly forwards its arguments toOrganismData::to_organism.best_config.jsonexposes everyMutationConfigparameter: per-gene rates, gaussian σ, clipping, compatibility coefficients, target species (null= fixed threshold), stagnation and elitism, disabled-gene inheritance, interspecies mating, dt, and τ mutation.MutationConfig::default().weight_mutate_power= 0.87 (gaussian σ). Since Mutación de pesos por gen, gaussiana y con recorte #64 this parameter is the σ of a gaussian. Before Mutación de pesos por gen, gaussiana y con recorte #64, 1.5 meant a uniform ±1.5 perturbation, whose standard deviation is 1.5/√3 ≈ 0.87. Keeping 1.5 would make each perturbation ≈1.7× wider (2.6× in variance) than the one the lander was tuned with. 0.87 keeps the old spread, and it also fits the problem's scale:champion.jsonstores the CTRNN settings. Old champions load with the values they were evolved with (τ 0.1, dt 0.01, step_time 0.5, sigmoid).serde_jsonnow usesfloat_roundtrip: without it, a weight such as0.2084075528757128loaded back as0.20840755287571278, so a saved champion was not exactly the one that was evolved. The new round-trip test caught this.serdeandserde_jsonare added as dev-dependencies, for the test.How it was verified
Organism::newdefaults),tests/lunar_lander_tests.rswas red. Organism 0 gave[0.3136…, 0.6292…]in the population and[0.3145…, 0.6293…]in the worker. With every CTRNN setting changed, the outputs were completely different. With the fix, all 9 tests pass.rust:1-slim):cargo fmt -- --check: OK.cargo clippy --release --all-targets: 56 warnings, the same count as develop.cargo build --release --examples: OK.cargo test --release --no-fail-fast: all green (122 unit, 9 new lander tests, the other integration tests, doc-tests).cargo check/clippy --release --features openai --example openai_lunar_lander --example test_championwith the stub pyo3 config: OK.--examplesas a whole fails onexamples/openai.rs(extern crate cpython), which fails the same way on develop and is not touched here.Closing criterion
ConfigFileexposes the new parameters with documented defaults: met.weight_mutate_powerre-chosen (0.87) and justified for the gaussian semantics: met. The justification is analytical only; no lander run was possible here.ref #94
Parte de la épica #55
🤖 Generated with Claude Code