caelum0x afd9f736dc
Some checks failed
Pull request checks / typescript (push) Failing after 26s
Pull request checks / rust (push) Failing after 31s
Pull request checks / python (push) Failing after 34s
fix(sim): widen ODE end-of-run tolerance to absorb float drift
`simulate` compared the remaining time against `config.step * 1e-12` to
decide whether the run had reached `config.end`. Repeated `time = time
+ step` additions drift from the exact grid by more than that after a
few hundred steps (e.g. 0.0..=5.0 step 0.01), so an extra near-zero
duration RK4 step snuck in right at the end, producing a spurious
duplicate-looking final sample (502 rows instead of the expected 501
for a 500-step run). This silently inflated row counts in simulate,
forecast, validate, backtest, and report output. Scaled the tolerance
to the step size (1e-6 instead of 1e-12) so it comfortably absorbs
summation drift while staying far smaller than any real remaining
sub-step. Added a regression test pinning the exact sample count for
a run that previously tripped this.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-11-04 17:05:35 +03:00
..
2026-08-16 21:04:23 +03:00
2026-08-16 21:04:23 +03:00

lawsynth-sim

Deterministic simulation of continuous and discrete World IR. The crate compiles world laws, evaluates explicit contexts, integrates ODEs with RK4, steps discrete worlds, splits hybrid intervals at events, and offers a seeded Euler–Maruyama path for diagonal-noise SDE experiments.

Use

use lawsynth_sim::{SimulationConfig, SimulationRequest};

let config = SimulationConfig::new(0.0, 10.0, 0.01)?;
let request = SimulationRequest::default();
assert!(config.step > 0.0);
let _ = request;
# Ok::<(), lawsynth_sim::SimulationError>(())

simulate validates states, parameters, controls, finite evaluation, step budgets, and event timing. Numerical results are approximations; report solver settings and compare convergence when scientific conclusions depend on them.