You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ENH: seed Monte Carlo per simulation index for worker-invariant inputs
MonteCarlo seeded the stochastic models once per worker (parallel) or once
before the loop (serial), so the generated inputs depended on how many workers
ran and which worker drew which simulation. Two runs of the same seed with
different worker counts produced different inputs.
Seed per simulation index instead: spawn one SeedSequence child per index from
the run's root seed, and reseed the stochastic models from child_seeds[i]
before simulation i. SeedSequence.spawn is invariant to the spawn count, so
index i always maps to the same child, including in append mode. Each index
seed is split three ways so the environment, rocket and flight do not share a
stream.
Inputs are now identical across serial, parallel(2) and parallel(N) for a fixed
seed, and a split append run reproduces a single run. This changes the numbers a
fixed seed produces (the per-model decorrelation, plus a serial index that now
counts from 0 like the parallel path already did), so stored baselines
regenerate.
Adds tests/unit/simulation/test_montecarlo_determinism.py covering serial
reproducibility, worker-invariance, append reproducibility, and the None-seed
path. Marked slow (each simulation rebuilds a full rocket) per the existing
test_monte_carlo_simulate convention.
0 commit comments