stochastic models
DESCRIPTION
queuing theoryTRANSCRIPT
2
Today
Queuing Theory
Reading: Chapter 20, Sections: 1- 11 (Winston 4th Edition)
Recommended optional reading (if interested in alternative presentation of the topic): “Introduction to Probability Models”, Sheldon M. Ross, Academic Press “Stochastic Processes”, Sheldon M. Ross, Wiley “Stochastic Modeling and the Theory of Queues”, Ronald W. Wolf, Prentice
Hall
3
Description
Each of us has spent a great deal of time waiting in lines.
Queueing theory deals with mathematical models for waiting lines, or queues.
4
Queueing Theory
5
Some Queuing Terminology
To describe a queuing system, an input process and an output process must be specified.
Examples of input and output processes are:
. Pizza parlor send out truck to deliver pizzas
Request for pizza delivery are received
Pizza parlor
Tellers serve the customers
Customers arrive at bank
Bank
Output ProcessInput ProcessSituation
Pizza parlor send out truck to deliver pizzas
Request for pizza delivery are received
Pizza parlor
Tellers serve the customers
Customers arrive at bank
Bank
Output ProcessInput ProcessSituation
6
The Input or Arrival Process The input process is usually called the arrival process.
Arrivals are called customers.
We assume that no more than one arrival can occur at a given instant.
If more than one arrival can occur at a given instant, we say that bulk arrivals are allowed.
Models in which arrivals are drawn from a small population are called finite source models.
If a customer arrives but fails to enter the system, we say that the customer has balked.
7
Arrival Process Probability Distribution of Arrivals over time
Usually Poisson Process Number of Arrivals in time interval ~ Poisson Time between arrivals ~ Exponential Memoryless Property
Deterministic General Distribution
Single or simultaneous arrivals (batch or bulk)
Behavior of arrivals Impatience (Balking or Reneging) Jockeying
Time behavior of system (Stationary or not)
Capacity limits
8
The Output or Service Process
To describe the output process of a queuing system, we usually specify a probability distribution – the service time distribution – which governs a customer’s service time.
We study two arrangements of servers: servers in parallel and servers in series.
Servers are in parallel if all server provide the same type of service and a customer need only pass through one server to complete service.
Servers are in series if a customer must pass through several servers before completing service.
9
The Output or Service Process
Finally we consider priority queuing disciplines.
A priority discipline classifies each arrival into one of several categories.
Each category is then given a priority level, and within each priority level, customers enter service on an FCFS basis.
Another factor that has an important effect on the behavior of a queuing system is the method that customers use to determine which line to join.
10
Service Process Probability Distribution of Service time
Usually modeled as Exponential General
Single or simultaneous service (bulk or individual) Number of Parallel service channels
.
11
Modeling Arrival and Service Processes
We define ti to be the time at which the ith customer arrives.
In modeling the arrival process we assume that the interarrival times Tis are independent, continuous random variables described by the random variable A.
The assumption that each interarrival time is governed by the same random variable implies that the distribution of arrivals is independent of the time of day or the day of the week.
This is the assumption of stationary interarrival times.
12
Kendal-Lee NotationA/B/x/C/y/z
A = letter for arrival distribution (e.g., m, e, g, d, …)
B = letter for service distribution
x = number of parallel service channels
C = queue discipline (FCFS, LCFS, GD, …)
y = number allowed in the system
z = size of the customer population
13
Measurement of System Performance System size
Number in queue Number in system
Customer waiting times Time in queue Time in system
Server idleness
14
Poisson Distribution
For a given , Poisson probability mass function for a random variable is given by:
( )0, >λλ
( )
( ) λλ
λλ λλ
==
>=== −
)(,
0,...,2,1,0,!
XVarXE
xex
xXPx
X
15
Exponential Distribution
A continuous random variable X is exponentially distributed with parameter , if it has the following probability density function:
µ
( )
( )
( )2
11)(
10)(
0,
µµ
µ
µ
µ
==
−=<<=
≥=
−
−
XVarXE
exXPxF
xexf
x
x
16
Erlang Distribution
A continuous random variable X is Erlang distributed with parameters and k, if it has the following probability density function:
. It can be shown that a random variable representing a sum
of k i.i.d variables each exponentially distributed with parameter , has an Erlang probability distribution with parameters and k.
µ
( ) ( )
( )2
1
)(
;0;0,)!1(
µµ
µµµ µ
kXVar
kXE
Zkxek
xxf x
k
k
==
∈>>−
= +−−
µµ
17
Poisson Process
Def (Ross):
A stochastic process N(t) that represents the total number of arrivals/events that have occurred up to time t is said to be a Poisson process with rate λ (λ > 0), if: N(0) = 0 The process has independent increments (the number of
events that occur in disjoint time intervals are independent)
The number of events in any interval of length t is Poisson distributed with mean λt. That is: { } 0,,,....,1,0,
!
)()()( ≥===−+ − tsne
n
tnsNstNP t
nλλ
18
Poisson Process Alternative Def (Ross):
A stochastic process N(t) that represents the total number of arrivals/events that have occurred up to time t is said to be a Poisson process with rate λ (λ > 0), if: N(0) = 0 The process has
Stationary increments (the distribution of the number of events that occur in any interval of time depends only on the length of the time interval)
Independent increments (the number of events that occur in disjoint time intervals are independent)
.
.
{ } 0)(
lim)(1)(0
=+==→ h
howherehohhNP
hλ
{ } )(2)( hohNP =≥
19
Modeling Arrival and Service Processes
Stationary interarrival times are often unrealistic, but we may often approximate reality by breaking the time of day into segments.
A negative interarrival time is impossible. This allows us to write
We define1/λ to be the mean or average interarrival time.
∫ ∫∞
=>=≤c
cdttacPdttacP
0)()(and)()( AA
∫∞
=0
)(1
dtttaλ
20
Modeling Arrival and Service Processes
We define λ to be the arrival rate, which will have units of arrivals per hour.
An important questions is how to choose A to reflect reality and still be computationally tractable.
The most common choice for A is the exponential distribution.
21
Modeling Arrival and Service Processes- Exponential Distribution -
An exponential distribution with parameter λ has a density f(t) = λe-λt.
We can show that the average or mean for exponentially distributed interarrival time is given by
We can also show that (for exponentially distributed interarrival time):
λ1
)( =AE
2
1var
λ=A
22
Modeling Arrival and Service Processes- Exponential Distribution -
Lemma 1: If A has an exponential distribution, then for all nonnegative values of t and h,
(*)
A probability density function that satisfies (*) is said to have the no-memory (memoryless) property.
)()|( hPthtP >=≥+> AAA
23
Modeling Arrival and Service Processes- Exponential Distribution -
The memoryless property of the exponential distribution is important because it implies that if we want to know the probability distribution of the time until the next arrival, then
It does not matter how long it has been since the last arrival !!!
24
Relationship between Poisson Distribution and Exponential Distribution
Let the number of arrivals be described by a discrete random variable N that has a Poisson distribution with parameter λ. That is, for n=0,1,2,…,
Let {An, n≥1} represent the sequence of interarrival times.
What is the probability distribution of An?
,...)2,1,0(!
)( ===−
nn
enP
nλλ
N
25
Relationship between Poisson Distribution and Exponential Distribution in Poisson Process
First, (provided that the number of arrivals follows Poisson distribution with parameter λt) notice:
The above result implies that A1 has an exponential distribution with mean 1/λ.
What is the probability distribution of A2?
{ } { } tetNPtAP λ−===> 0)(1
26
Relationship between Poisson Distribution and Exponential Distribution in Poisson Process
To obtain distribution of A2, we can use a conditional probability:
Therefore, we can conclude that A2 also has an exponential distribution with mean 1/λ.
Additionally, because A1 and A2 are independent, the following theorem holds:
{ } { }{ }
.)(
.).(],(0
|],(0| 112
incrstationarybye
incremindepbytssineventsP
sAtssineventsPsAtAP
tλ−=+=
=+==>
27
Relationship between Poisson Distribution and Exponential Distribution in Poisson Process
Theorem:
Interarrival times are exponential with parameter λ if and only if the number of arrivals to occur in an interval of length t follows the Poisson distribution with parameter λt.
28
The Birth and Death Process
“The birth and death process is a (continuous time) Markov chain with state space {0, 1, …}, where all jumps are between adjacent states.” (Wolf, 1989)
The terminology arises from the study of biological populations (births = incremental increase in population; deaths = incremental decrease in population)
Example:
.
0 1 2 j j+1 j+2
0λ
0µ
1λ jλ 1+jλ
1µ jµ 1+jµ
29
Birth-Death Processes-Terminology-
The state of a queuing system at time t is defined by the number of people present in the queuing system at time t.
A steady state, or equilibrium probability of state j is denoted by πj.
The behavior of the queuing system before the steady state is reached is called the transient behavior, and the corresponding transient probabilities are denoted by Pij(t).
Note: Pij(t) represents the probability that j people will be in the system at time t, given that i people were in the system at time 0.
30
Birth-Death Processes-Laws of Motion-
Law 1 If the queuing system is in state j at time t then:
The probability of a birth between time t and time t+Δt is λjΔt+o(Δt) A birth increases the system state by 1, to j+1 The variable λj is called the birth rate in state j (in most queuing systems, a birth is simply
an arrival).
Law 2 If the queuing system is in state j at time t then:
The probability of a death between time t and time t+Δt is µjΔt+o(Δt) A death decreases the system state by 1, to j-1. The variable µj is the death rate in state j (in most queuing systems, a death is a service
completion). Note that µ0 = 0 must hold, or a negative state could occur.
Law 3 Births and deaths are independent of each other.
31
Birth-Death Processes- Derivation of Steady-State Probabilities -
The key part is to relate (for small Δt) Pij(t+Δt) to Pij(t), and to remember that, in the steady state, the rate at which transitions occur into any state i must equal the rate at which transitions occur out of state i.
We can then derive a set of so called flow balance equations, or conservation of flow equations for a birth-death process.
.
,...)2,1()(1111 =+=+ ++−− jjjjjjjj µλπµπλπ
0011 λπµπ =
32
Birth-Death Processes- Derivation of Steady-State Probabilities -
If we define
Then, If is finite, we can solve for π0:
It can be shown that if is infinite, then no steady-state distribution exists.
The most common reason for a steady-state failing to exist is that the arrival rate is at least as large as the maximum rate at which customers can be served.
∑ ∞=
=
j
j jc1
∑ ∞=
=
j
j jc1
∑∞=
=
+= j
jjc
1
0
1
1π
33
Little’s Law- Motivation -
We are often interested in finding out some of the following system metrics:
L = the average number of customers present in the queuing system
Lq = the average number of customers waiting in line
Ls = the average number of customers in service
W = the average time a customer spends in the system
Wq = the average time a customer spends in line
Ws = the average time a customer spends in service
34
Little’s Law- Theorem -
For any queuing system in which a steady-state distribution exists, the following relations hold:
L = λW
Lq = λWq Ls = λWs
Important note: Parameter λ used in the Little’s Law corresponds to the average number of customers per unit time who actually enter the system.
35
Important Series
∑
∑
∑
∞
=
=
+
∞
=
−=
−−=
−=
<≤
02
0
1
0
)1()3(
1
1)2(
1
1)1(
10
j
j
n
j
nj
j
j
x
xjx
x
xx
xx
xFor
36
Queueing Models considered in this class
M/M/1/GD/∞/∞ M/M/1/GD/c/∞ M/M/s/GD/∞/∞ M/G/∞/GD/∞/∞ GI/G/∞/GD/∞/∞ M/G/1/GD/∞/∞
Finite Source Models Exponential Queues in Series Open Queueing Models M/G/s/GD/s/∞
37
The M/M/1/GD/∞/∞ Queuing System
Rate Diagram
Let , then:10, <≤= ρµλρ
)10()1(
)10(10
<≤−=
<≤−=
ρρρπρρπ
jj
38
The M/M/1/GD/∞/∞ Queuing System
λµλ
ρρ
ρρρ
ρρρρπ
−=
−=
−−=
=−=−== ∑∑∑∞=
=
∞=
=
∞=
=
1)1()1(
)1()1(
2
000
j
j
jj
j
jj
jj jjjL
ρρππππ =−−=−=+++= )1(11)(10 0210 sL
ρρρ
ρρ
−=−
−=−=
11
2
sq LLL
39
The M/M/1/GD/c/∞ Queuing System
Rate Diagram
)1(and
)1( c
c
LW
LW
πλπλ −=
−=
40
The M/M/s/GD/∞/∞ Queuing System
Rate Diagram
41
The M/M/s/GD/∞/∞ Queuing System
Can be modeled as a birth-death process with parameters
Let
then we can derive the following steady-state probabilities
10, <≤= ρµλρs
,...)2,1(
),...,1,0(
,...)1,0(
++==
====
ssjs
sjj
j
j
j
j
µµµµ
λλ
42
The M/M/s/GD/∞/∞ Queuing System
,...)2,1(!
)(
),...2,1(!
)(
)1(!)(
!)(
1
0
0
)1(
0
0
++==
==
−+
=
−
−=
=∑
ssjss
s
sjj
s
ss
is
sj
j
j
j
j
si
i
si
πρπ
πρπ
ρρρ
π
43
The M/G/∞/GD/∞/∞ and GI/G/∞/GD/∞/∞ Queuing System
There are many examples of systems in which a customer never has to wait for service to begin.
In such a system, the customer’s entire stay in the system may be thought of as his or her service time.
Since a customer never has to wait for service, there is, in essence, a server available for each arrival, and we may think of such a system as an infinite-server (or self-service).
44
The M/G/∞/GD/∞/∞ and GI/G/∞/GD/∞/∞ Queuing System
Using Kendall-Lee notation, an infinite server system in which interarrival and service times may follow arbitrary probability distributions may be written as GI/G/∞/GD/∞/∞ queuing system.
Such a system operates as follows: Interarrival times are iid with common distribution A. Define E(A)
= 1/λ. Thus λ is the arrival rate.
When a customer arrives, he or she immediately enters service. Each customer’s time in the system is governed by a distribution S having E(S)= 1/µ.
45
The M/G/∞/GD/∞/∞ and GI/G/∞/GD/∞/∞ Queuing System
Let L be the expected number of customers in the system in the steady state, and W be the expected time that a customer spends in the system. Since W= 1/µ, Little’s formula yields the following relationship that does not require any assumptions of exponentiality:
If interarrival times are exponential, it can be shown that the steady-state probability that j customers are present follows a Poisson distribution with mean
In other words:
.
µλ=L
µλ
46
The M/G/1/GD/∞/∞ Queuing System
Let (λ) be the arrival rate (assumed to be measured in arrivals per hour).
Also define 1/µ = E(S) and σ2=var S.
An M/G/1/GD/∞/∞ queuing system is not a birth-death process!
Determination of the steady-state probabilities for M/G/1/GD/∞/∞ queuing system is a difficult matter.
Fortunately, however, utilizing the results of Pollaczek and Khinchin, we may determine Lq, L, Ls, Wq, W, Ws.
47
The M/G/1/GD/∞/∞ Queuing System Pollaczek and Khinchin showed that for the M/G/1/GD/∞/∞ queuing
system,
It can also be shown that π0, the fraction of the time that the server is idle, is 1-ρ.
The result is similar to the one for the M/M/1/GD/∞/∞ system.
µ
λ
ρρρσλ
1
)1(2
222
+=
=
+=−+=
q
q
q
WW
LW
LL
L
48
Finite Source Models
With the exception of the M/G/1/GD/∞/∞ model, all the models we have studied have displayed arrival rates that were independent of the state of the system.
There are two situations where the assumption of the state-independent arrival rate may be invalid:
1. If customers do not want to buck long lines, the arrival rate may be a decreasing function of the number of people present in the queuing system.
2. If arrivals to a system are drawn from a small population, the arrival rate may greatly depend on the state of the system.
49
Finite Source Models
Models in which arrivals are drawn from a small population are called finite source models.
In the machine repair problem, the system consists of K machines and R repair people.
At any instant in time, a particular machine is in either good or bad condition.
The length of time that a machine remains in good condition follows an exponential distribution with rate λ.
Whenever a machine breaks down the machine is sent to a repair center consisting of R repair people.
50
Finite Source Models
The repair center services the broken machines as if they were arriving at an M/G/R/GD/∞/∞ system.
Thus, if j ≤ R machines are in bad condition, a machine that has just broken will immediately be assigned for repair; if j > R machines are broken, j – R machines will be waiting in a single line for a repair worker to become idle.
The time it takes to complete repairs on a broken machine is assumed exponential with rate µ.
Once a machine is repaired, it returns to good condition and is again susceptible to breakdown.
51
Finite Source Models
The machine repair model may be modeled as a birth-death process, where the state j at any time is the number of machines in bad condition.
Note that a birth corresponds to a machine breaking down and a death corresponds to a machine having just been repaired.
When the state is j, there are K-j machines in good condition.
When the state is j, min (j,R) repair people will be busy.
52
Finite Source Models
Rate diagram for 5 machines and 2 repair people:
53
Finite Source Models
Since each occupied repair worker completes repairs at rate µ, the death rate µj is given by
If we define p = λ /µ, an application of steady-state probability distribution:
.
),...2,1(
),...,1,0(
KRRjR
Rjj
j
j
++==
==
µµµµ
),...2,1(!
!
),...,1,0(
0
0
KRRjRR
jpj
K
Rjpj
Kj
Rj
j
j
++=
=
=
=
−
π
ππ
54
Finite Source Models
Unfortunately, there are no simple formulas for L, Lq, W, Wq. The best we can do is express these quantities in terms of the πj’s:
.
∑
∑=
=
=
=
−=
=
Kj
Rjjq
Kj
jj
RjL
jL
π
π
)(
0
λ
λq
q
LW
LW
=
=
55
Exponential Queues in Series and Open Queuing Networks
In the queuing models that we have studied so far, a customer’s entire service time is spent with a single server.
In many situations the customer’s service is not complete until the customer has been served by more than one server.
A system like the one shown in Figure 19 in the book is called a k-stage series queuing system.
56
Exponential Queues in Series and Open Queuing Networks
57
Exponential Queues in Series and Open Queuing Networks
Theorem 4 – If (1)interarrival times for a series queuing system are exponential with rate λ, (2) service times for each stage I server are exponential, and (3) each stage has an infinite-capacity waiting room, then interarrival times for arrivals to each stage of the queuing system are exponential with rate λ.
For this result to be valid, each stage must have sufficient capacity to service a stream of arrivals that arrives at rate λ; otherwise, the queue will “blow up” at the stage with insufficient capacity.
58
Open Queueing Networks Open queuing networks are a generalization of queues
in series. Assume that station j consists of sj exponential servers, each operating at rate µj.
Customers are assumed to arrive at station j from outside the queuing system at rate rj.
These interarrival times are assumed to be exponentially distributed.
Once completing service at station i, a customer joins the queue at station j with probability pij and completes service with probability
59
Open Queueing Networks
Define λj, the rate at which customers arrive at station j.
λ1, λ2,… λk can be found by solving the following systems of linear equations:
This follows, because a fraction pij of the λi arrivals to station i will next go to station j.
Suppose the sjµj > λj holds for all stations.
60
Open Queueing Networks
Then it can be shown that the probability distribution of the number of customers present at station j and the expected number of customers present at station j can be found by treating station j as an M/M/sj/GD/∞/∞ system with arrival rate λj and service rate µj.
If for some j, sj µj≤ λj, then no steady-state distribution of customers exists.
Remarkably, the number of customers present at each station are independent random variables.
61
Open Queueing Networks That is, knowledge of the number of people at all stations
other than station j tells us nothing about the distribution of the number of people at stations j!
This result does not hold, however, if either interarrival or service times are not exponential.
To find L, the expected number of customers in the queuing system, simply add up the expected number of customers present at each station.
To find W, the average time a customer spends in the system, simply apply the formula L=λW to the entire system.
62
The M/G/s/GD/s/∞ System (Blocked Customers Cleared)
In many queuing systems, an arrival who finds all servers occupied is, for all practical purposes, lost to the system.
If arrivals who find all servers occupied leave the system, we call the system a blocked customers cleared, or BCC, system.
Assuming that interarrival times are exponential, such a system may be modeled as an M/G/s/GD/s/∞ system.
63
In most BCC systems, primary interest is focused on the fraction of all arrivals that are turned away.
Since arrivals are turned away only when s customers are present, a fraction πs of all arrivals will be turned away.
Hence, an average of λπs arrivals per unit time will be lost to the system.
Since an average of λ(1-πs) arrivals per unit time will actually enter the system, we may conclude that
µπλ )1( s
sLL−==
64
For an M/G/s/GD/s/∞ system, it can be shown
that πs depends on the service time distribution only through its mean (1/µ).
The corresponding formula is known as Erlang’s loss formula.
In other words, any M/G/s/GD/s/∞ system with an arrival rate λ and mean service time of 1/µ will have the same value of πs.