Chapter 2 Probability, Statistics, and Traffic...

83
Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 1 Chapter 2 Probability, Statistics, and Traffic Theories

Transcript of Chapter 2 Probability, Statistics, and Traffic...

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 1

    Chapter 2

    Probability, Statistics, and Traffic Theories

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 2

    Outline Introduction Probability Theory and Statistics Theory

    Random variables Probability mass function (pmf) Probability density function (pdf) Cumulative distribution function (cdf) Expected value, nth moment, nth central moment, and

    variance Some important distributions

    Traffic Theory Poisson arrival model, etc.

    Basic Queuing Systems Little’s law Basic queuing models

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 3

    Introduction

    Several factors influence the performance of wireless systems: Density of mobile users Cell size Moving direction and speed of users (Mobility

    models) Call rate, call duration Interference, etc.

    Probability, statistics theory and traffic patterns, help make these factors tractable

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 4

    Probability Theory and Statistics Theory

    Random Variables (RVs) Let S be sample associated with experiment E X is a function that associates a real number to each s ∈S RVs can be of two types: Discrete or Continuous Discrete random variable => probability mass function (pmf) Continuous random variable => probability density function

    (pdf)

    s X(s) X

    S R S

    R

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 5

    Discrete Random Variables In this case, X(s) contains a finite or infinite

    number of values The possible values of X can be enumerated

    E.g., throw a 6 sided dice and calculate the probability of a particular number appearing.

    1 2 3 4 6

    0.1

    0.3

    0.1 0.1

    0.2 0.2

    5

    Probability

    Number

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 6

    Discrete Random Variables

    The probability mass function (pmf) p(k) of X is defined as:

    p(k) = p(X = k), for k = 0, 1, 2, ... where 1. Probability of each state occurring 0 ≤ p(k) ≤ 1, for every k; 2. Sum of all states ∑ p(k) = 1, for all k

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 7

    Continuous Random Variables

    In this case, X contains an infinite number of values

    Mathematically, X is a continuous random variable if there is a function f, called probability density function (pdf) of X that satisfies the following criteria:

    1. f(x)≥ 0, for all x; 2. ∫ f(x)dx = 1

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 8

    Cumulative Distribution Function

    Applies to all random variables A cumulative distribution function (cdf) is

    defined as: For discrete random variables:

    For continuous random variables:

    F(x) = P(X ≤ x) = ∫ f(x)dx -∞

    x

    P(k) = P(X ≤ k) = ∑ P(X = k) all ≤ k

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 9

    Probability Density Function

    The pdf f(x) of a continuous random variable X is the derivative of the cdf F(x), i.e.,

    x

    f(x)

    Area CDF

    ( ) ( )dx

    xdFxf X=

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 10

    Expected Value, nth Moment, nth Central Moment, and Variance

    0.3

    1 2 3 4 5 6

    0.1 0.1 0.1

    0.2 0.2

    E[X] = 0.166

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 11

    Discrete Random Variables Expected value represented by E or average of

    random variable nth moment

    nth central moment

    Variance or the second central moment

    Expected Value, nth Moment, nth Central Moment, and Variance

    E[X] = ∑ kP(X = k) all ≤ k

    E[Xn] = ∑ knP(X = k) all ≤ k

    E[(X – E[X])n] = ∑ (k – E[X])nP(X = k) all ≤ k

    σ2 = Var(X) = E[(X – E[X])2] = E[X2] - (E[X])2

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 12

    Continuous Random Variable Expected value or mean value nth moment nth central moment Variance or the second central moment

    Expected Value, nth Moment, nth Central Moment, and Variance

    E[X] = ∫ xf(x)dx +∞

    -∞

    E[Xn] = ∫ xnf(x)dx +∞

    -∞

    E[(X – E[X])n] = ∫ (x – E[X])nf(x)dx +∞

    -∞

    σ2 = Var(X) = E[(X – E[X])2] = E[X2] - (E[X])2

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 13

    Some Important Discrete Random Distributions

    Poisson E[X] = λ, and Var(X) = λ

    Geometric

    E[X] = 1/(1-p), and Var(X) = p/(1-p)2

    P(X = k) = p(1-p)k-1 ,

    where p is success probability

    0,...,2,1,0,!

    )( >===−

    λλλ

    andkkekXP

    k

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 14

    Some Important Discrete Random Distributions

    Binomial Out of n dice, exactly k dice have the same value:

    probability p k and (n-k) dice have different values: probability(1-p) n-k.

    For any k dice out of n:

    k)!k!(nn!

    kn

    ndability, aucess probp is the s,...,,nn,...,,,k where

    ,knp)(kpknk)P(X

    −=

    ==

    −−==

    ; 210 ;210,

    1

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 15

    Some Important Continuous Random Distributions

    Normal

    E[X] = µ, and Var(X) = σ2

    ∫∞−

    −−

    −−

    =

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 16

    Some Important Continuous Random Distributions

    Uniform E[X] = (a+b)/2, and Var(X) = (b-a)2/12

    >

    ≤≤−−

    <

    =

    ≤≤

    −=

    bfor x ,1

    for ,

    for ,0

    )(

    isfunction on distributi cumulative theandotherwise ,0

    for ,)(

    bxaabax

    ax

    xF

    bxaab

    dxf

    X

    X

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 17

    Some Important Continuous Random Distributions

    Exponential E[X] = 1/λ, and Var(X) = 1/λ2

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 18

    Multiple Random Variables

    There are cases where the result of one experiment determines the values of several random variables

    The joint probabilities of these variables are: Discrete variables:

    p(x1, …, xn) = P(X1 = x1, …, Xn = xn) Continuous variables:

    cdf: Fx1x2…xn(x1, …, xn) = P(X1 ≤ x1, …, Xn ≤ xn) pdf:

    n

    nn

    xxxxxxFxxxf nXXX

    n

    nXXX∂∂∂

    ∂=

    ..),...,(),...,(

    .21

    2121

    21,...,21,...,

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 19

    Independence and Conditional Probability

    Independence: The random variables are said to be independent of each other when the occurrence of one does not affect the other. The pmf for discrete random variables in such a case is given by:

    p(x1,x2,…xn)=P(X1=x1)P(X2=x2)…P(X3=x3) and for continuous random variables as:

    FX1,X2,…Xn = FX1(x1)FX2(x2)…FXn(xn) Conditional probability: is the probability that X1= x1 given

    that X2= x2. Then for discrete random variables the probability becomes:

    and for continuous random variables it is:

    ),...,(),...,,(),...,|(

    22

    1 2212211

    nn

    nnnn

    xXxXPxXxXxXPxXxXxXP

    =====

    ====

    ),...(),...,,(),...,|(

    22

    22112211

    nn

    nnnn

    xXxXPxXxXxXPxXxXxXP

    ≤≤≤≤≤

    =≤≤≤

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 20

    Bayes Theorem

    A theorem concerning conditional probabilities of the form P(X|Y) (read: the probability of X, given Y) is

    where P(X) and P(Y) are the unconditional

    probabilities of X and Y respectively

    )()()|()|(

    YPXPXYPYXP =

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 21

    Important Properties of Random Variables

    Sum property of the expected value Expected value of the sum of random variables:

    Product property of the expected value Expected value of product of stochastically

    independent random variables

    ∑∑==

    =

    n

    iii

    n

    iii XEaXaE

    11][

    ∏∏==

    =

    n

    i

    i

    n

    i

    i XEXE11

    ][

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 22

    Important Properties of Random Variables

    Sum property of the variance Variance of the sum of random variables is

    where cov[Xi,Xj] is the covariance of random

    variables Xi and Xj and

    If random variables are independent of each other,

    i.e., cov[Xi,Xj]=0, then

    ∑ ∑∑∑= = +==

    +=

    n

    i ijijiii

    n

    iii XXaaXVaraXaVar

    1

    1-n

    1i

    n

    1j

    2

    1],cov[2 )(

    ][][][])][])([[(],cov[

    jiji

    jjiiji

    XEXEXXEXEXXEXEXX

    −=−−=

    ∑∑==

    =

    n

    iii

    n

    iii XVaraXaVar

    1

    2

    1)(

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 23

    Important Properties of Random Variables

    Distribution of sum - For continuous random variables with joint pdf fXY(x, y) and if Z = Φ(X,Y), the distribution of Z may be written as

    where ΦZ is a subset of Z. For a special case Z= X+Y

    If X and Y are independent variables, the fXY (x,y)= fX(x)fY(y)

    If both X and Y are non negative random variables, then pdf is the convolution of the individual pdfs, fX(x) and fY(y)

    dxdyyxfzZPzFZ

    XYZ ),()()( ∫=≤=φ

    ∫∫ ∫ ∫∞

    ∞−

    ∞−

    ==Z

    XYXY dxdyyxfdxdyyxfzFz

    ),(),()(φ

    ∫∞

    ∞−

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 24

    Central Limit Theorem

    The Central Limit Theorem states that whenever a random sample (X1, X2,.. Xn) of size n is taken from any distribution with expected value E[Xi] = µ and variance Var(Xi) = σ 2, where i =1,2,..,n, then their arithmetic mean is defined by

    =

    =n

    iin Xn

    S1

    1

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 25

    Central Limit Theorem

    The sample mean is approximated to a normal distribution with E[Sn] = µ, and Var(Sn) = σ 2 / n

    The larger the value of the sample size n, the better the approximation to the normal

    This is very useful when inference between signals needs to be considered

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 26

    Poisson Arrival Model

    A Poisson process is a sequence of events “randomly spaced in time”

    For example, customers arriving at a bank and Geiger counter clicks are similar to packets arriving at a buffer

    The rate λ of a Poisson process is the average number of events per unit time (over a long time)

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 27

    Properties of a Poisson Process

    Properties of a Poisson process For a time interval [0, t] , the probability of n

    arrivals in t units of time is

    For two disjoint (non overlapping ) intervals

    (t1, t2) and (t3, t4), (i.e. , t1 < t2 < t3 < t4), the number of arrivals in (t1, t2) is independent of arrivals in (t3, t4)

    tn

    n enttP λλ −=!)()(

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 28

    Interarrival Times of Poisson Process

    Interarrival times of a Poisson process We pick an arbitrary starting point t0 in time .

    Let T1 be the time until the next arrival. We have

    P(T1 > t) = P0(t) = e -λt Thus the cumulative distribution function of

    T1 is given by FT1(t) = P(T1≤ t) = 1 – e -λt

    The pdf of T1 is given by fT1(t) = λe -λt

    Therefore, T1 has an exponential distribution with mean rate λ

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 29

    Exponential Distribution

    Similarly T2 is the time between first and second arrivals, we define T3 as the time between the second and third arrivals, T4 as the time between the third and fourth arrivals and so on

    The random variables T1, T2, T3… are called the interarrival times of the Poisson process

    T1, T2, T3,… are independent of each other and each has the same exponential distribution with mean arrival rate λ

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 30

    Memoryless and Merging Properties Memoryless property

    A random variable X has the property that “the future is independent of the past” i.e., the fact that it hasn't happened yet, tells us nothing about how much longer it will take before it does happen

    Merging property If we merge n Poisson processes with distributions for the

    inter arrival times 1- e- λit where i = 1, 2, …, n into one single process, then the result is a Poisson process

    for which the inter arrival times have the distribution 1- e -λt with mean λ = λ1 + λ2 +..+ λn

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. p.31/60

    Memoryless 證明:

    0

    0

    0 0 00 0

    0 0( )

    { , } { }{ | }{ } { }

    { }

    t tt

    t

    P T t t T t P T t tP T t t T tP T t P T t

    e ee

    P T t

    αα

    α

    − +−

    > + > > +> + > = =

    > >

    = =

    = >

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 32

    Basic Queuing Systems

    What is queuing theory? Queuing theory is the study of queues (sometimes

    called waiting lines) Can be used to describe real world queues, or more

    abstract queues, found in many branches of computer science, such as operating systems

    Basic queuing theory Queuing theory is divided into 3 main sections:

    Traffic flow Scheduling Facility design and employee allocation

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 33

    Kendall’s Notation

    D.G. Kendall in 1951 proposed a standard notation for classifying queuing systems into different types. Accordingly the systems were described by the notation A/B/C/D/E where:

    A Distribution of inter arrival times of customers B Distribution of service times C Number of servers D Maximum number of customers in the system E Calling population size

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved.

    Kendall’s Notation

    34 第2章 機率、統計與流量理論 第 48 頁

    A 顧客到訪間隔間之分佈 B 服務時間之分佈 C 伺服器數量 D 系統最大顧客數 E 通話人口大小

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 35

    Kendall’s notation

    A and B can take any of the following distributions types:

    M Exponential distribution (Markovian) D Degenerate (or deterministic) distribution Ek Erlang distribution (k = shape parameter) Hk Hyper exponential with parameter k

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved.

    Kendall’s notation

    M 指數分佈 (馬可夫: Markovian) D 退化 (deterministic) 分佈(或特定性分佈) Ek 爾朗(Erlang )分佈 (k 為外型参數) G 一般分佈(任意分佈) Hk 参數為 k 之超指數

    第2章 機率、統計與流量理論 第 49 頁 36

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 37

    Little’s Law

    Assuming a queuing environment to be operating in a stable steady state where all initial transients have vanished, the key parameters characterizing the system are: λ – the mean steady state consumer arrival N – the average no. of customers in the system T – the mean time spent by each customer in the

    system which gives N = λT

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 38

    Markov Process

    A Markov process is one in which the next state of the process depends only on the present state, irrespective of any previous states taken by the process

    The knowledge of the current state and the transition probabilities from this state allows us to predict the next state

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 39

    Birth-Death Process

    Special type of Markov process Often used to model a population (or, no. of jobs

    in a queue) If, at some time, the population has n entities (n

    jobs in a queue), then birth of another entity (arrival of another job) causes the state to change to n+1

    On the other hand, a death (a job removed from the queue for service) would cause the state to change to n-1

    Any state transitions can be made only to one of the two neighboring states

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 40

    The state transition diagram of the continuous birth-death process

    State Transition Diagram

    µ1 µ2 µ3 µn-1 µn µn+1 µn+2

    n-1 0 1 2 n n+1 …… λ0 λ1 λ2 λn-2 λn-1 λn λn+1

    P(0) P(1) P(2) P(n-1) P(n) P(n+1) Probability in a state

    狀態 0 的平衡方程式: 1 1 0 0p pµ λ= 狀態 1 的平衡方程式: 0 0 2 2 1 1 1( )p p pλ µ λ µ+ = + 狀態n的平衡方程式: 1 1 1 1 ( )n n n n n n np p pλ µ λ µ− − + ++ = + Equilibrium State Equations

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved.

    Birth-Death Process 由平衡方程式可得

    由數學歸納法(mathematical induction)可得

    01 0

    1

    p pλµ

    = 12 1 1 1 0 02 2

    1 011 0

    2 2 1

    1 ( )p p p p

    p p

    λ µ λµ µ

    λ λλµ µ µ

    = + −

    = =

    1 2

    1

    0

    00

    0 1

    1 1

    1, 2, (3)

    n

    ni

    i i

    n n

    n n

    pp

    p n

    λ λ λµ µ µ

    λµ

    = +

    − −

    =

    =

    = ∏

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved.

    Birth-Death Process 因為

    所以

    以下所討論的等候模式,若屬生死過程,即可用式(3)及式(4)

    1

    0 00 1 0 1

    1n

    in

    n n i i

    p p p λµ

    −∞ ∞

    = = = +

    = + =∑ ∑∏

    0 1

    1 0 1

    1 (4)1

    ni

    n i i

    pλµ

    −∞

    = = +

    =+∑∏

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 43

    M/M/1/∞ or M/M/1 Queuing System

    When a customer arrives in this system it will be served if the server is free, otherwise the customer is queued

    In this system customers arrive according to a Poisson distribution and compete for the service in a FIFO (first in first out) manner

    Service times are independent identically distributed (IID) random variables, the common distribution being exponential

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 44

    Queuing Model and State Transition Diagram

    λ

    Queue Server

    µ

    µ µ µ µ µ µ µ

    λ λ λ λ λ λ λ

    0 1 2 i-1 i i+1 …… …

    The M/M/1/∞ queuing model

    The state transition diagram of the M/M/1/∞ queuing system

    P(0) P(1) P(2) P(i-1) P(i) P(i+1) Probability in a state

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 45

    Equilibrium State Equations

    1 ),1()1()()(,0 ),1()0(

    ≥++−=+==

    iiPiPiPiPP

    µλµλµλ

    If mean arrival rate is λ and mean service rate is µ, i = 0, 1, 2 be the number of customers in the system and P(i) be the state probability of the system having i customers

    From the state transition diagram, the equilibrium state equations are given by

    1 ),0()()( ≥= iPiP iµλ

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved.

    Equilibrium State Equations

    46

    2 2

    (1) (0),

    (2) (1) ( ) (0) (0),

    ...

    ( ) ( 1) ( ) (0) (0),t i

    P P

    P P P P

    P i P i P P

    λµλ λ ρµ µ

    λ λ ρµ µ

    = = = = = − = =

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 47

    Traffic Intensity

    We know that the P(0) is the probability of server being free. Since P(0) > 0, the necessary condition for a system being in steady state is,

    This means that the arrival rate cannot be

    more than the service rate, otherwise an infinite queue will form and jobs will experience infinite service time

    1

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved.

    Pn為系統中顧客數 n 之機率,又機率總和等於 1,因此 = 1 P0 + P1 + P2 + … + Pn + …= 1

    P0 + (λ/µ) P0 + (λ/µ)2 P0 + … + (λ/µ)n P0 + … = 1

    P0 [ 1+ (λ/µ) + (λ/µ)2 + … + (λ/µ)n + … ] = 1

    P0 = 1 - (λ/µ) = 1 - ρ , ρ = λ/µ

    Pn = (λ/µ)n P0 = ρ

    n (1 - ρ) , n ≧0

    P0為系統中沒有顧客之機率,即服務設施閒置之機率。

    =∑ nn 0

    P

    ( / )

    = − 0

    1P 11 λ µ

    M/M/1 Queuing System

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 49

    Queuing System Metrics

    ρ = 1 – P(0), is the probability of the server being busy. Therefore, we have

    P(i) = ρ i(1- ρ) The average number of customers in the system

    is

    Ls =

    The average dwell time of customers is

    Ws =

    λµλ−

    λµ −1

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved.

    ∞ ∞

    n=0 n=0

    (a)

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved.

    (c)

    (b)

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 52

    Queuing System Metrics

    The average queuing length is

    )(

    2

    1 1

    2)()1(

    λµµλ

    ρρ

    −∑∞

    ==

    −=−=

    iiPiLq

    The average waiting time of customers is

    )()1(

    2

    λµµλ

    ρλρ

    λ −=

    −==

    qq

    LW

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. p.53/60

    Example

    問題 某郵局有一個專門辦理郵寄業務的窗口,中午12:00至下午1:00,到郵局辦理郵寄業務的顧客呈指數分配,平均每小時30人,每位顧客的服務時間亦呈指數分配,平均為1.5分鐘,求有五位顧客以上的機率為何?

    解答 此窗口的等候模式為 / /1M M 模式,且

    30 / hrλ = 1 11.5min hr 40 / hr

    40µ

    µ= = ⇒ =

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. p.54/60

    Example 因此

    30 0.7540

    λρµ

    = = =

    代入 / /1M M 模式的相關公式可得 30 3

    40 30L λ

    µ λ= = =

    − −位顧客

    2 230 2.25( ) 40(40 30)q

    L λµ µ λ

    = = =− −

    位顧客

    1 1 0.1 hr 6 min40 30

    Wµ λ

    = = = =− −

    30 0.075 hr 4.5 min( ) 40(40 30)q

    W λµ µ λ

    = = = =− −

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. p.55/60

    Example 代入 np 公式可得

    (1 ) (0.75) (1 0.75)n nnp ρ ρ= − = −

    因此

    0 1 2 3 40.250, 0.188, 0.141, 0.105, 0.079 p p p p p= = = = =

    五位以上顧客的機率為 4

    01 1 0.763 0.237n

    np

    =

    − = − =∑

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 56

    M/M/S/∞ Queuing Model

    λ

    Queue

    Servers

    S

    .

    .

    2

    1

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 57

    State Transition Diagram

    µ 2µ 3µ (S-1)µ Sµ Sµ Sµ

    0 1 2 S-1 S S+1 …… λ λ λ λ λ λ λ

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved.

    M/M/S/∞ Queuing Model 此模式的 nλ 及 nµ 如下:

    0,1, 1, 2, , 1 , 1,

    n

    n

    nn n ss n s s

    λ λ

    µµ

    µ

    = =

    = −= = +

    欲求得 np ,我們先計算式(3)中的乘積部分如下:

    1

    0 1

    ( / ) 1, 2, , 1 (1 )(2 ) ( ) !

    ( / ) , 1,(1 )(2 ) ( )( ) !

    n n

    ni

    n ni i

    n s n s

    n sn n

    n s ss s s s

    λ λ µµ µ µλ

    µ λ λ µµ µ µ µ

    = +− −

    = = −

    = = = +

    1 2

    1

    0

    00

    0 1

    1 1

    1, 2,

    n

    ni

    i i

    n n

    n n

    pp

    p n

    λ λ λµ µ µ

    λµ

    = +

    − −

    =

    =

    = ∏

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved.

    M/M/S/∞ Queuing Model 因此,

    0

    0

    ( / ) 1, 2, , 1 !

    ( / ) , 1,!

    n

    n n

    n s

    p n snp

    p n s ss s

    λ µ

    λ µ−

    = −=

    = +

    11

    01

    11

    0

    ( / ) ( / )1! !

    ( / ) ( / ) 1! ! 1 /( )

    n sn ss

    n n s

    n ss

    n

    pn s s

    n s s

    λ µ λ µ λµ

    λ µ λ µλ µ

    −−− ∞

    = =

    −−

    =

    = + +

    = + −

    ∑ ∑

    以上 0p 的求導過程中,必須 / 1sρ λ µ= <

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. p.60/60

    M/M/S/∞ 至於四個績效基準,可計算 qL 如下:

    00 0

    10 0

    0 0

    0 00

    02

    ( )

    ( / )!

    ( / ) ( / )! !

    ( / ) ( / ) 1! ! 1

    ( / )!(1 )

    q nn s

    si

    s ii i

    s si i

    i i

    s si

    i

    s

    L n s p

    ip i ps

    dp i ps s d

    d dp ps d s d

    ps

    λ µ ρ

    λ µ λ µρ ρ ρ ρρ

    λ µ λ µρ ρ ρρ ρ ρ

    λ µ ρρ

    =

    ∞ ∞

    += =

    ∞ ∞−

    = =

    =

    = −

    = =

    = =

    = = −

    =−

    ∑ ∑

    ∑ ∑

    其餘的績效基準可由 Little 公式及基本關係求得

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 61

    Queuing System Metrics

    The average number of customers in the system is

    ∑∞

    = −+==

    02)1(!)0()(

    i

    S

    sS

    PiiPLρ

    ραα

    The average dwell time of a customer in the system is given by

    2)1(!.)0(1ρµ

    αµλ −+==

    SSPLW

    SS

    S

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 62

    Queuing System Metrics

    The average queue length is

    ∑∞

    =

    +

    −−=−=

    si

    S

    qSSPiPSiL 2

    1

    )()!1()0()()(α

    α

    The average waiting time of customers is

    2)1(!.)0(ρµ

    αλ −==

    SSPLW

    Sq

    q

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved.

    M/M/1/K 到達率與服務率為

    0,1, , 10 , 1,n

    n Kn K K

    λλ

    = −= = +

    1, 2,n nµ µ= =

    將 nλ 與 nµ 代入式(4)及式(3),分別可得

    00

    1 0

    1

    1 1

    1 1 1

    1 1 1

    K Kn n

    n n

    K

    p

    K

    ρ ρ ρ

    ρ ρρ

    ρ

    = =

    +

    = =+

    − ≠ −= = +

    ∑ ∑

    1 2

    1

    0

    00

    0 1

    1 1

    1, 2, (3)

    n

    ni

    i i

    n n

    n n

    pp

    p n

    λ λ λµ µ µ

    λµ

    = +

    − −

    =

    =

    = ∏

    0 1

    1 0 1

    1 (4)1

    ni

    n i i

    pλµ

    −∞

    = = +

    =+∑∏

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved.

    M/M/1/K 0

    1

    1 1 1 for 0,1, ,

    1 1 1

    nn

    nK

    p p

    n K

    K

    ρ

    ρ ρ ρρ

    ρ

    +

    =

    − ≠ −= = = +

    在以上 0p 推導中,用到有限總和(finite sum)公式: 1

    0

    1 11

    1 1

    KK

    n

    n

    x xx xK x

    +

    =

    −≠= −

    + =∑

    此模式的穩定狀態並不需要 / 1ρ λ µ= <

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved.

    M/M/1/K 當 1ρ ≠ 時:

    1

    1

    [ ( 1) 1](1 )(1 )

    K K

    K

    LK Kρ ρ ρ

    ρ ρ

    +

    +

    =

    − + +=

    − −

    若 1ρ = ,則

    0

    1 ( 1)1 2 2

    K

    nn

    K K KL npK=

    += = =

    +∑

    qL 可計算如下:

    0(1 )qL L p= − −

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved.

    M/M/1/K 利用 Little 公式時,須使用有效到達率(effective

    arrival rate) effλ :

    eff (1 )Kpλ λ= − 代入 Little 公式可得

    eff eff

    qqLLW W

    λ λ= =

    lostλ

    λ

    effλ

    等候系統

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved.

    M/M/S/K 到達率與服務率為:

    0,1, , 10 , 1,

    1, 2, , 1 , 1, ,

    n

    n

    n Kn K K

    n n ss n s s K

    λλ

    µµ

    µ

    = −= = +

    = −= = +

    將 nλ 與 nµ 代入式(3)及式(4),分別可得

    0

    0

    ( / ) 1, 2, , 1 !

    ( / ) , 1, ,!

    0 1,

    n

    n

    n n s

    p n sn

    p p n s s Ks s

    n K

    λ µ

    λ µ−

    = −

    = = +

    = +

    1 2

    1

    0

    00

    0 1

    1 1

    1, 2, (3)

    n

    ni

    i i

    n n

    n n

    pp

    p n

    λ λ λµ µ µ

    λµ

    = +

    − −

    =

    =

    = ∏

    0 1

    1 0 1

    1 (4)1

    ni

    n i i

    pλµ

    −∞

    = = +

    =+∑∏

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. p.68/60

    M/M/S/K 1

    1

    01

    111

    1

    ( / ) ( / )1! !

    ( / ) ( / ) 1 ( / )1! ! 1 ( / )

    n sn ss K

    n n s

    n s K ss

    n

    pn s s

    sn s s

    λ µ λ µ λµ

    λ µ λ µ λ µλ µ

    −−−

    = =

    −− +−

    =

    = + +

    −= + + −

    ∑ ∑

    得到所有 np 後,即可求得 qL (當 / 1sρ λ µ= ≠ 時)如下:

    02

    ( )

    ( / ) [( )( 1) 1]!(1 )

    K

    q nn s

    sK s K s

    L n s p

    p K ssλ µ ρ ρ ρ ρ

    ρ

    =

    − −

    = − =

    = − − − +−

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved.

    M/M/S/K 此模式之L與 qL 的關係如下:

    1 1

    0 01

    s s

    q n nn n

    L L np s p− −

    = =

    = + + −

    ∑ ∑

    欲利用 Little 公式,須使用有效到達率 effλ :

    eff (1 )Kpλ λ= − 因此,

    eff eff

    qqLLW W

    λ λ= =

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved.

    Example 概述 保養廠設置2個升降工作

    台(各1位維修員),並可停放3輛

    若汽車無法進入保養廠停放,將會離開

    到達率呈指數分配,平均每小時2輛

    維修時間呈指數分配,平均需要40分鐘

    每位顧客平均消費金額$1350

    問題 a. 廠內有n位顧客的機率 b. 有效到達率 c. 每天營業的10小時期間

    ,因顧客無法進入而損失的營業額

    d. 兩工作台的期望車輛數 e. 每位維修員每天空閒時

    間的百分比 f. 等候維修的期望車輛數 g. 每位顧客在保養廠內的

    期望時間

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. p.71/60

    Solution (a) 此為 / / /M M s K 模式,其 2, 5s K= = ,且

    2 / hr 0,1, , 4n nλ = = 1 240min hr 1.5 / hr

    µ= = ⇒ =

    1.5 1, 23 3, 4,5n

    n nn

    µ=

    = =

    代入 np 公式可得

    0

    0

    (2 /1.5) 1, 2!

    (2 /1.5) 3, 4,52!2

    n

    n n

    n s

    p nnp

    p n−

    ==

    =

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. p.72/60

    Solution (a) 因此,

    2 3

    1 0 2 0 3 0

    4 5

    4 0 5 0

    4 1 4 1 4, , 3 2 3 4 3

    1 4 1 4 , 8 3 16 3

    p p p p p p

    p p p p

    = = =

    = =

    因機率總和等於 1,所以 2 3 4 5

    04 1 4 1 4 1 4 1 41 13 2 3 4 3 8 3 16 3

    p + + + + + =

    計算可得 0 0.2236p = ,因此

    1 2 3 4 50.2981, 0.1988, 0.1325, 0.0883, 0.058 p p p p p= = = = =

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. p.73/60

    Solution (b)

    (c)

    有效到達率可計算如下:

    eff 5(1 ) 2(1 0.0589) 1.8822pλ λ= − = − = cars / hr

    每小時無法進入的車輛數為

    5 2(0.0589) 0.1178pλ = = cars

    因此每天 10 小時所損失的營業額為

    5$1350 10 $1590.3pλ× × =

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. p.74/60

    Solution (d) 兩工作台的期望車輛數為

    1 2 3 4 51 2( ) 1.2551 carsp p p p p+ + + + =

    (e) 每位維修員每天空閒時間的百分比可計算如下:

    0 1(2 1 ) / 2 37.27%p p+ =

    (f) 等候維修的期望車輛數為

    5

    3 4 53( 2) 1 2 3 0.4858 carsq n

    nL n p p p p

    =

    = − = + + =∑

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. p.75/60

    Solution (g) 每位顧客在保養廠內的期望時間為

    eff

    0.4858 0.2581 hrs 15.49 min1.8822

    qq

    LW

    λ= = = =

    1 55.49 minqW W µ= + =

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved.

    Example

    某工廠買了許多同一型式之機器,現在需要確定一名工人應看管幾台機器,機器在正常運轉時是不需要看管的。已知每台機器的正常運轉時間服從平均數為120分鐘的指數分配,工人看管一台機器的時間服從平均數為12分鐘的指數分配。每名工人只能看管自己的機器,工廠要求每台機器的正常運轉時間不得少於87.5﹪。問在此條件之下每名工人最多能看管幾台機器?

    76

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved.

    Solution

    77

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved.

    Example

    某戲院有三個售票窗口,每個售票窗口對於每位客人之平均出售時間為5分鐘,依指數分佈;到達該戲院每小時平均6人,依Poisson分佈。但等候列的長度為30個人,試求下列問題?

    (1) 系列中有n個客人的機率 (2) 系列之呼損率(系列中已滿,再到達之客人不

    能進入系列中而馬上離開支機率)

    78

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved.

    Solution

    79

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved.

    HW

    有一超級市場在顧客的期望下,該店經理相信顧客對需排隊等候8分鐘並且共花10分鐘在等候系統上(不含真正購物時間)是難以接受的。因此經理嘗試下列兩方案中的一個來縮短顧客等待時間:(1)增聘一位員工打包貨品;(2)增加一個結帳櫃臺。

    80

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 85

    M/G/1/∞ Queuing Model

    We consider a single server queuing system whose arrival process is Poisson with mean arrival rate λ

    Service times are independent and identically distributed with distribution function FB and pdf fb

    Jobs are scheduled for service as FIFO

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 86

    Basic Queuing Model

    Let N(t) denote the number of jobs in the system (those in queue plus in service) at time t.

    Let tn (n= 1, 2,..) be the time of departure of the nth job and Xn be the number of jobs in the system at time tn, so that

    Xn = N (tn), for n =1, 2,.. The stochastic process can be modeled as a

    discrete Markov chain known as imbedded Markov chain, which helps convert a non-Markovian problem into a Markovian one.

  • Copyright © 2011, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 87

    Queuing System Metrics The average number of jobs in the system, in the steady state

    is

    The average dwell time of customers in the system is

    The average waiting time of customers in the queue is

    Average waiting time of customers in the queue is

    The average queue length is

    ρλ += qWNE ][

    )1(2][][

    22

    ρλρ

    −+=

    BENE

    )1(2][1][ 2

    ρλ

    µλ −+==

    BENEWs

    )1(2][ 2

    ρλ

    −=

    BEWq

    )1(2][ 22

    ρλ

    −=

    BELq

    Chapter 2OutlineIntroductionProbability Theory and Statistics TheoryDiscrete Random VariablesDiscrete Random VariablesContinuous Random VariablesCumulative Distribution FunctionProbability Density FunctionExpected Value, nth Moment, nth Central Moment, and VarianceExpected Value, nth Moment, nth Central Moment, and VarianceExpected Value, nth Moment, nth Central Moment, and VarianceSome Important Discrete Random DistributionsSome Important Discrete Random DistributionsSome Important Continuous Random DistributionsSome Important Continuous Random DistributionsSome Important Continuous Random DistributionsMultiple Random VariablesIndependence and Conditional Probability Bayes Theorem Important Properties of Random Variables Important Properties of Random Variables Important Properties of Random VariablesCentral Limit TheoremCentral Limit TheoremPoisson Arrival ModelProperties of a Poisson ProcessInterarrival Times of Poisson ProcessExponential DistributionMemoryless and Merging PropertiesMemorylessBasic Queuing SystemsKendall’s NotationKendall’s NotationKendall’s notationKendall’s notationLittle’s LawMarkov ProcessBirth-Death ProcessState Transition DiagramBirth-Death ProcessBirth-Death ProcessM/M/1/ or M/M/1 Queuing SystemQueuing Model and State Transition DiagramEquilibrium State EquationsEquilibrium State EquationsTraffic IntensitySlide Number 48Queuing System Metrics(a)(c)Queuing System MetricsExampleExampleExampleM/M/S/ Queuing ModelState Transition DiagramM/M/S/ Queuing ModelM/M/S/ Queuing ModelM/M/S/Queuing System MetricsQueuing System MetricsM/M/1/KM/M/1/KM/M/1/KM/M/1/K M/M/S/KM/M/S/KM/M/S/KExampleSolutionSolutionSolutionSolutionSolutionExampleSolutionExampleSolutionHWM/G/1/ Queuing ModelBasic Queuing ModelQueuing System Metrics