3y ago

61 Views

2 Downloads

2.40 MB

30 Pages

Transcription

QUEUEING THEORY WITH APPLICATIONS AND SPECIALCONSIDERATION TO EMERGENCY CAREJAMES KEESLING1. IntroductionMuch that is essential in modern life would not be possible without queueing theory. All communication systems depend on the theory including the Internet. In fact, the theory was developedat the time that telephone systems were growing and requiring more and more sophistication tomanage their complexity. Much of the theory was developed by Agner Krarup Erlang (1878-1929).He worked for Copenhagen Telephone Company. His contributions are widely seen today as fundamental for how the theory is understood and applied. Those responsible for the early developmentof what has become the Internet relied on the work of Erlang and others to guide them in designingthis new system. Leonard Kleinrock was awarded the National Medal of Honor for his pioneering work leading to the Internet. His book [7] reworked Queueing Theory to apply to this newdeveloping technology.These notes are being compiled from a seminar in the Department of Mathematics at the University of Florida on Queueing Theory Applied to Emergency Care. The seminar meets weekly andthe material is updated based on the presentations and discussion in the seminar. In the notes anattempt is made to introduce the theory starting from first principles. We assume some degree offamiliarity with probability and density functions. However, the main distributions and conceptsare identified and discussed in the notes along with some derivations. We will try to develop intuition as well. Often the intuition is gained by reworking a formula in a way that the new versionbrings insight into how the system is affected by the various parameters.If one makes complete rigor the principal goal in Mathematics, then the subject can becomeextremely dry. We will be content to be sure that the results are correct and any argumentselucidating. We will focus on the insights that might be relevant to the various applications thatwe have in mind.We will first introduce Poisson processes. This forms the basic underpinning of elementaryqueueing theory. Next we will introduce the simple queue. This is a queueing system with asingle server with Poisson arrivals and exponential service times. We then discuss more complexqueueing systems. As we introduce new ideas we will try to give applications and hint how the ideaswill apply to emergency care. The general applications will range from telephone communicationsto stochastic modeling of population dynamics and other biological systems. The most complexqueueing systems are frequently beyond mathematical analysis. This is likely the case for a realisticmodel of emergency care. Such cases will be studied by simulation. The tools of simulation willbe gradually developed through the notes. One of the major accomplishments of the seminar is arealistic model of the flow of patients in the emergency room.1

2JAMES KEESLINGThere are several texts that we recommend on the subject of queueing theory. The book byDonald Gross, John Shortle, James Thompson, and Carl Harris, Fundamentals of Queueing Theory [5] is recommended for those involved in this project. Some others that may be consulted areProbability, Markov Chains, Queues, and Simulation: the Mathematical Basis of Performance Modeling by William Stewart [9], An Introduction to Queueing Theory and Matrix-Analytic Methodsby Lothar Breuer and Dieter Baum [2], Queueing Theory and Telecommunications: Networks andApplications by Giovanni Giambene [4], Optimal Design of Queueing Systems by Shaler Sticham,Jr. [6], and Elements of Queueing Theory, Palm Martingale Calculus and Stochastic Recurrencesby François Baccelli and Pierre Brémaud [1]. Efficiency and reduced waiting times are only part ofthe management concerns of emergency care. A valuable general guide to operational improvementfor emergency departments is given in [3].As mentioned, this material is compiled from a seminar that meets regularly to study the subjectof Queueing Theory Applied to Emergency Care. Here is a picture of the participants at our meetingon October 25, 2012.Figure 1. Emergency Care/Queueing Seminar: (Left to Right) Jed Keesling,Trent Register, Joshua Hurwitz, Jean Larson, James Maissen, Hayriye Gulbudak, Evan Milliken, Jo Ann Lee, David Zhou, Scott McKinley, Lou Block, AdrianTyndall (Head of Emergency Services at Shands)2. Poisson ProcessesRandomness is hard to recognize. If points are thought to be random on a line or in the plane,then we would be suspicious if the points were regular distances apart. On the other hand, if thepoints are truly random and independent, then there will appear to be clustering. We will see whythis is so when we cover exponential waiting times in the next section. Arrivals in queueing theoryare assumed to be random and independent, but at some given rate. This is a Poisson process. Wefirst give the axioms for a Poisson process which intuitively describe a process in which the eventsare random and independent. In the following let α 0 be a real constant.Definition 2.1. A Poisson process is a random sequence of events such that the following threeaxioms hold.(1) The probability of an event occurring in a small interval of time t is given byP r α · t o( t).

