Professional Documents
Culture Documents
Description
Each of us has spent a great deal of time waiting in lines. In this chapter, we develop mathematical models for waiting lines, or queues.
Queue Discipline
The queue discipline describes the method used to determine the order in which customers are served. The most common queue discipline is the FCFS discipline (first come, first served), in which customers are served in the order of their arrival. Under the LCFS discipline (last come, first served), the most recent arrivals are the first to enter service. If the next customer to enter service is randomly chosen from those customers waiting for service it is referred to as the SIRO discipline (service in random order).
6
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 a 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.
7
Stationary interarrival times is 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
P(A e c) ! a(t ) dt and P (A " c) ! a(t )dt
0 c c g
! ta (t )dt
0
We define to be the arrival rate, which will have units of arrivals per hour. An important question is how to choose A to reflect reality and still be computationally tractable. The most common choice for A is the exponential distribution. An exponential distribution with parameter has a density a(t) = e- t. We can show that the average or mean interarrival 1 E (A) ! . time is given by P
10
Using the fact that var A = E(A2) E(A)2, we can show that
var A ! 1 P2
Lemma 1: If A has an exponential distribution, then for all nonnegative values of t and h,
P ( A " t h | A u t ) ! P ( A " h)
11
A density function that satisfies the equation is said to have the no-memory property. The no-memory 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.
12
A discrete random variable N has a Poisson distribution with parameter if, for n=0,1,2,,
e P Pn P(N ! n) ! (n ! 0,1,2,...) n!
What assumptions are required for interarrival times to be exponential? Consider the following two assumptions:
Arrivals defined on nonoverlapping time intervals are independent. For small t, the probability of one arrival occurring between times t and t + t is t+o( t) refers to any o ( (t ) quantity satisfying lim !0
(t p0
(t
14
Theorem 2: If assumption 1 and 2 hold, then Nt follows a Poisson distribution with parameter t, and interarrival times are exponential with parameter ; that is, a(t) = e- t. Theorem 2 states that if the arrival rate is stationary, if bulk arrives cannot occur, and if past arrivals do not affect future arrivals, then interarrival times will follow an exponential distribution with parameter , and the number of arrivals in any interval of length t is Poisson with parameter t.
15
Using integration by parts, we can show that if T is an Erlang distribution with rate parameter R and shape parameter k, then
k k E (T) ! and var T ! 2 R R
The Erlang can be viewed as the sum of independent and identically distributed exponential random variable with rate 1/Q
17
19
For this reason, we often assume that s(t) is an Erlang distribution with shape parameters k and rate parameter k. In certain situations, interarrival or service times may be modeled as having zero variance; in this case, interarrival or service times are considered to be deterministic. For example, if interarrival times are deterministic, then each interarrival time will be exactly 1/ , and if service times are deterministic, each customers service time is exactly 1/.
21
The first characteristic specifies the nature of the arrival process. The following standard abbreviations are used:
M = Interarrival times are independent, identically distributed (iid) and exponentially distributed D = Interarrival times are iid and deterministic Ek = Interarrival times are iid Erlangs with shape parameter k. GI = Interarrival times are iid and governed by some general distribution
23
24
The third characteristic is the number of parallel servers. The fourth characteristic describes the queue discipline:
FCFS = First come, first served LCFS = Last come, first served SIRO = Service in random order GD = General queue discipline
The fifth characteristic specifies the maximum allowable number of customers in the system. The sixth characteristic gives the size of the population from which customers are drawn.
25
In many important models 4/5/6 is GD//. If this is the case, then 4/5/6 is often omitted. M/E2/8/FCFS/10/ might represent a health clinic with 8 doctors, exponential interarrival times, twophase Erlang service times, a FCFS queue discipline, and a total capacity of 10 patients.
26
A birth-death process is a continuous-time stochastic process for which the systems state at any time is a nonnegative integer.
29
Law 1
Law 2
With probability j t+o( t), a death occurs between time t and time t + 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.
30
31
T 1Q1 ! T 0 P0
The above equations are often called the flow balance equations, or conservation of flow equations, for a birth-death process.
32
Each circle representing a state (i.e., number of customer in the system) has an unknown probability pj, j= 0, 1, 2, associated with it
33
34
Cj = (
j-1)/(1
2 3.. j)
T j ! T 0 c j ( j ! 1,2,...)
35
j !g j !1
cj
0:
1 c j
j !1
It can be shown that if c 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 !1 j
j !g
36
T 0 ! 1 p (0 e p 1) T j ! p j (1 p ) (0 e p 1)
If p 1, however, the infinite sum blows up. Thus, if p 1, no steady-state distribution exists.
37
Derivation of L
Throughout the rest of this section, we assume that p<1, ensuring that a steady-state probability distribution does exist. The steady state has been reached, the average number of customers in the queuing system (call it L) is given by
j !g j !0 j !g j !0
L ! jT j ! jp j (1 p)
j !g
! (1 p) jp j
j !0
and
38
L ! (1 p )
p p P ! ! (1 p ) 2 1 p Q P
Derivation of Lq
In some circumstances, we are interested in the expected number of people waiting in line (or in the queue). We denote this number by Lq.
p p2 P2 Lq ! p! ! 1 p 1 p Q (Q P )
j !g
Lq ! ( j 1)T j
j !1
39
Derivation of Ls
Also of interest is Ls, the expected number of customers in service.
Ls ! 0T 0 1(T 1 T 2 . ) ! 1 T 0 ! 1 (1 p ) ! p
p p2 Lq ! L Ls ! p! 1 p 1 p
Tj ! PQ P T0 Q Q
j 1
40
41
L = average number of customers present in the queuing system Lq = average number of customers waiting in line Ls = average number of customers in service W = average time a customer spends in the system Wq = average time a customer spends in line Ws = average time a customer spends in service
Theorem 3 For any queuing system in which a steadystate distribution exists, the following relations hold: L= W Lq = Wq Ls = Ws
42
Example 4
Suppose that all car owners fill up when their tanks are exactly half full. At the present time, an average of 7.5 customers per hour arrive at a single-pump gas station. It takes an average of 4 minutes to service a car. Assume that interarrival and service times are both exponential.
1. For the present situation, compute L and W.
43
2. Suppose that a gas shortage occurs and panic buying takes place.
To model the phenomenon, suppose that all car owners now purchase gas when their tank are exactly three-fourths full. Since each car owner is now putting less gas into the tank during each visit to the station, we assume that the average service time has been reduced to 3 1/3 minutes. How has panic buying affected L and W?
44
Solutions
1. We have an M/M/1/GD// system with = 7.5 cars per hour and = 15 cars per hour. Thus p = 7.5/15 = .50. L = .50/1-.50 = 1, and W = L/ = 1/7.5 = 0.13 hour. Hence, in this situation, everything is under control, and long lines appear to be unlikely. 2. We now have an M/M/1/GD// system with = 2(7.5) = 15 cars per hour. Now = 60/3.333 = 18 cars per hour, and p = 15/18 = 5/6. Then
5 L 5 1 L ! 6 ! 5 cars and W ! ! ! hours ! 20minutes 5 P 15 3 1 6
Problems in which a decision maker must choose between alternative queuing systems are called queuing optimization problems.
46
More on L = W
The queuing formula L = W is very general and can be applied to many situations that do not seem to be queuing problems.
L = average amount of quantity present. = Rate at which quantity arrives at system. W = average time a unit of quantity spends in system.
Then L = W or W = L/
47
A Simple Example
Example
Our local MacDonalds uses an average of 10,000 pounds of potatoes per week. The average number of pounds of potatoes on hand is 5000 pounds. On the average, how long do potatoes stay in the restaurant before being used?
Solution
We are given that L=5000 pounds and = 10,000 pounds/week. Therefore W = 5000 pounds/(10,000 pounds/week)=.5 weeks.
48
49
50
51
Slide 51 MSOffice1
, 11/3/2003
L ! PW
52
P!
j 0 1 . . c . . 0
j
P Tj ! T 0 Q 1 V , ifV { 1 T0 ! c 1 1 V
53
T0 !
1 , ifV ! 1 c 1
54
Q=2 Q=2 Q=2 p0 P = p1 Q p1 P+ p1 Q = p0 P + p2 Q p2 P+ p2 Q = p1 P + p3Q p2 P= p3 Q p0 + p1 + p2 + p3 = 1 Substituting the values of P = 1 and Q = 2, we have 2p1 = p0 p0 + 2p2 = 3p1 p1+2p3 = 2p2 p2 = 2p3 p0 + p1 + p2 + p3 = 1 p0 = 8/15, p1 = 4/15, p2 = 2/15, and p3 = 1/15
For the M/M/1/GD/c/ system, a steady state will exist even if . This is because, even if , the finite capacity of the system prevents the number of people in the system from blowing up.
55
Qj 0
1 2 . s s+1 .
Q 2Q . sQ sQ . sQ
57
Summarizing, we find that the M/M/s/GD// system can be modeled as a birth-death process with parameters
Pj ! P ( j ! 0,1,...) Q j ! jQ ( j ! 0,1,..., s) Q j ! sQ ( j ! s 1, s 2,...)
58
i !0
sV
i
i!
sV
s
s!(1 V )
Tj ! Tj !
sV
j T 0
j!
(j ! 1,2,...., s) (j ! s, s 1, s 2.....)
sV
j T 0
s! s
js
P(j u s) !
sV
s T 0
s!(1 V ) P( j u s) g ! ( j s )Tj Wq ! L q / P ! sQ P j!s
P( j u s) V , Lq ! (1 V ) L ! Lq P / Q
59
P( j u s) 1 W ! L / P ! L q / P 1 / Q ! Wq 1 / Q ! Q sQ P
M/M/s/GD/c/ - Multiple server waiting queue problem with exponential arrival and service times with finite capacity
60
61
62
63
64
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 operated 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 customers time in the system is governed by a distribution S having E(S)= 1/.
65
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.
P L! Q
66
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.
68
Pollaczek and Khinchin showed that for the M/G/1/GD// queuing system,
P2W 2 p 2 Lq ! 2(1 p) L ! Lq p Wq ! Lq P 1 Q
W ! Wq
It can also be shown that 0, the fraction of the time that the server is idle, is 1-p. The result is similar to the one for the M/M/1/GD// system.
69
S ~ Exp (mean ! 1 / Q ), P ! 5 / hr , Q ! 6 / hr , W 2 ! 1 / Q 2 p2 Lq ! ! 4.16 (1 p) S ~ Cons tan t (6), W 2 ! 0 p2 Lq ! ! 2.083 2(1 p) S ~ N (mean ! 10 min, W ! 3 min), W 2 ! (3 / 60)2 (5 / 6)2 52 (3 / 60)2 Lq ! ! 2.27 2(1 5 / 6) S ! S 1 S 2 S 3, Si ~ Exp( mean ! 3.33 min), S ~ Erlang ( R ! 18 / hr , k ! 3) E ( s ) ! K / R ! (3 / 18) ! 1 / Q V ( s ) ! K / R 2 ! 3 / 182 (5 / 6) 52 (3 / 18) Lq ! ! 2.77 2(1 5 / 6)
70
2 2
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.
72
The repair center services the broken machines as if they were arriving at an M/M/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.
73
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.
74
Since each occupied repair worker completes repairs at rate , the death rate j is given by
Q j ! jQ ( j ! 0,1,..., R) Q j ! RQ ( j ! R 1, R 2,...K )
75
Using the steady-state probabilities shown on the previous slide, we can determine the following quantities of interest:
L = expected number of broken machines Lq = expected number of machines waiting for service W = average time a machine spends broken (down time) Wq = average time a machine spends waiting for service
Unfortunately, there are no simple formulas for L, Lq, W, Wq. The best we can do is express these quantities in terms of the js:
76
L W ! j!K P L ! jT j Lq j !0 Wq ! j!K P L ! ( j R )T
q
j!R
P ! PjTj ! (k j )PTj ! P ( k L)
j !0 j !0
77
= 2/day, 1/ = 12 hours,
Qj 0 4, 8,R . R 8,R
78
T T T T
0 1 2 3
Find the expected number of machines working =3-L=3-(1(.4364)+2(.2182)+3(.0545))=3-1.0363=1.9637 Find the utilization of repairman =.4909 Ls= 1(.4364)+2(.2182)+2(.0545)=.9818 Find the expected wait time for the repairman
Wq !
79
Lq
! .0545 / 4 ! .63hours
80
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.
81
82
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:
P j ! r j pij Pi ( j ! 1,2,..., k )
i !1 i!k
This follows, because a fraction pij of the to station i will next go to station j. Suppose sjj > j holds for all stations.
83
arrivals
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. The number of customers present at each station are independent random variables.
84
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 station 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.
85
p1 p2 p3
2 3
P ! p1P 1 p 2P 2 p 3P 3
W=1/(8-5)=.333 =8,s=1
=5
=5+.5(10)=10 =12,s=1
W=1/(12-10)=.5
86
The usual way to treat this problem is to treat each arc as if it is an independent M/M/1 queue and determine the expected time spent by each packet transmitted through that arc by the formula
W! 1 Q P
We are assuming a static routing in which arrival rates to each node do not vary with the state of the network. In reality, many sophisticated dynamic routing schemes have been developed.
88
In most BCC systems, primary interest is focused on the fraction of all arrivals who 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
L ! Ls !
90
P (1 T s ) Q
8.12 How to Tell Whether Interarrival Times and Service Times are Exponential
How can we determine whether the actual data are consistent with the assumption of exponential interarrival times and service times? Suppose for example, that interarrival times of t1, t2, tn have been observed. It can be shown that a reasonable estimate of the arrival rate is given by n
P!
i !n i !1
t
91
It can also be shown that varWFCFS < varWSIRO < var(WLCFS) Since a large variance is usually associated with a random variable that has a relatively large chance of assuming extreme values, the above equation indicates that relatively large waiting times are most likely to occur with an LCFS discipline and least likely to occur with an FCFS discipline.
94
In many organizations, the order in which customers are served depends on the customers type. For example, hospital emergency rooms usually serve seriously ill patients before they serve nonemergency patients. Models in which a customers type determines the order in which customers undergo service are call priority queuing models. The interarrival times of type i customers are exponentially distributed with rate i.
95
Interarrival times of different customer types are assumed to be independent. The service time of a type I customer is described by a random variable Si.
96
Preemptive Priorities
In a preemptive queuing system, a lower priority customer can be bumped from service whenever a higher-priority customer arrives. Once no higher-priority customers are present, the bumped type i customer reenters service. In a preemptive resume model, a customers service continues from the point at which it was interrupted.
98
In a preemptive repeat model, a customer begins service anew each time he or she reenters service. Of course, if service times are exponentially distributed, the resume and repeat disciplines are identical. In the Kendall-Lee notation, we denote a preemptive queuing system by labeling the fourth characteristic PRP.
99
For obvious reasons, preemptive discipline are rarely used if the customers are people.
100
We have assumed the arrival rate, service rate and number of servers has stayed constant over time. This allows us to talk reasonably about the existence of a steady state. In many situations the arrival rate, service rate, and number of servers may vary over time. An example is a fast food restaurant.
It is likely to experience a much larger arrival rate during the time noon-1:30 pm than during other hours of the day. Also the number of servers will vary during the day with more servers available during the busier periods.
101
When the parameters defining the queuing system vary over time we say the queuing system is nonstationary. Consider the fast food restaurant. We call these probability distributions transient probabilities. We now assume that at time t interarrival times are exponential with rate (t) and that s(t) servers are available at time t with service times being exponential with rate (t). We assume the maximum number of customers present at any time is given by N.
102