Most Friday nights, Marika and I like ordering pizza for dinner from our favorite Gainesville spot, Satchel's Pizza. Being a Friday night though, many people have the same idea, and we can often get stuck with long wait times. This past Friday, we decided to get our order in earlier, ended up getting in before the rush, and our pizza was ready sooner than we would have liked. This situation, strategizing our moves relative to others trying to do the same thing, reminded me of a project I was part of when I first started at the University of Michigan. It was in a parallel/sub-field to Physics called Complex Systems, where we try to apply techniques from Physics to other systems. In this case, we were looking at co-adaptation and co-evolution. Our model involved simulating a group of agents that would act on an environment with different strategies. Based on the strategy, they would change the environment, and get some benefit or penalty, then try to change their strategy for more benefit.
How does this relate to pizza ordering? The other customers and I are the agents, acting on the pizza place. We choose when to place our orders, and based on how many orders are ahead of us, it takes the pizza place a certain amount of time to prepare the order. We then change our ordering time according to how close to dinnertime our pizza finished. The adjustment I settled on was
This says we adjust our ordering time by 10% of the time between when we want to have dinner, and when we actually got our pizza. I put the 10% in there to make the transitions a bit smoother.
The pizza place I modeled as a set of ovens and a queue. When a customer orders, they're added to the queue, and each empty oven will serve the first customer in the queue, and take 20 minutes to cook the pizza before becoming empty again. I was curious how the customers would change their order times, and what kind of wait times would be involved. I decided to run the simulation with a couple different numbers of ovens, and see how things changed. I decided all the customers would try to eat at time t=0, and use t=-20 minutes as their first order time. Here are the average order times used by the customers at each iteration:
After some initial transients, each of the oven cases settles into a sinusoidal pattern, but with different amplitude and frequency. We can also look at how far off the customer was from their dinnertime:A couple weeks ago was Homecoming weekend, and the wait times did indeed get into the 2 hour range! Where these results get really interesting is if we combine the previous two plots into one showing the relationship between the order time and the wait time: