Why Wait?!? Bryan Gorney Josh Staidl Matt Boche

advertisement
Why Wait?!?
Bryan Gorney
Joe Walker
Dave Mertz
Josh Staidl
Matt Boche
Purpose:
To minimize costs of businesses with waiting
lines, taking into consideration the cost of
servers and the long-run loss of revenue by
making customers wait too long.
Outline:
I.
Rudiments of Queuing Theory
a. 1 Customer, 1 Server
b. Many Customer, No Server
c. Many Customers, 1 Server
II. Concept of a Stationary Distribution
III. Traffic Intensity
a. Average Queue Length
b. Little’s Principle
c. Average Waiting Time
IV. Store Profit Maximization
1 Customer, 1 Server
•
•
•
•
N(t) = number of individuals at checkout counter at time t.
N(t) has only two possible values of 0 or 1.
“being served” corresponds to N(t) = 1.
“finished being served” corresponds to N(t) = 0.
To obtain the time-dependent transition probabilities for
this Markov chain, let
Xt =
( )
p(t)
q(t)
be the time-dependent distribution vector for the states
“being served” and “finished being served”.
That is,
p(t) = P[N(t) = 1]
and
q(t) = P[N(t) = 0]
• q(t) = 1 – p(t)
• lim p(t) = 0
t 
lim Xt =
t 
()
0
1
State diagram
mDt
1
0
1 - mDt
 P[service is completed in Dt] = mDt
 P[service is not completed in Dt] = 1 – mDt
1
 The transition matrix for each Dt time step is given by
A=
(
1 – mDt 0
mDt
1
)
 Thus,
Xt+Dt = AXt
which in matrix form gives:
(
p(t + Dt)
q(t + Dt)
) =(
1 – mDt 0
mDt
)( )
1
p(t)
q(t)
 Performing matrix multiplication yields:
p(t + Dt) = (1 – mDt)p(t)
 Rearranging so difference quotient is on the left-hand side:
p(t + Dt) – p(t)
Dt
=
-mp(t)
 By letting Dt go to zero, the difference quotient becomes a
derivative, and
p’(t) = lim
Dt
0
p(t + Dt) – p(t)
Dt
= -mp(t)
 This is the exponential differential equation with solution:
p(t) = P[N(t) = 1] = p0e-mt
 Since we assumed that there is an individual initially being
served, N(0) = 1. This implies that p(0) = 1 which gives
p0 = 1. Finally we have:
p(t) = P[N(t) = 1] = e-mt
 Since q(t) = 1 – p(t), the probability of completing the
service is:
q(t) = 1 – e-mt
• Next let T denote the time at which service is completed.
It is considered to be the time until transition from one
state to another.
• T is a continuous random variable with range 0 < T < .
• P[T > t] = P[N(t) = 1].
• P[T < t] = 1 – e-mt (complement).
• Left-hand side = cumulative distribution function of the
continuous random variable T.
• Right-hand side = exponential distribution.
 P[T > s + t given T > s] = P[T > t] (Memoryless property)
for all s,t > 0.
 Density function is the derivative of the cumulative
distribution which is:
f(t) = d P[T < t] = me-mt, 0 < t < .
dt
 E(T) =  tf(t)dt =  tme-mtdt = 1m


0
0
 Thus the average value of T is
rate m as:
m=
1
m
. We interpret the service
1
Mean Time Until Transition
Many Customers, No Server
Let N(t) be a time dependent function that denotes the number
of customer arrivals in a given interval [0,t], and assume the
following:
1. The probability that an arrival occurs in a short interval
[t, t+Dt] is proportional to the length of the interval Dt.
In symbols:
 P[ N(t+Dt) - N(t) = 1] = Dt
for some constant  >0.
2. The Memoryless Property:
The probability that an arrival occurs in [t, t+Dt] does
not depend on the time of previous arrivals:
 P[ N(t+Dt) – N(t) = n | N(s) = m ] = P[ N(t+Dt) – N(t) = n]
