Basics of Queueing Theory


1.

Arrival Rate \(\lambda\)=\((1/1.25)=0.8\)

Service Rate \(\mu\)=1

Find Wq,W,Lq,L and \(\rho\)

  • As per formula given on page-28 \(\rho\) =λ /(c μ)=0.8

  • As per formula given on page-29 => L = \(\rho\) / (1-\(\rho\) ) = 0.8/(1-0.8)=4

  • As per Little’s law => L = \(\lambda\)W => W = L / \(\lambda\) =>4/0.8=5

  • Now on page 28 \(\mu\)=1/E(s) =>E(s) =>1/\(\mu\) =1/1=1. W=Wq+E(s)=>Wq=W-E(s)= 5 - 1 = 4

  • \(L_q=\lambda\;W_q\)=> 0.8 * 4 = 3.2

Putting all above in fuction

require(queueing)
## Loading required package: queueing
MM1<-function(Arrival_Rate,Service_Rate,servers)
{
  
  lambda <- 1/Arrival_Rate 
  mu <- 1/Service_Rate
  
  p <- lambda / (mu*servers)
  L <- p/(1-p)
  W <- L/lambda
  
  es <- 1/mu
  
 
  Wq <- W-es
  Lq <- lambda*Wq
  df<-data.frame(p,L,W,Wq,Lq)
  return (df)
}
MM1(1.25,1,1)
##     p L W Wq  Lq
## 1 0.8 4 5  4 3.2

2

Counting same values with service time are (continuously) uniformly distributrd between a=0.1 and b=1.9 Other formulas same as from Little’s law only the way we find Wq will change. Now we will use Pollaczek-Khinchine formula.

MG1_continuous<-function(Arrival_Rate,Service_Rate,servers)
{
  standard_Deviation<-sqrt(((Service_Rate[2]-Service_Rate[1])^2)/12)
  lambda <- 1/Arrival_Rate 
  es <- (Service_Rate[1]+Service_Rate[2])/2
  mu <- 1/es 
  p <- lambda / (mu*servers)
  # As per formula on page -30
  Wq <- (lambda*((standard_Deviation^2)+(1/(mu^2))))/(2*(1-(lambda/mu)))
  W <- Wq+es
  L <- lambda*W
  Lq <- lambda*Wq
  df<-data.frame(p,L,W,Wq,Lq)
  return (df)
}

MG1_continuous(1.25,c(0.1,1.9),1)
##     p     L    W   Wq    Lq
## 1 0.8 2.832 3.54 2.54 2.032

Steady state average time in queue (Wq) and steady state average number of entities in queue(Lq) is decreased which is expected because decreased wait time at server.

3 ( Triangularly distributed service time)

MG1_tri<-function(Arrival_Rate,Service_Rate,servers){
  es <- (Service_Rate[1]+Service_Rate[3]+Service_Rate[2])/3
  standard_Deviation<-sqrt(((Service_Rate[1]^2)+(Service_Rate[2]^2)+(Service_Rate[3]^2)-(Service_Rate[1]*Service_Rate[3])-(Service_Rate[1]*Service_Rate[2])-(Service_Rate[2]*Service_Rate[3]))/18)
  lambda <- 1/Arrival_Rate 
  mu <- 1/es 
  p <- lambda / (mu*servers)
  # As per Pollaczek-Khinchine formula on page -30 
  Wq <- (lambda*((standard_Deviation^2)+(1/(mu^2))))/(2*(1-(lambda/mu)))
  W <- Wq+es
  L <- lambda*W
  Lq <- lambda*Wq
  df<-data.frame(p,L,W,Wq,Lq)
  return (df)
}

MG1_tri(1.25,c(0.1,1.9,1),1)
##     p     L    W   Wq    Lq
## 1 0.8 2.616 3.27 2.27 1.816

As we can see value of all variables decreased which would be considered as improvement.

5 (M/M/3)

summary(QueueingModel(NewInput.MMC(lambda=(1/1.25), mu=(1/3), c=3)))
## The inputs of the model M/M/c are:
## lambda: 0.8, mu: 0.333333333333333, c: 3, n: 0, method: Exact
## 
## The outputs of the model M/M/c are:
## 
## The probability (p0, p1, ..., pn) of the n = 0 clients in the system are:
## 0.05617978
## The traffic intensity is: 2.4
## The server use is: 0.8
## The mean number of clients in the system is: 4.98876404494382
## The mean number of clients in the queue is: 2.58876404494382
## The mean number of clients in the server is: 2.4
## The mean time spend in the system is: 6.23595505617978
## The mean time spend in the queue is: 3.23595505617978
## The mean time spend in the server is: 3
## The mean time spend in the queue when there is queue is: 5
## The throughput is: 0.8

