16
Theory of Stochastic Processes 11. Queues Tomonari Sei [email protected] Department of Mathematical Informatics, University of Tokyo June 29, 2017 http://www.stat.t.u-tokyo.ac.jp/~sei/lec.html 1 / 16

Theory of Stochastic Processes 11. Queuessei/lec/ohp_SP11.pdfTheory of Stochastic Processes 11. Queues Tomonari Sei [email protected] Department of Mathematical Informatics,

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Theory of Stochastic Processes 11. Queuessei/lec/ohp_SP11.pdfTheory of Stochastic Processes 11. Queues Tomonari Sei sei@mist.i.u-tokyo.ac.jp Department of Mathematical Informatics,

.

.

. ..

.

.

Theory of Stochastic Processes11. Queues

Tomonari [email protected]

Department of Mathematical Informatics, University of Tokyo

June 29, 2017

http://www.stat.t.u-tokyo.ac.jp/~sei/lec.html

1 / 16

Page 2: Theory of Stochastic Processes 11. Queuessei/lec/ohp_SP11.pdfTheory of Stochastic Processes 11. Queues Tomonari Sei sei@mist.i.u-tokyo.ac.jp Department of Mathematical Informatics,

Handouts & Announcements

Handouts:

Slides (this one)

Copy of Chapter 8 of PRP

Copy of §11.1 – 11.3 of PRP

Announcements:

About the final exam (important!)

The final exam is held on July 20 (Thu), 10:25–, 90 min.Contact me if you cannot attend it due to some unavoidable reasons.The exam is open-book and open-note. Write your answer in English.The exam will cover the whole material up to the next lecture (July 6).At least one question will be from the topics before the midterm exam.

2 / 16

Page 3: Theory of Stochastic Processes 11. Queuessei/lec/ohp_SP11.pdfTheory of Stochastic Processes 11. Queues Tomonari Sei sei@mist.i.u-tokyo.ac.jp Department of Mathematical Informatics,

Outline today

.

. .1 Where are we now?

.

. .

2 QueuesExamplesM/M/1M/G/1

.

. .

3 Recommended problems

3 / 16

Page 4: Theory of Stochastic Processes 11. Queuessei/lec/ohp_SP11.pdfTheory of Stochastic Processes 11. Queues Tomonari Sei sei@mist.i.u-tokyo.ac.jp Department of Mathematical Informatics,

Where are we now?

Dependence of topics

Stationary processes

Markov chains −→ Queues (today)

Martingales −→ Diffusion processes (next week)

4 / 16

Page 5: Theory of Stochastic Processes 11. Queuessei/lec/ohp_SP11.pdfTheory of Stochastic Processes 11. Queues Tomonari Sei sei@mist.i.u-tokyo.ac.jp Department of Mathematical Informatics,

Queues = waiting lines

Today’s topic

.

Example

.

.

.

. ..

.

.

Consider an ATM which serves customers.

Customers arrive at ATM according to a stochastic process.

The service time is also random.

5 / 16

Page 6: Theory of Stochastic Processes 11. Queuessei/lec/ohp_SP11.pdfTheory of Stochastic Processes 11. Queues Tomonari Sei sei@mist.i.u-tokyo.ac.jp Department of Mathematical Informatics,

Queueing theory

Other examples of queues:

security check at Narita airport

hospitals

Starbucks coffee

homework you have to do

The queueing theory concerns a mathematical study of queueing systems.

Remark:

In Japanese, a queue is called “待ち行列”.

Do not confuse it with “行列” (a matrix).

6 / 16

Page 7: Theory of Stochastic Processes 11. Queuessei/lec/ohp_SP11.pdfTheory of Stochastic Processes 11. Queues Tomonari Sei sei@mist.i.u-tokyo.ac.jp Department of Mathematical Informatics,

Notation

We only consider single-server queues.

Tn is the time when the n-th customer arrives.

Xn = Tn − Tn−1 is the interarrival time, where T0 = 0.

Sn is the service time of the n-th customer.

Q(t) is the number of waiting customers at t, including ones served.

7 / 16

Page 8: Theory of Stochastic Processes 11. Queuessei/lec/ohp_SP11.pdfTheory of Stochastic Processes 11. Queues Tomonari Sei sei@mist.i.u-tokyo.ac.jp Department of Mathematical Informatics,

Definition

.

Definition

.

.

.

. ..

.

.

A queueing model is a pair of sequences {Xn} and {Sn} of independentrandom variables.

Queueing models are classified by the distributions of Xn and Sn, togetherwith the number of servers (= 1 here). In particular,

M/M/1: Xn and Sn are exponential (M stands for Markov).

M/G/1: Xn is exponential and Sn is any (G stands for general).

Remark:

Remember that interarrival times of a Poisson process are exponential.

The notation A/B/s is called Kendall’s notation.

8 / 16

Page 9: Theory of Stochastic Processes 11. Queuessei/lec/ohp_SP11.pdfTheory of Stochastic Processes 11. Queues Tomonari Sei sei@mist.i.u-tokyo.ac.jp Department of Mathematical Informatics,

An important quantity

.

Definition

.

.

.

. ..

.

.

The traffic intensity ρ is defined by

ρ =E [S ]

E [X ]=

(mean service time)

(mean interarrival time).

We may expect that

If ρ < 1, then {Q(t)} is “stable”.

If ρ > 1, then {Q(t)} is “unstable”.

