om-08a - NYU Stern School of Business

advertisement
Queueing Theory
Overview
•Basic definitions and metrics
•Examples of some theoretical
models
Operations -- Prof. Juran
2
Basic Queueing Theory
A set of mathematical tools for the analysis of probabilistic
systems of customers and servers.
Can be traced to the work of A. K. Erlang, a Danish mathematician
who studied telephone traffic congestion in the first decade of the
20th century.
Applications:
Service Operations
Manufacturing
Systems Analysis
Operations -- Prof. Juran
3
Agner Krarup Erlang
(1878 - 1929)
Operations -- Prof. Juran
4
Components of a Queuing System
Service Process
Queue or
Waiting Line
Arrival Process
Servers
Exit
Customer Population Sources
Population Source
Finite
Infinite
Example: Number of
machines needing
repair when a company
only has three
machines.
Example: The
number of people
who could wait in a
line for gasoline.
Service Pattern
Service Pattern
Constant
Example: Items
coming down an
automated assembly
line.
Variable
Example: People
spending time
shopping.
Examples of Queue Structures
Single
Phase
Multiphase
Single Channel
One-person
barber shop
Car wash
Multichannel
Bank tellers’
windows
Hospital
admissions
Balking and Reneging
No Way!
Balking: Arriving, but
not joining the queue
No Way!
Reneging: Joining the queue,
then leaving
Suggestions for Managing Queues
1. Determine an acceptable waiting time for
your customers
2. Try to divert your customer’s attention when
waiting
3. Inform your customers of what to expect
4. Keep employees not serving the customers
out of sight
5. Segment customers
Suggestions for Managing Queues
6. Train your servers to be friendly
7. Encourage customers to come during
the slack periods
8. Take a long-term perspective toward
getting rid of the queues
Source: Katz, Larson, Larson (1991)
Arrival Rate refers to the average number of customers who require
service within a specific period of time.
A Capacitated Queue is limited as to the number of customers who
are allowed to wait in line.
Customers can be people, work-in-process inventory, raw materials,
incoming digital messages, or any other entities that can be modeled
as lining up to wait for some process to take place.
A Queue is a set of customers waiting for service.
Operations -- Prof. Juran
12
Queue Discipline refers to the priority system by which the next
customer to receive service is selected from a set of waiting customers.
One common queue discipline is first-in-first-out, or FIFO.
A Server can be a human worker, a machine, or any other entity that
can be modeled as executing some process for waiting customers.
Service Rate (or Service Capacity) refers to the overall average
number of customers a system can handle in a given time period.
Stochastic Processes are systems of events in which the times between
events are random variables. In queueing models, the patterns of
customer arrivals and service are modeled as stochastic processes
based on probability distributions.
Utilization refers to the proportion of time that a server (or system of
servers) is busy handling customers.
Operations -- Prof. Juran
13
In the literature, queueing models are described by a series of
symbols and slashes, such as A/B/X/Y/Z, where
•A indicates the arrival pattern,
•B indicates the service pattern,
•X indicates the number of parallel servers,
•Y indicates the queue’s capacity, and
•Z indicates the queue discipline.
We will be concerned primarily with the M/M/1 queue, in which
the letter M indicates that times between arrivals and times
between services both can be modeled as being exponentially
distributed. The number 1 indicates that there is one server.
We will also study some M/M/s queues, where s is some number
greater than 1.
Operations -- Prof. Juran
14
Performance Measure
Number of Customers in the System
Random Variable
N
Expected Value
L
Number of Customers in the Queue
Number of Customers in Service
Time Spent in the System
Nq
Ns
T
Lq
Ls
W
Time Spent in the Queue
Time Spent in Service
Tq
Ts
Wq
Ws
System Parameters
S
Number of Servers
Arrival Rate (number per unit of time)

Service Rate (number per unit of time)

Utilization Factor

Symbol
(Greek letter lambda)
(Greek letter mu)
(Greek letter rho)
Probability Measure
Pn
Probability of n customers in the system
Pw
Probability of having to wait
Be careful! These symbols can vary across different books, professors, etc.
Operations -- Prof. Juran
15
General
(all queue models)
Single Phase
Infinite Source
FCFS Discipline
Infinite Queue Length
Single Server
M/D/1
(Model 2)
Operations -- Prof. Juran
M/M/1
(Model 1)
M/M/S
M/M/2
(Model 3)
16
General Formulas
John D. C. Little
1928 —
Operations -- Prof. Juran
17
The single most important formula in queueing theory is called
Little’s Law:
L
Average time in system
W
Average customers in system
L  W
ii
Arrival Rate
L

W
iii

i
Little’s Law applies to any subsystem as well. For example,
Average time in queue
Operations -- Prof. Juran
Wq 
Lq

