Discussion Problem

In Banks DES textbook, pick problem 5, 8, or 11 and post your solution. Try to use different methods than others. What were the challenges associated with generating the variate?

Indicator Function

\[{ 1 }_{ A }\left( x \right) :=\begin{cases} 1 & x\in A \\ 0 & x\notin A \end{cases}\]

Problem 8.5

Given the following cdf for a continuous variable with range from -3 to 4, develop a generator for the variable. \[F\left( x \right) =0\cdot { 1 }_{ \left( x\leq -3 \right) }+\left( \frac { 1 }{ 2 } +\frac { x }{ 6 } \right) \cdot { 1 }_{ \left( -3<x\leq 0 \right) }+\left( \frac { 1 }{ 2 } +\frac { x^{ 2 } }{ 32 } \right) \cdot { 1 }_{ \left( 0<x\leq 4 \right) }+1\cdot { 1 }_{ \left( x>4 \right) }\]

rng_0805 <- function(n) {
  x <- runif(n, -3, 4)
  y <- numeric(n)
  for (i in 1:n) {
    y[i] <- if (x[i] > -3 & x[i] <= 0) { 
        1 / 2 + x[i] / 6
      } else if (x[i] > 0 & x[i] <= 4) {
        1 / 2 + x[i]^2 / 32
      } else {
        0
      }
  }
  return(y)
}
rng_0805(1)
## [1] 0.006165305
rng_0805(10)
##  [1] 0.55041229 0.50992203 0.15193069 0.97696410 0.13107463 0.68570909
##  [7] 0.70592077 0.86770572 0.08205781 0.52916803

Problem 8.8

The pdf of a random variable is [below]. Develop the random-variate generator. \[f\left( x \right) =\left( \frac { 1 }{ 5 } \right) \cdot { 1 }_{ \left( 0<x\leq 3 \right) }+\left( \frac { 1 }{ 8 } \right) \cdot { 1 }_{ \left( 3<x\leq 9 \right) }+0\cdot { 1 }_{ \left( x<0,x>1 \right) }\]

rng_0808 <- function(n) {
  x <- runif(n, 0, 9)
  y <- numeric(n)
  for (i in 1:n) {
    y[i] <- if (x[i] > 0 & x[i] <= 3) { 
        1 / 5
      } else if (x[i] > 3 & x[i] <= 9) {
        1 / 8
      } else {
        0
      }
  }
  return(y)
}
rng_0808(1)
## [1] 0.125
rng_0808(10)
##  [1] 0.125 0.200 0.200 0.125 0.125 0.125 0.200 0.125 0.125 0.125

Problem 8.11

The details of time taken by a mechanic to repair a breakdown are [below]. Develop a lookup table and generate five repair times using random numbers.

Repair Time Range (Hours) Frequency Probability
1 - 2 15 0.134
2 - 3 12 0.107
3 - 4 14 0.125
4 - 5 25 0.223
5 - 6 32 0.286
6 - 7 14 0.125

\[f\left( x \right) =\left( \frac { 1 }{ 112 } \right) \left[ 15\cdot { 1 }_{ \left( 1<x\leq 2 \right) }+12\cdot { 1 }_{ \left( 2<x\leq 3 \right) }+14\cdot { 1 }_{ \left( 3<x\leq 4 \right) }+25\cdot { 1 }_{ \left( 4<x\leq 5 \right) }+32\cdot { 1 }_{ \left( 5<x\leq 6 \right) }+14\cdot { 1 }_{ \left( 6<x\leq 7 \right) }+0\cdot { 1 }_{ \left( x<0,x>7 \right) } \right]\]

rng_0811 <- function(n) {
  x <- runif(n, 1, 7)
  y <- numeric(n)
  for (i in 1:n) {
    y[i] <- if (x[i] > 1 & x[i] <= 2) { 
        15
      } else if (x[i] > 2 & x[i] <= 3) {
        12
      } else if (x[i] > 3 & x[i] <= 4) {
        14
      } else if (x[i] > 4 & x[i] <= 5) {
        25
      } else if (x[i] > 5 & x[i] <= 6) {
        32
      } else if (x[i] > 6 & x[i] <= 7) {
        14
      } else {
        0
      }
  }
  return(y / 112)
}
rng_0811(1)
## [1] 0.1071429
rng_0811(10)
##  [1] 0.1339286 0.1250000 0.1250000 0.2232143 0.1071429 0.2232143 0.1250000
##  [8] 0.2857143 0.2857143 0.2857143

Assignment Problems

Kelton problems 1, 2, 3, 4, 5

Problem 5.7.1

What is the difference between an object property and an object state?

Properties are defined within an object to collect information from the user to customize the object’s behavior. Properties of a model object are the input parameters associated with that object. They are added to a model from the Properties panel of the Definitions window. States are defined within an object to hold the value of something that might change while the model is running. An Object Reference state variable defines an object reference variable that may be changed by assignment logic at discrete times during a model run. You can assign a value to an element reference state using an Assign step in a process. The expression used as the value for the assignment must return an object reference (Simio Reference Guide).

Problem 5.7.2

Consider the process associated with a Server object. What is the difference between a token’s parent object and its associated object?

