DATA604_Home_Work_2

Dilip Ganesan

M/M/1 Problem

  1. For an M/M/1 queue with mean interarrival time of 1.25 minutes and mean service team 1 minute, find all five of Wq, W, Lq, L and p. For each, interpret in words. Be sure to state all your units, and the relevant time frame of operation.
# Step 1 : Calculate p

# Formula for p=lambda/c*sigma

# lambda=arrival rate(reciprocal of interarrival time)
lambda=1/1.25

# sigma=the service rate
sigma=1/1

# Since the value of c=1 excluding in the formula.
p=lambda/sigma

# Using Little's Law we can calculate rest of values.

# L=p/(1-p)

L=p/(1-p)

# W = L/lambda

W= L/lambda

# W = Wq + E(s)

Es = 1/sigma

# W = Wq + Es

Wq = W - Es

# Lq = lambda * Wq

Lq = lambda * Wq

# Final Result.
df= data.frame(Wq , Lq, W, p, L)
df
##   Wq  Lq W   p L
## 1  4 3.2 5 0.8 4

2.6.2 M/G/1

  1. For this Problem, we will use M/G/1 queue because service times are not exponential but rather normaly distributed. Average Service Time is Uniform Dist between a=0.1 and b=1.9(0<a<b)
# Formula for p=lambda/c*sigma

a=0.1
b=1.9

# lambda=arrival rate(reciprocal of interarrival time)
lambda=1/1.25
sigma=1/1 # Same as in question 1.

# standard Deviation=using the value from the question is
sd=sqrt((b-a)^2/12)

rho= lambda/sigma



Wq = (lambda*((sd)^2 + 1/(sigma)^2))/2*(1-rho)

L = rho/(1-rho)

Lq = lambda * Wq

W= L/lambda

# Final Result.
df2= data.frame(Wq , Lq, W, rho, L)
df
##   Wq  Lq W   p L
## 1  4 3.2 5 0.8 4
df2
##       Wq      Lq W rho L
## 1 0.1016 0.08128 5 0.8 4
compare(df,df2)
## FALSE [FALSE, FALSE, TRUE, TRUE, TRUE]
# By Comparing with the first problem, we can see that Steady State Average time in queue and Number of Entitie in queue decerease with the service time being uniformly distributed compared to exponential distributed.

2.6.3 M/G/1

3.For this Problem, we will again use M/G/1 queue because service times are not exponential but rather triangulary distributed. Average Service Time is triangular Distributed.

a=0.1
b=1.9
c=1 # mode

sd=sqrt((a^2 + b^2 + c^2 - a*c - a*b - b*c)/18)

lambda=1/1.25
sigma=(a+b+c)/3

rho= lambda/sigma

Wq = (lambda*((sd)^2 + 1/(sigma)^2))/2*(1-rho)

L = rho/(1-rho)

Lq = lambda * Wq

W= L/lambda

# Final Result.
df3= data.frame(Wq , Lq, W, rho, L)

df
##   Wq  Lq W   p L
## 1  4 3.2 5 0.8 4
df3
##       Wq      Lq W rho L
## 1 0.0908 0.07264 5 0.8 4
compare(df,df3)
## FALSE [FALSE, FALSE, TRUE, TRUE, TRUE]
# Compared with first the value of Steady State Average time in queue and Number of Entitie in queue decerease with the service time being triangulaly distributed compared to exponential distributed.
# This is best reduction in time compared to all three questions.

2.6.5 M/M/3

  1. Trying to use the library queueing to achieve the result of Wq and Lq
lambda=1/1.25
sigma=1/3
c=3

rho= lambda/(c * sigma)

mm3 = NewInput.MMC(lambda,sigma,c=3,n=0,method = 0)
mm3queue = QueueingModel(mm3)

Lq = Lq(mm3queue)
Wq = Wq(mm3queue)

W = Wq + 1/sigma
L = Lq + lambda/sigma

df5= data.frame(Wq , Lq, W, rho, L)
df5
##         Wq       Lq        W rho        L
## 1 3.235955 2.588764 6.235955 0.8 4.988764

2.6.12

# sigma=the service rate
musign = 1/3
mureg = 1/5
mutrauma = 1/90
muexam = 1/16
mutreat = 1/15


# First the Arrival Rate at Sign Desk = 6 min
lamsign = 1/6
lamreg = 0.9 * lamsign
lamtrauma = 0.1 * lamsign
lamtreat = 0.64 * lamsign
lamexam = 0.9 * lamsign

# # of servers at each desk
cregist = 1
csign = 2
cexam = 3
ctreat = 2
ctraum = 2

# Now to calculate the value of rho = lambda/ c * sigma

rhosign = lamsign/ (csign * musign)
rhoreg = lamreg/ (cregist * mureg)
rhotrauma = lamtrauma / (ctraum * mutrauma)
rhoexam = lamexam/ (cexam * muexam)
rhotreat  = lamtreat/ (ctreat * mutreat)

# From this we can see that two place wherein the utilization of server is little high compared to other stations are in Examination Room and Treatment Room. 

# It would be better to add one more server to the Examination Room, because 90% of the load goes through the examination room. 
# Compared with Trauma which takes in only 60% of the load. And adding server at Trauma could not be cost effective because of complexity involved.