Week 7 Lab: Pricing the wait
Validate a supplied interruption scenario, gate actions on the physical set ledger, and make a one-lap stop call from an analytic expected cost
19 April 2027
Two hours, completed and submitted inside the session, for 2% of the course. You arrive with the codebase running and the simpler case finished: the Safety Car is already deployed, so the event is known and there is no hazard decision to make.
What leaves the room is a feasible stop now or wait one lap call. Its report
names the projected position, expected adjusted cost, required physical set,
supplied hazard and break-even hazard. It also states that the hazard is a
synthetic scenario value, not an estimated or calibrated Formula 1 probability.
Before the session#
Install the supplied codebase and run its test suite. Read the hazard, candidate and set-ledger schemas closely enough to identify each field and its units or state. The candidate traces already carry projected position and adjusted cost; the ledger distinguishes available, used and electronically returned sets.
Complete the already-deployed-Safety-Car warm-up. A deployed Safety Car is an observed race state, not a possible next-lap arrival, so this exercise checks candidate validation, the physical-set gate and report formatting without asking you to price uncertainty.
Then work the preparation fixture by hand. It supplies a constant synthetic
hazard of 0.10 for each of two laps. One-lap survival is 0.90; two-lap
survival is 0.90 × 0.90 = 0.81; arrival by the end of lap two is 0.19.
Write one sentence explaining why the second lap still has hazard 0.10 among
races that reached it, rather than 0.19.
What is supplied#
The codebase consumes supplied Week 3 and Week 4 outputs. It does not import your earlier lab code. No random draw belongs in this implementation: the one-lap expectation has two terms and both are known once the fixture opens.
In the session#
- Validate state — 20 minutes. Reject a probability outside
[0, 1], a negative or non-finite cost, a missing action, duplicate physical-set IDs, and any candidate that names a returned set. Keep these failures distinct; a malformed scenario must not fall through to a strategic answer. - Make the hazard executable — 25 minutes. Implement the next-lap hazard and survival functions. Pass the supplied hand-calculated fixture, including the two-lap survival result, and explain in a code comment that the hazard’s denominator contains only races with no earlier Safety Car.
- Gate, then score — 30 minutes. Build the feasible action set from the
physical ledger before computing any expected cost. For
wait one lap, useh × C_SC + (1 - h) × C_green. Compare projected finishing position first; use expected adjusted cost only where positions match. - Commit the threshold, then unlock — 25 minutes. Derive the break-even
hazard symbolically without the hidden hazard. Record which side selects
stop nowand which selectswait one lap, commit that checkpoint, then unlock the assessed fixture and reproduce its locked result exactly. - Test and report — 20 minutes. Run the altered-ledger case that marks the waiting action’s required set as returned; it must reject the action before scoring. Reproduce the supplied low-hazard flip, then emit the complete decision report from the canonical locked fixture.
What you hand over#
A marker checks the following before the session closes:
- validators and tests cover invalid probabilities and costs, missing actions, duplicate set IDs and a returned set named by a candidate;
- hazard and survival functions reproduce the preparation fixture and state the conditional denominator;
- the feasibility gate runs before the analytic expected-cost calculation, and the position-first objective survives the tie-break;
- the threshold calculation was committed before unlock and records the action selected on each side of the boundary;
- the released locked tests reproduce their exact expected cost, threshold, selected action and margin, while the altered-ledger test rejects waiting;
- the final report names the action, projected position, expected added cost, physical set, supplied hazard, threshold and synthetic-input caveat.
Sampling is not evidence here. If your code draws a Bernoulli event, remove the draw and calculate the two-term expectation.
The spec
What you bring to the session. Written so a reader can tell whether it has been met without asking you.
- the supplied codebase installs and its own test suite passes on your machine
- you can identify every field in the hazard, candidate and physical-set ledger schemas
- the already-deployed-SC warm-up passes and emits its decision report
- you have hand-calculated the supplied preparation fixture's one-lap hazard and two-lap survival
Teaching team
- Naila Sorge — Tutor, leading this week
- Tobias Wren — Tutor
- Kwame Ferriter — Tutor