The Parent Object is the object where the process was created and resides. An easy way to figure out what object is the Parent Object is to think about what Object would need to be selected in order for you to see the process. Therefore, for all Add-On Processes, the Parent Object is most commonly the main Model, since the Add On Processes are created within the main Model and they can be viewed and edited in the main Model’s Processes window. The Associated Object is the object that triggered a specific process to be executed. For a Server object, the Associated Object is the Entity because it triggers the process when it transfers into the Processing Station of the Server (Simio Reference Guide).

Problem 5.7.3

Develop a queuing model that gives the steady-state values analogues to the values in Table 5.2 (Model 5-1 with exponential processing times at both stations).

\[\lambda =\frac { N }{ T_{ a } } =\frac { 1 }{ 1/10 } =10;\quad \mu =\frac { N }{ T_{ s } } =\left\{ \frac { 1 }{ 1/15 } ,\frac { 1 }{ 1/20 } \right\} =\left\{ 15,20 \right\} ;\quad \rho =\frac { \lambda }{ c\mu } =\left\{ \frac { 10 }{ 1\cdot 15 } ,\frac { 10 }{ 1\cdot 20 } \right\} =\left\{ \frac { 2 }{ 3 } ,\frac { 1 }{ 2 } \right\} \] \[L = \sum\frac{\lambda}{\mu_i - \lambda} = 3; \quad W = \sum\frac{1}{\mu_i\left(1 - \rho_i\right)} = \frac{3}{10}; \quad L_{ q }=\frac { \rho ^{ 2 } }{ 1-\rho } =\left\{ \frac { 4 }{ 3 } ,\frac { 1 }{ 2 } \right\} ;\quad W_{ q }=\frac { \rho }{ \mu \left( 1-\rho \right) } =\left\{ \frac { 2 }{ 15 } ,\frac { 1 }{ 20 } \right\} \]

T_a <- 1 / 10
T_s <- c(1 / 15, 1 / 20)
lambda <- 1 / T_a
mu <- 1 / T_s
c <- 1
rho = lambda / (c * mu)
L_q <- rho^2 / (1 - rho)
L <- sum(lambda / (mu - lambda))
W <- sum(1 / (mu * (1 - rho)))
W_q <- rho / (mu * (1 - rho))
good <- 0.92
bad <- 1 - good
data.frame(rho, L_q, W_q)
##         rho      L_q       W_q
## 1 0.6666667 1.333333 0.1333333
## 2 0.5000000 0.500000 0.0500000
data.frame(L, W, good, bad)
##   L   W good  bad
## 1 3 0.3 0.92 0.08

Problem 5.7.4

Consider and office where people come to get their driver’s licenses. The process involves three steps for arriving customers - reception / application; a vision exam; and a written exam. Assume that customer arrivals are Poisson with a rate of 6 per hour (i.e., interarrival times are exponentially distributed with mean 10 minutes). The processing time distributions for the three processes are in [the table below]. The office has one person responsible for the reception / application and one person responsible for administering vision exams. The written exam is computer-based and there are three computer stations where customers can take the exam. Develop a Simio Model for the system. Assume that the office opens at 9:00 a.m. and closed at 5:00 p.m. The performance metrics of interest include the time that customers spend in the system, the utilizations of the office employees and the computer stations, and the average and maximum numbers of customers in the reception / application queue, the vision queue, and the written exam queue. How many replications should be run in order to be confident about your results? Justify your answer.

Process Processing time distribution
Reception/application triangular(5, 8, 11)
Vision Exam triangular(2, 4, 6)
Written Exam triangular(15, 15, 20)

One Source with Interarrival Time of Random.Exponential( 10 ) in Hours. One Server with Processing Time of Random.Triangular( 5, 8, 11 ) in Hours and Capacity of 1. One Server with Processing Time of Random.Triangular( 2, 4, 6 ) in Hours and Capacity of 1. One Server with Processing Time of Random.Triangular( 15, 15, 20 ) in Hours and Capacity of 3. A Work Schedule with 9:00 AM Start Time and 5:00 PM End Time. Experiment conducted with 100 Replications of 30 day runs with 15 day warm-up period. Add Response with the below expressions. The number of replications chosen was sufficiently large to produce steady-state results.

  • ModelEntity1.Population.TimeInSystem.Average
  • ReceptionApplication.Capacity.Utilized.Average
  • ReceptionApplication.InputBuffer.Contents.MinimumNumberWaiting
  • ReceptionApplication.InputBuffer.Contents.AverageNumberWaiting
  • VisionExam.Capacity.Utilized.Average
  • VisionExam.InputBuffer.Contents.MinimumNumberWaiting
  • VisionExam.InputBuffer.Contents.AverageNumberWaiting
  • WrittenExam.Capacity.Utilized.Average
  • WrittenExam.InputBuffer.Contents.MinimumNumberWaiting
  • WrittenExam.InputBuffer.Contents.AverageNumberWaiting
Simulation Model Work Schedule Experiment Results

Problem 5.7.5

Animate the model from Problem 4. If you did not already do so, specify a reasonable office layout and use Path object to incorporate customer movement through the office. Make sure that the distances between stations are reasonable for a driver’s license office and that the entity speed is appropriate for humans walking.

3D Animation

References

http://s1.daumcdn.net/editor/fp/service_nc/pencil/Pencil_chromestore.html

Simio and Simulation: Modeling, Analysis, Applications 3d Ed. by W. David Kelton, Jeffrey S. Smith and David T. Sturrock with Simio software.

Discrete-Event Systems Simulation, 5th Edition (2010), by Jerry Banks, John S. Carlson, Barry L. Nelson,and David M. Nicol.