iv
18
L as a Function of Rho
200
180
160
140
120
L
100
80
60
40
20
0
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
Rho
Operations -- Prof. Juran
19
General Single-Server Formulas
Average time in system
Average time in queue
Operations -- Prof. Juran
W  Wq 
Wq 
Lq

1

v
vi
20
•There aren’t many general queueing results (see Larry
Robinson’s sheet for some of them).
•Much of queueing theory consists of making
assumptions about the specific type of queue.
•The class of models with the most analytical results is
the category in which the arrival process and/or service
process follows an exponential distribution.
Operations -- Prof. Juran
21
Example: General Formula
𝐼≅
I
c
Ci
Cp
𝜌
2 𝑐+1
1−𝜌
×
𝐶𝑖
2
+ 𝐶𝑝
2
2
Average line length
Number of servers
Coefficient of variation; arrival process
Coefficient of variation; service process
Coefficient of Variation:
𝜎
𝐶𝑉 =
𝜇
Operations -- Prof. Juran
22
Andrey Markov
(Андрей Андреевич Марков)
1856 — 1922
Operations -- Prof. Juran
23
Probability
The Exponential Distribution
PT  t   e  t
Time between Events
T is a continuous positive random number.
t is a specific value of T.
Operations -- Prof. Juran
24
Example:
If the average time between arrivals is 45 seconds and inter-arrival times are
exponentially distributed, what is the probability that two sequential arrivals will
be more than 60 seconds apart?
Remember lambda is in “events per time unit”, so

PT  60
1
 0.02222
45
 e  t
 2.7180.02222*60
 0.2636
Operations -- Prof. Juran
25
PT  60  0.2636
Operations -- Prof. Juran
26
Here’s how to do this calculation in Excel:
1
2
3
4
D
E
lambda
t
0.02222
60
0.2636
F
G
=1/45
=EXP(-E2*E3)
The EXP function raises e to the power of whatever
number is in parentheses.
Operations -- Prof. Juran
27
Remember that the exponential distribution has a really long
tail. In probability-speak, it has strong right-skewness, and
there are outliers with very large values.
In fact, the probability of any one inter-event time being
longer than the mean inter-event time is:
1

P T  


 0.3679
In other words, only 37% of inter-event times will be longer
than the expected value of the inter-event times.
This counter-intuitive result is because some of the 37% are
really, really long.
Operations -- Prof. Juran
28
1

P T  


Operations -- Prof. Juran
 0.3679
29
Other Facts about the
Exponential Distribution
• “Memoryless” property: The expected time
until the next event is independent of how
long it’s been since the previous event
• The mean is equal to the standard deviation
(so the CV is always 1)
• Analogous to the discrete Geometric
distribution
Operations -- Prof. Juran
30
Siméon Denis Poisson
1781 — 1840
Operations -- Prof. Juran
31
If the random time between events is exponentially
distributed, then the random number of events in any
given period of time follows a Poisson process.
A Poisson random variable is discrete. The number of
events n (i.e. arrivals) in a certain space of time must be an
integer.
n is a positive random integer (sometimes zero).
Operations -- Prof. Juran
32

t  e
Pt n  
n
 t
n!
In English: The probability of exactly n events within t time
units.
Operations -- Prof. Juran
33
Poisson distribution; λ = 7.5
0.16

t  e
Pt n  
0.14
n
0.12
n!
0.10
Probability
 t
0.08
0.06
0.04
0.02
0.00
0
1
2
3
4
5
6
7
8
9
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
Number of Events in 1 Time Unit
Operations -- Prof. Juran
34
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
E
lambda
F
G
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
0.0005531
0.0041481
0.0155555
0.0388887
0.0729164
0.1093746
0.1367182
0.1464838
0.1373286
0.1144405
0.0858304
0.0585207
0.0365754
0.0211012
0.0113042
0.0056521
E
lambda
F
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
0.0005531
0.0047012
0.0202567
0.0591455
0.1320619
0.2414365
0.3781547
0.5246385
0.6619671
0.7764076
0.8622380
0.9207587
0.9573341
0.9784353
0.9897396
0.9953917
H
I
7.5
0.16
0.14
=POISSON(E25,$F$22,0)
Probability
0.12
0.10
0.08
0.06
0.04
0.02
0.00
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
Number of Events
G
H
I
7.5
1.0
0.9
=POISSON(E25,$F$22,1)
Operations -- Prof. Juran
0.8
Probability
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0.0
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
Number of Events
35
The Excel formula is good for figuring out the probability
distribution for the number of events in one time unit. Here
is a more general approach:
H
13
14
15
16
17
18
n
lambda
e
t
I
15
7.5
2.718
3
0.02481
J
K
L
M
N
=EXP(1)
=(((I14*I16)^I13)*((I15)^(-I14*I16)))/(FACT(I13))
This gives the probability of exactly fifteen events in three
time units, when the average number of events per time
unit is 7.5.
You could adapt the Excel formula for general purposes by
re-defining what “one time unit” means.
Operations -- Prof. Juran
36
Waiting Line Models
Model
1
2
3
4
Layout
Single Channel
Single Channel
Multichannel
Single or Multi
Source Population
Infinite
Infinite
Infinite
Finite
Service Pattern
Exponential
Deterministic
Exponential
Exponential
These four models share the following characteristics:
•Single Phase
•Poisson Arrivals
•FCFS Discipline
•Unlimited Queue Capacity
Model 1 (M/M/1) Formulas
Utilization
Average customers in the system



