For an M/M/1 queue with mean interarrival time 1.25 minutes and mean service time 1 minute, find all five of Wq, W, Lq, L, and p. For each, interpret in words. Be sure to state all your units (always!), and the relevant time frame of operation.
#First assign given values to:
lambda <- 1/1.25 #arrival rate (reciprocal of interarrival time)
mu <- 1/1 #expected value of service time
Es <- 1
#First we find rho, the utilization of the servers, which is the arrival rate divided by the server service time:
rho <- lambda/mu
#Using M/M/1 book formula for L:
L = lambda/((1/Es)-lambda)
#Now with L (avg number of entities in system) and Lambda (arrival rate), we can find W (average time in system)
W <- L/lambda
#Now that we have W, the average time in system, we can subtract service time to get average time in queue:
Wq <- W - Es
#Which allows us to find the average number of entities in just the queue:
Lq <- lambda * Wq
sprintf("rho is %f", rho)
## [1] "rho is 0.800000"
sprintf("lambda is %f", lambda)
## [1] "lambda is 0.800000"
sprintf("L is %f", L)
## [1] "L is 4.000000"
sprintf("Lq is %f", Lq)
## [1] "Lq is 3.200000"
sprintf("W is %f", W)
## [1] "W is 5.000000"
sprintf("Wq is %f", Wq)
## [1] "Wq is 4.000000"