Académique Documents
Professionnel Documents
Culture Documents
Prof C S P Rao
Dept. of Mechanical Engg
N I T, Warangal
Who was Markov?
Andrei A. Markov graduated from Saint
Petersburg University in 1878 and
subsequently became a professor there.
2
Markov Process
Markov process is a simple stochastic
process in which the distribution of
future states depends only on the
present state and not on how it arrived
in the present state.
5
Markov Chain
Let {Xt : t is in T} be a stochastic process with
discrete-state space S and discrete-time space
T satisfying
P(Xn+1 = j|Xn = i, Xn-1 = in-1, · · ·,X0 = i0)
= P(Xn+1 = j|Xn = i)
for any set of state i0, i1, · · · , in-1, i, j in S and n
≥ 0 is called a Markov Chain.
6
Markov Model
Sometimes Markov Model
restricts attention to Markov
chains with stationary transition
probabilities. But some people
tend to avoid this usage for sake of
confusion.
Markov Model is also used to
refer to all Markov processes
that satisfying Markov Property. 7
Components of Stochastic Processes
9
Discrete-Time Markov
Chains
10
Discrete-Time Markov
Chain
A stochastic process { Xn } where n ∈ N = { 0, 1, 2, . . . } is
called a discrete-time Markov chain if
Pr{ Xn+1 = j | X0 = k0, . . . , Xn-1 = kn-1, Xn = i }
11
Stationary Transition
Probabilities
Pr{ Xn+1 = j | Xn = i } = Pr{ X1 = j |X0 = i } for all n
(They don’t change over time)
We will only consider stationary Markov chains.
17
An NC machine processing three types of parts
18
Suppose that the NC machines processes the
parts in a cyclic way i.e. type 1 part followed
by type 2, followed by type 3 part and the
same sequence is repeated again and again.
The state transition diagram is shown below
0 1 0
The TPM of the system is
P 0 0 1
1 0 0
Suppose that the type of the next part to be
processed is selected probabilistically: part
type i is chosen next with probability qi = (i =
1,2,3…), where 0 <qi <1, q1+q2+q3 = 1.
In this case, the state transition diagram and
TPM are shown in figure below
q1 q2 q3
P q1 q2 q3
q1 q2 q3
Example 3
Consider the queuing network shown in figure
below.
After transportation by the AGV, the part leaves the system with
probability q0 or undergoes one more operation on one of the
machines with probabilities q1, q2, …. Qm.
21
Let there be a single job in this system and let us look at the
progress of this job in the system.
It is easy to note that the job can be in (m+1) states.
0 (if getting serviced by AGV)
i (if getting served by Mi, i=1,2,…m)
The flow of the job can be described by a DTMC model.
The TPM of this model is q0 q1 q2 ....qm
1 0 0 ....0
P 1 0 0 ....0
.......................
1 0 0 ....0
DTMC model for central server network
23
An Example Problem -- Gambler’s
Ruin
At time zero, I have X0 = $2, and each day I make a $1 bet.
I win with probability p and lose with probability 1– p.
I’ll quit if I ever obtain $4 or if I lose all my money.
Xt = amount of money I have after the bet on day t.
3 with probability p
So, X1 = { 1 with probability 1 – p
25
Transition Matrix of the Gambler’s
problem
At time zero I have X0 = $2, and each day I make a $1 bet.
I win with probability p and lose with probability 1– p.
I’ll quit if I ever obtain $4 or if I lose all my money.
Xt = amount of money I have after the bet on day t.
0 1 2 3 4
0 1 0 0 0 0
1 1-p 0 p 0 0
2 0 1-p 0 p 0
3 0 0 1-p 0 p
State Transition Diagram
1-p p p p
0 1
1
22 3
3 4
4
1-p 1-p
1 1
27
Printer Repair Problem
• Two printers are used for Russ Center.
(0.6)
State-Transition Network:
0
Node for each state,
(0.1) (0.3)
Arc from node i to node j if pij > 0.
(1) (0.8)
2 1
For printer repair example
(0.2)
Market Share/Brand Switching
Problem
Market Share Problem:
You are given the original market of three companies. The
following table gives the number of consumers that
switches from brand i to brand j in two consecutive weeks
Brand (a) 1 2 3
(i)
33
Assumption Revisited
• Markov Property
Pr{ Xt+1 = j | X0 = k0, . . . , Xt-1 = kt-1, Xt = i }
• Stationary Property
34
Transform a Process to a Markov
Chain
Specifically,
P{ rain tomorrowrain last 2 days (RR)} = .7
P{ rain tomorrowrain today but not yesterday (NR)} = .5
P{ rain tomorrowrain yesterday but not today (RN)} = .4
P{ rain tomorrowno rain in last 2 days (NN)} = .2
36
Choosing Balls from an Urn
An urn contains two unpainted balls at present. We
choose a ball at random and flip a coin.
Historical statistics:
2. If a customer had an accident last year then they
have a 10% chance of having one this year;
3. If they had no accident last year then they have a
3% chance of having one this year.
38
Find the steady-state probability and the long-run
average annual premium paid by the customer.
39
State-Transition Network for
Insurance Company
40
Solving the steady – state equations:
Solution:
π(N,N) = 0.939, π(N,Y) = 0.029, π(Y,N) = 0.029, π(Y,Y) = 0.003
42
Computations for All States Recurrent
If the probability of eventually visiting state j given
that we start in i is 1 then the expected number
of steps until we first visit j is given by
µ03 0=
(Y, Y) 1 + 00.97µ03
.90 + 0.03µ
.10 13
µ13 = 1 + 0.9µ23
µ23 = 1 + 0.97µ03 + 0.03µ13
48
Property of Continuous Time Markov
Chain
Examples
Poisson Process
The Birth/Death Processes in General
The M/M/s queue
Brown Motion
Illustration
The M/M/s queue
50
An ATM example (M/M/1/5 Queue)
Manager’s Questions
λ0 λ1 λ2 λ3 λ4
0 1 2 3 4 5
µ1 µ2 µ3 µ3 µ3
Steady State Probability
What is the long term steady state
probability?
54
Balance Equations
λ λ λ λ λ
0 1 2 3 4 5
µ µ µ µ µ
λ λ λ λ λ
0 1 2 3 4 5
µ 2µ 2µ 2µ 2µ
59
Rate Matrix & Solution with
M/M/2/5
Rate Matrix
State
s 0 1 2 3 4 5
0 0 2 0 0 0 0
1 2.5 0 2 0 0 0
2 0 5 0 2 0 0
3 0 0 5 0 2 0
4 0 0 0 5 0 2
5 0 0 0 0 5 0
Solution
State 0 State 1 State 2 State 3 State 4 State 5
0.431 0.345 0.137 0.055 0.022 0.009
M/M/3/5
0 1 2 3 4 5
µ 2µ 3µ 3µ 3µ
61
Rate Matrix & Solution with M/M/3/5
Rate Matrix
State
s 0 1 2 3 4 5
0 0 2 0 0 0 0
1 2.5 0 2 0 0 0
2 0 5 0 2 0 0
3 0 0 7.5 0 2 0
4 0 0 0 7.5 0 2
5 0 0 0 0 7.5 0
Solution
State 0 State 1 State 2 State 3 State 4 State 5
0.448 0.359 0.143 0.038 0.010 0.0027
Comparison of different alternatives
M/M/1/5 and M/M/2/5 and M/M/3/5
0 1 2 3 …. 8
µ µ µ µ µ
0 1 2 3 …. 12
µ µ µ µ µ
64
Comparison of different alternatives
M/M/1/5 and M/M/2/5 and M/M/3/5
Approach
Notice you have to differentiate the two server now
Let us use (HS, MS, # waiting) to represent the system,
suppose the foyer can hold at most 5 people
(0,0,0), (0,1,0), (0,1,0), (1,1,0), (1,1,1), (1,1,2), (1,1,3)
Addition of a Human
Server
State: (HS, MS, # waiting)
λ (1,0,0) λ λ λ λ
µm 1,1,0) 1,1,1) 1,1,2) 1,1,3)
(0,0,0) µh
µh
(0,1,0) µm+ µh µm+ µh µm+ µh
µm λ
67
Addition of Human Server
Rate Matrix 0,0, 0,1, 1,0, 1,1, 1,1, 1,1, 1,1,
States 0 0 0 0 1 2 3
0,0,0 0 0 2 0 0 0 0
0,1,0 2.5 0 0 2 0 0 0
1,0,0 1 0 0 2 0 0 0
1,1,0 0 1 2.5 0 2 0 0
1,1,1 0 0 0 3.5 0 2 0
1,1,2 0 0 0 0 3.5 0 2
1,1,3 0 0 0 0 0 3.5 2
Solution
States
Solutio 0,0,0
0.21 0,1,0 1,0,0
0.31 1,1,0
0.20 1,1,1
0.11 1,1,2 1,1,3
n 4 0.046 3 5 7 0.067 0.038
A Queue With Finite Input Sources
69
A Queue With Finite Input Sources
One Bay
6×1/3 5×1/3 4×1/3 3×1/3 1×1/3
0 1 2 3 …. 6
4 4 4 4 4
Two Bay
6×1/3 5×1/3 4×1/3 3×1/3 1×1/3
0 1 2 3 …. 6
70
A Queue With Finite Input Sources (1
Bay)
Rate Matrix
States 0 1 2 3 4 5 6
0 0 2 0
1.66 0 0 0 0
1 4 0 7 0
1.33 0 0 0
2 0 4 0 3 0 0 0
3 0 0 4 0 1 0
0.66 0
4 0 0 0 4 0 7 0
0.33
5 0 0 0 0 4 0 3
6 0 0 0 0 0 4 0
Solution
States
Solutio 0
0.55 1 2
0.11 3
0.03 4
0.01 5
0.00 6
n 6 0.278 6 9 0 2 0
A Queue With Finite Input Sources (2
Bay)
Rate Matrix
States 0 1 2 3 4 5 6
0 0 2 0
1.66 0 0 0 0
1 4 0 7 0
1.33 0 0 0
2 0 8 0 3 0 0 0
3 0 0 8 0 1 0
0.66 0
4 0 0 0 8 0 7 0
0.33
5 0 0 0 0 8 0 3
6 0 0 0 0 0 8 0
Solution
States
Solutio 0
0.61 1 2
0.06 3
0.01 4
0.00 5 6
n 6 0.308 4 1 1 0 0
Economics With These Results
73
Probability Transitions:
Service with Rework
Consider a machine operation in which there is a 0.4
probability that on completion, a processed part will
not be within tolerance.
If the part is unacceptable, the operation is repeated
immediately. This is called rework.
Assume that the second try is always successful
What will the system looks like if
a) Arrivals can occur only when the machine is idle
b) Arrivals can occur any time
74
Probability Transitions:
Service with Rework
a) Arrivals can occur only when the machine is idle
a 0.4d1
i w rw
0.6d1
0.6d2
0.6d1 0.6d1
75
An ATM with a Human Server
Consider an ATM located together with a Human Server at
the foyer of a bank. The foyer is limited in size and when
there are more than five people, arriving customers will balk
Statistics indicates that the average time between arrivals
is exponential distributed with an average of 30 seconds, or
2 customer per minute
The service time of the ATM is exponential distributed with
an average of 24 seconds. or 2.5 customers per minutes.
The service time of human server is exponential distributed
with an average of 1 minute per customer.
It is further assumed that when a customer enters into the
system, he/she would prefer to go to the human server first
if the server is available.
CTMC Model for ATM and
Human Server
State: (HS, MS, # waiting)
λ (1,0,0) λ λ λ λ
µm 1,1,0) 1,1,1) 1,1,2) 1,1,3)
(0,0,0) µh
µh
(0,1,0) µm+ µh µm+ µh µm+ µh
µm λ
77
CTMC Model for ATM and Human
Server
Rate Matrix 0,0, 0,1, 1,0, 1,1, 1,1, 1,1, 1,1,
States 0 0 0 0 1 2 3
0,0,0 0 0 2 0 0 0 0
0,1,0 2.5 0 0 2 0 0 0
1,0,0 1 0 0 2 0 0 0
1,1,0 0 1 2.5 0 2 0 0
1,1,1 0 0 0 3.5 0 2 0
1,1,2 0 0 0 0 3.5 0 2
1,1,3 0 0 0 0 0 3.5 2
Solution
1,1,
States
Solutio 0,0,0
0.21 0,1,0 1,0,0
0.31 1,1,0 1 1,1,2
0.20 0.11 0.06 1,1,3
0.03
n 4 0.046 3 5 7 7 8
Birth & Death Process
Pure Birth Process; e.g., Hurricanes
0
a0
1
a1
2
a2
3
a3
4 …
0 1 2 3 4 …
d1 d2 d3 d4
79
Pure Birth Process – Poisson Process
0
a0
1
a1
2
a2
3
a3
4 …
81
Pure Death Process
82
An Example
84
Assumption Revisited
Service time: Exponential ?
85
A Machine Repair Example
A factory contains two major machines which fails
independently according to a exponential
distribution with a mean time of 10 per hour
86
State-Transition Diagram
λ = rate at which a single machine breaks down
= 1/10 hr
87
Balance Equations for Repair Example
µπ1 = 2λπ0
λπ1 = µπ2
We can solve these balance equations for π0, π1 and π2,
but in this case, we can simply use the formulas
that solve general birth-and-death equations:
λn-1 … λ0
Cn = πn = Cnπ0 and π0 = 1 / Σn=0,∞ Cn
µn … µ1
88
Here, λ0 = 2λ µ1 = µ
λ1 = λ µ2 = µ
λ2 = λ
λ0 2λ λ1λ0 2λ2
C1 = µ = µ C2 = µ µ =
1 2 1 µ2
π2 = 2λ2
π = 0.330
µ2 0
1 L = 1 1 1
W=— (1.072) Wq = — Lq = 0.0928 (0.33)
λ 0.0928 λ
= 11.55 hours = 3.56 hours
Average amount of time Average amount of time that a
that a machine has to wait machine has to wait until the
to be repaired, including repairman initiates the work.
the time until the repairman
initiates the work.
Proportion of time repairman is busy = π1 + π2 = 0.742
Proportion of time that machine #1 is working
1 1
= π0 + π1 = 0.258 + (0.412) = 0.464
2 2