Week 9: Distributions#
One generated scenario, two strategies
The question#
What changes when we stop reporting one simulated race and instead preserve where each strategy finishes across many shared trials?
This week produces three related outputs:
- A’s full finishing-position distribution
- B’s full finishing-position distribution
- a paired comparison under the same sampled scenarios
The third does not replace the first two.
From one path to repeated trials#
A trial is one sampled interruption-and-weather scenario passed through the supplied deterministic outcome map.
Monte Carlo repeats that operation and summarises the resulting sample.
A finishing-position distribution records the proportion of trials ending at every valid place in the eight-car field: P1 through P8, including zeros.
Last week evaluated a finite list of weighted paths exactly. This week samples repeated scenarios. That is the turn.
The source boundary#
Heilmeier et al. use repeated Monte Carlo race runs to produce distributions of final ranks.
Pearce, Poloczek and Branke represent a generated scenario by a seed and reuse that seed when comparing alternatives.
Everything that follows is SlopU’s synthetic fixture:
- the interruption threshold and weather weights
- the strategies and deterministic outcome map
- the generator, seeds, draws and results
None is a calibrated Formula 1 probability.
Failure happens before sampling#
Both strategy records must exist. Both require physical wet-weather set W1, and W1 must be available in the supplied ledger.
The threshold contract must also hold:
- interruption threshold: finite and inside
[0, 1] - weather cut points:
0.20 < 0.55 < 0.85 < 1.00 - positions: exactly P1–P8, once each
- trial count: a positive integer
An unavailable set or malformed threshold rejects the run. The generator call count remains zero.
Two uniforms make one scenario#
Draw once per trial, in this order:
| Draw | Mapping |
|---|---|
u_sc | SC when < 0.20; otherwise no SC |
u_weather | E [0,.20), M [.20,.55), L [.55,.85), D [.85,1) |
An SC, or Safety Car, is an interruption that neutralises the field behind a lead car. E, M, L and D are four supplied weather paths.
The two uniforms make one scenario. Both strategies receive it.
The outcome map: no SC#
The strategies differ only in the lap after which they commit to W1:
- A: after lap 34
- B: after lap 36
| Weather | A | B |
|---|---|---|
| E | P2 | P5 |
| M | P3 | P2 |
| L | P5 | P3 |
| D | P7 | P5 |
These are synthetic deterministic outputs, not observations.
The outcome map: SC#
| Weather | A | B |
|---|---|---|
| E | P2 | P4 |
| M | P2, 601.5 s | P2, 601.8 s |
| L | P4 | P3 |
| D | P6 | P4 |
Position decides first. Only SC–M reaches adjusted finish because both strategies finish P2; A’s 601.5 s then beats B’s 601.8 s.
Every omitted adjusted time is supplied, but cannot alter a row whose positions differ.
Share the draw#
Common random numbers means reusing the same generated random inputs across alternatives.
u_sc, u_weather = wrapper.next_pair()
scenario = map(u_sc, u_weather)
A_outcome = outcome(A, scenario)
B_outcome = outcome(B, scenario)One scenario, two counterfactual strategies. If their outcomes differ, the scenario did not.
Four paired trials#
| Trial | Shared scenario | A | B | Result |
|---|---|---|---|---|
| 1 | no SC, E | P2 | P5 | A |
| 2 | no SC, M | P3 | P2 | B |
| 3 | SC, E | P2 | P4 | A |
| 4 | no SC, L | P5 | P3 | B |
Paired result: A 2, B 2.
Each row asks one counterfactual question: what would A and B have done in the same interruption and weather state?
Misalign them and A appears to win 4–0#
| Trial | A receives | A | B receives | B |
|---|---|---|---|---|
| 1 | no SC, E | P2 | no SC, D | P5 |
| 2 | no SC, E | P2 | no SC, D | P5 |
| 3 | SC, E | P2 | no SC, E | P5 |
| 4 | SC, E | P2 | SC, E | P4 |
Every row says A, but three rows compare different scenarios. The apparent difference includes easier luck for A.
This small fixture exposes scenario mismatch. It does not prove every independent sample misleads, or that shared draws always reduce variance.
The supplied generator contract#
The wrapper starts from integer seed 46 and returns u_sc then
u_weather for each trial. Underneath its self-test fixture:
state = (1664525 * state + 1013904223) mod 2^32
u = state / 2^32A seed makes this pseudo-random sequence reproducible. Students consume the tested wrapper; they do not implement the recurrence or claim that it is fit for real analysis.
Call next_pair() once per trial. Never restart it for B.
Seed 46: the first six pairs#
| t | u_sc | u_weather | Scenario | A | B |
|---|---|---|---|---|---|
| 1 | .253895 | .450940 | no SC, M | P3 | P2 |
| 2 | .316114 | .370620 | no SC, M | P3 | P2 |
| 3 | .041525 | .016507 | SC, E | P2 | P4 |
| 4 | .171429 | .783072 | SC, L | P4 | P3 |
| 5 | .908674 | .224428 | no SC, M | P3 | P2 |
| 6 | .668105 | .238925 | no SC, M | P3 | P2 |
This trace catches a swapped draw order, an incorrect boundary and a wrapper called independently for each strategy.
Twenty trials: A’s distribution#
| Position | Count | Probability |
|---|---|---|
| P1 | 0 | 0.00 |
| P2 | 5 | 0.25 |
| P3 | 9 | 0.45 |
| P4 | 1 | 0.05 |
| P5 | 2 | 0.10 |
| P6 | 1 | 0.05 |
| P7 | 2 | 0.10 |
| P8 | 0 | 0.00 |
Check: counts 20; probabilities 1.00.
Zeros stay. Dropping P1 or P8 changes the schema even though it does not change this run’s total.
Twenty trials: B’s distribution#
| Position | Count | Probability |
|---|---|---|
| P1 | 0 | 0.00 |
| P2 | 10 | 0.50 |
| P3 | 3 | 0.15 |
| P4 | 2 | 0.10 |
| P5 | 5 | 0.25 |
| P6 | 0 | 0.00 |
| P7 | 0 | 0.00 |
| P8 | 0 | 0.00 |
Check: counts 20; probabilities 1.00.
Same positions, same trial count, a different shape.
Compare each pair in order#
if A.position != B.position:
lower position wins
else if A.adjusted_finish != B.adjusted_finish:
lower adjusted finish wins
else:
unresolved tieAcross the twenty shared scenarios:
| A wins | B wins | Ties |
|---|---|---|
| 5 | 15 | 0 |
The SC–M time tie-break gives one of A’s five wins. Adjusted finish never jumps ahead of position.
Three outputs, three questions#
| Output | What it answers |
|---|---|
| A distribution | Where did A finish across the run? |
| B distribution | Where did B finish across the run? |
| B: 15/20 = 75% | How often did B beat A on paired trials? |
B beats A on 75% of this run’s shared scenarios.
Keep N=20, seed 46, both distributions and the synthetic-input boundary
beside that sentence. It does not make B the course’s next objective, and it is
not a reliable real-world probability.
Two assertions that protect the result#
Catch independent per-strategy draws:
assert each_trial.A.draw_pair is each_trial.B.draw_pair
assert wrapper.calls == NCatch a broken distribution:
assert bins.keys() == {P1, P2, P3, P4, P5, P6, P7, P8}
assert sum(counts) == N
assert sum(probabilities) == 1.0The first protects the comparison. The second protects each marginal output.
What leaves this week#
The report names:
- seed, trial count and synthetic uncertainty inputs
- both complete P1–P8 distributions
- paired win, loss and tie totals
- physical-set assumptions and feasibility result
- the synthetic, uncalibrated boundary
The instrument needs the distributions. The race uses one shared cohort draw.
Week 10 will decide whose objective ranks two-car strategies. Do not smuggle that objective into this report.