Stellar Grove · Concrete Mathematical Modelling
How many checkouts to open
Customers arrive at 1.8 a minute and take 2 minutes each to serve. How many lanes keep the wait reasonable?
Chapter 6 · Stationary distributions. A worked example rebuilt from the chapter's topic in Mike Mesterton-Gibbons, *A Concrete Approach to Mathematical Modelling*; the scenario and numbers are our own illustration, not the book's text.
Headline: The work needs 3.6 cashiers on average, but 4 lanes leave customers waiting 3.9 minutes on average. Opening one more cuts that to 0.6; meeting '80% start within 2 minutes' takes 5 lanes.
- 3.9 minaverage wait with 4 lanes (90% busy)
- 0.6 minaverage wait with 5 lanes
- 5lanes for 80% of customers to start within 2 minutes
The problem
Shoppers reach the checkouts at random, a minute (a Poisson process, as in Chapter 5), and service takes an exponentially distributed time with mean 2 minutes (). The load is busy cashiers' worth of work. With lanes and one shared line, how long do people wait?
The model
The number of customers in the store's checkout area is a birth-death chain: arrivals at rate , departures at rate . In the long run it settles into a stationary distribution found from the balance equations . Summing the tail gives Erlang's C formula, the probability that an arrival has to wait:
The waiting time is zero with probability , and otherwise exponential with rate :
Results
| Lanes | Utilisation | P(wait at all) | Mean wait (min) | P(wait > 2 min) | Mean queue length |
|---|---|---|---|---|---|
| 4 | 90% | 79% | 3.94 | 53% | 7.09 |
| 5 | 72% | 41% | 0.59 | 10% | 1.06 |
| 6 | 60% | 20% | 0.16 | 2% | 0.29 |
| 7 | 51% | 9% | 0.05 | 0% | 0.09 |
| 8 | 45% | 3% | 0.02 | 0% | 0.03 |
Try it
Checkout queue explorer
Bars show how many customers are at the checkouts (in service plus waiting), in the long run.
Key findings
- Waits explode near full utilisation. At 90% busy (4 lanes) the mean wait is 3.9 minutes; at 72% (5 lanes) it is 0.6, a 7-fold drop for one extra cashier.
- Averages hide the tail. With 5 lanes, 90% of customers start within 2 minutes, but managers should staff for a percentile target, not the mean.
- One shared line beats separate lines. Pooling lets any free cashier take the next customer; separate lines ( independent M/M/1 queues at ) would give a mean wait of 18.0 minutes with 4 lanes, versus 3.9 with one line.
from books.concrete_mathematics import stationary as st
q = st.mmc(lam=1.8, mu=0.5, c=4)
print(round(q.Wq, 2), round(q.p_wait, 3), round(q.L, 2))
print(st.servers_needed(1.8, 0.5, max_wait=2, prob=0.8))
# → 3.94 0.788 10.69
# → 5
Assumptions and extensions
- Exponential service is the M in M/M/c; real service times are less variable, which shortens waits (the Pollaczek–Khinchine formula for M/G/1 shows by how much).
- Steady state. A lunchtime surge is a transient; at near 1 the queue takes a long time to reach its stationary distribution.
- No balking. Shoppers who see a long line leave; the finite-capacity model
stationary.mmck(used in the barber explainer) handles that.