You are on page 1of 61

2101-495 Advanced Topics in CE I

Intro to Queuing Theory


Manoj Lohatepanont, Sc.D. Chulalongkorn University

Outline

Introduction to Queuing Applications Queuing System


Deterministic Stochastic

Probability Distribution

Littles Law Queuing Systems


M/M/1 M/G/1 M/M/s


Manoj Lohatepanont 2007 2

Chulalongkorn University

Queuing Theory

What is Queuing Theory?


A mathematical study of queues Queue is a waiting line especially of persons or vehicles awaiting processing A queue forms when current demand for a service exceeds the current capacity to provide that service Help provide decision or guideline on system capacity

When does queue occur?

Why study Queuing Theory?

Chulalongkorn University

Manoj Lohatepanont 2007

Why Is Queuing Decision Difficult?

Probabilistic nature of the problem

It is often impossible to predict accurately when and how many customers will show up, and how long it will take to service each customer
E.g., checkout queues at supermarkets

Providing too much capacity costs money Providing too little capacity leads to long wait in queues, which in turn leads to other undesirable consequences

Chulalongkorn University

Manoj Lohatepanont 2007

How Does Queuing Theory Help?

Queuing theory itself does not directly provide optimal solution Rather, it provides vital information about various characteristics of the queue to decision makers
Average waiting time Average queue length

Chulalongkorn University

Manoj Lohatepanont 2007

Applications

Traffic analysis Industrial plants Retail stores Service-Oriented Industries Telephone switchboard Aircraft Takeoff/Landing Sequence Expressway Toll Plaza
Manoj Lohatepanont 2007 6

Chulalongkorn University

Queue

A queue is formed when


demand exceeds service capacity for a period of time the arrival time headway is less than the service time at a location

A queue needs not be physical waiting line


Telephone switchboard Car repair shop Non-Physical Queue

Chulalongkorn University

Manoj Lohatepanont 2007

Queuing System
Queuing System Server 2

Server 1

Queue
Chulalongkorn University Manoj Lohatepanont 2007 8

Queuing System

Input Customers Source

Queue

Servers

Served Customers

Queuing System

Chulalongkorn University

Manoj Lohatepanont 2007

Input Source

Size of Input Source (Calling Population)

Infinite (Unlimited)
The size of input source is relatively large Implicit assumption of most queuing models

Finite (Limited)
The size of input source is relatively small This assumption should be used when the rate at which

the input source generates new customers is significantly affected by the number of customers in the queuing system
Chulalongkorn University Manoj Lohatepanont 2007 10

Arrival Process

Interarrival Time

The time between two consecutive arrivals of customers

Mean Interarrival Time


1/ time/customer 20 min/customer
1/ 1/ Time 1/

Mean Arrival Rate


customers/time unit 0.05 customers/min

Chulalongkorn University

Manoj Lohatepanont 2007

11

Queue

Queue Capacity

Infinite
Queue size can grow relatively large Implicit assumption of most queuing models

Finite
Queue size is limited by a relatively small number This assumption should be used when there is a relatively

small limit on how large the length of the queue can grow

Chulalongkorn University

Manoj Lohatepanont 2007

12

Queue Discipline

The order in which members of the queue are selected for service

First In, First Out (FIFO)


Most common

Last In, First Out (LIFO) Service in Random Order (SIRO)

Chulalongkorn University

Manoj Lohatepanont 2007

13

Servers

Number of Servers

One (s = 1) Multiple (s > 1) Elapsed time from the commencement of service to its completion for a customer

Service Time

Mean Service Time

1/ time/customer
10 min/customer

1/

1/ Time

1/

Mean Service Rate

customers/time unit
0.1 customers/min

Chulalongkorn University

Manoj Lohatepanont 2007

14

Deterministic Queue

Suppose

Mean arrival rate = 0.67 customer/min


1/ = 1.5 min

Mean service rate = 1 customer/min


3

users

2 1 0 1 2 3 4 5 6 7 8 Time (min)
15

Chulalongkorn University

Manoj Lohatepanont 2007

If >

What happen when > ? = 0.67; =0.5

In deterministic case
4

users

3 2 1 0 1 2 3 4 5 6 7 8 Time (min)
16

Chulalongkorn University

Manoj Lohatepanont 2007

Probabilistic Queue

Queue can occur even when < in stochastic case because of randomness In fact, that < is one of the requirements for the study of queuing theory

