Skip to main content

Monte Carlo or bust (Monte Carlo Method, part 4)

This is the final post on the mathematical approach known as the Monte Carlo method, following 'Generating random numbers.'

We have seen in previous posts why the method is named Monte Carlo, how it was first used and the difficulties of obtaining a stream of truly random numbers. This approach is now used across the sciences, as well in engineering, economics, AI and more. It's an technique that comes in useful when there is a complex mathematical problem solve, where taking repeated random samples of weighted possible outcomes will give a better understanding of a real world situation.

There are far too many applications to go into detail here (you can find a length set of possibilities in the Wikipedia entry). To see a simple one in action, take a look at this Monte Carlo-based pi generator. But I just want to pick out another application that I'm particularly familiar with from using it to help understand queues in an airport terminal. I've always thought that queuing is one of the most fascinating aspects of Operational Research, which I worked in for a good few years. Apart from anything, this is because queues involve people, and the way that people interact with each other.

Anyone who has visited theme park rides in different countries may well have experienced varying cultural approaches to dealing with a conventional single line queue, from polite fairness to 'cram in and try to get in front'. But things get more interesting when there are multiple servers. Once upon a time there would typically be an individual queue for each server. This is still often the case, for example, with supermarket trolley checkouts and airport passport checks. But in many cases, it is more effective to have a single queue feeding all the servers, where the person at the front goes to the first available server.

It's not long ago that such queuing systems were treated with suspicion: since the single queue is much longer than any one of the individual queues it replaces, it looks like it will make waiting time longer. But it doesn't in many circumstances. Usually when we want a single queue multiple server setup we corral people to make it easier to see what's happening. With no enforced structure, for example, at a row of several busy cash machines you usually see a queue forming behind each dispenser - though I was delighted a few years ago (when I used to use cash) to see a spontaneously formed single queue, multiple server arrangement developing as people held back from cashpoints and let the first person go to whichever became free.

There are times, though, when the intuitive setup may not be the most effective - and this is where a form of Monte Carlo Method comes in, in the form of simulation. (Some pedants don't include simulation as Monte Carlo, but I disagree, and it's one of the easiest examples to get your head around.) When I did this, I manually coded it, though for many years now you have been able to use off the shelf simulation packages. After collecting data on the distribution of times a transaction takes, which depends on the complexity of the interaction (e.g. the number of items in a shopping trolley, the number of bags and options in a check-in, or the complexity of a bank transaction ranging from a simple deposit to setting up a new account) plus the flows of customers at various times, the simulation makes use of random number generation to control both the availability of servers, the arrival of customers with different transactions, and their queue selection if there is more than one queue.

This is then run as a simulation, a bit like a self-playing video game, churning through a virtual day over and over to build up an effective picture of what is likely to happen. The same approach can then be taken with variations in the queuing layout, making it possible to provide the best structure of queue(s) for the particular requirement.

I had many a happy hour looking at queuing possibilities for Heathrow's Terminal Four (don't blame me if the queues don't work now - this was many years ago and the queuing structures/airline usage have changed several times since). It was a delight to be putting (pseudo-) randomness to good use.

Image from Unsplash by Lisanto

See all of Brian's online articles or subscribe to a weekly digest for free here

Comments

Popular posts from this blog

Why I hate opera

If I'm honest, the title of this post is an exaggeration to make a point. I don't really hate opera. There are a couple of operas - notably Monteverdi's Incoranazione di Poppea and Purcell's Dido & Aeneas - that I quite like. But what I do find truly sickening is the reverence with which opera is treated, as if it were some particularly great art form. Nowhere was this more obvious than in ITV's 2010 gut-wrenchingly awful series Pop Star to Opera Star , where the likes of Alan Tichmarsh treated the real opera singers as if they were fragile pieces on Antiques Roadshow, and the music as if it were a gift of the gods. In my opinion - and I know not everyone agrees - opera is: Mediocre music Melodramatic plots Amateurishly hammy acting A forced and unpleasant singing style Ridiculously over-supported by public funds I won't even bother to go into any detail on the plots and the acting - this is just self-evident. But the other aspects need some exp

Is 5x3 the same as 3x5?

The Internet has gone mildly bonkers over a child in America who was marked down in a test because when asked to work out 5x3 by repeated addition he/she used 5+5+5 instead of 3+3+3+3+3. Those who support the teacher say that 5x3 means 'five lots of 3' where the complainants say that 'times' is commutative (reversible) so the distinction is meaningless as 5x3 and 3x5 are indistinguishable. It's certainly true that not all mathematical operations are commutative. I think we are all comfortable that 5-3 is not the same as 3-5.  However. This not true of multiplication (of numbers). And so if there is to be any distinction, it has to be in the use of English to interpret the 'x' sign. Unfortunately, even here there is no logical way of coming up with a definitive answer. I suspect most primary school teachers would expands 'times' as 'lots of' as mentioned above. So we get 5 x 3 as '5 lots of 3'. Unfortunately that only wor

Why backgammon is a better game than chess

I freely admit that chess, for those who enjoy it, is a wonderful game, but I honestly believe that as a game , backgammon is better (and this isn't just because I'm a lot better at playing backgammon than chess). Having relatively recently written a book on game theory, I have given quite a lot of thought to the nature of games, and from that I'd say that chess has two significant weaknesses compared with backgammon. One is the lack of randomness. Because backgammon includes the roll of the dice, it introduces a random factor into the play. Of course, a game that is totally random provides very little enjoyment. Tossing a coin isn't at all entertaining. But the clever thing about backgammon is that the randomness is contributory without dominating - there is still plenty of room for skill (apart from very flukey dice throws, I can always be beaten by a really good backgammon player), but the introduction of a random factor makes it more life-like, with more of a sense