1.225J 1.225J (ESD 225) Transportation Flow Systems Lecture 8 Delays in Probabilistic Models: Elements from Queueing Theory Profs. Ismail Chabini and Amedeo Odoni Lecture 8 Outline Introduction to Queueing Conceptual Representation of Queueing Systems Codes for Queueing Models Terminology and Notation Little’s Law and Basic Relationships Exponential Distribution for Interarrival and Service times Modeling State Transition Diagram Derivation of waiting characteristics for M/M/1 Summary 1.225, 11/26/02 Lecture 8, Page 2 1 Applications of Queueing Theory Some familiar queues: • Airport check-in • Automated Teller Machines (ATMs) • Fast food restaurants • On hold on an 800 phone line • Urban intersection • Toll booths • Aircraft in a holding pattern • Calls to the police or to utility companies Level-of-service (LOS) standards Economic analyses involving trade-offs among operating costs, capital investments and LOS Queueing theory predicts various characteristics of waiting lines (or queues) such as average waiting time 1.225, 11/26/02 Lecture 8, Page 3 Queueing Models Can Be Essential in Analysis of Capital Investments Cost Total cost Optimal cost Cost of building the capacity Cost of losses due to waiting “Optimal” capacity 1.225, 11/26/02 Capacity Lecture 8, Page 4 2 Strengths and Weaknesses of Queueing Theory Queueing models necessarily involve approximations and simplification of reality Results give a sense of order of magnitude, of changes relative to a baseline, of promising directions in which to move Closed-form results are essentially limited to “steady state” conditions and derived primarily (but not solely) for birth-anddeath systems and “phase” systems Some useful bounds for more general systems at steady state Numerical solutions are increasingly viable for dynamic systems 1.225, 11/26/02 Lecture 8, Page 5 Queueing Process and Queueing System Queueing System Servers C Arrival point at the system C Queue Source of users/ customers Departure point from the system C C C C C C C C C C C Arrivals process Size of user source 1.225, 11/26/02 Queue discipline and Queue capacity Service process Number of servers Lecture 8, Page 6 3 Queueing network consisting of five queueing systems Queueing system 2 In Queueing system 1 Queueing system 3 Point where users merge Point where users make a choice + Queueing system 5 Out Queueing system 4 1.225, 11/26/02 Lecture 8, Page 7 A Code for Queueing Models: A/B/m Distribution of service time Queueing System Number of servers –/–/– Distribution of interarrival time Customers C C CCCCCC C C Queue S S S S Service facility Some standard code letters for A and B: • M: Negative exponential (M stands for memoryless) • D: Deterministic • Ek:kth-order Erlang distribution • G: General distribution Model covered in this lecture: M/M/1 1.225, 11/26/02 Lecture 8, Page 8 4 Terminology and Notation State of system: number of customers in queueing system Queue length: number of customers waiting for service N(t) = number of customers in queueing system at time t Pn(t) = probability that N(t) is equal to n λn: mean arrival rate of new customer when N(t) = n µn: mean (combined) service rate when N(t) = n Transient condition: state of system at t depends on the state of the system at t=0 or on t Steady state condition: system is independent of initial state and t s: number of servers (parallel service channels) If λn and the service rate per busy server are constant, then λn=λ, µn=sµ Expected interarrival time = 1 1 λ Expected service time = µ 1.225, 11/26/02 Lecture 8, Page 9 Quantities of Interest at Steady State Given: • λ = arrival rate • µ = service rate per service channel (number of servers =1, in this lecture) Unknowns: • L = expected number of users in queueing system • Lq = expected number of users in queue • W = expected time in queueing system per user (W = E(w)) • Wq = expected waiting time in queue per user (Wq = E(wq)) 4 unknowns ⇒ We need 4 equations 1.225, 11/26/02 Lecture 8, Page 10 5 Little’ Little’s Law A(t): cumulative arrivals to the system C(t): cumulative service completions in the system Number of users A(t) N(t) C(t) t T 1.225, 11/26/02 ∫ LT = 0 N (t )dt T T Time T = A(T ) ∫0 N (t ) dt ⋅ = λT ⋅ WT T A(T ) Lecture 8, Page 11 Relationships between L, Lq, W, W, and Wq 4 unknowns: L, W, Lq, Wq Need 4 equations. We have the following 3 equations: • L = λW (Little’s law) • Lq = λWq 1 • W = Wq + µ If we know L (or any one of the four expected values), we can determine the value of the other three The determination of L may be hard or easy depending on the type of queueing model at hand (i.e. M/M/1, M/M/s, etc.) ∞ L = ∑ nPn ( Pn : probability that n customers are in the system) n=0 1.225, 11/26/02 Lecture 8, Page 12 6 Modeling Interarrival Time and Service Time • T : Interarrival (service) time random variable αe −αt , t ≥ 0 • Density function : fT (t) = ,t < 0 0 • P{0 ≤ T ≤ t} = 1− e −αt , E (T ) = 1 α , var(T ) = 1 α2 • For small ∆t, P{0 ≤ T ≤ ∆t} ≈ α ∆t (why?) ∞ • e x = 1+ x + ∑ k =2 xk k! (−α ∆t) k ) k! k =2 ≈ α ∆t (for small ∆t) ∞ • P{0 ≤ T ≤ ∆t} = 1− e −α ∆t = 1− (1− α ∆t + ∑ • Interarrival Time : α = λ ; Service Time : α = µ 1.225, 11/26/02 Lecture 8, Page 13 State Transition Diagram for M/M/1 States: 0 … 2 1 n-1 n+1 n During ∆t: P1λ∆t P0 λ∆t 0 P2 λ∆t Pn +1λ∆t Pn λ∆t Pn −1λ∆t n-1 Pn −1µ∆t P3 µ∆t P2 µ∆t P1µ∆t … 2 1 Pn − 2 λ∆t n+1 n Pn + 2 µ∆t Pn +1µ∆t Pn µ ∆t Another way to represent it: State Transition Diagram λ λ 0 1.225, 11/26/02 µ λ … 2 1 µ λ µ n-1 µ n+1 n µ λ λ λ µ µ Lecture 8, Page 14 7 Observing State Transition Diagram from Two Points From point 1: λP0 = µP1 (λ + µ ) P1 = λP0 + µP2 λ λ 0 (λ + µ ) Pn = λPn −1 + µPn +1 λ λ … 2 1 n-1 n+1 n µ µ µ µ λ λ λ µ µ µ From point 2: λP0 = µP1 λPn = µPn +1 λP1 = µP2 λ λ 0 λ … 2 1 λ λ λ n-1 n+1 n µ µ µ µ λ µ µ 1.225, 11/26/02 µ Lecture 8, Page 15 Derivation of P0 and Pn n 2 Putting it all together: P1 = λ λ λ P0 , P2 = P0 , L, Pn = P0 µ µ µ n ∞ λ Since ∑ Pn = 1, ⇒ P0 ∑ = 1 ⇒ P0 = n =0 n =0 µ ∞ Let ρ = λ , then µ Therefore, P0 = 1 λ ∑ n =0 µ ∞ n n ∞ λ 1− ρ ∞ 1 = ∑ ρ n = = (Q ρ < 1) ∑ 1 − 1 − µ ρ ρ n= 0 n =0 ∞ 1 ∞ ∑ρ = 1− ρ n and Pn = ρ n (1 − ρ ) n =0 1.225, 11/26/02 Lecture 8, Page 16 8 Derivation of L, W, Wq, and Lq ∞ ∞ ∞ ∞ n =0 n =0 n =0 n =1 • L = ∑ nPn =∑ nρ n (1 − ρ ) = (1 − ρ )∑ nρ n = (1 − ρ ) ρ ∑ nρ n −1 d ∞ n d 1 = (1 − ρ ) ρ ∑ ρ = (1 − ρ ) ρ dρ n = 0 dρ 1 − ρ λ 1 ρ λ µ = = (1 − ρ ) ρ = = 2 λ (1 − ρ ) (1 − ρ ) 1 − µ µ − λ •W= L λ = 1 λ 1 ⋅ = µ −λ λ µ −λ • Wq = W − 1 µ = • Lq = λ Wq = λ ⋅ 1 µ −λ − 1 µ = λ µ (µ − λ ) λ λ2 = µ (µ − λ ) µ (µ − λ ) 1.225, 11/26/02 Lecture 8, Page 17 Lecture 8 Summary Introduction to Queueing Conceptual Representation of Queueing Systems Codes for Queueing Models Terminology and Notation Little’s Law and Basic Relationships Exponential Distribution for Interarrival and Service times Modeling State Transition Diagram Derivation of waiting characteristics for M/M/1 1.225, 11/26/02 Lecture 8, Page 18 9