Fix that design with simple stats

title image

  One hatred that we all share is waiting in line. We wait at airports, toll booths, elevators and even toilets. I hate all of them. Recently I had to make a daunting decision. It was whether to share a toilet or not. Eventually sharing 2 toilets amongst 25 people turned out non-problematic. That is not having to wait even once in more than 3 months of usage. This is both surprising and optimistic. There are a lot of terrible services yet to be fixed. And often there is a solution which is by design improvement as shown in the laid-back graph above. The idea behind the graph is

Putting more thought into design helps to dismiss some of our frustrations with everyday services.

This post is about a simple example of queues and physics behind it to understand the point.

What this post is about?

Simple statistical modelling of waiting time in queues

Queues occur in different scenarios and forms. We will be taking very specific form of queue which is motivated from my first-hand frustrations with waiting at toll booths, immigration, elevators. The scenario is consumers gets in a line in order to procure a service in FCFS(First come first serve) basis and waits until a slot for the service is empty. Tempted to understand more about the problem, I read about it and realised this is a very well studied subject known as Queuing theory. It has a vast number of use cases including telecommunications and computing. It starts with well defined notation and terminologies. Reading all this for my first-hand problems seemed an overkill and hence I decided to model just for my simpler case and see how can we fix this. Plus, I didn’t have any immediate empirical data to run this analysis on different configuration.

Basic Model

Waiting time is a function of a few exponential random variables

Think of a toll plaza with an inefficient ticketing system enough to cause some wait per vehicle. Vehicle arrives one by one and Arrival time of ith vehicle is show by A[i] in the following figure. It Waits for time W[i] and Finishes at F[i]. There are B number of booths. This particular case in figure is when vehicle A[i] waits till A[i-B] finishes. The second possible case is when A[i] comes after A[i-B] has finished and thus it need not wait. We will combine these two cases using a Max operation in equations after the figure.

title image

And above structure can be expressed as a recurrence relation as the following.

title image

Number of arrivals are not deterministic. These are modelled with poisson distribution and subsequently arrival time of vehicles can be modelled with Exponential distribution. Therefore the above expression of W[i] reduces to a function of exponential random variables.

Experiments and Inference

Simulation of a real toll booth

One such troubling toll booth has been at an Indian national highway on the Delhi-Gurgaon junction causing vehicles to wait for 15-30 at busy times. After writing down the above described model in python and plugging in specific toll booth data from this, we are ready to query python for the toll plaza parameters. Depending on the time and day, number of incoming vehicles varies from 400 to 800 in every 2 hours. Service time of each vehicle is about 4.3 minutes but we will take it 5 mins for simplicity. The variables that affect waiting time are rate of incoming vehicles, number of booths and processing time per vehicle.

Note: There are models which takes into account the few seconds of merging and splitting from a single lane. These are more accurate but do not affect our approximate analysis dealing with waiting time in the order of minutes.

Analysis

title image

This is a graph from the simulation showing average waiting of vehicle with changing number of booths and number of vehicles. The service time is taken to be 5 minutes.

Need of a flexible system to reduce frustration and maximise performance

Going through the above graph, we can see that the current number of booths i.e. 18 can only deal within 5 minutes for just 400 vehicles. We need to increase number of booths to bring down average waiting time for vehicles more than 400. One suggestion to improve waiting and maintain productivity of toll booth is a flexible design for number of booths. At 36 as number of booths, even 900 vehicles are dealt within 5 minutes. So a flexible design from 18 to 36 is needed. However this is infeasible for most of already existing toll booths.

Gains in waiting time are big even for a small change

One more important thing to notice is that the decrease in waiting time keeps getting smaller for same increase in number of booths. Just adding 15% more booths in existing 18 booth system cuts downs the waiting time of 23 minutes by 50%. This is because for a slow system, the waiting times become proportional to square of rate of net vehicle accumulation.

Validation

As to approximately estimate proper number of servers, there is Queuing rule of thumb. Queuing rule of thumb gives 33 in our case(N*r/t=800*5/120). Our results also shows number of booths greater than 33 for a ‘small’ waiting time.

Proposal

Having reached here, I recalled a design discussed in one of my university group project for a humanities course(not able to recall the original source of idea). This design lets us increase number of booths without physically increasing the width of the road. This is about putting multiple booths in a single lane and thus process multiple vehicles in one go. For illustration below, We put 8 vehicles in single ‘boothed’ lane on the left side and 12 vehicles in double ‘boothed’ lane on the right side.

title image

So basically the double-boothed lane process double the number of vehicles that of first in the same time. This is flexible for peak and non-peak hours as well. One drawback that we could think of this design it might be confusing for users in case where there is no waiting time display placed. They have to predict and go to the fastest lane which can cause a commotion.

Takeaway

We calculated waiting time for different configuration in a queuing scenario. That gives us quantitative measure of cost associated with being frugal with number of booths. At times, we have cases of not having empirical data about variable in interest(here the waiting time). Simple statistical model like this can help in pointing out the shortcoming in the design.

Feedback