L
L
Operations -- Prof. Juran
vii

1 

 
viii
ix
38
Model 1 (M/M/1) Formulas
Average queue length
Lq 

1 

2
Lq 
1 
2
Lq 
    
Operations -- Prof. Juran
x
xi
xii
39
Model 1 (M/M/1) Formulas
Average time in system
W
1
 
xiii
Average time in queue

Wq 
    
xiv
Wq 
Operations -- Prof. Juran
L

xv
40
Model 1 (M/M/1) Formulas
Probability of a specific number
of customers in the system
Probability of no wait
Operations -- Prof. Juran

   
Pn   1   
   

n
xvi
P N  n    n
xvii


P0   1  


xviii
41
Example: Model 1 (M/M/1)
Assume a drive-up window at a fast food restaurant.
Customers arrive at the rate of 25 per hour.
The employee can serve one customer every two minutes.
Assume Poisson arrival and exponential service rates.
Determine:
A. What is the average utilization of the employee?
B. What is the average number of customers in line?
C. What is the average number of customers in the system?
D. What is the average waiting time in line?
E. What is the average waiting time in the system?
F. What is the probability that exactly two cars will be in the
system?
Example: Model 1 (M/M/1)
A) What is the average utilization of the employee?
 = 25 cust/hr
1 customer
=
= 30 cust/hr
2 mins (1hr/60 mins)
 25 cust/hr
= =
= .8333
 30 cust/hr
Example: Model 1
B) What is the average number of customers in line?
(25)

Lq =
=
= 4.167
(  -  ) 30(30 - 25)
2
2
C) What is the average number of customers in the
system?

25
L=
=
=5
 -  (30 - 25)
Example: Model 1
D) What is the average waiting time in line?
Wq =
Lq

= .1667 hrs = 10 mins
E) What is the average time in the system?
W=
L

= .2 hrs = 12 mins
Example: Model 1
F) What is the probability that exactly two cars will
be in the system (one being served and the other
waiting in line)?
 λ  λ 
pn   1-  
 μ  μ 
n
2
25  25 

p2   1-    0.1157
 30  30 
M/D/1 Formulas
Average queue length
2
Lq 
2     
xix
Average customers in the system

L  Lq 

xx
Operations -- Prof. Juran
47
Example: Model 2 (M/D/1)
An automated pizza vending machine heats and
dispenses a slice of pizza in 4 minutes.
Customers arrive at an average rate of one every 6
minutes, with the arrival rate exhibiting a Poisson
distribution.
Determine:
A) The average number of customers in line.
B) The average total waiting time in the system.
Example: Model 2
A) The average number of customers in line.
(10)

Lq =
=
= .6667
2 (  -  ) (2)(15)(15 - 10)
2
2
B) The average total waiting time in the system.

10
Wq =
=
= .06667 hrs = 4 mins
2 (  -  ) 2( 15)( 15 - 10)
1
1
W = Wq + = .06667 hrs +
= .1333 hrs = 8 mins

15/hr
M/M/S Formulas
Utilization


S
xvii
Average customers in system

L  Lq 

xviii
Lq formula is nasty; best to use the Excel template or the table in the book.
Operations -- Prof. Juran
50
Example: Model 3 (M/M/2)
Recall the Model 1 example:
• Drive-up window at a fast food restaurant.
• Customers arrive at the rate of 25 per hour.
• The employee can serve one customer every two
minutes.
• Assume Poisson arrival and exponential service rates.
If an identical window (and an identically trained
server) were added, what would the effects be on
the average number of cars in the system and the
total time customers wait before being served?
Example: Model 3
Average number of cars in the system
Lq = 0.176
(Exhibit TN7.11 - - using linear interpolation)

25
L = Lq + = .176 + = 1.009

30
Total time customers wait before being served
Lq
.176 customers
Wq = =
= .007 hours ( 1 minute)
 25 customers/min
