You are on page 1of 72

Lecture 2: Queueing Theory

(Part 1)
MH4702: Probabilistic Methods in
Operations Research

Lecturer: Yan Zhenzhen


Office: SPMS-MAS-05-19
Email: yanzz@ntu.edu.sg
Tel: 6513 7466

Chapter 17 of Hillier & Lieberman, 10th Ed

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


Queueing Theory

System in which arrivals place a


demand upon a finite capacity, a
limited space or limited resources.

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


2
Learning Objectives

By the end of this lesson, you should be able to:


 List the applications of queueing theory.
 Explain the concept of basic queueing system.
 Recognize basic queueing systems and associated
assumptions.
 Understand how to use continuous time Markov chain to
model a queueing system under exponential
assumptions
 Understand important properties of exponential
distributions
 Understand and apply Little’s formula
 Understand birth and death process

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


3
Basic Queueing System

MH4702: Probabilistic Methods


in Operations Research

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


Applications of Queueing Theory

Queueing theory is a branch of statistics which deals with arrival times of people (or transport) and service
rates (time taken for change, or buying something, tickets, gates, etc.). 

Queueing theory is useful in:


• crowd safety management, entry and exit systems, concession planning and crowd flow
assessment, traffic control and planning;
• determining the sequence of computer operations, predict computer performance,
telecommunications;
• health services (for example, control of hospital bed assignments, appointment schedule);
• dwell time analysis at stations and many more logistic problems that can effect a venue; and
• in determining how to achieve a good performance in sports.

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


5
Basic Queueing System

Arrivals Queue Service


 Arrival time distribution  Capacity  Number of servers
(infinite or finite) (one or more)
 Calling population
(infinite or finite)  Queueing discipline  Service time distribution

Queueing system
© 2020 Nanyang Technological University, Singapore. All Rights Reserved.
6
Basic Queueing System (cont.)

Two common assumptions on arrivals:

 Calling population — The total number of customers that might require service from time to time is infinite.
 Arrival time distribution — Customers are generated over time according to a Poisson process.

 Arrivals occur randomly but at a certain fixed mean rate.

 The inter-arrival time follows an exponential distribution.

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


7
Basic Queueing System (cont.)

Two common assumptions on queues:

 Queue capacity — Infinite number of customers permitted.


 Queue discipline — First-come-first-served policy.
 In some situations, a finite queue assumption is necessary.
 Other queue disciplines include random, some priority order.

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


8
Basic Queueing System (cont.)

Two common assumptions on service:

 Number of servers — It could be either one server or multiple servers.


 Service time distribution — It refers to the exponential distribution.
 It is common to assume the same distribution on all servers.
 Other service-time distributions, for example, Erlang.

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


9
Basic Queueing System (cont.)
Input Source The Queuing System

Served jobs
Calling Jobs Service
population Queue mechanism
Leave the
system

Arrival Queue
process discipline

Queue Service process


configuration

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


10
Labelling Convention

Queueing models

Distribution of service times = Exponential distribution (Markovian)

𝐌/𝐌/𝐬 = Degenerate distribution (constant time)


—/—/— = Erlang distribution (shape parameter = k)
Number of servers 𝐌/𝐆/𝟏 = General distribution (any arbitrary distribution
Distribution of inter-arrival times allowed)

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


11
Model as a CTMC under Exponential Assumptions

 Let represent the number of customers in a queueing system at time .


 M/M/s system can be modelled as a continuous time Markov chain

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


12
Exponential Distribution

MH4702: Probabilistic Methods


in Operations Research

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


Exponential Distribution

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


14 14
Exponential Distribution

Probability density
function

Cumulative
distribution function

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


15 15
Exponential Distribution

The university runs two bus lines on campus:


red and green. The red line serves north
campus, and the green line serves south
campus with a transfer station linking
the two lines.

Green buses arrive randomly (exponential


inter-arrival time) at the transfer station
every 10 minutes. Red buses also arrive
randomly every 7 minutes.

What is the expected waiting time for a student arriving on


the transfer station via the green line to get on the red line?
© 2020 Nanyang Technological University, Singapore. All Rights Reserved.
16
Exponential Distribution (P1)

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


17 17
Exponential Distribution (P2)

The probability distribution of the remaining time until the event occurs
is always the same, regardless of how much time has already passed.

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


18 18
Exponential Distribution (P2)

For inter-arrival times, this property describes the common situation


where the time until the next arrival is completely uninfluenced by
when the last arrival occurred.

For service time, this property is not expected to hold in a situation