Let us check out this claim for M/M/1 and M/G/1.

9 / 16

Page 10: Theory of Stochastic Processes 11. Queuessei/lec/ohp_SP11.pdfTheory of Stochastic Processes 11. Queues Tomonari Sei sei@mist.i.u-tokyo.ac.jp Department of Mathematical Informatics,

M/M/1

M(λ)/M(µ)/1: Xn and Sn are exponential with parameters λ and µ,respectively. The pdfs are fX (x) = λe−λx and fS(x) = µe−µx .

The traffic intensity is

ρ =E [S ]

E [X ]=

1/µ

1/λ=

λ

µ.

Sample paths of Q(t):

0 10 20 30 40 50

01

23

45

6

time

queu

e

0 10 20 30 40 50

01

23

45

time

queu

e

0 10 20 30 40 50

05

1015

2025

time

queu

eρ = 0.5 ρ = 1 ρ = 1.5

An R code is available from the course web site.10 / 16

Page 11: Theory of Stochastic Processes 11. Queuessei/lec/ohp_SP11.pdfTheory of Stochastic Processes 11. Queues Tomonari Sei sei@mist.i.u-tokyo.ac.jp Department of Mathematical Informatics,

Stability of M/M/1

.

Theorem 11.2.8

.

.

.

. ..

.

.

Assume the M(λ)/M(µ)/1 model. Then Q(t) is a birth-death process,that is, a continuous-time Markov chain with the generator

G =

−λ λ 0µ −(λ + µ) λ

µ −(λ + µ). . .

0. . .

. . .

In particular, the stationary distribution exists if and only if ρ = λ/µ < 1.

.

Review exercise

.

.

.

. ..

.

.

Let ρ < 1. Show that the stationary distribution is πk = (1− ρ)ρk and themean number of waiting customers is ρ/(1 − ρ).

11 / 16

Page 12: Theory of Stochastic Processes 11. Queuessei/lec/ohp_SP11.pdfTheory of Stochastic Processes 11. Queues Tomonari Sei sei@mist.i.u-tokyo.ac.jp Department of Mathematical Informatics,

M/G/1

Now let us go on to the M/G/1 model.

Sample paths of Q(t) when Sn ≡ 1 (deterministic).

0 10 20 30 40 50

01

23

4

time

queu

e

0 10 20 30 40 50

02

46

8time

queu

e0 10 20 30 40 50

05

1015

20

time

queu

e

ρ = 0.5 ρ = 1 ρ = 1.5

.

Exercise

.

.

.

. ..

.

.

Q(t) is no longer a Markov chain. Why?

12 / 16

Page 13: Theory of Stochastic Processes 11. Queuessei/lec/ohp_SP11.pdfTheory of Stochastic Processes 11. Queues Tomonari Sei sei@mist.i.u-tokyo.ac.jp Department of Mathematical Informatics,

The idea

Let Dn be the leaving time of the n-th customer. In other words, Dn

is the n-th decreasing point of Q(t).

We will see that Q(Dn) is a discrete-time Markov chain, where Q(Dn)is inerpreted as Q(Dn+).

13 / 16

Page 14: Theory of Stochastic Processes 11. Queuessei/lec/ohp_SP11.pdfTheory of Stochastic Processes 11. Queues Tomonari Sei sei@mist.i.u-tokyo.ac.jp Department of Mathematical Informatics,

Find a Markov chain

Let Un be the number of arrived customers during the service time ofthe (n + 1)-th customer.Un is independent of {Q(t)}t≤Dn because of the Markov property ofarriving times.

Q(Dn) > 0 Q(Dn) = 0

.

Exercise

.

.

.

. ..

.

.

Check that Q(Dn+1) = Un + max(Q(Dn) − 1, 0).14 / 16

Page 15: Theory of Stochastic Processes 11. Queuessei/lec/ohp_SP11.pdfTheory of Stochastic Processes 11. Queues Tomonari Sei sei@mist.i.u-tokyo.ac.jp Department of Mathematical Informatics,

.

Theorem 11.3.4

.

.

.

. ..

.

.

Assume the M(λ)/G/1 model. Then the discrete-time process {Q(Dn)} isa Markov chain with the transition matrix

P =

0

B

B

B

B

B

@

δ0 δ1 δ2 · · ·δ0 δ1 δ2 · · ·0 δ0 δ1 · · ·0 0 δ0 · · ·...

......

. . .

1

C

C

C

C

C

A

, δj = P(Un = j) = E

»

(λSn)j

j!e−λSn

.

.

Theorem 11.3.5

.

.

.

. ..

.

.

The unique stationary distribution π exists if and only if ρ < 1.In that case, the generating function of π is

G (s) =∑

j

πjsj = (1 − ρ)(s − 1)

MS(λ(s − 1))

s − MS(λ(s − 1)),

where MS(θ) = E [eθSn ].

See §11.3 for proofs and further details.15 / 16

Page 16: Theory of Stochastic Processes 11. Queuessei/lec/ohp_SP11.pdfTheory of Stochastic Processes 11. Queues Tomonari Sei sei@mist.i.u-tokyo.ac.jp Department of Mathematical Informatics,

Recommended problems

Recommended problems:

§8.4, Problems 1, 2, 3, 4*, 5*.

§11.2, Problems 3, 7*.

§11.3, Problem 1*.

The asterisk (*) shows difficulty.

16 / 16