For < , steady state can be achieved It is nave to set = . This could lead to very large queues! If >= , queue becomes excessively large and uncontrollable

Note that here represents TOTAL service rate

Chulalongkorn University

Manoj Lohatepanont 2007

17

Steady State

If the queuing system is allowed to operate for a long time, it can be expected, under certain conditions, to reach an equilibrium or steady state Steady state means that the probability that you will observe a certain state of the system does not depend on the time at which you monitor the system

Chulalongkorn University

Manoj Lohatepanont 2007

18

Utilization

We define utilization of a queuing system as follows

= s
where s is the number of servers

s is, therefore, TOTAL service rate

A steady state is achievable when < 1


Manoj Lohatepanont 2007 19

Chulalongkorn University

Queuing Taxonomy

Queuing models can be classified by three components:


Interarrival Time Distribution (A), Service Time Distribution (B), and Number of Servers (m)

using the following notation.

A/B/m
Chulalongkorn University Manoj Lohatepanont 2007 20

Interarrival/Service Time Distribution

Probability Distribution of
Interarrival Time (A) Service Time (B)

Common Distributions
D: Deterministic M: [Negative] Exponential Distribution Ek: kth-order Erlang Distribution Hk: kth-order Hyperexponential Distribution G: general Distribution

Chulalongkorn University

Manoj Lohatepanont 2007

21

M/M/1

For example, M/M/1 queuing system refers to the queuing system that has

Exponentially distributed interarrival time


Times between arrivals are exponentially distributed

Exponentially distributed service time


Service times for customers are exponentially distributed

One server

Chulalongkorn University

Manoj Lohatepanont 2007

22

Exponential Distribution

Unsymmetrical distribution
2.5 2

=2
1.5 f(t) 1 0.5 0 0 1 2 t 3 4

E(T) = 1/ = 0.5
Chulalongkorn University

f(t) = e-t

t >= 0
23

Manoj Lohatepanont 2007

Example

If the interarrival time is exponentially distributed and its mean interarrival time is 0.5 min (arrival rate = 2 customers/min)
Customers arrive on average every 0.5 minute ~2/3 of the customers arrive less than 0.5 minute apart ~1/3 of the customers arrive more than 0.5 minute apart

Chulalongkorn University

Manoj Lohatepanont 2007

24

Memory Less Property

The probability distribution of the remaining time until the next event (e.g., arrival) occurs is always the same, regardless of how much time has passed (i.e., it does not remember how much time has passed)

If the interarrival time of a bus is exponentially distributed, then this property implies that the probability that a bus will arrive in the next minute is the same no matter how long you have waited at the bus stop

Chulalongkorn University

Manoj Lohatepanont 2007

25

Relationship to Poisson Distribution

If the interarrival time is exponentially distributed with parameter , then the number of arrivals (e.g., customers) (X) in a specified length of time T has a Poisson distribution with parameter T

Also called Poisson Arrival Process

e-T(T)n Prob(X = n) = n!
Chulalongkorn University Manoj Lohatepanont 2007 26

Poisson Distribution

We can use Poisson distribution to verify our assumption of exponentially distributed interarrival time

By comparing the number of users that arrive for service during a specific period of time with the number that the Poisson distribution suggests

Chulalongkorn University

Manoj Lohatepanont 2007

27

Quantities of Interest

There are four major quantities of interest in a queuing system


L = Expected number of users in the system Lq = Expected number of users in the queue W = Expected system occupancy time Wq = Expected waiting time in the queue

Chulalongkorn University

Manoj Lohatepanont 2007

28

Basic Characteristics

Utilization

= s

Where s is the number of servers

Let Pn be probability that there are n users in the system, then


L = nPn
n =0

These are true for all queuing models


Manoj Lohatepanont 2007 29

Chulalongkorn University

Littles Law

John D.C. Little at MIT is generally credited with being the first to prove these steady-state relationships formally in 1961

L = W Lq = Wq
Chulalongkorn University Manoj Lohatepanont 2007 30

M/M/1
Assumptions
Interarrival time is exponentially distributed Service time is exponentially distributed One Server FCFS

Chulalongkorn University

Manoj Lohatepanont 2007

31

M/M/1

Probability that there are n users in an M/M/1 queue is

Pn = (1 )

