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:

DrawMapping
u_scSC when < 0.20; otherwise no SC
u_weatherE [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
WeatherAB
EP2P5
MP3P2
LP5P3
DP7P5

These are synthetic deterministic outputs, not observations.

The outcome map: SC

WeatherAB
EP2P4
MP2, 601.5 sP2, 601.8 s
LP4P3
DP6P4

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

TrialShared scenarioABResult
1no SC, EP2P5A
2no SC, MP3P2B
3SC, EP2P4A
4no SC, LP5P3B

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

TrialA receivesAB receivesB
1no SC, EP2no SC, DP5
2no SC, EP2no SC, DP5
3SC, EP2no SC, EP5
4SC, EP2SC, EP4

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^32

A 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

tu_scu_weatherScenarioAB
1.253895.450940no SC, MP3P2
2.316114.370620no SC, MP3P2
3.041525.016507SC, EP2P4
4.171429.783072SC, LP4P3
5.908674.224428no SC, MP3P2
6.668105.238925no SC, MP3P2

This trace catches a swapped draw order, an incorrect boundary and a wrapper called independently for each strategy.

Twenty trials: A’s distribution

PositionCountProbability
P100.00
P250.25
P390.45
P410.05
P520.10
P610.05
P720.10
P800.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

PositionCountProbability
P100.00
P2100.50
P330.15
P420.10
P550.25
P600.00
P700.00
P800.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 tie

Across the twenty shared scenarios:

A winsB winsTies
5150

The SC–M time tie-break gives one of A’s five wins. Adjusted finish never jumps ahead of position.

Three outputs, three questions

OutputWhat it answers
A distributionWhere did A finish across the run?
B distributionWhere 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 == N

Catch a broken distribution:

assert bins.keys() == {P1, P2, P3, P4, P5, P6, P7, P8}
assert sum(counts) == N
assert sum(probabilities) == 1.0

The 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.