Repository navigation
feat(engine): season simulator, portable sampler and benchmarks - #14
Merged
Merged
Conversation
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
Milestone M1 for the engine:
std::poisson_distributionuses implementation-defined algorithms, so the same seed gave different goals on libstdc++ and libc++. It is replaced with Knuth's multiplication method fed by a bit-exact uniform (top 53 bits ofmt19937_64).split_mixmoves into the sharedrandommodule.simulate_season). Takes the current table, remaining fixtures and per-match goal rates; runs N seasons acrossstd::threadworkers with per-thread SplitMix64 seeds; returns each team's finishing-position and points distributions, mean points, and title, top-N and relegation probabilities. Ranking is points, goal difference, goals scored, then a seeded random tiebreak (head-to-head is not modelled).SUBSPOT_BUILD_BENCHMARKS, off by default) measuring seasons per second at 1, 2, 4 and 8 threads. Results table in the README.simulate_season, with pytest tests replacing the inline smoke test.Closes #5
Why
The season simulator drives the title, top-4 and relegation odds in the app. The portable sampler makes a seed reproducible across the g++ and clang++ builds, which the backtests and the iOS app both rely on.
How it was tested
PoissonKnuth.FixedSeedGivesKnownSequence: a hard-coded 20-draw sequence that must match on both compilers in the CI matrixBenchmark (Apple M4, Release, median of 3)