Therefore, the expected number of users in the system (at steady state) is
L = nPn = n(1 ) =
n n =0 n =0


32

Chulalongkorn University

Manoj Lohatepanont 2007

M/M/1

Once L is known all other quantities of interest can be computed from Littles Law and the following relationships
W = Wq + 1

L = Lq +

These equations are bridges between the two equations in Littles Law
Manoj Lohatepanont 2007 33

Chulalongkorn University

M/M/1

Results can be summarized as follows 1 W= L= 2 Wq = Lq = ( ) ( ) Note also that the probability that the system is idle is P0 = 1

Chulalongkorn University

Manoj Lohatepanont 2007

34

Example 1

At a small grocery store, customers arrive according to Poisson process with a mean of 15 customers per hour. The length of time it takes to checkout is exponentially distributed with mean equals 3 minutes.
M/M/1 = 15 customer/hr = 20 customer/hr

Chulalongkorn University

Manoj Lohatepanont 2007

35

Example 1

Compute

Probability that the checkout counter is idle

15 P0 = 1 = 1 = 0.25 20 Probability that the checkout counter is busy


1 P0 = 1 0.25 = 0.75

Chulalongkorn University

Manoj Lohatepanont 2007

36

Example 1

Probability that at least one customer is waiting to checkout 15 n Pn = (1 ) = = = 0.75 20


P0 = 1 0.75 = 0.25
1 P = (1 0.75)0.75 = 0.1875 1

Pn2 = 1 ( P0 + P 1 ) = 1 (0.25 + 0.1875) = 0.5625


Chulalongkorn University Manoj Lohatepanont 2007 37

Example 1

Average number of customers waiting to checkout


2 Lq = ( )
152 225 Lq = = = 2.25 20(20 15) 100

Chulalongkorn University

Manoj Lohatepanont 2007

38

Example 1

Suppose it costs the operator 3 Baht for each minute that a customer spends waiting in the queue. What is the average cost per customer?
Lq = Wq Lq 2.25 = = 0.15 hr / customer Wq = 15 Cost = 0.15 60 3 = 27 baht / customer

Chulalongkorn University

Manoj Lohatepanont 2007

39

Example 1

For an additional of 400 Baht per hour, the operator can decrease the average service time to 2 minutes. Is the additional expenditure worthwhile?

= 30 customer/hr

15 15 Wq = = = = 0.033 ( ) 30(30 15) 450 Cost = 0.033 60 3 = 6 baht / customer

Savings = 27 6 = 21 baht / customer Savings = 21 15 = 315 baht / hr


Chulalongkorn University Manoj Lohatepanont 2007 40

Example 1

Alternative solution
BEFORE AFTER

Lq = 2.25
Cost = 2.25 60 3 = 405 baht / hr

Lq = 0.5
Cost = 0.5 60 3 = 90 baht / hr

Difference = 405 - 90 = 315 baht/hr


Chulalongkorn University Manoj Lohatepanont 2007 41

M/G/1
Assumptions
Interarrival time is exponentially distributed Service time is described only by - an average service time, and - a variance One Server FCFS
Chulalongkorn University Manoj Lohatepanont 2007 42

M/G/1

In general, if the service time can be described by two quantities


Mean (1/) Variance (2)

the expected queue length can be estimated from

2 2 + 2 Lq = 2 (1 )
Chulalongkorn University Manoj Lohatepanont 2007 43

M/G/1

As in the previous case, all other quantities of interest can be calculated using Littles Law and the following relationships
1

W = Wq + L = Lq + Note also that the probability that the system is idle is P0 = 1


Chulalongkorn University Manoj Lohatepanont 2007 44

Example 2

Aircraft arrivals and departures at Bangkok International Airport can be approximated as a Poisson process at the average rate of 40 plane/hr. It takes the air traffic controller 1.2 min on average to land or dispatch an aircraft with variance equals to 1.96 min2. Assume FCFS queue discipline.

M/G/1 = 40 plane/hr = 50 plane/hr 2 = 0.00054444 hr2

Chulalongkorn University

Manoj Lohatepanont 2007

45

Example 2

Average number of plane waiting for landing or takeoff

