Try   HackMD

Birth-Death Processes

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

在了解 Markov Chain 的定義及其性質之後,這一節要介紹一種 continuous-time Markovian Chain: Birth-Death Processes。

在 Birth-Death Processes 中,state

n 只會跳到 state
n1
或者 state
n+1
(state
0
只能跳到 state
1
),
n
代表 population in the system。

Transition rate 可表示為:

{λn, nn+1μn, nn1

所謂 Birth 就代表有一個 arrival(

λ 對應的箭頭),使整個系統的 size 增加 1,而從一個 birth 到下一個 birth 發生的間隔時間為 exponential random variable。

所謂 Death 就代表一個 departure(

μ 對應的箭頭),也就是一個 customer 被 server 服務完而離開這個系統,系統的 size 減少 1,而兩個 Death(departure) 之間的時間長度也會是一個 exponential random variable。

由 Birth-Death Processes 延伸,包括日後會學到的

M/M/1,M/M/1/2 等等各式各樣的 queue,這些 queue 都是以 Birth-Death Processes 為基礎,差別只在於 Server 的數量(影響到 service rate(
μ
))以及 System Capacity 的不同(影響到 blocking probability & effective arrival rate(
λeff
))。

分析各種 queue 的第一步就是搞清楚 state transition,畫出各個 state 之間的 arrival & departure(service) rate(如 Figure 2.1),然後運用下面會介紹的 Balanced Equations 求出 steady state probability(

pn) ,有了 steady state probability(
pn
) 就可以進一步分析 queue 的各種 metrics,像是 average system size
L
,以及 average waiting time
W
等等。

因為 Birth-Death Processes 屬於 continuous-time Markov Chain,因此我們可以寫出它的 generator matrix:

Q=[λ0λ0000μ1(λ1+μ1)λ1000λ2(λ2+μ2)λ20]

當 state space 是有限的時候,可用

{PQ=0Pe=1

來求 steady state probability。

PQ=0 的式子經過整理其實就是 Global Balanced Equations。

Global Balanced Equations

首先寫出

PQ=0

{0=pn(λn+μn)+pn1λn1+pn+1μn+1,n>00=p0λ0+p1μ1,n=0

移項:

{pn(λn+μn)=pn1λn1+pn+1μn+1,n>0p0λ0=p1μ1,n=0

Global Balanced Equations 的意義為:在 Steady state,對一個

pn 來說要達到 Flow Balance,就是流進
pn
的 flow(右式)要和流出(左式)相等(見上面 Fig 2.1,注意箭頭的流向)。

將第一式移項,我們可以將

pn+1 表示為:

pn+1=λn+μnμn+1pnλn1μn+1pn1

將第二式移項,我們可以將

p1 表示為:

p1=λ0μ1p0

如此一來我們可以由

p0,p1,p2 開始,不斷往上疊代,代換出
p3,p4,
,下面以
p2
為例:

p2=λ1+μ1μ2p1λ0μ2p0=λ1+μ1μ2λ0μ1p0λ0μ2p0=λ1λ0μ2μ1p0

在代換的過程中我們會發現其規律,

pn 可以被表示成:

pn=λn1λn2λ0μnμn1μ1p0

Detailed Balanced Equations

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

pn1,pn 的中間的flow來說,跨到左邊跟跨到右邊(注意箭頭的流向) In the long term 會平衡(記得教授上課時說的例子:教授在上課期間內,從黑板左側走到右側,以及從右側走到左側的次數會差不多,最多差一次):

{pn1λn1=pnμnpn=λn1μnpn1

繼續代換(將

pn1
pn2
表示,以此類推)即可得到下式
pn=λn1λn2λ0μnμn1μ1p0

不論是 Global or Detailed,最後推導出來的結果都一樣:In steady state(In the long term)

pn=λn1λn2λ0μnμn1μ1p0

Steady State Probability

求解

pn 有三種方法可以用:

  1. Iterative
  2. Generating Funtions
  3. Recurrence Fromulas

以下用

M/M/1 queue 來示範上述三種方法。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

image source

Iterative

已知:

pn=λn1λn2λ0μnμn1μ1p0=(λμ)np0=ρnp0

利用機率合為一求解

p0

0pn=0ρnp0=p00ρn=1p0=10ρn=1ρ ( given ρ<1)pn=p0ρn=(1ρ)ρn

Generating Functions

定義 generating function

P(z)

P(z)=0pnzn

寫出 Global Balance Equation:

{pn(λ+μ)=pn+1μ+pn1λp1=ρp0

先對第一式做整理:

pn+1=pn(1+ρ)pn1ρ

同乘上

zn

pn+1zn=(1+ρ)pnznρpn1zn

z 做 sum 起來:
n=1pn+1zn=n=1(1+ρ)pnznn=1ρpn1zn

調整

z 的項次使之和
p
一致:

z1n=1pn+1zn+1=(1+ρ)n=1pnznzρn=1pn1zn1

將 sigma 項換回 generating function,可得:

z1(P(z)p0p1z)=(1+ρ)(P(z)p0)zρP(z)

代入第二式(

p1=ρp0):
z1(P(z)(1+ρz)p0)=(1+ρ)(P(z)p0)zρP(z)

經過一場混戰,對式子做整理後可得:

P(z)=p01zρ

z=1 代入,可得:
P(1)=pn1n=1=p01ρ,p0=1ρP(z)=1ρ1zρ=0(1ρ)ρnzn=0pnznpn=(1ρ)ρn

NOTE: 當

z=1 時,
ddzP(z)
就是 system size 的期望值
L=npn

Recurrence Formulas

pn+1=pn(1+ρ)pn1ρ,n>1

用公式解遞迴(公式解以及其推導請參考離散數學相關課程及教材),base case 為

p1=ρp0,以及
pn=1