55 min read

On lap 41 of the 2026 Barcelona Grand Prix, race control deployed a virtual safety car (VSC). Lewis Hamilton was leading the race in his Ferrari at that moment, 22.786 s ahead of George Russell's Mercedes at the end of lap 40. He had already stopped...

Chapter 12 — Race Strategy Fundamentals: Pit Stops, Tire Compounds, and the Optimization Problem Every Team Solves 60 Times Per Race

On lap 41 of the 2026 Barcelona Grand Prix, race control deployed a virtual safety car (VSC). Lewis Hamilton was leading the race in his Ferrari at that moment, 22.786 s ahead of George Russell's Mercedes at the end of lap 40. He had already stopped twice. Russell, who had started from pole, had also stopped twice and was 4 laps into a set of hard tyres. Hamilton's mediums were 13 laps old.

Hamilton made his third stop on that lap. Over laps 41 and 42 he lost 19.797 s to Russell, and he rejoined still in front, by 2.989 s. He then pulled away on the newer tyres, and he took the chequered flag 19.561 s ahead after 66 laps.

The result invites a story that writes itself: three stops beat two. Hamilton ran Soft–Hard–Medium–Hard and won. Russell ran Medium–Hard–Hard and finished second. So the aggressive strategy was the faster one, and Mercedes got it wrong.

The data tell a more interesting story. In this chapter we build an optimiser that prices every legal strategy for this race, all 1,470,486 of them. Under the 2026 tyre allocation, its best answer is Russell's shape of strategy: two stops, medium then two sets of hards. The model prices Hamilton's actual strategy as 13.83 s slower than that optimum, and Russell's as only 3.74 s slower. Yet Hamilton won by almost 20 s. Somewhere between the model and the result, about 30 s of race time came from things the model does not contain. By the end of the chapter we will have found every one of those seconds and put a label on it.

Lap times of Hamilton and Russell at the 2026 Barcelona Grand Prix, with stops and VSC laps marked

📊 Figure (described): Lap time against lap number for Hamilton (three stops, Soft–Hard–Medium–Hard) and Russell (two stops, Medium–Hard–Hard) at the 2026 Barcelona Grand Prix. Each stop shows as a pair of spikes: an in-lap a few seconds slow and an out-lap of about 100 s against racing laps of 80–84 s. Hamilton's third stop sits inside the first VSC period (shaded), where everyone's laps were slow. The takeaway: a race time is mostly 66 racing laps that drift upward as tyres wear, plus a handful of very expensive laps around each stop.

Look at the shape of those two lines before you read further. Between the spikes, each stint's lap times creep upward: that is tyre degradation, the subject of Chapter 4. Each spike costs about 20 s. Strategy is the business of deciding how many spikes to pay for, and when, in return for flatter, lower lines in between.

Ines: So why did Hamilton stop three times if two was faster?

Aisha: That's the wrong question, I think. The right one is: what would it have cost him to stop twice, given where he was and what happened?

Tom: And whether "faster" means faster lap times or a faster race. Those aren't the same thing.

Tom has put his finger on the idea this whole chapter turns on.

🏎️ Fan Track: Read 12.1–12.5 and 12.7–12.9 for the logic of pit stops, why most races are one- or two-stoppers and how to read a strategy on TV. Skim the code; the outputs and figures tell the story.

📊 Analytics Track: Everything, especially 12.6 (the optimiser), 12.7 (model vs reality) and both case studies. You will build boxbox.strategy, which Chapters 13, 22, 27 and 40 reuse.

🔧 Engineering Track: Focus on 12.2–12.4: the physics of the pit lane, why wear forces stops, and the closed-form break-even. The derivation of the critical degradation rate is the engineering heart of the chapter.

🎰 Betting Track: 12.4, 12.8 and Case Study 2. Stop-count base rates and how often a simple model calls the stop count right are useful priors for in-race markets.


12.1 The Objective: Total Race Time, Not Lap Time

A Grand Prix is decided by one number per car: the time it takes to complete the race distance. Everything a strategist does, every pit call and every tyre choice, is an attempt to make that number smaller than the rivals'. That sounds obvious, and it is, but it has a consequence that takes most people a while to absorb.

🚪 Threshold concept: strategy minimises total race time, not lap time. A pit stop makes the car slower for two laps, by about 20 s in total, so that it can be faster for the next twenty or thirty. A team that tried to minimise each lap's time would never stop at all, and in a dry race that is illegal anyway. A team that minimises the sum asks a different question on every lap: will the time I lose now be repaid before the flag? Once you see strategy this way, "he's on the slower tyre but he's winning" stops being a paradox.

We can write the objective down. For a race of $N$ laps run as a sequence of stints (the laps between stops on one set of tyres),

$$T_{\text{race}} \;=\; \sum_{L=1}^{N} t_L \;=\; \underbrace{N\,t_{\text{base}}}_{\text{car + driver}} \;+\; \underbrace{\sum_{L} f_L}_{\text{fuel}} \;+\; \underbrace{\sum_{\text{stints}}\;\sum_{a} \big(o_c + d_c\,a\big)}_{\text{tyres}} \;+\; \underbrace{k\,P}_{\text{stops}} \;+\; \underbrace{\sum_{\text{new sets}} w_c}_{\text{warm-up}}$$

In words: race time is the car's basic pace times the number of laps, plus the cost of carrying fuel, plus what the tyres cost as they age, plus a fixed price $P$ for each of the $k$ stops, plus a small warm-up penalty for each new set. Here $a$ is the tyre age (the laps already completed on the set when a lap begins), $o_c$ is the pace offset of compound $c$ when new, $d_c$ is its degradation rate in seconds per lap per lap of age, and $w_c$ is its warm-up cost.

📐 Definition: stint, stop, in-lap, out-lap. A stint is a run of consecutive laps on one set of tyres. A stop is a change to a different set (a pit-lane passage that keeps the same set is not a stop, and in this book a tyre change made while the race is suspended under a red flag is not a stop either; it is recorded separately). The in-lap is the lap that ends in the pit lane; the out-lap is the first lap on the new set, which starts in the pit lane. Pit-stop data from OpenF1 and Jolpica record the in-lap number as the stop lap.

Read the equation from the strategist's chair. The first two terms are the same for every strategy that covers the same distance: the car is as fast as it is, and every car burns its fuel load over the same 66 laps whatever its tyre plan. So when we compare strategies, those terms cancel. What is left is a trade between the tyre term, which grows quadratically with stint length (because each lap's penalty grows linearly with age, and you add them up), and the stop term, which grows linearly with the number of stops. More stops buy shorter stints and a smaller tyre term at a price of $P$ each.

That is the whole optimisation problem. The rest of the chapter measures each term from real timing data, solves the problem exactly, and then asks what the solution misses.

What a race time is made of

Take the two Barcelona drivers. The script code/01_race_time_anatomy.py loads the race and pulls out each driver's strategy with boxbox.strategy.actual_strategies, the function we build in 12.6:

s = f1data.session(2026, "Barcelona", "R")
act = S.actual_strategies(s)            # one row per driver: sequence, stop laps, starting-set age...
ps = metrics.pit_loss(s, per_stop=True) # canonical per-stop pit loss
Top 8 finishers and what they did:
 position acronym team_ref  grid sequence    stop_laps  first_set_age
        1     HAM  ferrari     2  S-H-M-H (11, 27, 41)              2
        2     RUS mercedes     1    M-H-H     (12, 36)              0
        3     NOR  mclaren     4    M-H-H     (13, 35)              0
        4     VER red_bull     5  S-M-H-M (12, 29, 40)              3
        5     PIA  mclaren     7    M-H-H     (14, 36)              0
        6     HAD red_bull     6  M-H-H-S (15, 32, 58)              0
        7     GAS   alpine    14    M-H-H     (14, 40)              0
        8     LAW       rb     8    M-H-H     (11, 35)              0

Race distance: 66 laps; HAM 5548.105 s, RUS 5567.666 s, gap 19.561 s

Neutralisations: status  start_lap  duration_s
   VSC       41.0       148.0
   VSC       63.0       233.0

Five of the top eight ran the same strategy shape, M-H-H, stopping around laps 12–14 and 35–40. Hamilton and Verstappen did something different: both started on used soft tyres (2 and 3 laps old, from qualifying) and both stopped three times. There were two VSC periods and no safety car.

The first_set_age column matters more than it looks. Since the abolition of the Q2 tyre rule in 2022 (data/reference/regulations_notes.md), any driver can start on any set, but a soft that has already done a qualifying run starts the race older. Its wear clock is already running.

Gap between Hamilton and Russell, lap by lap, 2026 Barcelona Grand Prix

📊 Figure (described): Hamilton's cumulative race time minus Russell's at the end of each lap; above the zero line means Hamilton was ahead. Each stop shows as a dip of about 20 s for the driver who pitted, recovered when the other driver pitted. Hamilton was 1–4 s behind for most of the first 36 laps, took the lead when Russell made his second stop, and kept it through his own VSC stop on lap 41. The takeaway: the gap chart turns strategy into geometry. The question at every stop is whether the dip will be repaid.