where the server must perform the same fixed operations for each
customer. However, in a situation where operations differ among
customers, this property may be quite realistic.

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


19 19
Exponential Distribution (P3)

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


20 20
Exponential Distribution (P3)

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


21 21
Exponential Distribution (P3)

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


22 22
Exponential Distribution

The university runs two bus lines on campus:


red and green. The red line serves north
campus, and the green line serves south
campus with a transfer station linking
the two lines.

Green buses arrive randomly (exponential


inter-arrival time) at the transfer station
every 10 minutes. Red buses also arrive
randomly every 7 minutes.

What is the expected waiting time for a student arriving on


the transfer station via the green line to get on the red line?
© 2020 Nanyang Technological University, Singapore. All Rights Reserved.
23
Poisson Distribution

Probability density function

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


24 24
Exponential Distribution (P4)

PROOF

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


25 25
Exponential Distribution (P4)

Proof by Mathematical Induction:


X(t)
Let be the inter-arrival time
between customers and , which has
a constant arrival rate .

When , there is only 1 arrival within


the time interval . So, and .
2
1
0 t1 t t2
T1 T2 T3 T4
© 2020 Nanyang Technological University, Singapore. All Rights Reserved.
26 26
Exponential Distribution (P4)

Proof by Mathematical Induction:


X(t)

2
1
0 t1 t t2
T1 T2
© 2020 Nanyang Technological University, Singapore. All Rights Reserved.
27 27
Exponential Distribution (P4)

Proof by Mathematical Induction:


X(t)
So, is true.

We assume that

is true.

Now, for n, 2
1
0 t1 t tn+1
T1 T2
© 2020 Nanyang Technological University, Singapore. All Rights Reserved.
28 28
Exponential Distribution (P4)
Proof by Mathematical Induction:
X(t)

2
1
0 t1 t tn+1
T1 T2
© 2020 Nanyang Technological University, Singapore. All Rights Reserved.
29 29
Exponential Distribution (P4)

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


30 30
Exponential Distribution (P5)

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


31 31
Exponential Distribution (P5)

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


32 32
Exponential Distribution

This property provides a convenient approximation of probability


that the event of interest (customer arrival or service completion)
occurs in the next small interval of time.

The probability that two events occur in a sufficiently


small interval of time is relatively negligible.

No two events occur


simultaneously.

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


33 33
Exponential Distribution (P6)

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


34 34
Exponential Distribution (P6)

PROOF

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


35 35
Exponential Distribution (P6)

PROVE

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


36 36
Exponential Distribution (P6)

Aggregation Disaggregation

N1 ~ Poisson(1) N1 ~ Poisson(p1)

N2 ~ Poisson(2) p1 N2 ~ Poisson(p2)
N ~ Poisson() N ~ Poisson() p2

…  = 1+2+…+k pk …
Nk ~ Poisson(k) Nk ~ Poisson(pk)

Note: p1+p2+…+pk=1

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


37 37
Exponential Distribution (P6)

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


38 38
Exponential Distribution (P6)

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


39 39
Exponential Distribution (P6)

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


40 40
Terminology and Notation

MH4702: Probabilistic Methods


in Operations Research

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


Terminology and Notation

 State of system = number of customers in queueing system


 Queue length = number of customers waiting for service to begin
= state of system - number of customers being served
 N (t ) = number of customers in queueing system at time
 Pn (t ) = probability of seeing exactly n customers in queueing system at time
 n = mean arrival rate (expected number of arrivals per unit time) of new customer when
n customers are in system
  n = mean service rate for overall system (expected number of customers completing service
per unit time) when n customers are in system

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


42 42
Terminology and Notation

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


43 43
Steady-state condition

Not the state


remains the same.
© 2020 Nanyang Technological University, Singapore. All Rights Reserved.
44 44
Terminology and Notation

When the system is in a steady-state condition:

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


45 45
Little’s Formula

MH4702: Probabilistic Methods


in Operations Research

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


Little’s Formula

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


47 47
Little’s Formula
Little’s Formula:
In a queueing system, let denote the long-term average
number of customers in the system, λ the rate of arrivals,
and the long-term average time that a customer is in the
system. Then
.
Consider a realization of a queueing system between the time when a
customer first enters the system and when the system is next empty. Assume
that four customers enter the system in the time interval with arrival and
departure times:
Customer Arrival Time Departure Time

1 t1 t5
2 t2 t4
3 t3 t7
48 4 t6 t © 2020 Nanyang Technological University, Singapore. All Rights Reserved.
48
Little’s Formula
Customer Arrival Time Departure Time
The following figure depicts the number of customers
1 t1 t5 in the system over time. Let be the area of the shaded
2 t2 t4 region.
3 t3 t7
4 t6 t

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


