Chapter 27 Instructor Notes — Monte Carlo Race Simulation

Chapter: Monte Carlo Race Simulation: Modeling Every Possible Race Outcome to Find the Optimal Strategy · Exercises · Quiz · Case Study 1 · Case Study 2 · Key Takeaways · Discussion guide

Chapter 27 turns every ingredient the course has measured into one engine. Incident hazards and durations (Chapter 14), lap-1 behaviour (Chapter 17), driver noise (Chapter 9), degradation (Chapter 22) and pit-stop costs are drawn from their measured distributions, and a Bellman decision table decides when each simulated car stops. The chapter then settles the book's Singapore question (Anchor C) in full, measures how many runs are enough, moves from one "ghost" car to the full field, and validates the engine on races it has not seen. Students build the montecarlo.py module of Box Box, the engine the capstone in Chapter 40 wraps.

Learning objectives

By the end of the session, students should be able to:

  1. Explain why a strategy has a distribution of outcomes, not a race time, and report a comparison with its mean, median, P(better), P(worse) and percentiles.
  2. Separate the decision model (point estimates in a Bellman table) from the truth used to score each simulated race (draws from measured distributions).
  3. Reproduce Anchor C in ghost mode and explain why the planned two-stop loses at Singapore while the flexible one-stop gains.
  4. Size a simulation from the Monte Carlo standard error, and use common random numbers for paired comparisons.
  5. Explain why seconds and positions can disagree once traffic and passing are switched on (field mode).
  6. Read a sensitivity tornado and name the inputs that dominate the answer.
  7. Validate a probabilistic forecast with Brier scores, log scores and a PIT histogram against a base rate.

Threshold concept

This chapter has no formal threshold concept. It builds on Chapter 12's (strategy minimises total race time, not lap time) and stretches it: once the race is random, "total race time" becomes a distribution, and the summary you choose is itself a decision. Watch for students who still look for "the" race time of a strategy, or who pick the strategy with the best median without noticing that a zero-cost option has a median of 0.

Suggested 75-minute session plan