12 ( Find local traffic intensity for all five stations. Interarrival time is 6 minutes)

Sign In :: 3 minutes

summary(QueueingModel(NewInput.MMC(lambda=1/6, mu=1/3, c=2)))
## The inputs of the model M/M/c are:
## lambda: 0.166666666666667, mu: 0.333333333333333, c: 2, n: 0, method: Exact
## 
## The outputs of the model M/M/c are:
## 
## The probability (p0, p1, ..., pn) of the n = 0 clients in the system are:
## 0.6
## The traffic intensity is: 0.5
## The server use is: 0.25
## The mean number of clients in the system is: 0.533333333333333
## The mean number of clients in the queue is: 0.0333333333333333
## The mean number of clients in the server is: 0.5
## The mean time spend in the system is: 3.2
## The mean time spend in the queue is: 0.2
## The mean time spend in the server is: 3
## The mean time spend in the queue when there is queue is: 2
## The throughput is: 0.166666666666667

Registration :: 5 minutes

summary(QueueingModel(NewInput.MM1(lambda=(1/6)*0.9, mu=1/5)))
## The inputs of the M/M/1 model are:
## lambda: 0.15, mu: 0.2, n: 0
## 
## The outputs of the M/M/1 model are:
## 
## The probability (p0, p1, ..., pn) of the n = 0 clients in the system are:
## 0.25
## The traffic intensity is: 0.75
## The server use is: 0.75
## The mean number of clients in the system is: 3
## The mean number of clients in the queue is: 2.25
## The mean number of clients in the server is: 0.75
## The mean time spend in the system is: 20
## The mean time spend in the queue is: 15
## The mean time spend in the server is: 5
## The mean time spend in the queue when there is queue is: 20
## The throughput is: 0.15

Trauma Rooms :: 90 minutes :: 2 servers

summary(QueueingModel(NewInput.MMC(lambda=(1/6*0.1), mu=1/90, c=2)))
## The inputs of the model M/M/c are:
## lambda: 0.0166666666666667, mu: 0.0111111111111111, c: 2, n: 0, method: Exact
## 
## The outputs of the model M/M/c are:
## 
## The probability (p0, p1, ..., pn) of the n = 0 clients in the system are:
## 0.1428571
## The traffic intensity is: 1.5
## The server use is: 0.75
## The mean number of clients in the system is: 3.42857142857143
## The mean number of clients in the queue is: 1.92857142857143
## The mean number of clients in the server is: 1.5
## The mean time spend in the system is: 205.714285714286
## The mean time spend in the queue is: 115.714285714286
## The mean time spend in the server is: 90
## The mean time spend in the queue when there is queue is: 180
## The throughput is: 0.0166666666666667

Exam Rooms :: 16 minutes ::3 servers

summary(QueueingModel( NewInput.MMC(lambda=(1/6*0.9), mu=1/16, c=3)))
## The inputs of the model M/M/c are:
## lambda: 0.15, mu: 0.0625, c: 3, n: 0, method: Exact
## 
## The outputs of the model M/M/c are:
## 
## The probability (p0, p1, ..., pn) of the n = 0 clients in the system are:
## 0.05617978
## The traffic intensity is: 2.4
## The server use is: 0.8
## The mean number of clients in the system is: 4.98876404494382
## The mean number of clients in the queue is: 2.58876404494382
## The mean number of clients in the server is: 2.4
## The mean time spend in the system is: 33.2584269662921
## The mean time spend in the queue is: 17.2584269662921
## The mean time spend in the server is: 16
## The mean time spend in the queue when there is queue is: 26.6666666666667
## The throughput is: 0.15

Treatment Rooms M/M/2 - 15 minutes :: 2 servers

summary(QueueingModel(NewInput.MMC(lambda=(1/6)*((0.9*0.6)+0.1), mu=1/15, c=2)))
## The inputs of the model M/M/c are:
## lambda: 0.106666666666667, mu: 0.0666666666666667, c: 2, n: 0, method: Exact
## 
## The outputs of the model M/M/c are:
## 
## The probability (p0, p1, ..., pn) of the n = 0 clients in the system are:
## 0.1111111
## The traffic intensity is: 1.6
## The server use is: 0.8
## The mean number of clients in the system is: 4.44444444444444
## The mean number of clients in the queue is: 2.84444444444444
## The mean number of clients in the server is: 1.6
## The mean time spend in the system is: 41.6666666666667
## The mean time spend in the queue is: 26.6666666666667
## The mean time spend in the server is: 15
## The mean time spend in the queue when there is queue is: 37.5
## The throughput is: 0.106666666666667

If we can add one more server then I think we should add at “Exam Room” because it has highest traffic intensity.