The gap chart is how a strategist sees a race. A stop is a 20-second hole you dig on purpose. You climb out of it at the rate your fresh tyres outpace the other car's old ones. At the end of lap 35, Hamilton, on 7-lap-old mediums, was 7.583 s behind Russell, on 22-lap-old hards. By the end of lap 37, after Russell's stop, Hamilton led by 17.580 s. The VSC stop cost him most of that lead but not all of it.

📺 On the broadcast: When the graphics show "PIT WINDOW OPEN" or the commentator says a driver "will come out in traffic", they are reading a gap chart like Figure 12.2. The pit window is the range of laps in which stopping costs little in total race time; "coming out in traffic" means the 20-second hole puts the car behind slower cars it must then pass. The first is in our model. The second, as we will see, is not.


12.2 The Price of a Stop: Pit Loss, Measured

The term $kP$ in the race-time equation needs a number for $P$. Fans usually quote "a pit stop takes about two seconds", which is the time the car is stationary. That number is almost irrelevant to strategy. What matters is how much race time the whole manoeuvre costs.

📐 Definition: three different pit-stop times. Stationary time is the time the car is stopped with its wheels off the ground; our free data have it only for some stops (OpenF1 has none for 2023 and only part of later seasons; the DHL fastest-stop figures in data/reference/dhl_pitstops.csv cover only the quickest stops). Pit-lane time runs from the pit-entry line to the pit-exit line and is recorded for every stop. Green-flag pit loss, the quantity strategy needs, is the race time lost relative to staying out: $(t_{\text{in}} + t_{\text{out}}) - 2\,t_{\text{ref}}$, where $t_{\text{ref}}$ is the driver's median clean lap within five laps of the stop. The book's canonical function is metrics.pit_loss, which drops stops under SC, VSC or red flag, wet stops, lap-1 stops and stops longer than 60 s in the pit lane.

The physics of the pit lane

Why does a stop cost about 20 s when the car is stationary for only 2–3 s? Because of the speed limit. The sporting regulations set a default pit-lane limit of 80 km/h (Art. 34.7, noted in data/reference/circuits_2023_2026.csv), with some circuits reduced to 60 km/h. A car doing 80 km/h covers 22.2 m every second. On track, the same car covers the stretch beside the pit lane at racing speed, several times faster.

Here is the arithmetic, with the inputs labelled. Suppose, as an assumption, that the pit lane is 400 m long and that the car would have covered the parallel stretch of track at an average of 200 km/h (55.6 m/s):

$$\Delta t_{\text{lane}} \approx \frac{400}{22.2} - \frac{400}{55.6} = 18.0 - 7.2 = 10.8\ \text{s}$$

Add the stationary time, the braking from racing speed down to 80 km/h before the entry line, the acceleration back up after the exit, and the first lap on cold tyres, and you reach the 20-odd seconds we measure. The physics tells you which circuits will be expensive: long pit lanes, low limits, and pit lanes that bypass slow corners (so the track route is not much quicker) or fast ones (so it is).

What the data say

code/02_pit_loss_and_break_even.py runs the canonical definition on every OpenF1 race from 2023 to Las Vegas 2026:

for sk, r in f1data.sessions(kind="R").set_index("session_key").iterrows():
    ps = metrics.pit_loss(sk, per_stop=True)      # every stop, flagged used / not used
    ...
U = P[P.used]                                       # green-flag stops only
by = U.groupby("circuit_ref").agg(stops=("pit_loss_s", "size"), pit_loss_s=("pit_loss_s", "median"),
                                  pit_lane_s=("pit_lane_s", "median")).query("stops >= 20")
Race pit stops examined: 3,331; green-flag stops used: 1,921
Pooled green-flag pit loss: median 22.512 s, IQR 20.864-24.957 s; median pit-lane time 23.318 s

The pooled median is 22.512 s, from 1,921 green-flag stops, with the middle half of stops between 20.864 and 24.957 s. That matches the book's reference figure exactly. But a pooled median hides the variable a strategist cares about most: the circuit.

Green-flag pit loss by circuit, 2023–2026, with median pit-lane time

📊 Figure (described): Median green-flag pit loss for each circuit with at least 20 stops (bars) and the median pit-lane time from entry to exit line (tick marks). Spa is the cheapest place to stop (19.27 s, 91 stops) and Imola the dearest (28.16 s, 37 stops); Barcelona-Catalunya sits mid-table at 23.18 s. The takeaway: the price of a stop varies by almost 9 s across the calendar, which is enough to change how many stops are worth making.

Two details in the table are worth a second look:

               stops  races  pit_loss_s  pit_lane_s  loss_minus_lane_s
spa               91      4       19.27       23.30              -4.03
silverstone       35      3       21.20       28.95              -7.74
albert_park       42      3       20.91       18.00               2.91
catalunya        164      4       23.18       22.30               0.88
imola             37      2       28.16       30.16              -2.00

At Spa and Silverstone, the pit loss is smaller than the pit-lane time. That is not an error. The pit lane replaces a stretch of track that itself takes time to drive; pit loss counts only the difference. Where the pit lane bypasses a slow part of the lap, or where the timing lines sit so that part of the lane would have been driven anyway, the loss falls below the lane time. At Albert Park it is the other way round. This is exactly why pit-lane time is the wrong number to plug into a strategy model.

⚠️ Common pitfall: using pit-lane time (or stationary time) as the cost of a stop. The headline "23-second pit stop" is a pit-lane time, and "a 2.3-second stop" is a stationary time. Neither is the race time lost. At Silverstone the median pit-lane time is 28.95 s, but the median green-flag loss is 21.20 s; a model fed the lane time would overprice every stop there by almost 8 s and recommend too few. Fix: use the circuit's green-flag pit loss (in + out − 2 × reference), and quote its $n$. Thin samples matter: the book's tables flag single 2026 races whose figure rests on one or two stops.

Stops under a safety car

The pit loss is a green-flag number. Under a safety car or VSC, the whole field slows down, so the time a stopping car loses relative to the cars around it shrinks. The book's reference tables measure this with a "near-field" variant (each stop compared with nearby cars over the same two laps): the median green stop costs 22.556 s (n = 1,628), a VSC stop 15.671 s (n = 106) and an SC stop 12.722 s (95% CI 11.02–14.50, n = 137). Per stop, an SC stop costs about 55% of the same circuit's green stop.

That saving is what Hamilton collected on lap 41. We measure it directly in 12.7, and Chapter 14 builds the hazard model that tells you how often such gifts arrive.

🔄 Check your understanding 1. Why do the base-pace and fuel terms of the race-time equation drop out when you compare two strategies for the same car? 2. At Spa the median pit-lane time is 23.30 s but the median pit loss is 19.27 s. Give the physical reason the loss can be smaller than the time spent in the lane. 3. Hamilton's in-lap 11 took 87.828 s and his out-lap 100.800 s, against a reference lap of 82.520 s. Compute his pit loss.

Answer

  1. Every strategy covers the same $N$ laps with the same car and burns the same fuel over them, so $N\,t_{\text{base}}$ and $\sum f_L$ are identical and subtract to zero. Only the tyre, stop and warm-up terms differ.
  2. The pit lane replaces a stretch of track that also takes time to drive. Pit loss is the difference between the two routes (plus slowing and warm-up), so if the bypassed stretch is slow, or the lane is laid out so that much of it overlaps track you would drive anyway, the loss falls below the lane time.
  3. $87.828 + 100.800 - 2 \times 82.520 = 23.588$ s, which matches the 23.587 s in the script output (rounding).

12.3 The Price of Not Stopping: Degradation and the Fresh-Tyre Delta

If stops cost 20-odd seconds, why make them? Because tyres wear out. Chapter 4 covered the physics: the tread loses rubber, overheats or cools out of its window, and the grip it can generate falls. Less grip means a lower friction limit in every corner, lower cornering speeds, later throttle on exit, and a slower lap. A fresh set restores the grip.

How much slower does an old tyre make the car? Here the data hold a trap.

Why raw lap times hide the wear

The car gets lighter every lap as it burns fuel, and a lighter car is faster. In race trim the two effects nearly cancel. The book's reference tables give the median stint slope of raw lap time against tyre age, across 3,262 dry-race stints in 2023–2026, as 0.003 s/lap for MEDIUM and −0.002 s/lap for HARD: essentially flat. Once each lap is corrected for the fuel it carried (the toolkit's labelled assumption of 100 kg at the start and 0.03 s per kg per lap), the slopes become SOFT 0.064, MEDIUM 0.051 and HARD 0.048 s/lap.