QUEUEING THEORY WITH APPLICATIONS AND SPECIAL CONSIDERATION TO EMERGENCY CARE3(2) If I and J are disjoint intervals, then the events occurring in them are independent. (3) The probability of more than one event occurring in an interval t is o t2 .From these axioms one can derive properties of the distribution of events. The first formula wewill derive is the probability of exactly k events occurring in an interval of length t. To derive theformula we divide the interval into n equal subintervals each of length nt . For large enough n, theprobability of an event in each of these intervals is approximately αtn . The probability that an eventwill not occur in a particular subinterval is 1 αt.Thus,thebinomialprobability for k occurrencesnis given by n k k αtαtn· 1 .B(n, k) knn nUsing the fact that limn 1 na ea one can easily calculate the limit of the above.(αt)kexp( αt)n k!This calculation tells us the probability of k occurrences in an interval of length t. The probabilities for k 0, 1, 2, . . . give a Poisson distribution. The average number in the interval is k αtand the variance is σ 2 αt. For large αt this is approximately a normal distribution. Below is agraph of the Poisson distribution for αt 5, 10, and 20.lim B(n, k) Ê Ê0.15ÊÊ‡ ‡Ê‡ Ï‡ Ï‡ �Ï‡Ï‡ÏÏ‡ÏÏÊ Ê Ê Ê Ê Ê ‡‡ ‡Ê ‡Ê ‡Ê Ê‡ Ê‡Ê ‡Ê ‡Ê ‡Ê ‡Ê ‡Ê ‡Ê Ê15202530Figure 2. Poisson Distributions3. Exponential Waiting TimesA Poisson process is equivalent to points being placed on a line by a stochastic process suchthat the distribution of distances between the points are independent from the density functionα exp( αt). If we think of the line as being time and the events as occurring at certain times, thedensity function is called the exponential waiting time with rate α or average waiting time α1 . Theaverage waiting time for this density function is α1 and the variance is α12 .Suppose that we have a Poisson process as described in §2. Suppose that we want to know thedensity function for the time to the next event. What is the probability that the next event willoccur between t and t t? For the time T to the next event to lie between t and t t, there

4JAMES KEESLINGmust not be an event in the interval [0, t]. This is the probability of 0 events in the interval of0length t which is (αt)0! exp( αt) exp( αt). In addition, there must be an event in the interval[t, t t]. The probability of this is approximately α t. So, by the independence of events in thesetwo intervals, the probability that both would occur is approximately α t · exp( αt). Dividing by t and taking the limit leads us to the density function, α exp( αt). So, a Poisson process hasexponential waiting times. It is easy to show that these are independent since events in disjointintervals are independent.On the other hand, it can also be shown that if we have independent exponential waiting timesbetween events, it will be a Poisson process. It is a good test of your understanding to prove this.Exercise 3.1. Suppose that points are distributed on a line with the intervals between being independent exponential waiting times with parameter α. Show that the points come from a Poissonprocess with rate α.1.00.80.60.40.212345Figure 3. Exponential Distribution with α 1Note that the distribution implies that short times are more frequent than long times since theprobability density function is highest at zero. A longer time is less frequent than a shorter timesince the function is decreasing. It is also helpful to have the cumulative distribution function F (t).This is the function such that theR probability of the time T to the next event being less than ttis given by F (t). Clearly, F (t) 0 α exp( ατ )dτ 1 exp( αt). The cumulative distributionfunction is useful for simulating waiting times. First we give the graph of the cumulative distributionfunction with α 1.The next step is to figure how to simulate independent exponential waiting times. First wesuppose that we have a method of generating a sequence of independent random numbers fromthe uniform distribution on [0, 1]. Such random number generators are usually included with anymodern programming language. We will not go into the theory of how to generate such numbersor test that they are independent. We will take on faith that it can be done and that the programavailable will do that. So, suppose that we have a finite sequence of such numbers {ui }ni 1 . Witheach of these numbers ui we associate a time from the exponential waiting time α exp( αt). Themethod is straightforward, simply solve ui F (ti ). Since F (t) is monotone increasing, there willbe a unique ti for each ui . In the case at hand, ui 1 exp(αt). Solving we getti ln(1 ui ).α

