In a real line, people leave. A queue with reneging counts who walked out and how long they lasted first, which is often the number a service manager cares about most.
One barber. Customers arrive on average every 15 minutes and a haircut takes 12 on average, both exponential. Each customer has a patience limit: if the barber hasn’t started on them by then, they leave. The shop runs for 480 minutes.
Patience runs from 2 to 8 minutes. The model hands it out in turn rather than at random: the first customer will wait 2 minutes, each later one 0.06 minutes longer, and after the hundredth it starts again at 2. Over a long run that is an even spread from 2 to 8. A day has about 30 customers, so within one day only the impatient end of the range comes up.
The customer waits for the barber or for its patience to run out, whichever comes first. A condition that mentions time sets a deadline, so the language wakes the customer at that moment without anything polling the clock.
On waking, the customer checks which one happened. If the barber is still busy, it counts itself as gone and leaves. In GPSS the usual way is to split off a second transaction as a timer; here it is one line.
class Customer
{
int id;
actions
{
double arrived_at = time;
double patience =
2.0 + 6.0 * (id % 100) / 100.0;
wait until (!busy
or time >= arrived_at + patience);
if (busy)
{
reneged++;
renege_wait += time - arrived_at;
terminate;
}
busy = TRUE;
advance rv_expo(2, 12.0);
busy = FALSE;
served++;
served_time += time - arrived_at;
terminate;
}
}
gpss/reneging. A generator makes customers every rv_expo(1, 15.0) minutes and numbers them.As written, one day, run 20 times from seed 1. About a third of customers leave. The day-to-day spread is large: one day loses only a few, another loses more than half.
| Measure | Mean of 20 runs | Lowest to highest run |
|---|---|---|
| Customers served | 20.2 ± 2.2 | 9 to 30 |
| Customers who left | 11.5 ± 2.0 | 3 to 22 |
| Share who left | 35.60% ± 4.88 | 15.00% to 60.87% |
| Mean time in shop, served | 12.27 min ± 1.95 | 8.15 min to 26.68 min |
| Mean wait before leaving | 3.04 min ± 0.11 | 2.64 min to 3.65 min |
Over 480,000 minutes, the share who leave barely moves, but the wait before leaving grows. That is the patience rule showing through: a long run reaches the more patient customers, numbered past the first few dozen, that a single day rarely sees.
| Measure | Mean of 20 runs | Lowest to highest run |
|---|---|---|
| Share who left | 35.94% ± 0.11 | 35.57% to 36.51% |
| Mean time in shop, served | 12.64 min ± 0.03 | 12.53 min to 12.74 min |
| Mean wait before leaving | 4.84 min ± 0.01 | 4.81 min to 4.88 min |
± is the 95% confidence interval of the mean over 20 runs. These figures are simulation results only; with patience handed out this way there is no closed-form answer to set beside them.
Replace the patience line with a random draw, rv_uniform(3, 2.0, 8.0) for example, so every day sees the whole range. Add a second barber and watch the share who leave fall. Or let customers look at the line when they arrive and refuse to join if it is long, which is balking. Each is a few lines. How GPSS blocks map to chiaha-SLX is on the GPSS models page.