📐 Definition: degradation rate. The canonical degradation rate (metrics.degradation) is the OLS slope of fuel-corrected clean lap time on tyre age within one stint, after dropping the stint's first lap, in s/lap per lap of age, with a 95% CI and $n$. Every deg number in this chapter is fuel-corrected at the toolkit's 100 kg × 0.03 s/kg assumption unless it says otherwise. The data-driven alternative (each race's own fuel-plus-track-evolution slope) gives nearly the same pooled values.

The correction is not a fudge. Strategy compares a car on old tyres with the same car on new tyres at the same fuel load, because both strategies carry the same fuel on lap 30. The fuel effect is common to both and cancels, exactly as it did in the race-time equation. What remains is the tyre-age effect, and that is what the fuel-corrected slope estimates. One caution: the slope also absorbs track evolution (the surface rubbering in and getting faster during the race), which makes measured deg smaller than the tyre's true wear. We return to that in 12.9.

⚠️ Common pitfall: quoting a deg number without its fuel correction. "Mediums degrade at 0.05 s/lap" and "mediums don't degrade at all" are both true statements about the same data: the first is fuel-corrected, the second is raw. Fix: state the correction with every degradation rate, and when you compare circuits or seasons, compare like with like.

The fresh-tyre delta

A second way to measure what new tyres are worth skips the regression. Take every green-flag stop in a dry race and compare the first three clean laps on the new set with the last three on the old set, fuel-corrected. The book's reference tables report a median fresh-tyre delta of 1.078 s/lap (95% CI 1.046–1.124, n = 1,594 stops). New tyres were more than 1 s/lap faster after 55.1% of stops and more than 2 s/lap faster after only 11.2%. The quartiles are 0.640 and 1.568 s/lap.

The break-even

Now combine the two prices. If fresh tyres are $\Delta$ seconds per lap faster and a stop costs $P$, the stop repays itself after

$$n_{\text{break-even}} = \frac{P}{\Delta}$$

laps. In words: divide the price of the stop by the time you win back each lap. With the pooled inputs, $22.512 / 1.078 = 20.9$ laps.

Break-even laps = pit loss / fresh-tyre advantage:
  Spa (lowest)           pit loss 19.274 s -> median delta  17.9 laps; strong delta  12.3; weak delta  30.1
  All circuits pooled    pit loss 22.512 s -> median delta  20.9 laps; strong delta  14.4; weak delta  35.2
  Imola (highest)        pit loss 28.164 s -> median delta  26.1 laps; strong delta  18.0; weak delta  44.0

Break-even: time regained by fresh tyres against the pit loss

📊 Figure (described): Time regained by a fresh set as a function of laps run on it, at the median fresh-tyre advantage of 1.08 s/lap (line) and across the middle half of measured stops (band), against the pit loss at Spa, all circuits pooled and Imola (dashed lines). At the median advantage, a stop pays for itself after 17.9 laps at Spa, 20.9 laps on average and 26.1 laps at Imola. The takeaway: with typical numbers you need about 20 laps on a new set before the stop is in profit, which is why stops cluster in the middle third of races.

The often-quoted rule "if fresh tyres are 1.5 s/lap faster and the stop costs 23 s you need 15 laps" is correct arithmetic with made-up inputs. With measured inputs the answer is about 21 laps, and between roughly 14 and 35 laps depending on how big the fresh-tyre advantage turns out to be at that circuit on that day.

🔍 Why this works (and where it breaks): The constant-delta break-even assumes the new set's advantage stays the same every lap. If both sets wear at the same rate, it does: the old set keeps getting slower at the same pace the new set does, so the difference stays fixed. If the new compound is harder than the old one, the advantage is smaller at first; if the old set is about to fall off a cliff, it grows. That is why we need a proper model, one that tracks each set's age lap by lap rather than assuming a fixed delta. The next section builds it.


12.4 How Many Stops? The Critical Degradation Rate

🧩 Productive struggle. Before reading on, try this. A 57-lap race, one compound that degrades at $d$ seconds per lap of age, a pit loss of 22.5 s. Ignore warm-up and compound differences. With one stop you would split the race into two equal stints; with two stops, three equal stints. How fast must the tyre degrade for the second stop to pay? Set up the tyre term for each case and find the $d$ where they tie. (Hint: a stint of $L$ laps on a new set costs $d\,(0 + 1 + \dots + (L-1)) = d\,L(L-1)/2$.)

Here is the derivation. With $k$ stops and $k+1$ equal stints of $L = N/(k+1)$ laps, the total wear time is

$$W_k = (k+1)\cdot d\,\frac{L(L-1)}{2} = \frac{d\,N}{2}\left(\frac{N}{k+1} - 1\right).$$

Adding one more stop saves

$$W_k - W_{k+1} = \frac{d\,N^2}{2}\left(\frac{1}{k+1} - \frac{1}{k+2}\right) = \frac{d\,N^2}{2(k+1)(k+2)}.$$

The extra stop pays when that saving exceeds its price $P$ (plus the new set's warm-up $w$). Setting them equal gives the critical degradation rate:

$$d^{*}_{k \to k+1} = \frac{2(k+1)(k+2)\,(P + w)}{N^2}.$$

In words: the extra stop is worth making when the tyre wears faster than twice the product of the stint counts, times the price of a stop, divided by the race length squared. For the second stop ($k = 1$) that is $12\,(P+w)/N^2$; for the third ($k = 2$), $24\,(P+w)/N^2$. The third stop always needs twice the wear the second one did.

Plug in numbers (code/03_how_many_stops.py):

N=57, P=22.512: critical deg 1->2 stops = 0.0831 s/lap; 2->3 = 0.1663 s/lap
N=66, P=23.682: critical deg 1->2 stops = 0.0652 s/lap; 2->3 = 0.1305 s/lap
N=70, P=22.512: critical deg 1->2 stops = 0.0551 s/lap; 2->3 = 0.1103 s/lap
Wear saved by a 2nd stop at d=0.051, N=57: 13.81 s

At a 57-lap race with the pooled pit loss, a second stop pays only if the tyres degrade faster than 0.083 s/lap. The pooled fuel-corrected MEDIUM rate is 0.051 s/lap. At that rate a second stop would save only 13.81 s of wear against a 22.5-second price. That one line explains most of modern Formula 1 strategy: at typical wear rates, the one-stop race is cheaper, and a second stop needs a high-wear circuit, a long race, or a cheap stop.

Notice the $N^2$. Race length matters as much as wear. Barcelona's 66 laps bring the threshold down to 0.065 s/lap, and a 70-lap race to 0.055 s/lap. That is one reason the Hungaroring and the Red Bull Ring (70 and 70–71 laps in our data) see more two-stoppers than their modest wear rates would suggest.

Testing it on every dry race

The formula is a prediction, so let's test it. For each of the 76 dry races in 2023–2026 (the book's filter: no intermediate or wet tyres and no rain flag on any lap), we compute the race's median fuel-corrected stint deg $d$, its length $N$ and its circuit's pooled pit loss $P$. Then we plot the wear a second stop would save, $d N^2/12$, against $P$. Races to the right of the diagonal should be two-stop races.

The second-stop test on 76 dry races

📊 Figure (described): Each point is a dry race from 2023–2026. The horizontal axis is the wear time a second stop would save under equal stints, $dN^2/12$; the vertical axis is the circuit's pit loss. Points are shaped by the median stop count of that race's classified finishers. Points right of the solid line are races where the simple theory says a second stop pays; the dashed line marks the same test for a third stop. The 2026 Barcelona race sits alone at the far right. The takeaway: the line separates one-stop races from two-stop races quite well, but many races just left of it still went two-stop.

Races where the 2nd stop's wear saving exceeds the pit loss: 17 of 76
Median finisher stops, by side of the line:
       count      mean  50%
below   56.0  1.330357  1.0
above   17.0  2.176471  2.0

Correlation (Spearman) of wear-saved/pit-loss ratio with actual median stops: 0.53

Seventeen of the 76 dry races fall right of the line. In those races the finishers' median stop count averaged 2.18; in the 56 races left of it, 1.33. (Three races, the 2023 Australian, 2026 Monaco and 2026 Italian GPs, have no finisher median, because every classified finisher changed tyres during a red-flag suspension.) A one-line formula with three measured inputs sorts races into one-stoppers and two-stoppers with a rank correlation of 0.53. It is not perfect, and the misses all lean the same way: races the formula calls one-stop that the field ran as two-stops. Case Study 2 investigates that bias in detail. For now, note the direction: the simple model under-predicts stops.

📋 Try it: Predict the race. Before the 2025 São Paulo Grand Prix (71 laps), suppose you had the circuit's pooled pit loss (22.51 s) and expected a fuel-corrected deg near 0.09 s/lap. Use the critical-rate formula to predict the field's stop count, then check code/race_stop_table.csv.

Answer

$d^{*}_{1\to2} = 12 \times 22.51 / 71^2 = 0.054$ s/lap and $d^{*}_{2\to3} = 0.107$ s/lap. With $d \approx 0.09$, a second stop pays and a third does not: predict two stops. The table gives the race a measured deg of 0.090 s/lap, a finisher median of 2 stops, and a two-stop winner (Norris, M-S-M).

Why is Barcelona so far right?

The 2026 Barcelona race measured a median stint deg of 0.148 s/lap across all compounds, the highest of any dry race in the period, and the race is 66 laps long. Its wear saving for a second stop, 53.7 s, is more than double its pit loss. It is also the only race in the period that sits clearly right of the dashed line, where even a third stop pays in the simple theory. The data say Barcelona 2026 was a three-stop race in principle, and the field half agreed: of the fifteen classified finishers, seven stopped three times, one stopped four times and seven stopped twice. So why does our full optimiser, below, end up preferring two? Because the simple theory leaves out the rules.

🔄 Check your understanding 1. Doubling the race length (with the same wear and pit loss) changes the critical deg rate by what factor? 2. Why does the third stop need twice the wear rate of the second? 3. A 50-lap race, pit loss 21 s, measured deg 0.05 s/lap. One stop or two?

Answer

  1. $d^* \propto 1/N^2$, so doubling $N$ divides it by 4.
  2. The saving from stop $k+1$ is $dN^2/(2(k+1)(k+2))$: 1/12 of $dN^2$ for the second stop, 1/24 for the third. Each extra stop splits already-shorter stints, so it saves less.
  3. $d^* = 12 \times 21/50^2 = 0.101$ s/lap. At 0.05 s/lap a second stop saves only $0.05 \times 2500/12 = 10.4$ s against a 21-s price: one stop.

12.5 The Rules of the Game: Two Compounds and a Limited Number of Sets

A strategy is not just any partition of the race into stints. The sporting regulations constrain it, and the constraints sometimes decide the answer.

The two-compound rule. In a dry race, each driver must use at least two different dry compounds, one of them a mandatory race specification. Breaking the rule means disqualification, or a 30-second penalty if the race is suspended and not restarted. The rule does not apply if intermediate or wet tyres were used. (2025 Sporting Regulations Art. 30.2; 2026 Section B Art. B6.3.8; both summarised in data/reference/regulations_notes.md and regulations_2026.md.) Monaco 2025 added a further requirement: at least three sets.

The allocation. Each driver gets 13 sets of dry tyres for a normal weekend and 12 for a sprint weekend (data/reference/regulations_by_season.csv, FIA Sporting Regulations 2023–2026). For 2026 the regulations fix the split: 2 HARD, 3 MEDIUM and 8 SOFT on a standard weekend, and 2 / 4 / 6 on a sprint weekend (FIA 2026 Section B Art. B6.2.4, in regulations_2026.md). Those sets must cover practice, qualifying and the race, so by Sunday a driver has fewer than that, and some of them already have laps on them.

📐 Definition: legal strategy. In this book a strategy is legal for a dry race when (1) it uses at least two different dry compounds, (2) it uses no more sets of any compound than the driver has available, (3) it meets any event-specific rule such as Monaco 2025's three-set minimum, and (4) for modelling purposes, every stint is at least 5 laps long (shorter stints are never optimal under green flags and would only slow the search). boxbox.strategy.is_legal implements (1)–(4).

What the two-compound rule does at a zero-wear race

The 2025 Italian Grand Prix at Monza is a clean test. Its fuel-corrected wear was almost nil (code/07_rules_and_sensitivity.py):

2025 Italian GP inputs:
compound  deg_s_per_lap  n_stints
  MEDIUM          0.007        15
    HARD          0.015        16
N = 53, pit loss 25.289 s (n = 19)

With the two-compound rule (best per stop count):
sequence  n_stops stop_laps  race_time_s  gap_s
     M-H        1     (34,)     4451.129  0.000
   M-H-H        2  (24, 38)     4474.480 23.351

Without the rule (as if it were wet-legal to run one set):
sequence  n_stops stop_laps  race_time_s  gap_s
       M        0        ()     4429.752  0.000
     M-M        1     (26,)     4450.594 20.842

Without the rule, the best "strategy" at Monza would be to run one set of mediums for all 53 laps and never stop. A 25-second stop buys tyres that are barely faster. The rule forces one stop, and that stop costs about 21 s of race time against the no-stop fantasy. Verstappen won that race on M-H, stopping after lap 37, inside the model's window: every stop lap from 25 to 43 is within 1 s of the model's best.

This is the first thing the rule teaches: at low-wear circuits, the one stop is not a strategic choice; it is a regulatory tax. The only strategic question left is when to pay it, and with a flat cost curve the answer is "whenever track position says so". That is why low-wear races turn into undercut battles (Chapter 13): if the cost curve is flat, the timing of the stop is free, and you may as well spend it on beating the car in front.

One-stop cost curves for three races with low, medium and high wear

📊 Figure (described): Model race time above the best one-stop, as a function of the stop lap (as % of race distance), for the 2025 Italian GP (Medium–Hard, very low wear), the 2024 Bahrain GP (Soft–Hard, about 0.09 s/lap) and the 2026 Barcelona GP (Medium–Hard, high wear). Monza's curve is almost flat: stopping anywhere from lap 25 to lap 43 costs under 1 s. Bahrain's 1-s window is 7 laps wide and Barcelona's 5. The takeaway: wear sets the width of the pit window; low wear gives teams freedom to use the stop for tactics.

2025 Italian M-H: best one-stop lap 34 of 53; within 1 s: 25-43 (19 laps); deg M 0.007, H 0.015; one-stop at lap 10 costs 6.2 s
2024 Bahrain S-H: best one-stop lap 29 of 57; within 1 s: 26-32 (7 laps); deg S 0.094, H 0.092; one-stop at lap 10 costs 32.9 s
2026 Barcelona M-H: best one-stop lap 27 of 66; within 1 s: 25-29 (5 laps); deg S 0.237, M 0.182, H 0.124; one-stop at lap 10 costs 42.4 s

The shape is a parabola, and the parabola's curvature is the sum of the two compounds' degradation rates. You can see why from the derivative. For a one-stop from compound 1 to compound 2 with stop lap $s$,

$$\frac{dT}{ds} = o_1 - o_2 + d_1\left(s - \tfrac{1}{2}\right) - d_2\left(N - s - \tfrac{1}{2}\right),$$

which is zero at

$$s^{*} = \frac{d_2 N + o_2 - o_1 + (d_1 - d_2)/2}{d_1 + d_2}.$$

In words: stop when one more lap on the old set would cost as much as one more lap on the new set at the end of the race. If both compounds wear equally, $s^*$ is close to half distance; if the second compound wears more slowly, you stop earlier and give it the longer stint. The second derivative is $d_1 + d_2$: high combined wear means a sharp, narrow valley; low wear means a flat one. For Barcelona, the closed form gives lap 26.6 for Medium→Hard and the exhaustive search gives lap 27.

What the allocation does at a high-wear race

Now return to Barcelona 2026. Without any set limit, the optimiser's favourite strategy is M-H-H-H, three stops with three sets of hards. The 2026 allocation gives each driver two hard sets for the whole weekend. M-H-H-H is not a strategy anyone could run. Remove it and every other three-hard strategy, and the best three-stop must use a medium or a soft for one of its four stints, both of which wear much faster than the hard. The three-stop's advantage disappears. Section 12.6 shows the numbers.

⚠️ Common pitfall: optimising strategies nobody can run. An unconstrained optimiser will happily recommend three sets of the most durable compound, or a 50-lap stint on a tyre no one has ever run that long. Fix: constrain the search with the sets the driver actually has (at least the allocation; ideally the new sets left after qualifying) and with realistic stint limits. optimise(..., sets_available=ALLOCATION_2026["standard"]) does the first; a max_laps value on a compound does the second.

🔄 Check your understanding 1. At Monza 2025, why is the one stop called a "regulatory tax" rather than a strategic choice? 2. What sets the width of a pit window in the linear model?

Answer

  1. With wear near zero, the best plan without the rule is not to stop at all (the model prices no-stop 21 s faster than the best one-stop). The two-compound rule forces the stop; only its timing is a choice.
  2. The curvature of the one-stop cost curve, $d_1 + d_2$. Low combined wear gives a flat curve and a wide window (19 laps within 1 s at Monza 2025); high wear a narrow one (5 laps at Barcelona 2026).

12.6 Building the Optimiser

Time to build it. Aisha's design goal for boxbox.strategy is a small, reusable core that later chapters extend: Chapter 13 adds the out-lap/in-lap battle between two cars, Chapter 22 supplies better degradation inputs, and Chapter 27 wraps the whole thing in a Monte Carlo engine with safety cars and retirements.

The objects

Three dataclasses carry everything:

@dataclass(frozen=True)
class CompoundParams:
    deg_s_per_lap: float               # linear wear, s per lap of tyre age (fuel-corrected)
    offset_s: float = 0.0              # pace of a new set vs MEDIUM (negative = faster)
    warmup_s: float = 0.0              # extra time on stint laps 2-3 of a new set
    curvature_s_per_lap2: float = 0.0  # optional quadratic wear
    max_laps: int | None = None        # optional hard life limit (a crude cliff)

@dataclass
class RaceModel:
    total_laps: int
    pit_loss_s: float
    compounds: dict                    # {"SOFT": CompoundParams, ...}
    base_lap_s: float = 0.0
    fuel_start_penalty_s: float = 3.0  # toolkit ASSUMPTION: 100 kg x 0.03 s/kg, burning off linearly
    first_stint_age: int = 0

@dataclass(frozen=True)
class Strategy:
    compounds: tuple                   # ("MEDIUM", "HARD", "HARD")
    stop_laps: tuple = ()              # in-laps: (17, 41)

A Strategy is a compound sequence plus the in-lap of each stop. Strategy.parse("M-H-H", [17, 41]) builds one from the shorthand used on timing screens.

Pricing one stint in closed form

The workhorse is the time of one stint. A stint of $n$ laps starting at age $a_0$ costs

$$\sum_{k=0}^{n-1}\big(o + d\,(a_0 + k)\big) = n\,o + d\left(n\,a_0 + \frac{n(n-1)}{2}\right),$$

so we never need to loop over laps:

def stint_time(p: CompoundParams, n_laps: int, start_age: int = 0, new_set: bool = True) -> float:
    n = int(n_laps)
    if n <= 0:
        return 0.0
    s1 = n * start_age + n * (n - 1) / 2                                       # sum of tyre ages
    s2 = sum((start_age + k) ** 2 for k in range(n)) if p.curvature_s_per_lap2 else 0.0
    return n * p.offset_s + p.deg_s_per_lap * s1 + p.curvature_s_per_lap2 * s2 + (p.warmup_s if new_set else 0.0)

race_time(strategy, model) adds the stints, the stops and the two strategy-independent terms. race_time_breakdown returns the pieces separately, which is useful for explaining a result to someone who does not want to see the code.

Searching every strategy

How many strategies are there? For a 66-lap race with up to three stops, three compounds and stints of at least 5 laps, the explicit generator enumerate_strategies counts them:

Legal strategies (1-3 stops, stints >= 5 laps, two-compound rule): 1,470,486

Pricing 1.5 million strategies one at a time in Python is slow but possible. We can do much better with one observation: for a fixed compound sequence, the race time depends only on the stint lengths. So optimise builds a table of stint costs for every compound and every length once, builds every legal combination of stop laps once as a NumPy array, and then prices all combinations for a sequence with a few vector additions:

for k in range(min_stops, max_stops + 1):
    grid = _stop_grid(N, k, min_stint)                       # all in-lap combinations, as an array
    lens = np.diff(np.column_stack([zeros, grid, full_N]), axis=1)   # stint lengths per row
    for seq in _sequences(k + 1, comps, dry, min_compounds, sets_available, min_sets, start_compound):
        tyre = cost[seq[0]][True][lens[:, 0]].copy()         # opening stint: starting-set age, no warm-up
        for j in range(1, k + 1):
            tyre += cost[seq[j]][False][lens[:, j]]          # later stints: new sets, with warm-up
        i = int(np.argmin(tyre))                             # best stop laps for this sequence
        rows.append(... race_time_s=fixed + tyre[i] + k * model.pit_loss_s ...)

The search is exact for the model: every combination of stop laps is priced, and the best one for each compound sequence is kept. The whole Barcelona search runs in well under a second. The project checkpoint confirms that the explicit enumeration and the array search find the same optimum.

Fitting the model to a real race

fit_race_model(session) turns a race into a RaceModel:

  • Degradation per compound: the median canonical stint slope over the race's dry stints with at least 8 usable laps. A compound measured on fewer than 3 stints is left out, because a single stint is not a rate. (The guard exists because of the 2024 Hungarian GP, where one soft stint with a slope of −0.112 s/lap made the optimiser fall in love with soft tyres.)
  • Offsets: the book's pooled same-driver, same-race compound offsets at equal tyre age, SOFT −0.136 and HARD −0.039 s/lap relative to MEDIUM. These are small, and the reference tables' confidence intervals show HARD vs MEDIUM is not distinguishable from zero. In race trim, compounds differ far more in how long they last than in their pace at equal age.
  • Warm-up: the pooled extra time on stint laps 2–3 of a new set, SOFT 0.450, MEDIUM 0.552 and HARD 0.111 s.
  • Pit loss: the race's own canonical green-flag pit loss, unless you pass a circuit figure.

⚠️ Common pitfall: hindsight. Fitting the degradation rates from a race's own stints and then "discovering" the race's optimal strategy uses information no strategist had on Sunday morning. It is the right way to ask "what was optimal, given what we now know?" and the wrong way to evaluate a decision. Fix: say which you are doing. For decision evaluation, use inputs available before or during the race: practice long runs, the race's first stints, previous seasons at the circuit. fit_race_model(..., first_stints_only=True) gives a mid-race version; Chapter 22 builds the pre-race version properly.

The Barcelona answer

code/04_optimise_barcelona.py runs the whole pipeline:

Model inputs (deg = median canonical stint slope, fuel-corrected at 100 kg x 0.03 s/kg):
compound  deg_s_per_lap  deg_iqr_low  deg_iqr_high  n_stints  offset_s  warmup_s
    SOFT          0.237        0.205         0.273         9    -0.136     0.450
  MEDIUM          0.182        0.145         0.209        18     0.000     0.552
    HARD          0.124        0.096         0.157        34    -0.039     0.111
N = 66 laps, pit loss = 23.682 s (n = 41 stops), base lap = 80.787 s
Critical deg for a 2nd stop: 0.0652; for a 3rd: 0.1305 s/lap

Every compound wears faster than the second-stop threshold, and the soft and medium wear faster than the third-stop threshold too. Without set limits:

Best per stop count, no set limit:
sequence  n_stops    stop_laps    stint_lengths  race_time_s  gap_s
     M-H        1        (27,)         (27, 39)     5608.913 39.870
   M-H-H        2     (17, 41)     (17, 24, 25)     5572.688  3.644
 M-H-H-H        3 (12, 30, 48) (12, 18, 18, 18)     5569.044  0.000

The unconstrained answer is three stops, 3.6 s better than two. Now apply the 2026 allocation of two hard sets:

Best per stop count with the 2026 allocation {'HARD': 2, 'MEDIUM': 3, 'SOFT': 8}:
sequence  n_stops    stop_laps    stint_lengths  race_time_s  gap_s
     M-H        1        (27,)         (27, 39)     5608.913 36.225
   M-H-H        2     (17, 41)     (17, 24, 25)     5572.688  0.000
 M-H-H-M        3 (13, 33, 53) (13, 20, 20, 13)     5576.673  3.985

With only two hard sets, the best three-stop needs a second medium stint, and it falls 4.0 s behind the best two-stop. The sign of the answer flipped because of a rule.

Best strategy for each stop count at the 2026 Barcelona GP, under the 2026 allocation

📊 Figure (described): Model race time behind the best strategy for the best one-stop, two-stop and three-stop at the 2026 Barcelona GP, under the 2026 tyre allocation. The one-stop (M-H, lap 27) is 36.2 s slower; the best two-stop (M-H-H, laps 17 and 41) is fastest; the best three-stop (M-H-H-M) is 4.0 s behind it. The takeaway: at a high-wear race the one-stop is out of the question, and the choice between two and three stops is close enough to be decided by things outside the model.

The two-stop optimum is a valley, not a point:

Race-time surface of the M-H-H two-stop over both stop laps, with the actual M-H-H stops marked

📊 Figure (described): Model race time of a Medium–Hard–Hard two-stop at Barcelona 2026 for every combination of first and second stop lap, relative to the best (star, laps 17 and 41), with contours at 1, 3, 5 and 10 s. The six classified finishers who ran M-H-H are marked. Gasly (laps 14 and 40) was 0.83 s from the model optimum; Piastri, Russell and Norris 2.8–4.1 s; Lawson 5.4 s; Lindblad, who ran a long first stint to lap 22, 9.5 s. The takeaway: the valley is broad along the diagonal, so moving both stops a few laps earlier together costs little, but the field's systematic early first stop costs 3–4 s in this model.

Notice where the actual M-H-H runners sit: almost all of them stopped earlier than the model's optimum, around laps 11–14 and 35–36 instead of 17 and 41. Teams that stop early and together are usually not optimising a solo race time. They are covering each other: if the car behind stops on lap 12 and gains time on fresh tyres, the car ahead must respond or lose the place. That is the undercut, and it pulls the whole field's stops earlier than a single-car optimiser would choose. Chapter 13 measures it: in the book's 2023–2026 undercut study, the car that stopped first got ahead in 42.9% of situations (95% CI 35.6–50.4%, n = 168).

🔄 Check your understanding 1. Why does the optimiser only need to search stint lengths for each compound sequence, rather than lap-by-lap tyre choices? 2. The unconstrained Barcelona optimum is M-H-H-H. Name the rule that makes it illegal, and say which source in data/reference/ you would cite. 3. Using the closed form, what happens to the optimal one-stop lap if the second compound's wear $d_2$ halves?

Answer

  1. Within a stint, the tyre age just counts up from the stint's starting age, so a stint's cost depends only on its compound, length and starting age. Given the sequence, the race time is a function of the stint lengths (equivalently, the stop laps) alone.
  2. The 2026 allocation of 2 HARD sets per driver per standard weekend (FIA 2026 Section B Art. B6.2.4, in regulations_2026.md; total sets also in regulations_by_season.csv).
  3. $s^*$ moves earlier: with a more durable second compound, you want the second stint to be the long one. Roughly, $s^* \approx d_2 N/(d_1 + d_2)$, so halving $d_2$ reduces the numerator by half and the denominator by less.

📋 Try it: Build the strategy. Run optimise on the 2026 Barcelona model three more times: (a) with sets_available={"HARD": 2, "MEDIUM": 2, "SOFT": 4} (a driver who used a medium and several softs in practice and qualifying); (b) with first_stint_age=2 (a used set of softs, as Hamilton had); (c) with start_compound="SOFT". For each, write down the best two-stop and the best three-stop and the gap between them. Which change moves the answer most, and why?


12.7 Model Against Reality: Why the "Wrong" Strategy Won

We now have the machinery to answer the question from the hook. The script prices each classified finisher's actual strategy with the same model, using each driver's own starting-set age:

Each finisher's actual strategy, model cost vs the best allocation-legal strategy (s):
 position acronym  sequence        stop_laps  first_set_age  model_cost_s
        1     HAM   S-H-M-H     (11, 27, 41)              2         13.83
        2     RUS     M-H-H         (12, 36)              0          3.74
        3     NOR     M-H-H         (13, 35)              0          4.11
        4     VER   S-M-H-M     (12, 29, 40)              3         43.57
        5     PIA     M-H-H         (14, 36)              0          2.81
        6     HAD   M-H-H-S     (15, 32, 58)              0         10.05
        7     GAS     M-H-H         (14, 40)              0          0.83
        8     LAW     M-H-H         (11, 35)              0          5.40
        9     LIN     M-H-H         (22, 37)              0          9.48
       10     COL     S-H-H         (12, 34)              0          7.72

Each finisher's actual strategy priced by the model

📊 Figure (described): For every classified finisher at the 2026 Barcelona GP, the model race time of the strategy they actually ran minus the model's best allocation-legal strategy, coloured by stop count. The winner's three-stop is priced 13.8 s off the optimum; the second- and third-placed two-stops 3.7 and 4.1 s; Verstappen's four-stint S-M-H-M 43.6 s. The takeaway: finishing order is not strategy order. The model prices strategies for identical cars under green flags, and the race was neither.

Verstappen's 43.6 s deserves a word before we move on. His strategy included a 26-lap final stint on mediums, and the model charges every medium lap at the field's median medium wear of 0.182 s/lap. He finished fourth, so his car clearly did not lose 43 s to that stint. A single field-wide wear rate cannot describe every car. That is a limitation of the inputs, not of the optimiser, and Chapter 22 gives each team its own rates.

Decomposing the 19.6-second win

Now the main event. code/05_strategy_vs_pace.py predicts every lap of the race for Hamilton and Russell with lap_times(), which spreads each stop's pit loss over the in-lap and out-lap in the measured proportions (19.1% on the in-lap) and adds the warm-up to the second and third laps of each new set. The predicted gap is what two identical cars running those two strategies would produce. The difference between the actual gap and the predicted gap is everything else.

for d in ("HAM", "RUS"):
    m = replace(model, first_stint_age=int(act.loc[d, "first_set_age"]))
    pred[d] = pd.Series(S.lap_times(act.loc[d, "strategy"], m), index=range(1, model.total_laps + 1))
    actual[d] = lp.loc[d].lap_duration
gap_act = (actual["HAM"] - actual["RUS"]).cumsum()        # positive = HAM behind
gap_mod = (pred["HAM"] - pred["RUS"]).cumsum()
resid = (actual["HAM"] - actual["RUS"]) - (pred["HAM"] - pred["RUS"])
Final actual gap (HAM - RUS): -19.611 s
Model gap from strategy alone: +10.088 s  (negative = HAM ahead)
Residual (everything else): -29.699 s, split by lap type:
                           sum  size
VSC laps               -11.151     6
both clean             -14.560    51
green pit laps          -4.334     7
other (lap 1, yellows)   0.345     2

On laps where both ran clean: HAM gained 0.285 s/lap on average (median 0.134), n = 51 laps

(The −19.611 s is the difference in summed OpenF1 lap times; the official classification gap is 19.561 s. We use summed laps so that the decomposition adds up exactly.)

Actual gap and the strategy-only model gap between Hamilton and Russell

📊 Figure (described): Hamilton minus Russell, lap by lap, at the 2026 Barcelona GP: the actual gap (solid) and the gap the model predicts from their two strategies alone (dashed), for identical cars paying a green-flag pit loss at every stop. The model expects Hamilton to finish 10.1 s behind; he finished 19.6 s ahead. The lines separate gradually through the green laps (pace) and sharply around lap 41 (the VSC stop). The takeaway: strategy alone would have lost Hamilton this race; car pace and a well-timed neutralisation won it.

Here is the full accounting of those 29.7 s, all from the data:

Component Seconds (HAM relative to RUS) What it is
Strategy (model) +10.088 Hamilton's S-H-M-H vs Russell's M-H-H for identical cars, green pit loss at every stop
Pace on clean laps −14.560 51 laps where both ran clean laps; Hamilton 0.285 s/lap quicker on average after adjusting for tyre age
VSC laps −11.151 6 laps touched by the two VSCs, mostly Hamilton's cheap third stop
Green pit laps −4.334 the 7 green in- and out-laps of both cars went 4.3 s better for Hamilton than the model's split of a 23.682-s loss (these laps include his pace too)
Other +0.345 Lap 1 and a yellow-flag lap
Total −19.611

So the model was right that, for two identical cars under green flags, Russell's strategy was the better one, by about 10 s. Hamilton won anyway, because his car was quicker on clean laps by about 0.29 s/lap on average (a median of 0.13 s/lap) and because the VSC arrived exactly when he needed a stop. The first of those is not a strategy effect at all. The second is strategy in the sense of Chapter 14: being in a position to use a neutralisation.

Look at the VSC stop in isolation:

HAM's third stop (in-lap 41, VSC): HAM lost 19.797 s to Russell over laps 41-42; a green stop costs 23.682 s;
gap before it (end lap 40) -22.786 s, after (end lap 42) -2.989 s
If HAM had paid the full green pit loss on top of the lap-40 gap: +0.896 s

Had the third stop come under green flags, Hamilton would have rejoined about 0.9 s behind Russell, on fresher tyres, and would have had to pass him on track. The VSC saved him roughly 3.9 s and turned a pass he would have needed into a lead he could manage.

📋 Try it: Call the pit stop. 2026 Barcelona GP, end of lap 40. You are Hamilton's strategist. Hamilton leads Russell by 22.786 s. Hamilton's mediums are 12 laps old (13 at the start of lap 41); Russell's hards are 4 laps old. A green-flag stop costs 23.68 s at this race. You have one fresh set of hards left. Twenty-six laps remain. The VSC is deployed during lap 41. Do you stop now, stop later under green, or not stop at all?

Reveal

Not stopping means running laps 42–66 (25 laps) on mediums aged 14 to 38. At the race's median medium wear of 0.182 s/lap that costs $0.182 \times (14 + 15 + \dots + 38) = 0.182 \times 650 = 118.3$ s of wear. Stopping instead puts a new hard on for those 25 laps: $-0.039 \times 25 + 0.124 \times (0 + 1 + \dots + 24) + 0.117 = -0.975 + 37.2 + 0.117 = 36.3$ s, plus the 23.68-s stop, so 60.0 s in all. Staying out loses about 58 s to stopping, more than twice the 22.8-s lead. Not an option.

Stopping later under green costs the full 23.68 s and, on the lap-40 gap, puts Hamilton about 0.9 s behind Russell.

Stopping under the VSC costs much less relative to Russell, because Russell is also driving slowly. The data show Hamilton lost 19.797 s over laps 41–42 and kept the lead by 2.989 s.

Hamilton stopped on lap 41. The timing data are consistent with a team that recognised the VSC as a cheap stop. With a fresh hard set and the lead, he extended the gap to 19.6 s by the flag.

🧪 Illustrative model: The "not stopping" arithmetic above extrapolates the field's median wear rates linearly to 38 laps of age, beyond any medium stint observed in this race. Real tyres may degrade faster near the end of their life. The conclusion (staying out was not viable) holds by a wide margin under any plausible wear curve; the exact figure does not.

What else the model leaves out

The Barcelona decomposition is unusually clean because two VSCs and a pace gap explain the result. More generally, the gap between optimiser and reality has five recurring sources:

  1. Pace differences. The model prices strategies for identical cars. Real cars differ by tenths per lap, and a faster car can afford a costlier strategy.
  2. Neutralisations. A safety car or VSC can halve the price of a stop (12.2). Teams that keep their options open benefit; teams that have just stopped lose out.
  3. Track position and traffic. A stop that rejoins behind slower cars costs more than the pit loss, because the car is held up. Our model has no traffic. The book's overtaking model (Chapter 35) adds it.
  4. The rival. Strategy is a game. Covering an undercut can be the right call even when it moves your stop away from your solo optimum.
  5. The inputs themselves. One wear rate for the whole field, hindsight fitting, and linear wear are all simplifications. The sensitivity test below shows how much they matter.

Kenji: So the model was wrong?

Aisha: It answered a narrower question than the one the race asked. It told us that for identical cars, two stops beat three by a few seconds. That's useful. It just isn't the whole race.

Ray: Most of my betting losses came from forgetting that difference.

🧪 Illustrative model: sensitivity. The Barcelona inputs are measured, but they carry uncertainty: the stint slopes' interquartile ranges are wide, and a pit loss can differ from the median by a second or two. code/07_rules_and_sensitivity.py scales all three wear rates from 0.5× to 1.5× and varies the pit loss from 18 to 30 s, and re-optimises under the 2026 allocation at every point.

Optimal stop count at Barcelona 2026 as wear and pit loss vary

📊 Figure (described): The optimal stop count for the 2026 Barcelona GP (2026 allocation) on a grid of wear multipliers (0.5× to 1.5× the measured rates) and pit losses (18–30 s). The star marks the measured inputs (1.0×, 23.7 s), which sit in the two-stop region about one grid step from the three-stop region. At 1.1× wear the answer becomes three stops if the pit loss is 21 s or less; at 1.2×, if it is 23 s or less. The one-stop never appears. The takeaway: whether Barcelona was a two- or three-stop race lies within the uncertainty of the inputs. That is precisely when teams split their strategies, and they did.

This is the honest summary of the Barcelona optimisation. The model is confident about one thing (one stop was out of the question: it never appears anywhere on the grid) and appropriately unsure about another (two vs three stops). The field reflected both: no finisher stopped once, and the finishers split almost evenly between two and three stops.

🔄 Check your understanding 1. The model priced Russell's strategy 10.1 s better than Hamilton's. Name the two largest effects that reversed the result, with their sizes. 2. Why is "Hamilton was 0.285 s/lap faster on clean laps" not a strategy effect? 3. Without the lap-41 VSC, where would Hamilton have rejoined relative to Russell?

Answer

  1. Pace on laps where both cars ran clean laps (−14.6 s) and the VSC laps (−11.2 s), mostly his cheap third stop.
  2. The residual is measured after the model has already accounted for each car's tyre ages and stops. What remains on clean laps is the difference between the cars and drivers, which no choice of stop laps creates.
  3. About 0.9 s behind: the lap-40 lead of 22.786 s minus a green-flag pit loss of 23.682 s.

12.8 How Formula 1 Actually Races: Stop Counts, 2023–2026

Step back from one race to the whole period. code/06_stop_counts.py runs actual_strategies on all 91 races and keeps the classified finishers of the 76 dry ones:

Dry races, classified finishers, % by stop count (3 = 3 or more):
stops_c    0     1     2     3  finishers  mean_stops
year                                                 
2023     2.2  35.5  49.2  13.1        321         1.7
2024     0.0  46.5  44.8   8.7        357         1.6
2025     0.0  48.3  42.1   9.6        354         1.6
2026     3.7  53.2  33.1  10.0        299         1.5

All dry-race finishers 2023-2026: one-stop 45.8%, two-stop 42.5%, n = 1331
Dry-race winners who one-stopped: 40 of 76 = 52.6% [41.6, 63.5]

These match the book's reference tables exactly. The "0 stops" are drivers whose only tyre change came during a red-flag suspension, which is not a stop: six finishers at the 2023 Australian GP and one at the 2023 Mexico City GP, and in 2026 one at Monaco and ten at the Italian GP.

Share of classified finishers by stop count in dry races, by season, with winners' stop counts

📊 Figure (described): For each season 2023–2026, the share of classified finishers in dry races who made one, two, or three or more stops, with the winners' stop counts listed at the right. One- and two-stoppers split the field roughly evenly; three or more stops account for 9–13% of finishers. Just over half of all dry-race winners one-stopped. The takeaway: the critical-rate theory of 12.4 predicts a sport of one- and two-stop races, and that is what the data show.

Some patterns are worth reading closely:

  • The one-stop share rose from 35.5% (2023) to between 46% and 53% (2024–2026). The data cannot tell us why from timing alone. Plausible contributors are compound choices and wear levels that differ by season (the reference tables show MEDIUM wear of 0.042 s/lap in 2023 and 0.063 in 2024, so it is not simply "lower wear"), and teams learning to manage tyres longer. Treat any single explanation with care.
  • The common shapes are M-H (27.7% of dry-race finishers), M-H-H (12.1%), H-M (6.6%), M-H-M (6.1%), M-S (4.4%) and M-H-S (4.4%). Starting on the medium and finishing on the hard is the default race of this era.
  • One-stoppers stop at a median of 41.8% of race distance (IQR 31.8–54.7%, n = 610). The closed-form optimum says "near half distance when wear is equal, earlier when the second compound is more durable". The hard is usually the second compound and a little more durable, so the stop comes before half distance.

Does stopping more cost places?

The reference tables include a regression on the same period: in dry races, among classified finishers from the same grid slot in the same race, two-stoppers finished on average 1.43 places further back than one-stoppers (95% CI +0.66 to +2.20, n = 1,175 finishers in 75 races).

⚠️ Common pitfall: reading strategy outcomes causally. "Two-stoppers finish 1.43 places worse, so two-stopping costs 1.43 places" is wrong. Drivers often switch to two stops because something has gone wrong: damage, a poor first stint, a safety car that makes a stop cheap. The association mixes the strategy's effect with the reasons it was chosen. Fix: compare strategies with a model (as this chapter does) or with a design that holds the reason fixed, and describe raw outcome comparisons as associations.

🔄 Check your understanding 1. Just over half of all dry-race winners in 2023–2026 one-stopped. Does that mean one-stopping helps you win? 2. Why do one-stoppers typically stop before half distance?

Answer

  1. No. Winners are mostly the fastest cars from the front of the grid, and the one-stop is the default strategy of the era; the 52.6% (40 of 76) describes what winners did, not what caused the win.
  2. The closed form puts the stop where the marginal lap on the old set equals the marginal lap at the end of the new stint. When the second compound (usually the hard) wears a little more slowly, the optimum shifts earlier so that the more durable compound gets the longer stint. The median one-stopper stopped at 41.8% of race distance.

📋 Try it: Compare these drivers. At the 2024 Bahrain GP, the top nine all ran soft–hard–X two-stops, but Verstappen and Pérez finished on softs (S-H-S) while Sainz, Leclerc and Russell finished on hards (S-H-H). Using S.race_time with first_stint_age=3, price both shapes at each driver's actual stop laps. Which shape does the model prefer, and by how much? (Case Study 1 has the full table.)


12.9 What the Model Cannot See

Every model in this book comes with an honest list of its blind spots. For boxbox.strategy in its Chapter 12 form, the list is long, and knowing it is part of using the tool well.

Track evolution inside the deg rates. The fuel-corrected slope is wear minus the speed the track gains as it rubbers in. On a "green" track that evolves a lot, measured deg understates true wear. Las Vegas, Baku and Losail show negative median deg for some compounds in the reference tables, which means the track was getting faster than the tyres were getting slower. Fed a negative rate, the optimiser wants infinitely long stints and the two-compound rule becomes the only reason to stop.

Managed stints, not tyre limits. Race data show the stints teams chose to run, which are managed to reach a planned stop. The reference tables find that only 0.5% of race stints (95% CI 0.3–0.8%, n = 3,262) end more than 2 s above their linear trend: a "cliff" is rarely visible in race data because teams stop before it. The model therefore never sees the reason a team might not run a 40-lap stint. CompoundParams.max_laps lets you add that limit by hand.

No telemetry of the tyre's state. Teams see tyre surface and carcass temperatures and wear estimates during the race. Our free data have no tyre temperatures and no wear measurements (and no ERS state or fuel load either). We infer the tyre's condition from lap times alone.

No traffic and no rival. The optimiser races a single car on an empty track. Undercuts, covering stops, rejoining into a queue, the DRS train (in 2023–2025), all are absent. Chapter 13 brings in the rival.

No neutralisations. The optimiser assumes a green race. Under a measured hazard of neutralisations, the robust strategy may differ from the clean-race optimum; Chapter 14 introduces the hazard and Chapter 27 simulates it.

Hindsight. Unless you build the inputs from data available before the decision, you are grading the race with the answer key.

How large are these blind spots in aggregate? Case Study 2 tests the model on every dry race of the period: it matches the field's median stop count in 55 of 73 races (75.3%, 95% CI 64.4–83.8%), against 53.4% for the naive rule "always predict one stop". All 18 of its misses predict fewer stops than the field made. A model that never stops too often and sometimes stops too rarely is telling you that the missing factors (safety cars, tyre limits, undercut pressure) all push in the same direction: toward stopping more.

Anchor B preview. Chapter 22 takes the same linear stint model to the 2025 Mexico City Grand Prix with pre-decision inputs and asks it to call Norris's stop: the book's reference tables report that it picks lap 36 with race early-stint wear, two laps from his actual stop after lap 34, inside a flat 1-s window of laps 33–40.

🪞 Learning check-in. You have now met three different ways to think about a pit stop: as a 20-second price (12.2), as a break-even against fresh-tyre pace (12.3), and as one term in a total-race-time optimisation (12.4–12.6). Which of the three would you reach for first if a friend asked, mid-race, "should he pit now"? Which one did the Barcelona race expose as incomplete, and what did it leave out? If you can answer both in a sentence each, you have the threshold concept. If the second one is fuzzy, reread 12.7's decomposition table and ask which rows a solo optimiser could ever have predicted.


Spaced Review

From Chapter 4 (Tires). Before you look back: why does a tyre's lap-time penalty grow with age, and why should that growth be roughly linear over most of a race stint? Chapter 4's answer is that wear removes tread and changes the tyre's operating temperature, so grip falls steadily until the tyre leaves its working window. This chapter turned "roughly linear" into a model assumption with a price: linear wear makes the stint cost quadratic in stint length, which is why splitting a race into more stints pays at all. When the data show a curved stint, the linear model will understate late-stint cost.

From Chapter 10 (The Circuit). Which circuit characteristics set the pit loss? Answer before reading on. Chapter 10 profiled each track's layout, its pit lane and its proportion of full-throttle running. Here we saw those characteristics turn into a strategy input: a spread of nearly 9 s in green-flag pit loss between Spa and Imola, enough by itself to raise the critical deg rate for a second stop by almost half.

From Chapter 6 (The Power Unit). Why does the fuel load make the car faster as the race goes on, and why does that effect cancel when two strategies are compared? Chapter 6 measured the fuel effect; here it reappeared as the reason raw lap times look flat through a stint, and as a term that drops out of the strategy comparison because every strategy carries the same fuel over the same laps. Remember which number you are quoting: raw or fuel-corrected.


Project Checkpoint: strategy.py

Aisha has a habit of naming her modules after the question they answer. This one answers: given what we know about this race, what is the fastest legal way to run it? boxbox.strategy is the core of Box Box. Every later strategy module will call it.

What it contains.

Function / class Purpose
CompoundParams, RaceModel, Strategy the inputs and the object being optimised
Strategy.parse("M-H-H", [17, 41]) build a strategy from timing-screen shorthand
is_legal(strategy, N, dry=True, min_sets=None, sets_available=None, ...) the two-compound rule, set limits, Monaco-style minimums
stint_time, race_time, race_time_breakdown, lap_times price a stint, a strategy, its parts, and each lap
enumerate_strategies(...) the explicit generator of every legal strategy
optimise(model, max_stops=3, sets_available=..., ...) exhaustive array search, one row per compound sequence
best_by_stops, one_stop_curve, optimal_one_stop_lap summaries and the closed form
break_even_laps, extra_stop_gain, critical_deg the closed-form checks of 12.3–12.4
actual_strategies(session), is_dry_race(session) what every driver actually did, with the book's stop definition
fit_race_model(session, pit_loss_s=None, first_stints_only=False, min_stints=3, ...) build a RaceModel from a race's timing data

The demo. code/project_checkpoint.py runs the module on the 2026 United States Grand Prix (Circuit of the Americas):

2026 United States Grand Prix: N = 56, pit loss 21.544 s (n = 30)
compound  deg_s_per_lap  n_stints
    SOFT          0.081        23
  MEDIUM          0.081         9
    HARD          0.057        17
sequence  n_stops    stop_laps  race_time_s  gap_s
     S-H        1        (24,)     5713.019  0.000
   S-H-H        2     (16, 36)     5716.220  3.202
 S-H-S-H        3 (12, 28, 40)     5730.448 17.429
M-H one-stop: closed form lap 23.0; search lap 23; within 1 s: laps 20-26
Winner ANT: M-H, stopping after lap 24 (starting set 0 laps old); model cost vs optimum +3.18 s
Stop counts among classified finishers: {1: 10, 2: 9}

Self-checks passed: explicit enumeration of 21,954 strategies (1-2 stops) finds the same optimum
(S-H, stopping after lap 24) as optimise(); lap_times() sums to race_time().

The model calls this a one-stop race by 3.2 s, close enough that the field split ten one-stoppers to nine two-stoppers. Antonelli won it on a Medium–Hard one-stop, stopping after lap 24, one lap from the model's best Medium–Hard stop and inside its 1-s window of laps 20–26. His strategy is priced 3.18 s off the overall optimum mostly because the model's pooled offsets make a new soft 0.136 s/lap quicker than a new medium (the book's paired same-driver comparison), so the optimiser prefers to start on softs. The fixed-effects version of the same comparison cannot distinguish the two compounds from zero, so treat a 3-second margin that rests on that offset with caution.

How it plugs in. RaceModel and Strategy are the shared currency of Box Box from here on. Chapter 13's undercut.py uses lap_times to compare two cars' in-laps and out-laps; Chapter 14's neutralisation.py will swap the pit loss for an SC/VSC value on the right laps; Chapter 22's degradation.py will supply better CompoundParams; Chapter 27's Monte Carlo engine will call optimise thousands of times; and Chapter 40's command line will wrap it as python -m boxbox simulate.


Chapter Summary

Quantity Formula / definition Value in this chapter (source)
Race time $N t_{\text{base}} + \sum f_L + \sum_{\text{stints}} \sum_a (o_c + d_c a) + kP + \sum w_c$ Barcelona 2026 best: M-H-H, laps 17 and 41
Green-flag pit loss $(t_{\text{in}} + t_{\text{out}}) - 2\,t_{\text{ref}}$ 22.512 s pooled, n = 1,921; Spa 19.27 to Imola 28.16 s
SC / VSC pit loss (near-field) stop vs nearby cars over the same two laps SC 12.722 s (n = 137), VSC 15.671 s (n = 106)
Degradation rate slope of fuel-corrected clean lap time on tyre age pooled S 0.064, M 0.051, H 0.048 s/lap (100 kg × 0.03 s/kg)
Fresh-tyre delta first 3 clean laps new − last 3 old, fuel-corrected 1.078 s/lap faster (n = 1,594)
Break-even $P / \Delta$ 20.9 laps pooled (17.9 Spa, 26.1 Imola)
Critical deg, stop $k \to k+1$ $2(k+1)(k+2)(P+w)/N^2$ 0.083 s/lap (2nd stop, N = 57, P = 22.5 s)
One-stop optimum $s^* = (d_2 N + o_2 - o_1 + (d_1 - d_2)/2)/(d_1 + d_2)$ Barcelona M→H lap 26.6 (search: 27)
Stop counts, dry finishers 2023–26 actual_strategies 1 stop 45.8%, 2 stops 42.5% (n = 1,331)
Winners who one-stopped 40 of 76 dry races, 52.6% (41.6–63.5)
Model vs field stop count Case Study 2 55 of 73 races (75.3%); naive "one stop" 53.4%

Decision checklist for a strategy call

  1. What is this circuit's green-flag pit loss, and on how many stops does it rest?
  2. What are the compounds' fuel-corrected wear rates, from data available now (practice, first stints, previous seasons)?
  3. Compute the critical rate for the next stop. Is wear clearly above it, clearly below, or close?
  4. Which sets does the driver actually have, and how old is the starting set? Re-optimise with them.
  5. How flat is the cost curve? A flat curve frees the stop for tactics (undercut, cover, track position).
  6. What could change the price of a stop in the next laps (SC/VSC hazard), and does staying flexible cost much?
  7. After the race, decompose the result: strategy, pace, neutralisations, stop execution. Grade the decision on what was knowable.

What's Next

Our optimiser races one car on an empty track. Chapter 13 adds the car in front: why stopping a lap earlier than your rival can gain you the place even when it costs you race time, how often the undercut works in the 2023–2026 data, and when the overcut beats it. Then Chapter 14 brings in the event that won Hamilton the Barcelona race: the safety car and its virtual cousin.