Why do we have to spend so much time in queues?

12 03 2010

If you have ever taken the bus or metro in São Paulo you might know the Bilhete Unico1 already. This chip card is similar to the Pay-As-You-Go Oyster Card2 in London. It contains a balance which will be debited every time you catch a bus or the metro. This makes the payment of your fare hassle-free, and saves you even money when you take more than one bus.

The hassles of the Bilhete Unico

The Bilhete Unico would be an real incentive for people to take public transport, if there weren’t the long queues at the service counters when you want to top-up the card’s balance. The last time I waited in such queue I was wondering why SPTrans, São Paulo’s transportation company, does such a bad capacity planning in regard to the number of their attendees. The problem is simple: In order to recharge your card you have to wait into a single line which will be served by 1-3 tellers. The attendees only recharge the Bilhete Unico. For any other service the customer has to take a different queue. So why does it take so long in order to top-up the Bilhete Unico?

Good and Bad Analysis

The answer to this question might be simple: Either SPTrans has not enough capacity to attend the demand for top-ups or its planners do not know Queuing Theory. Given the fact that labour is rather cheap in Brasil I assume the latter point is actually true. Hence, I like to give a simple example in order to illustrate my argument.

Let’s assume the following numbers. There are 55-60 clients per hour, who want to top-up their cards. Each attendee can serve 32-33 clients per hours. So a planner without any knowledge about queueing theory might think:

My worst case is 60 clients per hour. With 2 tellers I am able to serve 64-66 clients per hour. That should be more than sufficient. In fact, with 2 clients my capacity exceeds demand by ca. 7%3 in the worst case and 20%4 in the best case.

This argument seems to be quite solid, but it has a little flaw. It works with arrival rates and service rates as they were constants. But what will happen if these rates are only means of a random variable (with an exponential distribution)?

Such an inquiry can be made with the help of Queuing Theory. So let’s have a look how stochastic arrivals and service times affect our queue with 2 attendees. For the best case we get:

\lambda = 55 \, \textrm{clients/hour}, \, \mu=33 \, \textrm{clients/hour}, \, \rho=\frac{55}{33}=1.66667

L_{q} = \left( 1 + \rho + \frac{\rho^2}{2 \cdot \left(1 - \frac{\rho}{2}\right) }\right)^{-1} \cdot \frac{\rho^3}{4 \cdot \left( 1 - \frac{\rho}{2} \right)^2}

L_{q} = 3.788 \, \textrm{clients}

This means that there are on average 3.788 people in the queue. So with a little help from Little’s Law we are able to calculate the average waiting time:

W_{q} = \frac{L_{q}}{\lambda} =0.069 \, \textrm{hours} = 4.1 \, \textrm{minutes}

Hence, if the process is stochastic, customers will have to wait more than 4 minutes in the best case, with a ‘capacity surplus’ of 20%. This leads naturally to the question about the upper bound for the average waiting time:

\lambda = 60 \, \textrm{clients/hour}, \, \mu=32 \, \textrm{clients/hour}, \, \rho=\frac{60}{32}=1.875

L_{q} = 13.609 \, \textrm{clients}

W_{q} = 0.227 \, \textrm{hours} = 13.6 \, \textrm{minutes}

As a result, average waiting times might go up to almost 14 minutes. A number quite close to my personal experience in the metro station.

Conclusion

The reason we have to spend so much time in queues might not be bad intentions of the capacity planners but bad analysis. Most processes, like arrival rates and service rates, are stochastic. This randomness must be taken into account while dimensioning a system.

Another intriguing fact is the sensitivity of queue’s length in respect to rather small changes in the arrival or service rates. For example, if the arrival rate is 60 clients per hour and the service rate drops from 32 to 31 clients per hour, the average waiting time increases by almost 110%.

However, all this maths does not answer the question why it is not possible to install a sufficient amount of vending machines in each metro station, like it has been done in London.

  1. http://www.sptrans.com.br/bilhete_unico/ []
  2. http://www.tfl.gov.uk/tickets/oysteronline/12421.aspx []
  3. 64/60 – 1 = 0.066667 []
  4. 66/55 – 1 = 0.2 []