Chapter 5 The Queue M/G/1. 2 M/G/1 Arrival Service GeneralPoisson 1 srver.

Post on 21-Dec-2015

224 views 2 download

Transcript of Chapter 5 The Queue M/G/1. 2 M/G/1 Arrival Service GeneralPoisson 1 srver.

Chapter 5

The Queue M/G/1

2

M/G/1

Arrival

Service

GeneralPoisson

teta )(

1 srver

arbitraryxb )(

3

Bus Paradox

If uniform

最少 0 分,最多 10 分;平均 5 分鐘

If Poisson(or Exponential)

人任意時刻來到 bus stop, 平均要 wait 多久 ?

(depends on bus 來的 distribution)

min 10xbusstop

10

1

10 minbus arrival

customerarrival

10 min

10 minbus arrival

customerarrival 10 min 10 min

4

X: “special” interarrival time we pick Y: residual life(waiting time as above) Let f(x) be the pdf of interval lengths (mn = nth monent)

fx(x) be the pdf of the interval we randomly pick

f(x) be the pdf of residual life Y

X(life)

Y(residual life)age

5

1

1010

00

0 x

)()()(

)(m )(

)(1)(

1)(f

n)(assumptio )()(

)( , )(

m

xxfxkxfxf

kmdxxxfkdxxxflet

dxxxfkdxxkxf

dxx

xkxfxf

xfxxf

x

x

x

成正比會跟

61

**

1

*

1

11

1

)(1)(11)(ˆ

)(1)(ˆ

)(ˆ])(1[)(

)(

0for ],[]|[

],[

0 ,]|[

Sm

SF

S

SF

SmSF

m

yFyf

dyyfyFm

dydx

m

xxf

x

dy

dxm

xxf

x

dy

xydxxXxPdxxXxdyyYyP

dxxXxdyyYyP

xyx

yxXyYP

y

yyx

7

1

2

1

1

n

n

2

using1

life residual theofmonent th -n is r

length internal theofmonent th -n is mLet

m

mtimeresidualmeanr

l rule) L'Hospita, ()m(n

mr

n

nn

102

,102

10m10

1

lExponentia

52

,10

10 ticDeterminis

:

1

21

22

1

1

212

2

1

m

mr

m

m

mr

m

m

example

8

Method of Embedded(Imbedded) Markov

Chain

dk = P[departure leaves behind k in system]

rk = P[arrival finds k in system upon his arrival]

pk = P[k in system at random point of time]

time

departure instants

9

Example: D/D/1

If arrivals are Poisson, then pk = rk

If system states change by ± 1, then dk = rk

For M/G/1 pk=rk=dk

Deterministic

time

N(t)

1

departure

p r d

,,, k

kx

k,

p

,,, k

k, r

,,, k

k, d

k

k

k

320

1,

01

210

01

210

01

x

10

Proof

1. Let A(t, t + △ t) = arrival occurs in interval (t, t + △ t)

)()(

])([

],([

])([])(|),([lim

],([

)],( ,)([lim

)],(|)([lim

0

0

0

tPtR

ktNP

tttAP

ktNPktNtttAP

tttAP

tttAktNP

tttAktNP(t)P

time t] system atfinds k inP[arrival (t)R

e t]tem at timP[k in sys(t)P

kk

t

t

tk

k

k

11

2.

rk=dkk k+1

balance

k customers

12

M/G/1GeneralPoisson

kkk

t

drpSBxb

eta

)()(

)(*

1 srver

1,,, 2 xxx b 2

kk

kk

d, then rte by change staif system

r then ps Poisson,if input i

1

13

x

x

m

mr

)m(n

mr

)life (r residual monent ofn

x

B(x)(x)b

(x)bife pdf residual l

nn

nth

22

1

ˆ

2

1

21

1

1

21

2

srvice]in him findshat t

arrivalan delay willservice

foundcustomer a that E[timeLet W0

xλρ)(Oρ

x

x

2 2

Delay 的時間有人被 served

沒被 serve 的機率

14

Imbeded Markov Chain

Let cn be the nth customer to enter system

qn be the number of customers left behind by the departure of cn

time

cn-2 cn-1 cn cn+1

qn left behind

15

]n x arrival iP[ P

]n x arrival iP[ P

me of cservice ti where x

]xal during P[no arriv, PGiven q

d,Pdd

i]j|qP[qNeed P

][PP],,,d[dd

imediscrete tte state, discreov Chain. is a Markq

)rp(dk]P[q

k]P[q

n

n

nn

nn

kk

nnij

ij

n

kkknn

n

102

101

100

0

1

10

2

1

0

1

lim

16

Let vn = number of arrivals during xn

P[vn+1 = k] = αk

10

210

210

210

00

0

P

)()(

)(!

)(

)(]~|~[

]~[

~

*

0

)1(

0

0

ZBdxxbe

dxxbk

ex

dxxbxxkvP

kvP

vtate s, nndent of s is indepev

xZ

xk

k

n

17

)(B

)(

)()ek!

x)((

))(!

)(()(

~

*

0

)1(

0

x-

0k

k

00

00

Z

dxxbe

dxxbZ

Zdxxbk

exZV

k]ZvP[ZαV(Z)Let α

xZ

k

k

kxk

k

k

k

kk

transformZ

k

xZe

18

xv

xx

dZ

Zd

Zd

ZdB

dZ

dV(Z)v E[v]

)(B) v(Z

λZ):(λBcheck V(Z)

ZZ

*

*

)()(

)(

)(

)(

1011

1

*

1

arrival rate

mean service time

進入的個數

222)2()0(

*

1

2

2

*2

1

2

22

)(B

)(

)(

)()(

x

dZ

Zd

Zd

ZBd

dZ

ZVdvv

ZZ

xxv 222

19

server

queue

cn cn+1

τn

cn cn+1

τn+1

cn cn+1

tn

xnxn+1

qn+1qn

vn+1

nnk

nnk

nn

nnn

nn

thn

y ct behind bs left lef# customerqd

during x arrivals # customervα

me f cservice tixb(x)

time)erarrival (ττta(t)

ime of c:arrival tτ

customer:nc

int1

20

11

02

nn

n

vq

: qCase

server

queue

cn+1

cn cn+1

cn+1

xn+1

qn+1qn=0

vn+1

0

0

1

11

1 if qn v

if qvqq

,n

n, nn

n

0

01

111

1

nnn-n

n

n

n

, if qvqq

rve c

, departure c

: qCase

se 會被便馬上被只要

當第 cn+1 離開時發現

原來的 進來的

21

ise, otherw

,,,, klet

0

3211Δk

k

△k

-2 -1 0 1 2 3

1

ρvs busy] P[server is busy]P[system i

]qP[]qP[]qP[]E[Δv

vv]vE[

dk]q: P[q vΔqq

)rd (Nkdkqq

vΔqq

vΔqq

kpkd

q

k

qn

kkk

nn

nqnn

nqnn

n

n

~

~

01

11

11

0~0~10~0

~~

~~~

lim

22

)1(2

)1(2)1(2

2

222

222

222

) (

2

2222

)(2d222

222

112

122

1

112

1222

1

vNq

vvq

vqvqvqq

vqvqvqq

vqvqvqq

nletq

xvvdZ

ZV

qqtake n

nqnnnnqnn

nqqnnnnqnn

nn

nnn

趨於取期望值兩邊平方求

nq nq

23

1

1

1

2/

)1(2

0

0

2

22

WW

WxT

xxT

TN

xNq

Pollaczek-Khinchin

MEAN-VALUE Formula

P-K Mean-Value Formula

24][)()(

][][][)(

][][][

)(

][]~[)()(lim

][)(][

)(][

1

1

11

~

0

0

11

111

11

nqn

nnqnnnqn

nnqnnnqnn

nnqnn

n

n

q

n

vqvq

n

vqvqq

vqq

nqnn

kkk

q

k

kn

n

qn

k

kn

nn

ZEZVZQ

ZEZEZZEZQ

ZZEZEZE

ZZ

vqq

ZQdpr

ZEZkqPZQZQ

ZEZQZkqP

ZQkqP

kd

)(ZV

25

Z

qPZQqPZVZQ

nlet

Z

qPZQqPZVZQ

qPZQZ

qP

kqPZqP

kqPZqPZZE

n

nnnn

nnn

kn

kn

kn

kkn

qnqn

]0~[)(]0~[)()(

1)(

]0[)(]0[)()(

]0[)(1

]0[

][]0[

][]0[][

1

1

1

1

0 0

26

kdZZB

ZZBZQ

-ρty]ver P[empSingle ser

)Q(her ] from eitqP[

ZBZV

ZZV

qPZZV

ZZV

ZqP

ZV

)(

)1)(1()()(

1

110~

)()(

)(

]0~[)1()(

)(1

)1

1](0~[)(Q(Z) Q(Z),

**

*

Pollaczek-Khinchin Transform equ.

27

example

kk

x

d

Z

ZZZ

Z

ZZZ

Z

ZZ

Z

ZZQ

eS

SB

)1(

1

1

)1()1(

)1)(1()1)(1(

)1)(1()(

)(

2

*

1// MM

28

P-K Mean-

Value

Formula

1

2/

1

2/

1

2/

1

22

2

20

xNq

xxWxT

xWW

2

2

2

2

0x

xx

xW

time waiting)(yw

timesystem )(ys

kd

29

example

1

1

)1

1(1

1212

1

2 ,

1

1

/1

2

22

T

xx

T

1// MM

)1(2

)1(

)1(

)()1(2

2

22

22

2

2222

2

b

b

cxW

xx

xx

xxxx

xW

30

)-2(1

xW

0

:1//

1

-1

xW

1

:1//

2b

2b

c

DM

x

c

MM

02

1

1//

1//1//

DD

MMDM

W

WW

W

ρ

M/M/1

M/D/1

D/D/1

31

)()(

)()(

FIFO) (assume

customer nfor timesystem:

)()(

*

*

th

*

ZSZQ

ZSZQ

s

ZBZV

n

n

n

server

queue

cn

cn

xn

vn::Poisson λcn

server

queue

cn

cn

sn

qn left behind

Poisson λcnfirst come first serve

32

SZ

ZSLet

ZZB

ZZBZQZS

1

)(

)1)(1()()()(

***

)(

)1()()(

1)(

)1)(11()()(

***

*

**

SBS

SSBSS

SSB

S

SBSS

33

)(

)1()(

)()()(

)()()(

~~~

**

***

SBS

SSW

SWSBSS

ywybys

wxs

wxs nnn

34

example

yeys

SS

S

S

SSS

SSB

)1(

*

*

)1()(

)1(

)1()1()(

)(

1// MM

y

s(y)

ye )1()1(

35

yeyuyw

SSW

S

S

SSS

SS

SS

SSW

)1(0

*

2*

)1()()1()(

)1(1)1()(

)1(

))(1()1)(()1()(

system idle

system busy

w(y)

ye )1()1( 1

y

36

0)(

0

*

*

*

****

)(ˆ)1()(

))(ˆ()1(

)(ˆ1

1)(

)(11

1

))(1

(

)1(

)(

)1()(

kk

k

k

k

ybyw

SB

SBSW

xSSB

xSB

xS

S

SBS

SSW

ice timeidual servpdf of res

(x)b(S)B* ˆˆ

convolved itself k times

37

Stages of method

1. Series/Parallel

2. d = dP

3. Supplementary Variables

4. Imbedded Markov Chain

38

U(t) = unfinished work in system at time t

= Time required to empty the system measured from time t, if no new customers are allowed to enter after tU(t)

t0 τ1τ1+x1

x1

x2

WAVG

Virtual Waiting Time (only for FCFS)

Busy Periody

Idle Period

I

WFCFS=WLCFS=WX