In a previous post, I discussed using discrete-event simulation to validate an optimization model and its underlying assumptions. A similar approach can be used to validate queueing models as well. And when it is found that the assumptions required for a queueing model are not a good fit for the real-world system under investigation, discrete-event simulation provides a flexible modeling alternative. To demonstrate, let’s use a queueing theory model and discrete-event simulation to investigate a real-life system that has become quite popular in the NC Triangle area in recent years: the Food Truck Rodeo.

Four times a year, downtown Raleigh hosts a Food Truck Rodeo that includes a half mile of food trucks spread out over eleven city blocks. Over 50 trucks from across NC participate with names like Wandering Moose, Stuft, and Bam Pow Chow, serving everything from Korean BBQ to cupcakes. A local food truck called Pho Nomenal Dumpling was even named ‘Best Food Truck in America’ after participating in the Food Network’s Great Food Truck Race.

#### The Queueing Model

Let’s suppose that we are interested in attending the next food truck rodeo (where Pho Nomenal Dumpling will be participating) and we want to estimate how long we will have to wait in line at any given truck. In the formulation of our queueing theory model, we can consider the food trucks to form a network of nodes. Customers may arrive from outside the network to any node (i.e., truck) and may depart the network from any node. Customers may return to nodes previously visited, or skip some nodes entirely. The other assumptions for our queueing model are as follows:

- There are trucks.
- Customers arrive from outside the network to truck as a Poisson process with an average rate .
- All servers at truck work according to an exponential distribution with average rate . All workers on a truck represent one service unit, rather than parallel servers.
- When a customer completes service at truck , he or she goes to truck next with probability , independent of the system state. With probability , a customer leaves the network at node upon completion of service (after receiving his or her food).
- There is no limit on queue capacity at any truck.
- There is a first-come-first-serve queueing discipline.

Queueing systems with these properties are called open (i.e., arrivals and departures from outside the network exist) Jackson networks. They have closed-form solutions for the expected waiting time in queue. To compute the waiting time, we first compute the total arrival rate into truck and then compute the utilization factor for the truck.

Now has two components: the external arrival rate into node and the probability-weighted sum of arrival rates from all other trucks . In summary, .

The utilization factor is the ratio of the total arrival rate to the mean service time: . It is a measure of the average use of the resource (in our case, a truck). If , then the queue grows infinitely long, and so thus the average waiting time. But if , then the expected waiting time at node is .

For this example, assume there are trucks participating in our food truck rodeo. Table 1 below shows the mean arrival rate to each truck from outside the network, as well as the mean service rates. Table 2 gives the probability that a customer who has completed service and received his or her food at truck will go to truck next and get something else to eat. We will assume truck 4 is the popular Pho Nomenal Dumpling truck.

Solving five equations in five unknowns for , we can compute the total mean flow rate for each truck and then we can compute the utilization factor for each truck. Table 3 shows these results, along with the expected waiting time (queueing time) at each truck.

The expected waiting time that we computed for each truck in Table 3 using the Jackson Network model is the expected waiting time *when the system is in steady-state*. But suppose we want to model the time spent waiting in line at each truck during a four-hour window around dinner time. Then, we are interested in a *transient* state. In general, analytical solutions for transient queueing systems are impractically difficult to obtain. How different is the steady state from this transient state?

#### The Simulation Model

To answer that question, I built a discrete-event simulation model of our food truck rodeo system in SAS Simulation Studio 14.1 (shown below) and ran the model two ways. First, I ran the simulation to steady state. Then, I ran the model for the more realistic simulated time of four hours (or approximately four hours since the model will continue to run until all customers that are still in the system at the end of four hours are served).

SAS Simulation Studio has a Steady State block to estimate the expected waiting time at each truck in steady-state operation. Table 4 below shows the results of that simulation experiment. As we should expect, the theoretical expected waiting times and those simulated using a sample agree almost exactly. The SAS Simulation Studio Steady State block provides a further measurement: an estimate of the time to reach steady-state operation. Truck 4, the one with the longest waiting times, and thus the one whose performance is most important to estimate accurately, takes an alarmingly long time to reach steady-state.

Food trucks typically operate for short time windows around lunch or dinner. It is not likely that any food truck would remain open for the period of time required to reach steady-state operation (and certainly not 49 hours). So I then ran 100 independent replications of the simulation model, each with a run length of four hours (to represent a window around dinner time) and recorded the average waiting time across all replications for each truck. The results of this simulation experiment are shown in Table 5.

Table 5 demonstrates that the steady-state results do not reflect the behavior we observe if we run the system for four hours. I am pretty certain that the owners of the Pho Nomenal truck would not appreciate an overestimation of their expected waiting times by almost 19 minutes.

Before you get too excited about the relatively small amount of time you will have to wait to sample one of Pho Nomenal's dumplings, please note that all arrival rates and service rates in my food truck system are fictional. To my colleague Leo Lopes, who suggested that I write this blog post, I now challenge you to hang out at the next food truck rodeo and collect actual arrival and service rates so we can all carefully plan out which food trucks to visit at the next rodeo.

Easy modeling of transient behavior is only one of the ways that SAS Simulation Studio enhances the analytics of queueing networks. The following simple (and realistic) changes to our food truck rodeo example also violate the assumptions underlying the Jackson Network model:

- Suppose someone is waiting in line and sees someone else walk by with something yummy from another truck. The person decides to jump out of line and join the line for the other truck.
- Suppose someone at a particular truck places an exceptionally large order. Naturally, the food truck workers are going to assist other customers in line behind that customer if they are able to do so.
- Suppose a concert lets out and there is a rush of people to the food truck rodeo.

In future blog posts we will enhance our model to handle these conditions.

## 2 Comments

Your transition probabilities are memoryless, aren't they? So If there's a 10% chance that I follow up that first order of tacos from Truck A with yummy ribs from Truck B, then find my way back to A for a fifth round of tacos, there's a 10% chance again of more ribs, ad nauseum (literally). Another adjustment to the model might be a system exit probability that increases with total consumption, or transition probabilities that decline with number of prior visits to the destination.

Yes, I think you are right! This is another reasonable adjustment that can be added easily to the simulation model.