M/M/s Calculator (Mms.xls)
A
1 mms.xls
2
3
4 Inputs:
5 lambda
6 mu
7
8
9
10
11
12
13
14
15 Outputs:
16
s
17
0
18
1
19
2
20
3
21
4
22
5
23
6
24
7
25
8
26
9
27
10
B
C
D
M/M/s Queueing Formula Spreadsheet
E
F
G
H
Definitions of terms:
25
30
Lq
4.1667
0.1751
0.0222
0.0029
0.0003
0.0000
0.0000
0.0000
0.0000
0.0000
Operations -- Prof. Juran
lambda = arrival rate
mu = service rate
s
= number of servers
Lq = average number in the queue
L
= average number in the system
Wq = average wait in the queue
W
= average wait in the system
P(0) = probability of zero customers in the system
P(delay) = probability that an arriving customer has to wait
L
5.0000
1.0084
0.8555
0.8362
0.8337
0.8334
0.8333
0.8333
0.8333
0.8333
Wq
W
0.1667
0.0070
0.0009
0.0001
0.0000
0.0000
0.0000
0.0000
0.0000
0.0000
0.2000
0.0403
0.0342
0.0334
0.0333
0.0333
0.0333
0.0333
0.0333
0.0333
P(0)
0.1667
0.4118
0.4321
0.4343
0.4346
0.4346
0.4346
0.4346
0.4346
0.4346
P(delay)
0.8333
0.2451
0.0577
0.0110
0.0017
0.0002
0.0000
0.0000
0.0000
0.0000
Utilization
0.8333
0.4167
0.2778
0.2083
0.1667
0.1389
0.1190
0.1042
0.0926
0.0833
53
Finite Queuing: Model 4
Finite Notation:
D = Probability that an arrival must wait in line
F = Efficiency factor, a measure of the effect of having to wait in line
Ls = Average number of units being served
J = Source population less those being served
Lq = Average number of units in line
S = Number of servers
Operations -- Prof. Juran
54
n = Number of customers in the system
N = Number of customers in the source population
P = Probability of exactly n customers in the system
T = Average time to perform service
U = Average time between service (per customer)
W = Average waiting time in line
X = Service factor =
T
(the proportion of time a customer is in service)
T U
Operations -- Prof. Juran
55
The copy center of an electronics firm has four copy
machines that are all serviced by a single technician.
Every two hours, on average, the machines require
adjustment. The technician spends an average of 10
minutes per machine when adjustment is required.
Assuming Poisson arrivals and exponential service,
how many machines are “down” (on average)?
N, the number of machines in the population = 4
M, the number of repair people = 1
T, the time required to service a machine = 10 minutes
U, the average time between service = 2 hours
T
10 min
X=

= .077
T + U 10 min + 120 min
From Table TN7.12, F = .980 (Interpolation)
Lq = N(1 - F) = 4(1 - 0.980) = 0.08 machines
(From Table TN6.11: F = 0.980 , using interpolation)
Ls = FNX = 0.980(4)(0.077) = 0.302
Average number of machines down = Lq + Ls = 0.382 machines
Note: TN7 uses L instead of Lq, and H instead of Ls
Operations -- Prof. Juran
58
Example: Airport Security
Each airline passenger and his or her luggage must be checked to
determine whether he or she is carrying weapons onto the
airplane. Suppose that at Gotham City Airport, an average of 10
passengers per minute arrive, where interarrival times are
exponentially distributed. To check passengers for weapons, the
airport must have a checkpoint consisting of a metal detector and
baggage X-ray machine.
Whenever a checkpoint is in operation, two employees are
required. These two employees work simultaneously to check a
single passenger. A checkpoint can check an average of 12
passengers per minute, where the time to check a passenger is also
exponentially distributed.
Operations -- Prof. Juran
59
Why is an M/M/l, not an M/M/2, model relevant here?
Operations -- Prof. Juran
60
What is the probability that a passenger will have
to wait before being checked for weapons?
Operations -- Prof. Juran
61
On average, how many passengers are waiting in line
to enter the checkpoint?
Operations -- Prof. Juran
62
On average, how long will a passenger spend at the
checkpoint (including waiting time in line)?
Operations -- Prof. Juran
63
Difficulties with Analytical Queueing Models
• Using expected values, we can get some
results
• Easy to set up in a spreadsheet
• It is dangerous to replace a random variable
with its expected value
• Analytical methods (beyond expected values)
require difficult mathematics, and must be
based on strict (perhaps unreasonable)
assumptions
Operations -- Prof. Juran
64
Summary
•Basic definitions and metrics
•Examples of some theoretical
models
Operations -- Prof. Juran
65
Download