èƵ

How the maths of queuing can make lines more efficient

From shops to ride-share apps, queuing is everywhere. Peter Rowlett explains how the maths behind queuing can help us spend less time in line
EDINBURGH, SCOTLAND - JUNE 06: Taylor Swift fans queue outside Murrayfield stadium ahead of tomorrow nights concert on June 06, 2024 in Edinburgh, Scotland. Taylor Swift's Eras World Tour plays 15 dates across Scotland, Wales and England this June and August. Her fans, known as Swifties, had made the superstar $200 million in Eras merchandise sales as of November 2023. (Photo by Jeff J Mitchell/Getty Images)
Taylor Swift fans queue outside Murrayfield stadium
Jeff J Mitchell/Getty Images

I imagine that you may, at some point in your life, have been in a queue that wasn’t run entirely efficiently. Despite allegedly loving to line up and wait for things, Brits like me have an array of stories about badly run queues.

Luckily, maths can give us insight into queues and answer questions like how many staff are needed to help them run efficiently. We can gather data on a real queue and use the average arrival rate to calculate the probability of someone joining. This is just an average, of course: if I told you an average of six people were going to enter your shop every hour and six arrived in the first few minutes, would you assume no one else would enter for the rest of the hour? No, because customers don’t arrive in average numbers at all times.

Rather than assume the average number of arrivals, we calculate probabilities for numbers of arrivals based on the average using the Poisson distribution, named for mathematician Siméon Denis Poisson (1781-1840). This uses an exponential curve to calculate lower probabilities away from the average – so, for example, if you expect the next person to join the queue in 2 minutes, it isn’t unthinkable that they take longer, but it gets increasingly unlikely for longer times.

This maths is useful in working out how many cashiers you need in your shop. But queuing goes a lot further than this.

Your queue need not be a physical one: you may have been held in a queue online waiting to buy tickets, or on a phone where “your call is very important to us”.

Or your queue may be part of a computer process. Typing this text caused a queue of operations to be sent to a computer processor, which worked through them one at a time. When you upload a video to social media, it gets divided into data packets that form a queue to be reassembled.

Some queues have more complicated dynamics. In a supply chain, a shop might be queuing to receive products from a factory, which is waiting in turn to obtain raw materials. A ride-share app operates a two-ended queue, with customers waiting to be served and drivers queuing for jobs.

Sometimes queues don’t serve people in the order they joined. Should a lift move to the next person who pressed the button, or pick up other people it passes on the way? There are also queues with ordering based on urgency of need, such as triage systems in hospitals or maintenance jobs.

I am writing this on a slightly delayed train. If we miss our slot at a station, should we be prioritised, potentially delaying another train, or be made to wait?

We can gain insight into a great many processes by thinking of them as queues, and using maths like the Poisson distribution helps us create more realistic models and understand how to run those queues more efficiently.

For other projects visit newscientist.com/maker

Topics: Mathematics