49 49
Little’s Formula
Customer Arrival Time Departure Time
t5
t4 4
1 t1
2 t2 t7 2 3
3 t3 t 1
4 t6

The average length of time W that a customer spends in the system is


(t5  t1 )  (t 4  t2 )  (t7  t3 )  (t  t6 )
W
4
(t  t1 )  (t5  t 2 )  (t7  t6 )  (t 4  t3 )

# of customers in [0, t ]
A

# of customers in [0, t ]
© 2020 Nanyang Technological University, Singapore. All Rights Reserved.
50 50
Little’s Formula
Customer Arrival Time Departure Time

1 t1
3
2 t2 2 4 6
3 t3 1 5 7
4 t6

In addition, the average number of customer L in the system is


1
L  [1(t 2  t1 )  2(t3  t 2 )  3(t 4  t3 )  2(t5  t 4 )  1(t6  t5 )  2(t7  t6 )  1(t  t7 )]
t
A

t

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


51 51
Little’s Formula

Putting both expressions together:

A W  Number of customers in [0, t ]


L 
t t

For large t, this gives L  W

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


52 52
Little’s Formula

The mean service


© 2020rate per
Nanyang busy server
Technological University, Singapore. All Rights Reserved.
53 53
Little’s Formula

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


54 54
The Birth-and-Death Process

MH4702: Probabilistic Methods


in Operations Research

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


The Birth-and-Death Process

0 1 2 …… n-2 n-1 n n+1 …

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


56 56
The Birth-and-Death Process

0 1 2 …… n-2 n-1 n n+1 …

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


57 57
The Birth-and-Death Process

No two events
occur
simultaneously.
© 2020 Nanyang Technological University, Singapore. All Rights Reserved.
58 58
The Birth-and-Death Process

0 1 2 …… n-2 n-1 n n+1 …

59 Rate diagram © 2020 Nanyang Technological University, Singapore. All Rights Reserved.
59
The Birth-and-Death Process

0 1 2 …… n-2 n-1 n n+1 …

A special type of continuous time Markov chain

Analysis of the birth-and-death process is


 very difficult when the system is in a transient condition
 relatively straightforward after it has reached a steady-state condition

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


60 60
The Birth-and-Death Process

0 1 2 …… n-2 n-1 n n+1 …

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


61 61
The Birth-and-Death Process

0 1 2 …… n-2 n-1 n n+1 …

The balance equation:

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


62 62
The Birth-and-Death Process

0 1 2 …… n-2 n-1 n n+1 …

63 Rate In = Rate Out Principle© 2020 Nanyang Technological University, Singapore. All Rights Reserved.63
The Birth-and-Death Process

0 1 2 …… n-2 n-1 n n+1 …

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


64 64
The Birth-and-Death Process

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


65 65
The Birth-and-Death Process

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


66 66
The Birth-and-Death Process

0 1 2 …… n-2 n-1 n n+1 …

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


67 67
Example

Potential customers arrive at a full-service, one-pump gas station at a Poisson rate of


20 cars per hour. However, customers will only enter the station for gas if there are less
than two cars (including the one currently being attended to) at the pump. Suppose the
amount of time required to serve a car is exponentially distributed with a mean of five
minutes.
(a) What fraction of the attendant's time will be spent serving cars?
(b) What fraction of potential customers are lost?

𝜆0 =20 𝜆1 =20 𝜆2 𝜆3 =0 ……

0 1 2 4 5 6 7 …
3

𝜇1 =12 𝜇 2=12 𝜇3 𝜇 4=0 ……

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


68 68
Summary

MH4702: Probabilistic Methods


in Operations Research

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


Summary
Here are the key takeaways from the lesson.
Queueing models

Distribution of service times

—/—/—
Number of servers
Distribution of inter-arrival times

A queueing system with exponential distribution assumption


can be modelled as a continuous time Markov Chain

 Let represent the number of customers in a waiting line


at time .

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


70
Summary (cont.)
Here are the key takeaways from the lesson.

Properties of an Exponential Distribution

Property 4: If the time between consecutive occurrences follows an


exponential distribution with parameter , then

where denotes the number of occurrences by time .

Property 6: Unaffected by aggregation and disaggregation

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


71
Summary (cont.)
Here are the key takeaways from the lesson.

Little’s Formula:
.

The Birth-and-Death Process

Rate In = Rate Out Principle

© 2020 Nanyang Technological University, Singapore. All Rights Reserved.


72

You might also like