Method and checks

Shift Rehearsal is a small discrete-event simulation that runs in your browser. It's written to be checked: the rules are below, the code is public, and the results are compared with the textbook formula every week.

The model

The weekly check against the textbook

For steady arrivals, exponential service and nobody giving up, queueing theory gives an exact long-run answer (Erlang C). Each week the self-test runs these cases through the simulator for 100 simulated 24-hour days and fails if they drift apart. Results from this build:

CaseFormula: average waitSimulatedFormula: served within 1 minSimulated
One server, 80% busy (48/h, 1 min)4.00 min4.01 min34.5%34.8%
Four servers, 75% busy (180/h, 1 min)0.51 min0.51 min81.3%81.5%
Café-like: five staff, 83% busy (100/h, 2.5 min)1.86 min1.95 min55.6%55.3%
Desk-like: five staff, 80% busy (30/h, 8 min)4.43 min4.17 min51.1%52.7%

Simulated days start with an empty shop, so at high utilisation they wait slightly less than the long-run formula, which assumes a line that's been running forever. Little's law (average line = arrival rate × average wait) holds in every case to within 0.02 people.

What it doesn't know

That's why results are labelled simulations, not forecasts, and why the tool has a reality check: write down what happened after a real shift and see how far off the simulation was.