You are on page 1of 44

Queuing theory (Waiting-line theory)

BME405 OPERATIONS RESEARCH


B.Tech. Mechanical Engineering
Fall Sem 2010-11
Queuing theory (Waiting-line theory)
and
Simulation model
SIVA PRASAD DARLA
(Unit IV)
SMBS / VIT
Outline for Queuing Theory
Introduction to Queuing Theory
Basic elements of Queuing system
Kendall and Lee notation
Steady state of generalized Poisson queue
Steady state measures of performance
Single-channel queueing model Single-channel queueing model
Multi-channel queueing model
Shoppers waiting in front of checkout stands in a
supermarket
Cars waiting at a stoplight
Patients waiting at an outpatient clinic
Planes waiting for takeoff in an airport
Broken machines waiting to be serviced by a repairman
Introduction
Broken machines waiting to be serviced by a repairman
Letters waiting to be typed by a secretary
Programs waiting to be processes by a digital computer
It is direct result of randomness in the operation of service
facility.
Objective
To determine the characteristics that measure the
performance of the system under study
Measure of performance I
How long a customer is expected to wait before being How long a customer is expected to wait before being
serviced?
Measure of performance II
What is the percentage of time the service facility is not
used?
Basic elements of the queueing model
Customer
Server
Customer arrival ~ arrivals distribution (single or bulk arrivals)
No time lost between the completion of a service and the
admission of a new customer into the facility
Server
Service time ~ service time distribution (single or bulk service)
Service discipline
FCFS, LCFS, SIRO, Priority queue
Design of facility and execution of service
Parallel servers
Queues in series or tandem queues
Network queues (both series and parallel servers)
Queue size finite due to space limitation or infinite
Basic elements of the queueing model contd..
Queue size finite due to space limitation or infinite
Calling source
Finite number of customers
Infinitely many customers
Effect of human behavior
Human server
Human customer - Jockey
- Balk
- Renege
Basic elements of the queueing model contd..
- Renege
All customers in a queue are expected to behave equally
while in the facility.
Role of the Poisson and exponential distributions
Condition 1: The probability of an event occurring between
t and t+s depends only on the length of s.
Condition 2: The probability of an event occurring during a
very small interval is positive but less than one.
Condition 3: At most one event can occur during a very
small interval. small interval.
Describe a process in which the count of events during a
given time interval is Poisson, and equivalently the time
interval between successive events is exponential.
f(t) = probability density function of time interval t between
the occurrence of successive events, t 0
Role of the Poisson and Exponential distributions
f(t) = e
-t
, t 0
exponential distribution with mean = 1/ time units
( )
,
!
) (
n
e t
t p
t
n
n


= n = 0, 1, 2, .
p
n
(t) = probability of n events occurring during time t
Poisson distribution with mean = t events
Queueing system (parallel servers)
_ _
Departing
customers
Arriving
customers
1
2
3
System
Queue Service
facility
Schematic diagram of parallel queueing system
3
c
Kendall-Lee notation
a / b / c : d / e / f
Main characteristics of queueing system has been standardized
in the following format:
where a = arrivals distribution
b = service time (or departures) distribution b = service time (or departures) distribution
c = number of parallel servers
d = service discipline
e = number of customers allowed in system ( in queue
+ in service)
f = size of calling source
Standard notation for arrivals and departures
distribution
M Poisson (or Markovian) arrival or departure distribution
D constant or deterministic interarrival or service time
E
k
Erlangian or gamma distribution of interarrival or
service time distribution with parameter k service time distribution with parameter k
For example
M / M / 4 : GD / N /
Steady state model of generalized Poisson queue
n number of customers in the system

n
rate of arrival given that n is the number of customers in
the system

n
rate of departure given that n is the number of customers
in the system in the system
p
n
the steady-state probability of n customers in system
n n-1
n+1

n-1

Steady state model of generalized Poisson queue


Transition-rate diagram

n+1
Balance equation Under steady-state condition, the
expected rates of flow into and out of state n must be equal
Expected rate of
flow into state n
=
0(p
0
++p
n-2
)

n-1
p
n-1
+
n+1
p
n+1 =
Expected rate of
flow out of state n
=

n
p
n
+
n
p
n
Balance equation
Steady state model of generalized Poisson queue
+0(p
n+2
+.) +
n-1
p
n-1
+
n+1
p
n+1

n-1
p
n-1
+
n+1
p
n+1

n
p
n
+
n
p
n
, n = 1, 2, 3, ..
=
Balance equation
Transition rate diagram for n = 0
0
1

1
Balance equation for n = 0

0
p
0

1
p
1
, n = 0
=

0
p
0
+
2
p
2
= (
1
+
1
)p
1
Recursively
p
1
= (
0/

1
) p
0
For n=0
For n=1
Steady-state probability of n customers in the
system (p
n
)

0
p
0
+
2
p
2
= (
1
+
1
)p
1
For n=2

1
p
1
+
3
p
3
= (
2
+
2
)p
2
0
1 2
0 1
2
p p


=
0
1 2 3
0 1 2
3
p p


=
In general
For n
Steady-state probability of n customers in the
system (p
n
)
n= 1, 2, 3, ..
,
..........
..........
0
1 2 1
0 3 2 1
p p
n n n
n n n
n




=
The value of p
0
is determined by
1
0
=

= n
n
p
Steady-state measures of performance
p
n
= steady-state probability of n customers in the system
L
s
= expected number of customers in system
L
q
= expected number of customers in queue
Consider a service facility with c parallel servers
(Characterstics of queueing system)
L
q
= expected number of customers in queue
W
s
= expected waiting time of a customer in system
W
q
= expected waiting time of a customer in queue
Expected
waiting time
in queue
Expected
waiting time
in system
Expected
service time
=
+
Steady-state measures of performance

=
=
0 n
n s
np L

= ) (
n q
p c n L
From definition of p
n

+ =
=
1
) (
c n
n q
p c n L
s eff s
W L =
Relationship exists between L
s
and W
s
where
eff
-effective average arrival rate

=
=
0 n
n n eff
p
(Littles formulae)
Steady-state measures of performance
Expected
waiting time
in queue
Expected
waiting time
in system
Expected
service time
=
+
Relationship exists between W
s
and W
q
1
+ = W W

1
+ =
q s
W W

eff
q s
L L + =
Steady-state measures of performance
Expected number
of busy servers

eff
q s
L L c = = =
Percent
utilization
100 *
c
c
=

=
=
0 n
n s
np L
eff
s
s
L
W

=
q eff q
W L =
c
n
p

1
=
s q
W W
Given p
n
, we can compute the systems measures of performance
q s
L L c =
M/M/1:GD//
n number of customers in the system
rate of arrival =
n
= for all n
rate of departure =
n
= for all n

n
= since it is independent of the number in the
system
Single Channel Queueing System
system
Defining = /
,
..........
..........
0
1 2 1
0 3 2 1
p p
n n n
n n n
n




=
n = 0, 1, 2, .
,
0 0
p
n
p
n
n
p
n

= =
n = 0, 1, 2, .
, 1
1
1
0
=
|
|

\
|

p
p
0
(1++
2
+
3
+.) =1
Assume < 1
M/M/1:GD//
p
o
= 1 -
, ) 1 ( ) 1 (
n
n
n
p
n

= = n = 0, 1, 2, .

=
=
0
) 1 (
n
n
n

=
=
0 n
n s
np L
M/M/1:GD//
2
) 1 ( ) 1 (

=

=
1 1

=
=
0 n
n s
np L
eff
s
s
L
W

=
q eff q
W L =

1
=
s q
W W
q s
L L c =
Littles formulae
M/M/1:GD//

=
1
s
L
) 1 (
1

= =
s
s
L
W

= =
1
2
s q
L L
) 1 (


= =
q
q
L
W
Single Channel Queueing System- M/M/1:GD//
Average length of non-empty queue

=
>
=
0) length (queue p
L
q
Probability that an arrival will have to
dt e
t


=
) (
) 1 (

Probability that an arrival will have to


wait more than or equal to specified time
dt e
t
t


=
) (
) 1 (

Probability that an arrival will have to


wait more than or equal to specified time
in the system
dt e
t
t


=
) (
) (


M/M/1:GD/N/
Single Channel Queueing System
Maximum queue length = N-1

=
, 0
,

n
n=0, 1, 2, ., N-1
n=N, N+1, ..

n
= for all n=0, 1, 2,
Let = /

=
, p
n
n N
1 ) ..... 1 ( 1
2
0
0
= + + + + =

=
N
N
n
n
p p
Let = /

=
, 0
,
0
p
p
n
n N
n > N
p
0
=
,
1
1
1 +

,
1
1
+ N
=1
1
p
n
=
,
1
1
1
n
N

,
1
1
+ N

=
=
N
n
n s
np L
0
=1
1
n=0, 1, 2,..N

=
+

=
N
n
n
N
n
0
1
1
1

M/M/1:GD/N/
) 1 )( 1 (
} ) 1 ( 1 {
1
1
+
+

+ +
=
N
N N
N N


=1
1
,
2
N
,
) 1 )( 1 (
} ) 1 ( 1 {
1
1
+

+ +
+
N
N
N
N N


L
s
=
M/M/1:GD/N/

N N eff
p p p p p 0 ) ....... (
1 2 1 0
+ + + + + =


) 1 (
N eff
p = ) (
q s
L L =
Effective arrival rate (
eff
) is
) 1 ( p

eff
s q
L L =
) 1 (
N
q
eff
q
q
p
L L
W

= =

) 1 (
1
N
s
eff
s
q s
p
L L
W W

= = + =

) 1 (
N
s
p
L

=
Multi-channel Queueing System
M/M/c : GD//
p p
n

=
n

n
= for all n=0, 1, 2,

=
,
,

c
n
n
n c
n c
Compute p
n
for n c
n
| |

0
) )......( 3 )( 2 (
p
n
p
n


=
0
!
p
n
n
n

=
Compute p
n
for n c
( )
0
) )........( )( )( ( ) 1 ( )..... 3 )( 2 (
p
c c c c c
p
n
n

=
0
!
p
c c
n c n
n

=
(n-c) times
0
!
p
n
n
|
|

\
|
=

0
!
p
c c
c n
n
|
|

\
|
=

M/M/c:GD//
1
1
0
0
! !

)
`

+ =

c
n c n
c n
c n c n
c c n
p

,
1
1
! !
1
1
0

|
|
|
|

\
|

+ =

c
n
c n
c
c n


Multi-Channel Queueing System
1 <
c

Multi-channel Queueing System


M/M/c : GD//

=
=
c n
n q
p c n L ) (
0
0 0
!
p
c c
k kp L
k
k
c k
k
c k q

=
+

=
+
= =

1
0
0
!

\
|
=
k
k
c
c
k p
c c

(
(

1
c

Let n-c=k
1 c

+
(
(
(


=
2
0
) 1 (
1
!
c
c c
p
c


Here
eff
=

+ =
q s
L L

q
q
L
W =

1
+ =
q s
W W
0
2
1
) ( )! 1 (
p
c c
c


=
+
Multi-channel Queueing System
M/M/c : GD/N/
Maximum queue size = N-c

=
,
,

c
n
n
n c
c n N

=
, 0
,

n
n=0, 1, 2, ., N-1
n=N, N+1, ..
c n N

,
!
,
!
0
0
p
c c
p
n
p
c n
n
n
n

n c
c n N
,
) 1 ( !
) ) ( 1 (
!
1
1
0
1

=
+
(
(
(

c
n
c N c
n
c
c
c
n

, ) 1 (
! !
1
1
0

=
(

+ +

c
n
c n
c N
c n

/c 1
/c = 1
p
0
=
Multi-channel Queueing System
M/M/c : GD/N/

=
=
N
c n
n q
p c n L ) (
Let n-c = j
1
0
0
0
!

=
+
|

\
|
= =

j
c N
j
c
c N
j
c j q
c
j p
c c
jp L

, ) 1 )( 1 ( 1
) ( )! 1 (
1
2
1
0

\
|
+
|

\
|


+
+
c N c N
c
c c
c N
c c c
p

,
! 2
) 1 )( (
0
c
c N c N
p
c
+
/c 1
/c = 1

L
q
=
Multi-channel Queueing System
M/M/c : GD/N/

eff
q s
L L + =
) 1 (
N eff
p = ) ( c c =

=
=
c
n
n
p n c
0
) ( = c Expected number of idle servers
) ( c c L L L
q
eff
q s
+ = + =

Outline for Simulation Model


Introduction to Simulation
Terminology
Advantages and disadvantages
Generation of Random Numbers
Monte Carlo method of Simulation
Introduction
A computerized imitation of the random behaviour of a system as a
function of time.
As simulation advances with time, statistics are gathered about the
simulated system when there is a change in the behaviour of the
system.
Simulation is performed by jumping on the time scale from one
event to the next. This type of modeling is described as discrete event to the next. This type of modeling is described as discrete
event simulation.
In some systems the state changes all the time. In such cases
continuous simulation is more appropriate, although discrete event
simulation can serve as an approximation.
Approaches for simulation model
Next-event scheduling
Process operation
System terminology
State: attribute in the system
Event: occurrence in time
Entity: object
Queue: waiting for something
Creating: causing an arrival of a new entity
Scheduling: assigning a new future event
Random variable: uncertain
Distribution: mathematical law
Advantages and Disadvantages
Intricate managerial decision problems
Eliminate the need of costly trial and error methods of trying ou the
new concept on real methods and equipment
Easy to use and understand
Comparatively flexible and modified to accommodate the changes
Less time for computations of large size problems
Use for training the operating and managerial staff in the operation
of complex plans of complex plans
Approximation solutions
Quantifications of the variables is another difficult
Model development is difficult for large and complex problems
Costly
Too much tendency to rely on the simulation models
GPSS, GASP
SimScript / SimLab / MODSIM II (http://www.caciasl.com)
SIMPLEX II (http://www.uni-passau.de)
SimProcess (http://www.caciasl.com)
Software
SIMPLE++
ARENA
Witness

Generation of Random Numbers


Methods
Spinning arrow method
Spinning disc method
Mid-square method
8612, square of 8621=74166544
1665, square of 1665= 02772225
Congruence method (residue method)
r
i+1
= (a r
i
+ b) ( modulo m)
where a, b and m are constants and the value of r
0
is
required called seed.
arithmetic operations are always predictable and reproducible
Pseudo-random numbers
Monte Carlo method of simulation
The basic data regarding the occurrence of various events are
known, into which the probabilities of separate events are merged
in a step by step analysis to predict the outcome of the whole
sequence of events.
A simulation technique in which statistical distribution functions
are created by using a series of random numbers.
Example
At a telephone booth, suppose that the customers arrive with an
average time (constant) of 1.8 units between one arrival and the
next. Service times (constant) are assumed to be 4 time units.
Simulate the system by assuming that the system starts at time zero
in order to find the average waiting time per customer.
A
1
A
5
A
4
A
3
A
2
D
1
D
2
A
6
A
7
D
3
A
8
A
9
t =0
e
1 e
2
e
3
e
4
e
6
e
5
e
8
e
7
e
9
e
10
e
11
e
12
Time Event Customer Waiting time
0 e1 1
a
--
Simulation run
1.8 e2 2
a
--
3.6 e3 3
a
--
4.0 e4 1
d
4-1.8 = 2.2 (customer 2)
5.4 e5 4
a
--
7.2 e6 5
a
--
8.0 e7 2
d
8-3.6 = 4.4 (customer 3)
9.0 e8 6 --
Average waiting time per customer = 3.57 time units.
9.0 e8 6
a
--
10.8 e9 7
a
--
12.0 e10 3
d
12-5.4 = 6.6 (customer 4)
13.6 e11 8
a
--
Simulation run stop at 14 time, end 14-7.2 = 6.8 (customer 5)
14-9.0 = 5 (customer 6)
14-10.8 = 3.2 (customer 7)
14-13.6 = 0.4 (customer 8)