Discussion Problem

Attempt to complete 2.6 problem 1 from Kelton here (page 35). Discuss your calculations and approaches. See if you can simulate this problem in Simio. Share your work and discuss.

Problem 2.6.1

For an \(M/M/1\) queue with mean interarrival time 1.25 minutes and mean service time 1 minute, find all the five of \(W_q\), \(W\), \(L_q\), \(L\), and \(\rho\). For each, interpret in words. Bea sure to state all of your units (always!), and the relevant time frame of operation.

N <- 1
time_arrival <- 5 / 4
time_service <- 1

\[\lambda = \frac{N}{T_a}=\frac{1}{{5}/{4}}=\frac{4}{5}, \quad\quad \mu = \frac{N}{T_s} = \frac{1}{1} = 1, \quad\quad \rho = \frac{\lambda}{\mu} = \frac{{4}/{5}}{1} = \frac{4}{5}\]

lambda <- 4 / 5 # Mean rate of arrival.
mu <- 1 / 1 # Mean service rate.
rho <- 4 / 5 # Utilization of the server.

\[L_q = \frac{\rho^2}{1 - \rho} = \frac { { \left( { 4 }/{ 5 } \right) }^{ 2 } }{ 1-{ 4 }/{ 5 } } = \frac{16}{5}=3.2, \quad\quad L = \frac{\lambda}{\mu - \lambda} = \frac{{4}/{5}}{1 - {4}/{5}} = 4\]

(L_q <- rho^2 / (1 - rho)) # Mean number of customers in the queue.
## [1] 3.2
(L <- lambda / (mu - lambda)) # Mean number of customers in the system.
## [1] 4

\[W_q = \frac{\rho}{\mu\left(1 - \rho\right)} = \frac{{4}/{5}}{1\left(1 - {4}/{5}\right)} = 4, \quad\quad W = \frac{1}{\mu\left(1 - \rho\right)} = \frac{1}{1\left(1 - {4}/{5}\right)} = 5\]

cat(W_q <- rho / (mu * (1 - rho)), "minutes =", W_q / 60, 'hours') # Mean wait in the queue.
## 4 minutes = 0.06666667 hours
cat(W <- 1 / (mu * (1 - rho)), "minutes =", W / 60, 'hours') # Mean wait in the system.
## 5 minutes = 0.08333333 hours

Simio Simulation

In the below Simio output, the first statistic is mean number of customers in the queue \(L_q\), the second is the mean wait in the queue \(W_q\) in hours, and the third is the utilization of the server \(\rho\). The mean number of customers in the system, \(L\) is the sum of the fourth and sixth statistics multiplied by the utilization rate \(\rho\). The mean wait in the system in hours, \(W\) is the sum of the fifth and seventh statistics multiplied by the utilization rate \(\rho\).

Assignment Problems

Complete problems 2, 3, 5, and 12 from Section 2.6 in Kelton.

Problem 2.6.2

Repeat Problem 1, except assume that the service times are not exponentially distributed, but rather (continuously) uniformly distributed between \(a=0.1\) and \(b=1.9\)… Compare all five of your numerical results to those in Problem 1 and explain intuitively with respect to this change in the service-time distribution (but with its expected value remaining at 1).

\[\mu = \frac{a+b}{2} = \frac{0.1+1.9}{2} = 1, \quad\quad \sigma^2 = \frac{\left(b-a\right)^2}{12} = \frac{\left(1.9-0.1\right)^2}{12} = \frac{\left(1.8\right)^2}{12} = \frac{27}{100}\]

a <- 0.1
b <- 1.9
mu <- (a + b) / 2
sigma <- sqrt((b - a)^2 / 12)

\[L_q = \frac{\lambda^2\sigma^2+\rho^2}{2\left(1 - \rho\right)} = \frac{\rho^2\left(1 + \lambda^2\sigma^2\right)}{2\left(1 - \rho\right)} = \frac{\left({8}/{10}\right)^2\left[1 + \left({27}/{100}\right)^21^2\right]}{2\left(1 - {8}/{10}\right)} = \frac{254}{125}\]