2 2 + 2 Lq = 2 (1 )
40 0.00054 + ( = 2 (1 40 50 )
2 40 50

= 3.78 plane
Chulalongkorn University Manoj Lohatepanont 2007 46

Example 2

Average wait time

Lq = Wq
3.78 Wq = = = 0.094 hr / plane 40 Lq

Chulalongkorn University

Manoj Lohatepanont 2007

47

Example 2

It is estimated that it costs 81,000 baht per hour for an aircraft to wait in the queue. What is the total cost of aircraft waiting to land or takeoff at the airport?

Cost = 3.78 81,000 = 306,000 baht / hr

Chulalongkorn University

Manoj Lohatepanont 2007

48

Example 2

Common mistakes

Lq = 3.78 plane
Cost = 0.094 81,000 = 7,650 baht / hr / plane Cost = 7,650 3.78 = 28,900 baht / hr 28,900 baht / hr << 306,000 baht / hr
Chulalongkorn University Manoj Lohatepanont 2007 49

M/M/s
Assumptions
Interarrival time is exponentially distributed Service time is exponentially distributed There are s servers FCFS

Chulalongkorn University

Manoj Lohatepanont 2007

50

M/M/s

When there are s servers, all with the same service rate
s 1 ( ) n ( ) s + P0 = 1/ s! n =0 n !
s +1

1 1 s

( ) Lq = P0 2 ( s 1) ! ( s )
Chulalongkorn University Manoj Lohatepanont 2007 51

M/M/s

As in the previous cases, all other quantities of interest can be calculated using Littles Law and the following relationships
W = Wq + 1

Note, however, that

L = Lq +

= s
52

Chulalongkorn University

Manoj Lohatepanont 2007

Example 3

At a Burger Mary outlet, mean arrival rate of customers is 60 customers per hour and each takes on average 3 minutes to complete order. Arriving customers form one sneak queue in front of 4 cashiers. Assume interarrival and service times are exponentially distributed.

M/M/s = 60 customer/hr = 20 customer/hr s=4


Manoj Lohatepanont 2007 53

Chulalongkorn University

Example 3

How would the average queue length and time in the system change if a fifth cashier is opened.

We first check whether steady state is achievable

60 = = = 0.75 s 4 20
Chulalongkorn University Manoj Lohatepanont 2007 54

Idle Probability (s=4)


s 1 ( ) n ( ) s P0 = 1/ + s! n =0 n ! 1 1 s 1 1 60 420

n 60 4 3 ( 60 ( 20 ) 20 ) = 1/ + 4! n =0 n ! = 1/ [13 + 3.375 4]

= 1/ 26.5 = 0.038
Chulalongkorn University Manoj Lohatepanont 2007 55

Expected Queue Length (s=4)


s +1 ( ) Lq = P0 2 ( s 1) ! ( s ) 5 ( 60 20 ) = 0.038 60 2 3! ( 4 20 ) 243 = 0.038 6 1 = 1.53 customers
Chulalongkorn University Manoj Lohatepanont 2007 56

Idle Probability (s=5)


s 1 ( ) n ( ) s + P0 = 1/ s! n =0 n ! 1 1 s

n 60 5 4 ( 60 ( 1 20 ) 20 ) = 1/ + 60 5! 1 520 n =0 n ! = 1/ [16.375 + 2.025 2.5]

= 1/ 21.44 = 0.047
Chulalongkorn University Manoj Lohatepanont 2007 57

Expected Queue Length


s +1 ( ) Lq = P0 2 ( s 1) ! ( s ) 6 ( 60 20 ) = 0.047 60 2 4! ( 5 20 ) 729 = 0.047 24 4 = 0.35 customers
Chulalongkorn University Manoj Lohatepanont 2007 58

Expected Time in System

S=4
Lq

1.53 Wq = = = 0.025 hr / cus = 1.53 m / cus 60

S=5
Lq

0.35 Wq = = = 0.006 hr / cus = 0.35 m / cus 60


Chulalongkorn University Manoj Lohatepanont 2007 59

Additional Queuing Characteristics

Balking

Occur when a customer arrives at a finite queue that is fully occupied Or when a customer decides not to join the queue because it is too long Occur when a customer leaves the system without being served Occur when a customer switches between queues thinking s/he will receive service faster by so doing
Manoj Lohatepanont 2007 60

Reneging

Jockeying

Chulalongkorn University

Final Question

Why does the use of express lanes make sense?


Supermarket Expressway Entrance Self Service Check-in at Airport (to a certain extent)

Chulalongkorn University

Manoj Lohatepanont 2007

61