For this blog I want to take you to Disney World. Theme parks are very large places with many different attractions, be it rides, restaurants or shows. They are also places that are typically very crowded. This generally leads to long waiting times at many attractions throughout the day. Now, you may consider the possibility that the waiting times are not constant throughout the day. As such, there could be an **optimal** time to visit each attraction.

The idea of applying optimisation to a theme park visit is something that never occurred to me. It is just one of those things that seems to be known—theme parks mean long waiting times. Listening to the podcast How I Built This, at the very end of an episode they talked to Len Testa from Touring Plans who has developed an app for optimising your time at many different theme parks, including Disneyland, Disney World and Universial Orlando.

I thought that this was such a great idea, that I decided that to devote a blog post to this concept.

## The problem we want to solve

I like the topic because it is such a practical problem that people would love to be able to solve (even if they don’t know it). The problem that we want to solve here is:

*To find a plan that visits as many attractions as possible with a minimal amount of waiting time.*

This problem breaks into two parts: i) devising a plan that visits as many attractions as possible and ii) minimising the amount of waiting time. Since there are two parts this becomes a multi-objective optimisation problem, which is more difficult than is necessary for the purposes of this blog post. So we will focus on the minimisation of waiting time.

What is interesting about this problem is that it is a variant of theĀ *travelling salesman problem* or *shortest path problem*. More generally we could call it a *routing problem* (since you are trying to find a route through the theme park).

## The objective function

If you have seen other parts of this website, then you will have noticed that there are really two key aspects of an optimisation problem. The first is the objective function, which is the thing that you want to maximise or minimise, and the other is the set of constraints, which hinders your ability to achieve an absolute maximum or minimum. In this case we have a very clear objective function,

*minimise the total waiting time.*

Now, it is likely that we don’t know what the actual waiting times will be for a given day, so we will need to minimise the **expected** waiting time. The expected waiting times is something that really relies on the data that you have, which is something we will come to a little later.

## The constraints

In this particular problem there are not too many constraints. The main ones that needs to be considered is

- The number of usable hours
- Typically, you will only have a single day to visit a theme park.
- The amount of time you have in a day is restricted by the opening hours.

- The times for specific activities
- If you want to visit a restaurant for lunch or dinner, then there are time windows that must be considered.
- For example, you would not want to have lunch at 10am or dinner at 3pm.

There could be additional constraints that you wish to impose yourself. An example of such a constraint is that you may only want to visit each selected attraction once.

Since this problem is a routing problem, there are many constraints that are needed for the mathematical model. Some of these are very intuitive, but because mathematics we can’t rely on intuition these constraints need to be explicitly stated.

Lets say that you wanted to visit Peter Pans Flight, Monsters Inc Laugh Floor, Tomorrowland Speedway, “it’s a small world” and have lunch at Be Our Guest Restaurant. A map of Disney World with those attractions highlighted is below. What I have done here is connect each of the attractions with a line. All the lines combined is called a *network* or *graph*. This particular network is called a complete graph. The network that I have drawn here is what will be used to find the optimal plan with minimal waiting time.

The mathematical model will describe the following constraints

- You can only visit each attraction once,
- When visiting an attraction, you must use exactly one line going into the attraction and one line leaving the attraction,
- Since you want to have lunch at Be Our Guest Restaurant, then you can only use lines going to that restaurant between 11:00 and 13:00.

Above we stated that the objective function is to minimise the total waiting time. In addition, you could also want to minimise the travel time between the attractions. Each of the lines in the above image has an associated travel time. So the order of visiting the attractions will result in a different travel time for the complete plan.

The problem that we need to solve is a variation of the *travelling salesman problem*. This problem could also be solved as a shortest path problem.

## The data

A very important aspect of this problem is the data. Most importantly, the waiting time data at each of the attractions is required. Now, the waiting time at Tomorrowland Speeway today could be very different to the waiting times tomorrow or next week. As such, statistical techniques are required to provide an estimation of the *expected waiting times*. There are many different techniques that could be used and a quick search of “Disney World waiting times data” brings up a number of articles about this. Some techniques that I saw during this search included forecasting and machine learning.

## Solving the problem

Given the data for the waiting times, this problem becomes either a shortest path problem or the travelling salesman problem. Since the number of attractions is typically small (you can only really see up to 30 attractions in a day), it is not too difficult to solve these problems. It is expected that this problem could be solved in the order of seconds.

## Optimisation techniques for your visit to Disney World

So, next time you are visiting a theme park, think about whether optimisation could be used to improve your experience. There are many cool and interesting applications of optimisation techniques, this is one that has the ability to make your visit to Disney World much more enjoyable.