(L_q <- rho^2 * (1 + sigma^2 * mu^2) / (2 * (1 - rho)))
## [1] 2.032

Given the same value for \(\mu\), going from an \(M/M/1\) to an \(M/G/1\) only changes the value of \(L_q\) due to the fact that \(L_q\) must be take \(\sigma^2\) into account.

Problem 2.6.3

Repeat Problem 1, except assume that the service times are triangularly distributed between \(a=0.1\) and \(b=1.9\), and with the mode at \(m=1.0\)… Compare all five of your results to those from Problem 1 and 2.

\[\mu = \frac{a+m+b}{3} = \frac{0.1+1+1.9}{2} = 1, \quad\quad \sigma^2 = \frac{a^2+m^2+b^2 -am-ab-bm}{18} = \frac{{243}/{100}}{18} = \frac{27}{200}\]

m <- 1
mu <- (a + m + b) / 3
sigma <- sqrt((a^2 + m^2 + b^2 - a * m - a * b - b * m) / 18)

\[L_q = \frac{\lambda^2\sigma^2+\rho^2}{2\left(1 - \rho\right)} = \frac{\rho^2\left(1 + \lambda^2\sigma^2\right)}{2\left(1 - \rho\right)} = \frac{\left({8}/{10}\right)^2\left[1 + \left({27}/{200}\right)^21^2\right]}{2\left(1 - {8}/{10}\right)} = \frac{227}{125}\]

(L_q <- rho^2 * (1 + sigma^2 * mu^2) / (2 * (1 - rho)))
## [1] 1.816

Again, given the same value for \(\mu\), going from an \(M/M/1\) to an \(M/G/1\) only changes the value of \(L_q\) due to the fact that \(L_q\) must be take \(\sigma^2\) into account.

Problem 2.6.5

Repeat Problem 1, except for an \(M/M/3\) queue with mean interarrival time 1.25 minutes and mean service time 3 minutes at each of the three servers. Consider using creating a computer program, or spreadsheet, or use mmc.exe.

library('queueing')
i_mmc <- NewInput.MMC(lambda=1/1.25, mu=1/3, c=3) # create input parameters
o_mmc <- QueueingModel(i_mmc) # Build the model
mmc_summ <- summary(o_mmc)
t(mmc_summ$el[c(1, 2, 3, 10, 7, 11, 8, 12, 9)])
##              [,1]
## lambda 0.80000000
## mu     0.33333333
## c      3.00000000
## X      0.80000000
## P0     0.05617978
## L      4.98876404
## Lq     2.58876404
## W      6.23595506
## Wq     3.23595506

The command-line program from the Simio website (username and password in Preface of book) provides a C++ executable file that calculates various \(M/M/c\) metrics. It is called using the command prompt, navigating to the directory of the mmc.exe file, and typing mmc followed by the values of \(\lambda\), \(\mu\), and \(c\) separated by space(s).

$ cd C:\Users\josez\Google Drive\Education\Masters\SPS\DATA 604\Simio_Student_Resources

$ mmc 0.8 0.333333 3

Problem 2.6.12

In the urgent care clinic of Figure 2.1 [below], suppose that the patients arrive from outside into the clinic (coming from the upper right corner of the figure and always into the Sign In station) with interarrival times that are exponential distributed with mean 6 minutes. The number of individual servers at each station and the branching probabilities are all as shown in Figure 2.1. The service times at each node are exponentially distributed with means (all in minutes) of 3 for Sign In, 5 for Registration, 90 for Trauma Rooms, 16 for Exam Rooms, and 15 for Treatment Rooms. For each of the five stations, compute the “local” traffic intensity \(\rho_\textrm{Station}\) there. Will the clinic “work,” i.e., be able to handle the external patient load? Why or why not? If you could add a single server to the system, and add it to any of the five stations, where would you add it? Why?

The above is a Jackson Network since: 1) Interarrival times are independently and exponentially distributed, 2) Service times are independently and exponentially distributed, 3) The exists probabilistic routing, 4) there is infinite queue capacity, and 5) utilization, \(\rho\), is strictly less than one for all servers.