for all 0  s  t.
3. Occurrences of arrivals in non-overlapping intervals are
independent.
4. The Probability of two or more arrivals in [t, t+Dt] is negligible.
Assume Pn(t) = P[N(t) = n]
N(t) has possible values 0,1,2,… since it is possible
to have any number of customers in line.
Considering a time step of size Dt, N(t) forms a Markov
Chain, with a transition matrix of:
A=
(
1-Dt
0
0
0...
Dt 1-Dt
0
0...
0
Dt 1- Dt 0 . . .
)
State Diagram of Transition Matrix
Dt
1-Dt
Dt
1-Dt
Dt
1-Dt
Xt+Dt = AXt is the state equation for each time step
size Dt, where:
Xt =
P0(t)
P1(t)
:
Pn(t)
:
( )
After Matrix Multiplication: we have the following
system of equations:
P0(t+Dt) = (1-Dt)P0(t)
P1(t+Dt) = DtP0(t)+(1-Dt)P1(t)
Pn(t+Dt) = DtPn-1(t)+(1-Dt)Pn(t)
These equations can then be rearranged to make
difference quotients.
Letting Dt go to zero we obtain a system of differential
equations. For n  1,
 Pn’(t) =
Pn(t+ Dt) – Pn(t)
limDt0
Dt
= [Pn-1(t) – Pn(t)],
and for n = 0,
P0’(t) = -P0(t)
 This equation is the exponential differential
equation with initial condition that there are
no arrivals (P0(0) = 1). This gives:
P0(t) = e-t
Similarly, letting n=1,
P1’(t) = [P0(t)- P1(t)]
= [e-t - P1(t)]
This is a first-order linear differential equation
which can be solved by multiplying by the
integrating factor et.
d
[etP1(t)] = so that etP1(t) = t+c
dt
The initial condition P0(0) =1 implies Pn(0) = 0
for all n  1, thus:
P1(t) = te-t
It can be shown by induction that the system of
differential equations has solution:
Pn(t) = e-t(t)n
n!
for t0, n = 0,1,2,…
•Known as a homogeneous Poisson process
with rate . ( does not depend on time variable
t)
•Mean is t (t customers during time interval
of length t)
Ex. = 2 customers/minute, t =5 minutes
t = 5*2 = 10 customers over 5 minutes
Many Customers, 1 Server
• Let N(t) = number of individuals at
checkout counter at time t.
• N(t) = any of the integer values 0, 1, 2, … at
time t.
• Probability of arrival in Dt is Dt.
• Probability of departure in Dt is mDt.
• Three mutually exclusive events:
I. Exactly one arrival in (t,t + Dt)
II. Exactly one departure in (t,t + Dt)
III. No arrivals or departures in (t,t + Dt).
Dt
0
1 – Dt
Dt
1
Dt
2
mDt
mDt
mDt
1 – Dt - mDt
1 – Dt - mDt
• The time step for this Markov chain is Dt
and the transition matrix is:
(
1-Dt
A=
mDt
Dt 1 – mDt – Dt
0
..
.
Dt
..
.
0
0
0 …
mDt
0
0 …
)
1 – mDt – Dt mDt 0 …
..
..
..
.
.
.
• Let Pn(t) = P[N(t) = n] be the probability
that there are n customers in the queue at
time t. Thus letting
P0(t)
P1(t)
Xt =
..
.
Pn(t)
..
.
• We obtain the equation Xt + Dt = AXt for the
single-server queue.
• The state equation gives the following
(infinite) system of equations for the singleserver queue:
P0(t + Dt) = (1 – Dt)P0(t) + mDtP2(t)
P1(t + Dt) = (1 – Dt - mDt)P1(t) + DtP0(t) + mDtP2(t)
..
.
Pn(t + Dt) = (1 – Dt - mDt)Pn(t) + DtP0 - 1(t) + mDtPn + 1(t)
..
.
 System of differential equations by letting
