Home/chiaha-SLX/Reneging

Customers who give up

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.

The problem

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.

One wait with a deadline

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;
  }
}
The customer from the workspace example gpss/reneging. A generator makes customers every rv_expo(1, 15.0) minutes and numbers them.

What 20 runs show

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.

MeasureMean of 20 runsLowest to highest run
Customers served20.2 ± 2.29 to 30
Customers who left11.5 ± 2.03 to 22
Share who left35.60% ± 4.8815.00% to 60.87%
Mean time in shop, served12.27 min ± 1.958.15 min to 26.68 min
Mean wait before leaving3.04 min ± 0.112.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.

MeasureMean of 20 runsLowest to highest run
Share who left35.94% ± 0.1135.57% to 36.51%
Mean time in shop, served12.64 min ± 0.0312.53 min to 12.74 min
Mean wait before leaving4.84 min ± 0.014.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.

Make it your own

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.