\[\lambda_\textrm{Sign} = \frac{N}{T_a}= \frac{1}{6}, \quad\quad \mu_\textrm{Sign} = \frac{N}{T_s} = \frac{1}{3}, \quad\quad \rho_\textrm{Sign} = \frac{\lambda}{c\mu} = \frac{1/6}{2\cdot\left(1/3\right)} = \frac{1}{4}\]

signin <- t(summary(QueueingModel(NewInput.MMC(lambda=1/6, mu=1/3, c=2)))$el)

\[\lambda_\textrm{Reg}=0.9\lambda_\textrm{SignIn} = 0.9\left(\frac{1}{6}\right) = \frac{3}{20}, \quad\quad \mu_\textrm{Reg} = \frac{N}{T_s} = \frac{1}{5}, \quad\quad \rho_\textrm{Reg} = \frac{\lambda}{c\mu} = \frac{3/20}{1\cdot\left(1/5\right)} = \frac{3}{4}\]

register <- t(summary(QueueingModel(NewInput.MMC(lambda=3/20, mu=1/5, c=1)))$el)

\[\lambda_\textrm{Trauma}=0.1\lambda_\textrm{SignIn} = 0.1\left(\frac{1}{6}\right) = \frac{1}{60}, \quad\quad \mu_\textrm{Trauma} = \frac{N}{T_s} = \frac{1}{90}, \quad\quad \rho_\textrm{Trauma} = \frac{\lambda}{c\mu} = \frac{1/60}{2\cdot\left(1/90\right)} = \frac{3}{4}\]

trauma <- t(summary(QueueingModel(NewInput.MMC(lambda=1/60, mu=1/90, c=2)))$el)

\[\lambda_\textrm{Exam}=\lambda_\textrm{Reg} = \frac{3}{20}, \quad\quad \mu_\textrm{Exam} = \frac{N}{T_s} = \frac{1}{16}, \quad\quad \rho_\textrm{Exam} = \frac{\lambda}{c\mu} = \frac{3/20}{3\cdot\left(1/16\right)} = \frac{4}{5}\]

exam <- t(summary(QueueingModel(NewInput.MMC(lambda=3/20, mu=1/16, c=3)))$el)

\[\lambda_\textrm{Treat}= \lambda_\textrm{Trauma} + 0.6 \lambda_\textrm{Exam} = \frac{1}{60} + 0.6 \left(\frac{3}{20}\right) = \frac{8}{75}, \quad\quad \mu_\textrm{Treat} = \frac{N}{T_s} = \frac{1}{15}, \quad\quad \rho_\textrm{Treat} = \frac{\lambda}{c\mu} = \frac{8/75}{2\cdot\left(1/15\right)} = \frac{3}{4}\]

treat <- t(summary(QueueingModel(NewInput.MMC(lambda=8/75, mu=1/15, c=2)))$el)
(results <- data.frame(signin, register, trauma, exam, treat)[c(1, 2, 3, 10, 7, 11, 8, 12, 9),])
##            signin register       trauma        exam       treat
## lambda 0.16666667     0.15   0.01666667  0.15000000  0.10666667
## mu     0.33333333     0.20   0.01111111  0.06250000  0.06666667
## c      2.00000000     1.00   2.00000000  3.00000000  2.00000000
## X      0.16666667     0.15   0.01666667  0.15000000  0.10666667
## P0     0.60000000     0.25   0.14285714  0.05617978  0.11111111
## L      0.53333333     3.00   3.42857143  4.98876404  4.44444444
## Lq     0.03333333     2.25   1.92857143  2.58876404  2.84444444
## W      3.20000000    20.00 205.71428571 33.25842697 41.66666667
## Wq     0.20000000    15.00 115.71428571 17.25842697 26.66666667
rowSums(results)[c(6, 8)]
##         L         W 
##  16.39511 303.83938

The system will be able to handle the external patient load since \(\sum { W } > 0\). Given the ability to add a single server to any of the five stations in the system, the server would be added to the Trauma Rooms station to alleviate the bottleneck created by its currently long service time.