Skip to content

README: dependency line and CTRNN dynamics section, README snippets as doc-tests - #110

Merged
TLmaK0 merged 1 commit into
developfrom
issue-93-readme-version-tau
Nov 25, 2026
Merged

TLmaK0 merged 1 commit into
developfrom
issue-93-readme-version-tau

Conversation

@TLmaK0

@TLmaK0 TLmaK0 commented Nov 25, 2026

Copy link
Copy Markdown
Owner

What changes

  • Dependency line. crates.io API (/api/v1/crates/rustneat, checked 2026-11-25): newest published version is 0.2.1 (2018-05-28); 0.3.0 is not published. 0.2.1 lacks create_population_initialized, evaluate_in -> Result and with_seed, so the README now depends on the repository (git = "https://github.com/TLmaK0/rustneat", branch = "develop") and says the README documents the code in the repo, which can differ from crates.io releases. No version number or release status is written in the README, so it does not go stale when 0.3.0 is published (at that point the line can become rustneat = "0.3").
  • CTRNN section rewritten for the current integrator: the ODE with input neurons as sources, exponential Euler as the only integrator used by Organism::activate, dt / step_time / round(step_time/dt) steps, the meaning of dt/τ, propagation depth (one connection per step, so at most round(step_time/dt) connections per call), per-neuron τ genes (Genome::tau/set_tau, tau_mutation_rate (0 by default), tau_gene_mutation_rate, tau_mutate_power, tau_range, compatibility_tau_coefficient), and Integrator::Euler. It also includes a small MutationConfig builder snippet.
  • Snippets cannot rot. src/lib.rs adds #[cfg(doctest)] #[doc = include_str!("../README.md")] pub struct ReadmeDoctests;, so cargo test compiles and runs every ```rust block in the README. The XOR snippet is now bounded (500 generations) and seeded (with_seed(42)) so it can run as a test, and it points to `examples/simple_sample.rs`.

Fact found while documenting: Integrator::Euler can only be reached through the low-level Ctrnn::with_integrator. Organism uses a pub(crate) const INTEGRATOR = ExponentialEuler, so evolution cannot select it. The README states this as it is and does not change that behaviour.

Verification

  • Red first: with the hook in place and the README call misspelled (create_population_initialised), cargo test --release --doc fails with src/lib.rs - ReadmeDoctests ... Couldn't compile the test.
  • Green: cargo test --release --doc runs ReadmeDoctests (line 100) and (line 194), both ok. The XOR snippet, run as a program, solves XOR with seed 42 (champion fitness 15.69 > 15.5) well inside the 500-generation cap. The doc-test takes 0.6 s.
  • Gates: cargo fmt -- --check ok; cargo clippy --release --all-targets 56 warnings, same as develop 4eafc8e; cargo build --release --examples ok; cargo test --release --no-fail-fast all green (122 unit + every integration binary + 4 doc-tests, 2 ignored as on develop).

Closing criterion

  • README version vs Cargo.toml/published: 0.3.0 is not published, so no version is shown. The README uses a git dependency and explains why.
  • The τ section describes the current integrator: exponential Euler default, Integrator::Euler, dt, per-neuron τ, tau_mutation_rate, propagation depth.
  • The README usage snippet compiles and runs as a doc-test.

ref #93
Parte de la épica #55 (part of epic #55)

🤖 Generated with Claude Code

…, ref #93

- Sample usage: the crates.io release (0.2.1) predates this API and 0.3.0
  is not published, so the README depends on the git repository (develop)
  instead of a version number.
- Replace the explicit-Euler tau section with the current dynamics:
  exponential Euler, dt and step_time, propagation depth per activation,
  per-neuron tau genes and their mutation, and Integrator::Euler (only
  reachable through the low-level Ctrnn).
- Bound the XOR snippet to 500 generations and seed it, so it can run as a
  test.
- Compile and run the README Rust blocks as doc-tests through a
  cfg(doctest) item in lib.rs.

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