Waiting Line Models: Queuing Theory Basics Cuantitativos M. En C. Eduardo Bustos Farias 1
Agenda Queuing system structure Performance measures Components of queuing systems Arrival process Service process M/M/1 Queue M/M/s (M/M/k) Queue Economic analysis of waiting lines Waiting line models extensions Summary Cuantitativos M. En C. Eduardo Bustos Farias 2
When you are in queue? In the bank, restaurant, supermarket In front of restroom during the break of football game How much is your patience? Waiting costs your patience and your temper and it also costs the business. Time = For the business, they have to find the optimal service level that keeps customers happy and makes them profitable. Cuantitativos M. En C. Eduardo Bustos Farias 3
INTRODUCTION Queuing models are everywhere. For example, airplanes queue up in holding patterns, waiting for a runway so they can land. Then, they line up again to take off. People line up for tickets, to buy groceries, etc. Jobs line up for machines, orders line up to be filled, and so on. A. K. Erlang (a Danish engineer) is credited with founding queuing theory by studying telephone switchboards in Copenhagen for the Danish Telephone Company. Many of the queuing results used today were developed by Erlang. Cuantitativos M. En C. Eduardo Bustos Farias 4
A queuing model is one in which you have a sequence of times (such as people) arriving at a facility for service, as shown below: Arrivals 00000 Service Facility Consider St. Luke s s Hospital in Philadelphia and the following three queuing models. Model 1: St. Luke s s Hematology Lab St. Luke s treats a large number of patients on an outpatient basis (i.e., not admitted to the hospital). Outpatients plus those admitted to the 600-bed hospital produce a large flow of new patients each day. Cuantitativos M. En C. Eduardo Bustos Farias 5
Most new patients must visit the hematology laboratory as part of the diagnostic process. Each such patient has to be seen by a technician. After seeing a doctor, the patient arrives at the laboratory and checks in with a clerk. Patients are assigned on a first-come, first-served served basis to test rooms as they become available. The technician assigned to that room performs the tests ordered by the doctor. When the testing is complete, the patient goes on to the next step in the process and the technician sees a new patient. We must decide how many technicians to hire. Cuantitativos M. En C. Eduardo Bustos Farias 6
Model 2: Buying WATS Lines As part of its remodeling process, St. Luke s s is designing a new communications system which will include WATS lines. WATS (Wide Area Telephone Service) is an acronym for a special flat-rate, long distance service offered by some phone companies. When all the phone lines allocated to WATS are in use, the person dialing out will get a busy signal, indicating that the call can t t be completed. We must decide how many WATS lines the hospital should buy so that a minimum of busy signals will be encountered. Cuantitativos M. En C. Eduardo Bustos Farias 7
Model 3: Hiring Repairpeople St. Luke s s hires repairpeople to maintain 20 individual pieces of electronic equipment. The equipment includes measuring devices such as electrocardiogram machines small dedicated computers CAT scanner other equipment If a piece of equipment fails and all the repairpeople are occupied, it must wait to be repaired. We must decide how many repairpeople to hire and balance their cost against the cost of having broken equipment. Cuantitativos M. En C. Eduardo Bustos Farias 8
All three of these models fit the general description of a queuing model as described below: PROBLEM ARRIVALS SERVICE FACILITY 1 Patients Technicians 2 Telephone Calls Switchboard 3 Broken Equipment Repairpeople These models will be resolved by using a combination of analytic and simulation models. To begin, let s s start with the basic queuing model. Cuantitativos M. En C. Eduardo Bustos Farias 9
Queuing Systems customers Single Channel Waiting Line System arrival... channel (server) departure waiting line (queue) system server 1 Multi-Channel Waiting Line System arrival... server 2. departure server k system Cuantitativos M. En C. Eduardo Bustos Farias 10
Waiting Line Examples Situation Arrivals Servers Service Process Bank Customers Teller Deposit etc. Doctor s Patient Doctor Treatment office Traffic Cars Light Controlled intersection passage Assembly line Parts Workers Assembly Tool crib Workers Clerks Check out/in tools Cuantitativos M. En C. Eduardo Bustos Farias 11
THE BASIC MODEL Consider the Xerox machine located in the fourth- floor secretarial service suite. Assume that users arrive at the machine and form a single line. Each arrival in turn uses the machine to perform a specific task which varies from obtaining a copy of a 1-page letter to producing 100 copies of a 25-page report. This system is called a single-server server (or single- channel) ) queue. Cuantitativos M. En C. Eduardo Bustos Farias 12
Questions about this or any other queuing system center on four quantities: 1. The number of people in the system (those being served and waiting in line). 2. The number of people in the queue (waiting for service). 3. The waiting time in the system (the interval between when an individual enters the system and when he or she leaves the system). 4. The waiting time in the queue (the time between entering the system and the beginning of service). Cuantitativos M. En C. Eduardo Bustos Farias 13
ASSUMPTIONS OF THE BASIC MODEL 1. Arrival Process. Each arrival will be called a job. job. The interarrival time (the time between arrivals) is not known. Therefore, the exponential probability distribution (or negative exponential distribution) ) will be used to describe the interarrival times for the basic model. The exponential distribution is completely specified by one parameter, λ,, the mean arrival rate (i.e., how many jobs arrive on the average during a specified time period). Cuantitativos M. En C. Eduardo Bustos Farias 14
Mean interarrival time is the average time between two arrivals. Thus, for the exponential distribution Avg. time between jobs = mean interarrival time = 1 λ Thus, if λ = 0.05 1 1 mean interarrival time = = = 20 λ 0.05 2. Service Process. In the basic model, the time that it takes to complete a job (the service time) ) is also treated with the exponential distribution. The parameter for this exponential distribution is called µ (the mean service rate in jobs per minute). Cuantitativos M. En C. Eduardo Bustos Farias 15
µt is the number of jobs that would be served (on the average) during a period of T minutes if the machine were busy during that time. The mean or average, service time (the average time to complete a job) is Avg. service time = 1 µ Thus, if µ = 0.10 1 1 mean service time = = = 10 µ 0.10 3. Queue Size. There is no limit on the number of jobs that can wait in the queue (an infinite queue length). Cuantitativos M. En C. Eduardo Bustos Farias 16
4. Queue Discipline. Jobs are served on a first- come, first-serve serve basis (i.e., in the same order as they arrive at the queue). 5. Time Horizon. The system operates as described continuously over an infinite horizon. 6. Source Population. There is an infinite population available to arrive. Cuantitativos M. En C. Eduardo Bustos Farias 17
QUEUE DISCIPLINE In addition to the arrival distribution, service distribution and number of servers, the queue discipline must also be specified to define a queuing system. So far, we have always assumed that arrivals were served on a first-come, first-serve serve basis (often called FIFO, for first-in, in, first-out out ). However, this may not always be the case. For example, in an elevator, the last person in is often the first out (LIFO). Adding the possibility of selecting a good queue discipline makes the queuing models more complicated. These Cuantitativos models are referred M. En C. Eduardo to as Bustoscheduling Farias models. 18
Various Type of Queues Single Channel/Single Phase Multi-channel/Single Phase Single Channel/Multi-phase Queuing Network Cuantitativos M. En C. Eduardo Bustos Farias 19
Queuing System Structure Population Source - Finite - Infinite Exit 1. Return to service population 2. Do not return to service population arrival Server departure Arrival characteristic 1. Size of units - Single - Batch 2. Arrival rate - Constant - Probabilistic 3. Degree of patience - Patient - Impatient Features of lines 1. Length - Infinite capacity - Limited capacity 2. Number - Single - Multiple 3. Queue discipline -FIFO - Priorities Service facility 1. Structure 2. Service rate - Constant - Probabilistic - random services - State-dependent service time Cuantitativos M. En C. Eduardo Bustos Farias 20
Deciding on the Optimum Level of Service Cost Total expected cost Minimum total cost Cost of providing service Low level of service Optimal service level Negative Cost of waiting time to company High level of service Cuantitativos M. En C. Eduardo Bustos Farias 21
Performance Measures P 0 = Probability that there are no customers in the system P n = Probability that there are n customers in the system L S = Average number of customers in the system L Q = Average number of customers in the queue W S = Average time a customer spends in the system W Q = Average time a customer spends in the queue P w = Probability that an arriving customer must wait for service ρ = Utilization rate of each server (the percentage of time that each server is busy) Cuantitativos M. En C. Eduardo Bustos Farias 22
Arrival Process Very large population of potential customers behave independently in any time instant, at most one arrives arrive at intervals of average duration 1/λ Important X: # of customer arrivals within time interval of length t Pr(X=n) = ( λt ) n λt e n! λ = the mean arrival rate per time unit t = the length of the time interval e = 2.7182818 (the base of the natural logarithm) n! = n(n 1)(n 2) (n 3) (3)(2)(1) X follows Poisson Distribution(λt) Mean = λt Variance = λt λ = arrival rate = # of arrivals per unit of time Important t should be expressed in the same time unit as λ Cuantitativos M. En C. Eduardo Bustos Farias 23
Examples of Poisson Distribution p(x) Poisson distribution with parameter 1/2 0.4 0.2 0.0 0 1 2 3 x p(x) 0.4 Poisson distribution with parameter 1 0.2 0.0 0 1 2 3 4 x p(x) 0.2 Poisson distribution with parameter 2 0.0 Cuantitativos 0 1 M. 2En C. Eduardo 3 Bustos Farias 4 5 x 24
Service Process Assume service time is exponentially distributed(µ) P.D.F. f(t) = µe -µt Pr(Service t) = 1 e -µt Mean = 1/µ Variance = 1/µ 2 Important µ= service rate = # of customers served per unit time Properties of exponential distribution 1. Memoryless (The conditional probability is the same as the unconditional probability.) 2. Most customers require short services; few require long service 3. If arrival process follows Possion (λ), then inter-arrival time follows exponential(λ) Important Cuantitativos M. En C. Eduardo Bustos Farias 25
Examples of Exponential Distribution Cuantitativos M. En C. Eduardo Bustos Farias 26
Queuing Theory Notation A standard notation is used in queuing theory to denote the type of system we are dealing with. Typical examples are: M/M/1 M/G/1 D/G/n Servers E/G/ Servers Poisson Input/Poisson Server/1 Server Poisson Input/General Server/1 Server Deterministic Input/General Server/n Erlangian Input/General Server/Inf. The first letter indicates the input process, the second letter is the server process and the number is the number of servers. (M = Memoryless = Poisson) Cuantitativos M. En C. Eduardo Bustos Farias 27
Terminology λ = Arrival rate = 1/ Mean arrival interval µ = Service rate = 1/ Mean service time ρ = λ/ µ k = # of Servers Performance measures P 0 = Probability that there are no customers in the system P n = Probability that there are n customers in the system L S = Average number of customers in the system L Q = Average number of customers in the queue W S = Average time a customer spends in the system W Q = Average time a customer spends in the queue P w = Probability that an arriving customer must wait for service ρ = Utilization rate of each server (the percentage of time that each server is busy) Cuantitativos M. En C. Eduardo Bustos Farias 28
Single Server Case Poisson arrivals, exponential service rate, no priorities, no balking, steady state) λ λ λ λ ONLY IF 0 1 2 3 4... µ µ µ µ Steady state exists! STATE ENTRY RATE LEAVING RATE 0 λp 0 µp 1 1 λp 0 + µp 2 (λ + µ)p 1 2 λp 1 + µp 3 (λ + µ)p 2 3 λp 2 + µp : : 4 : (λ + µ)p 3 : : : P n = (λ/µ) n P 0 = ρ n P 0 for n = 1,2,3,... λ< µ or λ/µ = ρ <1 1 = n = 0 n P = ρ 0 = 1 ρ n = 0 P n P 0 if ρ < 1 Cuantitativos M. En C. Eduardo Bustos Farias 29
Single Server Case P 0 = 1 ρ P n = ρ n (1 ρ) L S = E[N] where N = no. of customers in system (denote S) = = ρ /(1 ρ) L Q = E[N q ] where N q = no. of customers in queue (denote Q) = = 0 n n = 0 = ρ 2 /(1 ρ) W S = L S / λ W Q = L Q / λ np n ( n 1) P n Little s Law L S = λ W S L Q = λ W Q Cuantitativos M. En C. Eduardo Bustos Farias 30
Single Server Queue Performance (M/M/1) P 0 = 1 λ/µ P n = (λ/µ) n P 0 L Q = 2 λ µ = 2 ρ ( µ λ) 1 ρ L S W Q = L Q + λ/µ = L Q + ρ = ρ/(1 ρ) = L Q / λ W S = W Q + 1/µ P w = 1 P 0 = ρ Cuantitativos M. En C. Eduardo Bustos Farias 31
The Schips, Inc. Truck Dock Problem Schips, Inc. is a large department store chain that has six branch stores located throughout the city. The company s Western Hills store, which was built some years ago, has recently been experiencing some problems in its receiving and shipping department because of the substantial growth in the branch s sales volume. Unfortunately, the store s truck dock was designed to handle only one truck at a time, and the branch s increased business volume has led to a bottleneck in the truck dock area. At times, the branch manager has observed as many as five Schips trucks waiting to be loaded or unloaded. As a result, the manager would like to consider various alternatives for improving the operation of the truck dock and reducing the truck waiting times. Cuantitativos M. En C. Eduardo Bustos Farias 32
The Schips, Inc. Truck Dock Problem One alternative the manager is considering is to speed up the loading/unloading operation by installing a conveyor system at the truck dock. As another alternative, the manager is considering adding a second truck dock so that two trucks could be loaded and/or unloaded simultaneously. What should the manager do to improve the operation of the truck dock? While the alternatives being considered should reduce the truck waiting times, they may also increase the cost of operating the dock. Thus the manager will want to know how each alternative will affect both the waiting times and the cost of operating the dock before making a final decision Truck arrival information: truck arrivals occur at an average rate of three trucks per hour. Service information: the truck dock can service an average of four trucks per hour. Cuantitativos M. En C. Eduardo Bustos Farias 33
The Schips, Inc. Truck Dock Problem Options: 1. Using conveyor to speed up service rate 2. Add another dock server Assumptions: The waiting cost is linear Poisson Arrivals Exponential service time Cuantitativos M. En C. Eduardo Bustos Farias 34
Schips, Inc. - Current Situation Cuantitativos M. En C. Eduardo Bustos Farias 35
Schips, Inc. - Alternative I Alternative I: Speed up the loading/unloading operations by installing a conveyor system (costs of different conveyer system are not provided here, but you should consider it when you evaluate the total cost) Cuantitativos M. En C. Eduardo Bustos Farias 36
M/M/k Queue Multiple server, single queue (Poisson arrivals, I.I.D. exponential service rate, no priority, no balking, steady state) Server 1 Arrival λ Server 2 Departure kµ ONLY IF λ< kµ or λ / kµ = ρ <1 Steady state exists! Server k Cuantitativos M. En C. Eduardo Bustos Farias 37
M/M/k Queue Performance Measures Cuantitativos M. En C. Eduardo Bustos Farias 38
The Schips, Inc. Problem Alternative II: k = 2 (continued) Alternative I P 0 = 0.4545 L Q = 0.123 L S = 0.873 W Q = 0.041 W S = 0.291 P w = 0.2045 Cuantitativos M. En C. Eduardo Bustos Farias 39
Economic Analysis of Queuing System Cost of waiting vs. Cost of capacity COST TOTAL CAPACITY WAITING CAPACITY Cuantitativos M. En C. Eduardo Bustos Farias 40
The Schips, Inc. Problem (Cost analysis, FYI) c W = Hourly waiting cost for each customer c Server = Hourly cost for each server Total waiting cost/hour = c W L L S = Average number of customers in system Total server cost/hour = c Server k k = Number of servers Total cost per hour = c W L+ c Server k Total Hourly Cost Summary for The Schips Truck Dock Problem c W = $25/hour, c Server = $30/hour Incremental cost of using conveyor: $20/hour for every µ = 2 System µ Avg. # of Trucks in Total Cost/Hour c W L + c S k system (L) 1-server 4 3 (25)(3)+(30)(1)=$105 1-server 6 1 (25)(1) +(30+20)(1) = $75 +conveyor 1-server 8 0.6 (25)(0.6) + (30+40)(1) = $85 +conveyor 1-server +conveyor 10 0.43 (25)(0.43) + (30+60)(1) = $100.71 2-server 4 0.873 (25)(0.873) + (30)(2) = $81.83 Cuantitativos M. En C. Eduardo Bustos Farias 41
Discrete distribution Suppose the bank has only one server, the interarrival and service rate are both discrete Interarrival distribution Service time distribution distribution. This bank wants to simulate for 150 customers arrival. Value Prob Value Prob 1 0.05 1 0.15 2 0.15 2 0.15 3 0.35 3 0.25 4 0.35 3 0.20 5 0.10 4 0.10 Cum. Prob. 1 5 0.05 6 0.05 7 0.03 8 0.02 Cum. Prob. 1 This bank wants to know the queuing length and waiting time of their current service. Cuantitativos M. En C. Eduardo Bustos Farias 42
Discrete distribution Single server queueing simulation (starting empty and idle) Server work Number in queue Customer IA_Time Arrival_Time Service_Time Queue_Time Start_Time Depart_Time Before entry After entry Before entry After entry 1 1 1 3 0 1 4 0 3 0 0 2 3 4 3 0 4 7 0 3 0 0 3 3 7 3 0 7 10 0 3 0 0 4 3 10 2 0 10 12 0 2 0 0 5 3 13 2 0 13 15 0 2 0 0 6 4 17 3 0 17 20 0 3 0 0 7 4 21 6 0 21 27 0 6 0 0 8 4 25 3 2 27 30 2 5 0 1 9 1 26 3 4 30 33 4 7 1 2 10 4 30 7 3 33 40 3 10 0 1 11 3 33 3 7 40 43 7 10 0 1 12 2 35 3 8 43 46 8 11 1 2 13 4 39 3 7 46 49 7 10 2 3 14 4 43 3 6 49 52 6 9 1 2 15 3 46 1 6 52 53 6 7 1 2 14 Waiting Times in Queue 4.5 Queue Length Versus Time (Shown only at times just after arrivals) 12 4 10 3.5 8 3 2.5 6 2 4 1.5 2 1 0.5 0 1 6 11 16 21 26 31 36 41 46 51 56 61 66 71 76 81 86 91 96 101 106 111 116 121 126 131 136 141 146 Customer 0 0 50 100 150 200 250 300 350 400 450 500 Customer Arrival Times Cuantitativos M. En C. Eduardo Bustos Farias 43
Discrete distribution If the arrival rate keeps the same, but the service rate is faster Service time distribution Value Prob 1 0.25 2 0.25 3 0.20 3 0.20 4 0.10 5 0.00 6 0.00 7 0.00 8 0.00 Cum. Prob. 1 2.5 2 1.5 1 0.5 4.5 4 3.5 3 2.5 2 1.5 1 0.5 Waiting Times in Queue-Faster Service Rate 0 1 6 11 16 21 26 31 36 41 46 51 56 61 66 71 76 81 86 91 96 101 106 111 116 121 126 131 136 141 146 Customer Queue Length Versus Time- Faster Service (Shown only at times just after arrivals) 0 0 50 100 150 200 250 300 350 400 450 500 Customer Arrival Times Cuantitativos M. En C. Eduardo Bustos Farias 44
Discrete distribution : L5-QSim2-3servers If the bank has more frequent arrival, they definitely need more servers. Now they have 3 servers. Interarrival distribution Service time distribution Value Prob Value Prob 1 0.80 1 0.15 2 0.15 2 0.15 3 0.03 3 0.25 4 0.01 3 0.2 5 0.01 4 0.1 1 5 0.05 6 0.05 7 0.03 8 0.02 1 Cuantitativos M. En C. Eduardo Bustos Farias 45
Discrete distribution : L5-QSim2-3servers (con t) The waiting time and queuing length with 3 servers 4.5 Waiting Times in Queue-3 servers Queue Length Versus Time- 3 servers (Shown only at times just after arrivals) 4.5 4 4 3.5 3.5 3 2.5 2 1.5 3 2.5 2 1.5 1 1 0.5 0.5 0 1 6 11 16 21 26 31 36 41 46 51 56 61 66 71 76 81 86 91 96 101 106 111 116 121 126 131 136 141 146 Customer 0 0 50 100 150 200 250 Customer Arrival Times If you change to 2 servers, then. Waiting Times in Queue-2 servers Queue Length Versus Time- 2 servers (Shown only at times just after arrivals) 50 30 45 25 40 35 20 30 25 15 20 15 10 10 5 5 0 0 1 6 11 16 21 26 31 36 41 46 51 56 61 66 71 76 81 86 91 96 101 106 111 116 121 126 131 136 141 146 0 50 100 150 200 250 Customer Customer Arrival Times Cuantitativos M. En C. Eduardo Bustos Farias 46
Waiting Line Models Extensions Notation for Classifying Waiting Line Models Code indicating arrival distribution Code indicating service time distribution Number of parallel servers others M = Designates a Poisson probability distribution for the arrivals or an exponential probability distribution for service time D = Designates that the arrivals or the service time is deterministic or constant G = Designates that the arrivals or the service time has a general probability distribution with a known mean and variance Cuantitativos M. En C. Eduardo Bustos Farias 47
Waiting Line Models Extensions Notation for Classifying Waiting Line Models Code indicating arrival distribution Code indicating service time distribution Number of parallel servers others M/M/1 M/M/k M/G/1 (M/D/1 is a special case, D for deterministic service time) G/M/1 And more. G/G/1 G/G/k Cuantitativos M. En C. Eduardo Bustos Farias 48
M/G/1 Queue Performance Measures M/G/1 System: Steady state results (λ<µ) P 0 = 1 ρ (ρ = λ/µ) L Q = 2 2 λ σ + ρ 2(1 ρ ) 2 L S W Q = L Q + λ/µ = L Q + ρ = L Q / λ W S = W Q + 1/µ P w = 1 P 0 = ρ µ = service rate 1/ µ = mean service time σ 2 = variance of service time distribution M/D/1 Queue: σ 2 = 0 2 ρ L Q = 2 (1 ρ ) Cuantitativos M. En C. Eduardo Bustos Farias 49
An Example: Secretary Hiring Suppose you must hire a secretary and you have to select one of two candidates. Secretary 1 is very consistent, typing any document in exactly 15 minutes. Secretary 2 is somewhat faster, with an average of 14 minutes per document, but with times varying according to the exponential distribution. The workload in the office is 3 documents per hour, with interarrival times varying according to the exponential distribution. Which secretary will give you shorter turnaround times on documents? Cuantitativos M. En C. Eduardo Bustos Farias 50
Secretary Hiring - Queuing Model Cuantitativos M. En C. Eduardo Bustos Farias 51
M/M/s with Finite Population The number of customers in the system is not permitted to exceed some specified number Example: Machine maintenance problem Cuantitativos M. En C. Eduardo Bustos Farias 52
M/M/s with Limited Waiting Room Arrivals are turned away when the number waiting in the queue reaches a maximum level Example: Walk-in Dr.s office with limited waiting space Cuantitativos M. En C. Eduardo Bustos Farias 53
Remember: λ & µ Are Rates λ = Mean number of arrivals per time period e.g., 3 units/hour µ = Mean number of people or items served per time period e.g., 4 units/hour 1/µ = 15 minutes/unit If average service time is 15 minutes, then µ is 4 customers/hour 1984-1994 T/Maker Co. Cuantitativos M. En C. Eduardo Bustos Farias 54
Summary Queuing system design has an important impact on the service provided by an enterprise Steady state performance measures can provide useful information in assessing service and developing optimal queuing systems The general procedure of solving a queuing problem: Identify Queue Type Estimate Arrival & Service Processes Calculate Performance Measures Conduct Economic Analysis Many queuing systems do not have closed-form solutions. Simulation is a powerful tool of analyzing those systems. Cuantitativos M. En C. Eduardo Bustos Farias 55