Dt go to zero; more specifically, for n > 1,
Pn(t + Dt) – Pn(t)
P’n(t) = lim
Dt 0
Dt
= -( + m)Pn(t) + Pn – 1(t) + mPn – 1(t)
And, P0’(t) = -P0(t) + mP1(t).
Many classical methods are available for the solving the
system:
Pn’(t) = -( + m)Pn(t) + Pn – 1(t) + mPn – 1(t)
P0’(t) = -P0(t) + mP1(t)
However, they involve ideas beyond the scope of our analysis instead, we will be using the system of equations to obtain
steady-state (time-independent) behavior.
Stationary Distribution
Looking for whether the system of time-dependent probabilities
settles down and displays no more “transient” behavior - analogous
to finding the fixed points for deterministic systems. In this case,
the fixed points will be “stationary” distributions.
The system of differential equations:
Pn’(t) = -( + m)Pn(t) + Pn – 1(t) + mPn – 1(t)
P0’(t) = -P0(t) + mP1(t)
has a fixed point or stationary distribution provided its rates of
change are zero, that is:
Pn’(t) = 0 for n  0.
lim Pn’(t) = 0 for n  0, is equivalent to assuming that
t 
lim Pn(t) = Pn exists, where Pn does not depend upon t.
t 
Applying Pn’(t) = 0 to the system of equations, we obtain:
1.) 0 = -P0 + mP1
and
2.) 0 = -( + m)Pn + Pn-1 + mPn+l, for n > 1.
Solving for P1, using equation 1:
P1 = ( / m) P0
Solving for P2, using P1 and equation 2:
P2 = ( / m)2 P0
Continuing on, using induction, shows:
Pn = ( / m)n P0
Queue size must be a non-negative integer, hence,
P0 + P1 + P2 + … = 1
So,
P0 + (/m)P0 + (/m)2P0+ … = 1
Which is,
P0

Σ (/m)
n
= 1.
n=0
This sums to 1/(1-(/m)) provided that (/m) < 1, which is the
condition for the stationary distribution.
Using this sum, P0 = 1 – (/m), so the stationary distribution for
the single-server queue is:
Pn = (/m)n(1-(/m))
Traffic Intensity
• Average Queue Length
• Little’s Principle
• Average Waiting Time
Average Queue Length
Let ρ = (λ / μ). (called the traffic intensity of the queue)
By assumption, ρ < 1, as λ < μ.
Using ρ in: Pn = (λ / μ)n (1 – (λ / μ)),
Pn = ρn (1 – ρ).
Obtaining the average number Na of customers in the queue:

Na = E(N) =

Σ nP = Σ n(ρ (1 – ρ))
n
n=0
n
n=0

Σ
= (1 – ρ) n = 0 nρn = (1 – ρ)


Σ ρnρ
n-1
n=0
d ρn
d  n
= (1 – ρ)ρ
= (1 – ρ)ρ dρ ρ
dρ
n=0
n=0
Σ
Σ
d (1 / (1 – ρ))
= (1 – ρ)ρ dρ
= (1 – ρ)ρ(1 – ρ)-2
ρ
=
ρ-1
ρ
Na =
ρ-1
Average Number of Customers in Queue
10
9
Number of Customers
8
7
6
5
4
3
2
1
0
0
0.2
0.4
0.6
Traffic Intensity (p)
0.8
0.9
1
Average Waiting Time
Little’s Principle – the average number of customers in a
queueing system is equal to the average arrival rate of
customers to that system times the average time spent in
that system.
Na = λTa
Ta = Na / λ = (ρ / ((1 – ρ)λ) = ((λ / μ) / ((1 – (λ / μ))λ))
= (1 / μ) / (1 – (λ / μ)) = (1 / μ) / (1 – ρ) = 1/(μ - λ)
Ta = 1/ (μ – λ )
Average Waiting Time
12
Units of Time
10
8
6
4
2
0
0
0.2
0.4
0.6
Traffic Intensity
0.8
0.9
1
Model Formulation of Store Profit Maximization
C(ŧ), which is the Customer Attrition Function, models
the loss of profit per day and is given below:
C(ŧ) =
0
for ŧ  Ta0
ATa0
for ŧ  Ta0
{
 Ta0 represents the threshold where customers stop
returning to the store due to long waiting times.
Graph of Customer Attrition Function
C(ŧ)
Ŧ0
ŧ
C(ŧ) = C(1/(μ-λ)) for one server
C(ŧ) = C(1/(μ-λ)) for  servers
This models the loss of profit due to customers having
to wait in lines
Customer waiting costs plus employee costs
J() = C(1/(μ-λ)) +K 
1<
 = # number of employees (checkers)
K = cost associated with retaining those employees
Conclusion
The object of the manager is to minimize J() by
finding the number of employees that eliminates
the attrition factor by decreasing costs.
References
A Course in Mathematical Modeling, by Douglas Mooney
and Randall Swift
Dr. Steve Deckelman
Download