Time Segment What happens
0–8 min Hook Put two answers to the same Singapore question side by side: Chapter 14's simplified simulation (two-stop +9.44 s, faster in 10.7%) and the book's earlier Anchor C (+10.36 s, faster in 16.8%). Ask: "Same circuit, same tyres, same 10,000 races. Why do they differ?"
8–22 min Concept The engine's ingredients: per-phase hazard (lap 1 0.176, laps 2–10 0.031, middle 0.019, final 10 0.015), the incident library (118 events), SC/VSC lap factors (1.43 / 1.16), stop losses drawn from a pool. Then the Bellman rule: pit if price + GO < STAY. Stress "decide with the model, score with the truth".
22–40 min Live demo Run code/02_anchor_c_singapore.py (about 6 s; needs 01's caches). Walk the reconciliation steps A → D on screen: fixed ratios, ratio draws, tyre draws, then the snapshot incident library. The mean barely moves (+9.5 to +10.3 s); the two-stop's win probability almost doubles. Then run code/03_convergence.py and show the common-random-numbers gain.
40–58 min Activity Pairs work exercise B2 (runs needed for ±0.25 s and ±0.1 s) and B5 (SC gap compression) at the board, then discuss field mode: the two-stop costs 24–26 s and about two places at the front; the flexible option costs about 0.13–0.15 places with Singapore's calibrated passing.
58–75 min Wrap-up Validation on the 2026 US Grand Prix: the actual podium was the engine's top three by P(podium), 20 of 22 drivers inside their 10–90% intervals, but the engine under-rated the pole-sitter. Exit ticket: "Name one thing a Monte Carlo interval of ±0.26 s does not include."

Key numbers students should leave with

  • Anchor C (the book's headline, this chapter's main run): a planned two-stop at Singapore is +10.10 s (+9.83 to +10.35) slower on average and faster in 18.9% of 10,000 races. The robust answer is the flexible one-stop (stop once; take a second stop only under SC/VSC), which gains 0.84 s on average (better in 15.5%, identical in 78.7%, worse in 5.8%).
  • The earlier version: before the 2026 red-flag messages were read correctly, the book's Anchor C gave +10.36 s, 16.8% and a flexible gain of 0.46 s. Swapping back to that incident library gives +10.33 s, 18.0% and −0.49 s, which reproduces its mean. Teach the difference as a lesson in how much the incident library matters to an option's value.
  • Hazard does not flip it: at 3× Singapore's estimated hazard (k = 3.99) the two-stop is still +8.8 s on average. With the 2023–24 pit loss (29.66 s) it is +16.6 s. Degradation decides it: the two-stop wins on average only near double Singapore's wear, matching Chapter 12's critical degradation of 0.0745 s/lap.
  • Base rates: 72.5% of 2023–26 Grands Prix (66 of 91) had an SC, VSC or red flag.
  • Stop-loss pools (field-relative, dry, 2023–26): green median 22.522 s (n = 1,917); SC ratio median 0.639, mean 0.688; VSC median 0.751, mean 0.857 (trimmed pools). The decision model plans with Chapter 14's medians, 0.632 and 0.771. The book's near-field SC and VSC losses remain 12.722 s and 15.671 s; the engine uses the ratios because their mean and spread matter.
  • Convergence: per-race SD of two-stop minus one-stop 13.01 s, flexible minus one-stop 6.40 s. Common random numbers cut the paired variance by a factor of about 1,570.
  • Tornado (ghost mode, main +9.91 s): degradation ×0.5 / ×1.5 moves the answer to 14.93 / 4.59 s; the pit-loss pool to 6.59 / 16.49 s. Hazard and ratio changes move it by about a second.
  • Validation: over 15 dry 2026 races the engine beat the grid base rate on Brier and log loss (podium 0.065 vs 0.073), but its mean P(win) for pole-sitters was 0.39 while poles won 10 of 15.

Common misconceptions and remedies

Misconception Remedy
"Run more simulations and the answer becomes certain." More runs shrink Monte Carlo error only. The tornado moves the same number from +4.5 to +16.6 s; that is model error. Exercise A1.
"Pick the strategy with the best median." The flexible option's median gain is exactly 0 and its mean is positive. Show the three-way split (better / identical / worse).
"Seed each strategy separately; it's fairer." Independent seeds bury a sub-second effect under race-to-race noise. Show the paired SE (0.084) against the independent one (3.311).
"Singapore always has a safety car, so plan two stops." Even with a neutralisation in most simulated races, the two-stop loses on average. Read Section 27.4's hazard sweep.
"If it wins on time it wins on position." Field mode at a low-passing circuit: the time-only rule gives up track position it cannot get back.

Exercises to assign

  • Core (everyone): Part A — A1, A2, A4, A7; Part B — B2, B5, B7.
  • Code lab: Part C — C2 (Anchor C at a second circuit) and C4 (convergence for a probability). C5 (replay a real race) suits stronger groups.
  • Judgment: Part D — D1 (call the pit stop at the 2026 Singapore lap-8 VSC) in class; D4 (reply to the folklore in 150 words) as a short written piece.
  • Stretch: Part C — C7 (plan with the mean, not the median) and C8 (calibration by grid slot); Part E — E1 (a position-aware decision rule).
  • Interleaving: Part M — M2 (Chapters 14 and 27, two definitions of an SC stop cost) and M1 (the Chapter 12 optimiser against the Bellman table).

Lab tips

  • Run order matters: 01_engine_ingredients.py (about 12 s) writes the race summary, incident library and stop-loss caches every other script reads. 02_anchor_c_singapore.py writes _anchor_c_main.parquet, which 03_convergence.py reads. Run 01 → 02 → 03 before anything else.
  • Runtimes: 02, 03 and 05 take seconds; 06_validation_usgp.py about 45 s; 04_singapore_field.py about 3.5 min; case_study_01.py about 3 min; case_study_02.py about 5.5 min. Run the field and case-study scripts before class, not during it. Printed outputs are saved as code/*_output.txt; compare against them first.
  • _common.py is a shared helper (Singapore inputs, race_setup for any race from its grid).
  • Gotcha — fuel convention: degradation fitted at the toolkit's default fuel correction must be paired with the matching fuel term (−3.0/N s/lap). A mismatch double-counts or drops the fuel effect.
  • Gotcha — a circuit with no other race: the circuit hazard multiplier divides by zero for a circuit with no history (the 2026 Madrid round). _common.py falls back to k = 1; tell students that is a labelled assumption.
  • 10,000 ghost races take about 0.3 s; 10,000 full-field races about 9 s. Use ghost mode for anything interactive.

Connections

  • Backward: Chapter 12 (the optimiser and critical degradation), Chapter 14 (hazards and the first Anchor C run), Chapter 17 (lap-1 model), Chapter 22 (degradation inputs), Chapter 26 (the prediction baselines).
  • Forward: Chapter 35 tests the pass model against real overtakes; Chapter 36 adds weather. The capstone, Chapter 40, wraps this engine into the finished strategy simulator.