Základy teorie front III Aplikace Poissonova procesu v teorii front II Mgr. Rudolf B. Blažek, Ph.D. prof. RNDr. Roman Kotecký, DrSc. Katedra počítačových systémů Katedra teoretické informatiky Fakulta informačních technologií České vysoké učení technické v Praze Rudolf Blažek & Roman Kotecký, 211 Statistika pro informatiku MI-SPI, ZS 211/12, Přednáška 18 Evropský sociální fond Praha & EU: Investujeme do vaší budoucnos@
Introduction to Queueing Theory III in Queueing Theory II Mgr. Rudolf B. Blažek, Ph.D. prof. RNDr. Roman Kotecký, DrSc. Department of Computer Systems Department of Theoretical Informatics Faculty of Information Technologies Czech Technical University in Prague Rudolf Blažek & Roman Kotecký, 211 Statistics for Informatics MI-SPI, ZS 211/12, Lecture 18 The European Social Fund Prague & EU: We Invest in Your Future
Definition and Basic Properties Definition!!!!!! Poissonův Process s intenzitou λ Let ti ~ Exp(λ) be independent random variables, i = 1, 2,... Let Tn = t1 + t2 +... + tn with T =, and define N(s) = max {n: Tn s} for all s. Then N(s) is called the Poisson Process with rate λ. ti ~ Exp(λ)*...* independent exponential interarrival times Tn* * *...* arrival time of the n th customer N(s)* *...* number of arrivals during time interval (,s) 3
Definition and Basic Properties Defining the Poisson Process by Exponential Interarrival Times Number of arrivals N(s) = number of arrivals during (,s) N(s)... Poisson Process with rate λ t1 ~ Exp(λ) t2 ~ Exp(λ) t3 ~ Exp(λ) t4 ~ Exp(λ) t5 ~ Exp(λ) t5 > s -T4 N(s) = max {n: Tn s} N(s) = max {1,2,3,4} N(s) = 4 T2 T4 T1 =t1 T3 =t1+t2+t3 (T2 =t1+t2) (T4 =t1+t2+t3+t4) s Time t ti ~ Exp(λ)*...* independent exponential interarrival times Tn* * * *...* arrival time of the n th customer 4
Definition and Basic Properties The Poisson Distribution Lemma N(s) has a Poisson distribution with mean λs. Definition!!!!!!!!!!!! X ~ Poisson(μ) A random variable X has a Poisson distribution with mean μ if P(X = n) =e µ µn for n =, 1,... n! 5
Definition and Basic Properties The Poisson Distribution Lemma N(s) has a Poisson distribution with mean λs. To prove the lemma, we need the distribution of the arrivals: Theorem Let ti ~ Exp(λ) be independent random variables, i = 1, 2,... Then Tn = t1 + t2 +... + tn ~ Gamma(n, λ). 6
Definition and Basic Properties Gamma Distribution of Arrival Times Theorem Let ti ~ Exp(λ) be independent random variables, i = 1, 2,... Then Tn = t1 + t2 +... + tn ~ Gamma(n, λ). Definition!!!!!!!!!!!! T ~ Gamma(n, λ) A random variable T has a Gamma distribution with parameters n and λ if its density is f T (t) = ( e t ( t)n 1 (n 1)! for t otherwise. 7
Definition and Basic Properties Proof Tn = t1 + t2 +... + tn ~ Gamma(n, λ) Pretend that Tn and tn are discrete random variables: P(T n+1 = t) =P(T n + t n+1 = t) = P(T n + t n+1 = t, T n = s for some s,apple s apple t) = = X s:applesapplet X s:applesapplet P(s + t n+1 = t, T n = s) P(T n = s) P(t n+1 = t s) 8
Definition and Basic Properties Proof Tn = t1 + t2 +... + tn ~ Gamma(n, λ) Pretend that Tn and tn are discrete random variables: X P(T n+1 = t) = P(T n = s) P(t n+1 = t s) s:applesapplet For continuous variables replace probabilities with densities: Z t f Tn+1 (t) = f Tn (s) f tn+1 (t s) ds A rigorous proof uses the same idea, but is much harder. Let s see it next for comparison... 9
Definition and Basic Properties Proof Tn = t1 + t2 +... + tn ~ Gamma(n, λ) Tn+1, thus the density of Tn+1 satisfies P(T n+1 apple u) =P( apple T n + t n+1 apple u) Z Z t = s + w dt = dw = = Z Z { s+w u, s, w} { t u, s t} Z Z u t f Tn,t n+1 (s, w) ds dw f Tn,t n+1 (s, w) ds dt = f Tn (s) f tn+1 (t s) ds dt 1
Definition and Basic Properties Proof Tn = t1 + t2 +... + tn ~ Gamma(n, λ) Tn+1, thus the density of Tn+1 satisfies Z u Z t P(T n+1 apple u) = Z u Z t f (s) f (t s) ds dt Tn tn+1 = f Tn (s) f tn+1 (t s) ds dt Z u = f Tn+1 (t) dt 11
Definition and Basic Properties Proof Tn = t1 + t2 +... + tn ~ Gamma(n, λ) 1. Proof by mathematical induction. First check for n = 1: f T1 (t) =f t1 (t) = e t = e t ( s)! 2. Assume the claims is true for n 1: f (t) = e Tn t ( t)(n 1) (n 1)! 3. Prove it for n+1 using the claim for n: f Tn+1 (t) = e t ( t)n n! 12
Definition and Basic Properties Proof Tn = t1 + t2 +... + tn ~ Gamma(n, λ) Z t f (t) = f (s) f (t s) ds Tn+1 Tn tn+1 Z t = e = e Claim for n t s ( s)n 1 e (t s) (n 1)! n (n 1)! Exp(λ) Z t s n 1 ds = e t ( t)n n!... Claim for n+1 13
Definition and Basic Properties Proof that N(s) ~ Poisson (λs) First recall the density of S ~ Exp(λ): f S (t) = e t for t ; otherwise. And the probabilities for X ~ Poisson(μ = λt): P(X = n) = e µ µn = e t ( t) n n! n! Now look at the density of T ~ Gamma(n, λ): for n =, 1,... f T (t) = e t ( t)n 1 (n 1)! for t ; otherwise. 14
Definition and Basic Properties Proof that N(s) ~ Poisson (λs) N(s) = n if and only if Tn s < Tn+1 P(N(s) =n) =P(T n apple s < T n+1 ) = P(T n apple s < T n + t n+1 ) = P(T n = t for some t apple s, and T n + t n+1 > s) = P(T n = t for some t apple s, and t n+1 > s t) Z Z = {t s, u>s t} f Tn,t n+1 (t, u) dt du 15
Definition and Basic Properties Proof that N(s) ~ Poisson (λs) Z Z P(N(s) =n) Tn and tn+1 are independent = = Z s s t Z s {t s, u>s t} Z 1 f Tn,t n+1 (t, u) dt du f Tn (t)f tn+1 (u) du dt Z 1 = f Tn (t) f tn+1 (u) du dt Z s s t = f Tn (t) P(t n+1 > s t) dt 16
Definition and Basic Properties Proof that N(s) ~ Poisson (λs) Z s P(N(s) =n) = f Tn (t) P(t n+1 > s t) dt = Z s e t ( t)(n 1) (n 1)! e (s t) dt = n (n 1)! e s Z s t n 1 dt = e s ( s)n n!... Poisson (λs) 17
Poisson Process Model for Customer Arrivals Why is the Poisson Process is a Reasonable Model for Customer Arrivals Consider arrivals of customers to a gas station during 4-5 pm Customers decide independently whether to go buy gas n* *...* number of cars (customers) in the city λ/n*...* probability that a customer goes buy gas Customers arrive at a random time between 4-5 pm Probability that exactly k customers arrive is binomial P(K = k) = n(n 1) (n k + 1) k! n k 1 n n k 18
Poisson Process Model for Customer Arrivals Why is the Poisson Process is a Reasonable Model for Customer Arrivals Rearrange the expression n(n 1) (n k + 1) k! n k 1 n n k k k! n(n 1) (n k + 1) n k 1 n n 1 n k k k! n n 1 n n n k +1 n 1 n n 1 n k 19
Poisson Process Model for Customer Arrivals Why is the Poisson Process is a Reasonable Model for Customer Arrivals Let n k k! n n 1 n n n k +1 n 1 n n 1 n k k 1 1 1 e 1 - k k! k P(k customers)! e as n!1 k!... Poisson(λ) 2
Non-homogeneous Poisson Process Independent Increments Lemma Fix s. N(t+s)-N(s), t is a rate λ Poisson process. It is independent of N(r), r s. Lemma N(t) has independent increments. If < t < t1 < t2 <... < tn then * N(t1)-N(t), N(t2)-N(t1),..., N(tn)-N(tn-1) are independent. 21
Non-homogeneous Poisson Process Second Definition of the Poisson Process via Independent Increments Theorem!!!!!!!!!!!!! (Definition II) {N(s), s } is a rate λ Poisson process if and only if all of the following hold (i) N() = (ii) N(t) has independent increments (iii) N(t + s) - N(s) ~ Poisson (λt)* * * [rand. variable] This definition Is useful for proving theorems... Can be easier generalized... 22
Non-homogeneous Poisson Process Non-homogeneous Poisson Process Theorem!!!!!! Nehomogenní Poissonův process We say that {N(s), s } is a (non-homogeneous) Poisson process with rate λ(r) if (i) N() = (ii) N(t) has independent increments (iii) N(t + s) - N(s) ~ Poisson rand. variable Z t+s * * * * * * * * with mean s (r) dr 23
Non-homogeneous Poisson Process Non-homogeneous Poisson Process Theorem!!!!!! Nehomogenní Poissonův process We say that {N(s), s } is a (non-homogeneous) Poisson process with rate λ(r) if (i) N() = (ii) N(t) has independent increments (iii) N(t + s) - N(s) ~ Poisson rand. variable Z t+s * * * * * * * * with mean s (r) dr 24
Thinning and Superposition Thinning and Superposition Theorem!!!!!!!!!!!!!!! Thinning Assume that * * Yi are indep. identically distributed random variables * * Yi are integer valued, non-negative * * Yi associated with the i th arrival * * Yi are all independent of the Poisson process Let Nj (t) be number of arrivals in (, t) with Yi = j. Then!! Nj (t) are independent Poisson processes * * with rates P(Y i = j) 25
Thinning and Superposition Thinning and Superposition Theorem!!!!!!!!!!!!! Superposition Assume that Nj (t) are independent Poisson processes with rates λj, j = 1, 2,..., k. Then * * N (t) = N1(t) + N2 (t) +... + Nk (t) is a Poisson process * * * * * * * * * * with rate λ1 + λ2 +... + λk. 26
Thinning and Superposition Web and Database Servers Example Pool of m application servers (e.g. Tomcat) submits a job to a central database server Application server 1 Application server 2 Central Database Server Application server m 27
Thinning and Superposition Web and Database Servers Example We assume Poisson arrival process (λ) for the requests. Scenario 1: Application servers can submit multiple requests We have m application servers Then we obtain a Poisson arrival process with the rate * * * * * * * * * μ = m λ We will see later why... 28
Thinning and Superposition Web and Database Servers Example Case 1: Application servers can submit multiple requests Application server 1 Rate λ Application server 2 Rate λ Rate mλ Central Database Server Application server m Rate λ 29
Thinning and Superposition Web and Database Servers Example We assume Poisson arrival process (λ) for the requests. Scenario 2: Application servers must wait for their request to finish State k: If k servers are waiting for their requests to finish, then only (m-k) servers can submit requests Then we obtain a state-dependent Poisson arrival process with the rate (k) = (m k) k < m k m 3