QUEUEING THEORY WITH APPLICATIONS AND SPECIAL CONSIDERATION TO EMERGENCY CARE51.00.80.60.40.212345Figure 4. Cumulative Distribution of the Exponential Distribution with α 1Since 1 ui also comes from a uniform distribution on [0, 1], we could replace 1 ui by ui in thei)formula. Doing so would reduce the computation by one floating point operation: ti ln(uα .Figure 5 gives a randomly generated list of twenty random numbers ui followed by the associatedexponential waiting times with α 1.Figure 5. Twenty Independent Exponential Waiting Times with α 1

6JAMES KEESLINGFigure 6. Twenty Independent Samples from1π·11 x2

QUEUEING THEORY WITH APPLICATIONS AND SPECIAL CONSIDERATION TO EMERGENCY CAREFigure 7. Mathematica Program for Poisson Simulation7

8JAMES KEESLING4. Independent Numbers from an Arbitrary DistributionIn the derivation and simulation in the last section, the distribution that we were using wasthe exponential distribution with probability density function p(t) α exp(αt) and cumulativedistribution function F (t) 1 exp(αt). However, if we wanted to generate a set of independentrandom numbers from an arbitrary probability density function, p(t), we would go through thesame process using its cumulative distribution function F (t). We would use a set of independentNrandom numbers from the uniform distribution on [0, 1], {ui }Ni 1 , and then solve for {xi }i 1 usingthe equation ui F (xi ).1For example, suppose that our probability density function is p(x) π1 · 1 x2 . Then the cumula1tive distribution is F (x) π · arctan(x). As before we generate twenty independent numbers fromthis distribution using random numbers from [0, 1]. Figure 5 gives a list numbers generated fromthis distribution.In the next few sections, we will assume exponential exponential waiting times. The reason isto be able to make certain calculations. When we derive the Kolmogorov-Chapman differentialequations, we need the processes to only depend on the most recent state. This is called the Markovproperty for a stochastic process. If the waiting time to leave a given state is exponential, then theMarkov property will be satisfied. When this assumption is not appropriate, we may have to resortto simulation. So, the ability to generate independent values from a general distribution will bevaluable tool.Figure 6 is a program in Mathematica that simulates a Poisson process. The plot is n(t) thenumber of events that have occurred in the interval [0, t]. In the simulation, we generate a table ofindependent exponential waiting times. We use these times as the times between successive eventsin the Poisson process. The output of the various computations in the simulation are shown tomake the program more transparent. In Mathematica one could have hidden this output. Later inthis document we will be simulating much more complex examples. In the program one can changethe number of events n and the rate α.What are examples of Poisson processes? Radioactive decay is one example. If you take thetransformation of one of the atoms in the radioactive sample as an event, then the sequence ofthese decays will be a Poisson process. In telephone networks one generally assumes that a customertrying to make a call is an event. It is assumed that this is a Poisson process and this assumptionis supported in practice. Of course, the rate α will change with the time of day and day of theweek. We will be assuming that α is constant, but it is not hard to analyze the case that α is timedependent. The arrival of information packets at a given node in the Internet is assumed to bePoisson. The distances between successive cars in a lane on a highway are sometimes assumed tobe independent and exponential.We can also derive a theory of Poisson processes for events in the plane or space. How wouldyou modify the axioms in these cases? How would the properties that we derived change in thesesettings? Can you think of a way of simulating a Poisson process in a region of the plane? In threespace? In Rn ?An example of a Poisson process in the plane would be the location of a species of plant whoseseeds disperse widely from the parent plant. The location of stars in a star chart down to a givenmagnitude will be Poisson. The three dimensional location of stars is Poisson. However, the densityα varies through space.

QUEUEING THEORY WITH APPLICATIONS AND SPECIAL CONSIDERATION TO EMERGENCY CAREFigure 8. The von Koch CurveFigure 9. The Sierpinski CarpetFigure 10. The Menger Sponge9

10JAMES KEESLINGOne can also define Poisson processes on fractal sets or other spaces having a regular measure.What do you think would be a good definition? How could you simulate such a Poisson process onthe von Koch curve, the Sierpiński carpet, or the Menger sponge? Figures 8, 9, and 10 give picturesof these objects if you are not familiar with them.5. A Simple Queue!In this section we explaina simple queue. This will illustrate the fundamentals of the theory.There are a number of good references for queueing theory. We recommend Fundamentals ofQueueing Theory by Donald Gross, John Shortle, James Thompson, and Carl Harris [5].A simple queue has a single server that can serve one customer at a time. The service time isan exponential waiting time with parameter σ. The service times are assumed to be independentand independent of arrivals. The arrival rate is Poisson with rate α. If a customer arrives and theserver is occupied, that customer goes to the end of the waiting line. Customers are served in orderof arrival.There is a notation that has become common in the field that communicates the assumptionsbeing made about a given queueing system. The case described above is denoted M/M/1/FIFO.The first M indicates the assumption about arrivals. In this case they are Markovian (Poisson).The second M indicates the assumption about the service times, that they are exponential waitingtimes. The third indicator gives the number of servers. The last indicates the queueing discipline,that is in what order the waiting customers are served. FIFO indicates that they are served in theorder “first in first out”.There are also some helpful diagrams that are used to describe this queue. In the one thatfollows, the clients are denoted by circles and the service facility by a box. The circle in the boxdenotes the client that is being served by that server.!!!Figure 11. Diagram of a Simple QueueWe will let the states of the system at a given time to be the number of customers that havearrived and not completed service. The state n will be in the set {0, 1, 2, . . . }. If the state is n 0,then one customer is being served and n 1 are waiting in line. We can also represent the systemin the following way.We can also represent this type of queue with the following diagram.0α σ1α σ3α σ···nα σn 1···Let pn (t) denote the probability that the system is in state n at time t. We will be assuming a setof initial probabilities {pn (0)} n 0 . We will now describe a set of differential equations that governthe system, the Kolmogorov-Chapman equations. Suppose that we have the following probabilitiesat time t, {pn (t)} n 0 . How can these change in a small interval of time t? Consider the casen 0.p0 (t t) σ t · p1 (t) (1 α t) · p0 (t)

QUEUEING THEORY WITH APPLICATIONS AND SPECIAL CONSIDERATION TO EMERGENCY CARE 11This leads to the differential equation.dp0 (t) σp1 (t) αp0 (t)dtSimilarly we can derive a differential equation for each n 0.dpn (t) σpn 1 αpn 1 (t) (α σ)pn (t)dtThe system of differential equations determines the behavior of the probabilities through timeafter a time t that the values {pn (t)} n 0 are known.If σ α, we can expect that these probabilities will have a limiting value. We call the set ofthese limiting values the steady-state for the system. We can solve for the steady-state by settingthe derivatives equal to zero in the Kolmogorov-Chapman equations. In the case of a simple queuewith σ α, this leads to the following probabilities. α n α · 1 σσThe average number in the system E(n) n can be calculated.pn n ασ1 ασConsider a simple example. Suppose that α 9. This could be nine customer arrivals per hourif the unit of time is an hour. Suppose that σ 10. At first glance it would seem that this queueingsystem should run smoothly. In an hour we would expect nine arrivals. The server could handleten in the hour. So, he should be able to finish the work and have time for a rest before the nexthour. However, this naı̈ve analysis does not take proper account of the randomness of the process.The formula for n above shows that the average number in the system isn 9101 910 9.This is much more congested than one would have imagined. A customer arriving at a timewhen the system is in steady-state would fine nine customers already in the system and would have1to wait on average ten times as long as one service time σ1 10, that is, the average wait would beone hour rather than just six minutes.Let us imagine that this is an approximate of emergency care and a typical time of treatment is9one hour. Then σ 1 and α 10. We have changed the time scale, but this does not change the9ratio between α and σ which is still 10. So, n 9 and the average time that the patient will be inthe emergency care facility is a total of ten hours, ten times as long as the treatment period of onehour.What this demonstrates is that it is important to have an accurate model of how randomness isaffecting the system. If we have not properly taken it into account, the congestion that arises dueto randomness will be unexpected and may be overwhelming. In what follows we will be showingthat the congestion that is due to randomness can be lowered to a manageable level by a modestadditional investment of resources.

12JAMES KEESLING6. A. K. ErlangHistorically, Agner Krarup Erl

of Queueing Theory Applied to Emergency Care. Here is a picture of the participants at our meeting on October 25, 2012. Figure 1. Emergency Care/Queueing Seminar: (Left to Right) Jed Keesling, Trent Register, Joshua Hurwitz, Jean Larson, James Maissen, Hayriye Gulbu-dak, Evan Milliken,

Related Documents: