8. Preliminaries L, L Q, W, W Q L = average number of customers in the system. L Q = average number of customers waiting in queue. W = average number of time a customer spends in the system. W Q = average amount of time a customer spends waiting in queue. The reason why we are using averages is because we are looking at a dynamic system where the actual numbers change over time. One of the reasons we do modeling is to get expected values (averages). For instance, if we open a barbershop then we may want an estimate of how many chairs to provide for the customers waiting (in the queue). W Q Queue Server Service time min min min 3 min 8.5 The System M/G/ M stands for memoryless (exponential arrival times and Poisson counts). Memoryless means that at any time the probabilities of an arrival and the counts of arrivals will be the same as at any other times. G stands for a general distribution of service times. stands for a single (one) server system. M/M/ Let s look for a moment at the M/M/ system for comparison. Both the arrival and service times are memoryless, so the number of customers in the system completely determines the state. In my picture, there are 4 people in the system, so that completely determines the state of the system. This allows us to look at the system at any point in time and know the probabilities of the transitions to the other states. Because of this you can define a transition as when the number of customers changes (either an arrival or a service completion). of 8
Transition diagram: 3 4 5 6 All transitions are to the adjacent states: a service completion and a customer departs, state i to state i-, or an arrival, state i to state i+. M/G/ The service time has a general distribution, and as such may not be memoryless. (It would still be valid if the distribution was memoryless, but in that case it would be better to use the simpler M/M/ model.) Let s say the distribution was uniform (,). At 9 minutes after the service had started, completion is much more likely than at minutes after the service had started. At 9 minutes, it will complete within the next minute, while at minutes, it could take up to 8 minutes more to complete. Because of this, the number of customers does not adequately describe the system; its state would also depend on the amount of service time already completed on the current customer. To get around this obstacle we only look at the system at the beginning of the general distribution, that is, when a service completes and the next begins. Now the number of customers does describe the system, as we would know the amount of service completed on the current customer: none. The arrivals, being memoryless, can be safely ignored as they occur, the arrival of the next customer does not depend on how long it has been since the previous customer arrived. If we must be mindful of one type of event (service completions), it is very useful to be able to ignore the other (arrivals). We define a transition as a service completion (i.e. a customer departing). Since we ignored arrivals during a service, any number of customers could have arrived during the last service. Since we are watching service completions, the possible transitions are: the only transition down is to the lower adjacent state (the customer leaves and there are no new arrivals); a transition to itself (one arrival to replace the departing customer); or a transition to any of the higher states (more customers arrive to replace the departing one). Transition diagram (only some transitions from 4 are drawn): 3 4 5 6 7 of 8
M/G/ Equations We want to consider the work represented by the customer in the system. To simplify matters, let s consider a fixed service time ( minutes). At 6 minutes into the service with 3 people in the queue, there is a total of 34 minutes (3 + 4) of work in the system. To calculate the average work in the system, we are going to equate money with work. For each person in the queue, he is representing minutes of work the amount of service time he will get when he is serviced. So for every minute in the queue, we are going to charge him $. While he is being serviced, at the beginning of service, he is still representing minutes of work so we charge him $/min., as work progresses, such as after minute; he represents 9 minutes of work remaining, so we charge him $9/min., etc. So, based on the fundamental cost equation: average rate at which the system earns = λ a average amount a customer pays giving us for V, the average work in the system: V = λ a E[amount paid by a customer One customers waits W* minutes in the queue being charged S dollars per minute, or SW* Q dollars. While being serviced, he is charged S x dollars per minute x minutes into the service, or S (S x) dx = S / dollars. S [ E[amount paid by a customer = E SW Q * + (S x)dx V = λ a E SW Q * [ + λ a E[ S (8.3) With S independent of W* Q : V = λ a E[SW Q + λ a E[ S (8.3) (The * is dropped because we went from the wait time for a customer to the expected value.) 3 of 8
8.5. Application of Work to M/G/ A customer s wait in the queue is the work he sees on arrival, because he must wait until the existing work is completed before he is serviced. Since Poisson arrivals see work averages, the average wait in the queue is the average work seen on arrival is the average work in the system. W Q = V Using (8.3) and solving for W Q, we get the Pollaczek-Khintchine formula: W Q = [ ( [ ) λe S λe S (8.33) Add the expected service time to queue wait time to get the total wait time. W = W Q + E[S = [ ( [ ) λe S λe S + E[S (8.34) As the wait times depend on the number of customers waiting, L Q = λw Q = L = λw = λ E[ S ( [ ) λe S λ E[ S ( [ ) + λe[s λe S 8.5.3 Busy Periods Let I n and B n be the lengths of the n th idle time and n th busy time. P = proportion of idle time P = lim I +L+ I n I +L+ I n + B +L+ n B n We divide both the numerator and denominator by n to use averages rather than totals; P = lim ( I +L+ I n ) n I +L+ I n + B +L+ n ( B n ) n P = E[ I [ + E[ S E I (8.35) 4 of 8
As an idle period is the time until a Poisson arrival: E[I = λ (8.36) The proportion of busy time (using the fundamental cost equation) is λe[s, so we get: P = λe[s (8.37) Substituting the last equations into (8.35): λe[s = λ λ + E B [ Solving for E[B, the expected length of a busy period: E[B = [ [ E S λe S The expected number of customers in a busy period, E[C, can be calculated by noting that exactly one customer out of C customers will find the system empty, namely the first customer of that busy period. So the proportion of customers who find the system empty, a is: a = E C [ Because Poisson arrivals see time averages, a = P and: E[C = λe S [ 5 of 8
8.7 The Model G/M/ As with the M/G/, the general distribution causes us difficulty with the state of the system. This time, however, the arrival distribution is general and the service distribution is memoryless. We deal with the problem similarly, ignoring the services and only looking at the system at the beginning of the general distribution. We define a transition as an arrival: X n the number in the system as seen by the n th arrival Since we ignored service completions between arrivals, any number of customers (in the system) may have been serviced since the last arrival. Our transition diagram needs to account for that (only transitions from 4 are shown): 3 4 5 The transition probabilities, P i,j, can be determined as follows: For j > i +, P i,j =. For P i, to P i,i+ (here j represents the number of customers who have left since the last arrival): P i,i+ j = e µt ( µt) j! j ( ) dg t, j =,,..., i P i, is more difficult because the transition to the idle state. The server possibility had time to service more customers, if they had been there. Thus, P i, should be obtained by: P i = i j= P i,i+ j The limiting probabilities can be found by solving π k = π i P ik, k i π i = i By trying a geometric sequence as a solution, we determine that: π k = ( β)β k, k =,, does satisfy the equations, for some value of β. 6 of 8
8.9. The System M/M/k With the M/M/ system, the arrival and service times are memoryless, so the state of the system is completely described by the number of customers in it. State Rate at which a process leaves = rate at which it enters λp = µp (λ + µ)p = λp + µp n, n > (λ + µ)p n = λp n + µp n+ To solve these equations, let β = λ, and rewrite them as follows: µ P = βp P = (β +.5)P βp P n+ = (β + )P n βp n, n > In terms of P ; P = P P = βp P = (β +.5)(βP ) βp = β(β + )P = β P P 3 = (β + )(β P ) β( βp ) = β (β + - )P = β 3 P P 4 = (β + )(β 3 P ) β( β P ) = β 3 (β + - )P = β 4 P P n+ = (β + )(β n P ) β( β n P ) = β n (β + - )P = β n+ P To determine P, use the fact that the P n must sum to = P n = P + n= β n P = P ( + β β ) = P + β β n= We get the solution: P = β + β = µ λ µ + λ P n = µ λ ( λ ) µ + λ µ n 7 of 8
8.9.3 The System G/M/k We ignore service completions (being memoryless) as with G/M/ and only look at the system when an arrival occurs. We can calculate the transition probabilities as follows: Case : j > i + It cannot go up more than state as we are watching arrivals, P i,j =. Case : j i + k The new arrival finds a server available, as did the last arrival, and i + j services have been completed, service completions during the interarrival time are binomial. P i,j = i + ( e µt ) i+ j (e ut ) j dg t j ( ) Case 3: k j i + The new arrival finds all servers busy, as did the last arrival, and i + j services have been completed, service completions during the interarrival time are Poisson. P i,j = e kµt i+ j ( kµt) ( i + j )! dg t ( ) Case 4: j k i + The new arrival finds a server avalable, but the last arrival found all servers busy, and i + j services have been completed. During the interarrival time enough services are completed to make a server available, we must divide the interarrival time into the period when the queue is not empty, and the period when the queue is empty. The period when the queue is not empty has a gamma distribution (i + k, kµ), waiting for i + k Poisson events to occur. The period when the queue is empty has a binomial distribution. P i,j = k (kµs) i k ( e µ(t s) ) k j (e u(t s) ) j kµe kµs j (i k)! t dg( t) 8.9.4 The System M/G/k The model is problematic because even by looking at the system at service completions, there are other services still in process, so the number of customers is not adequate to describe the system even at these times. The system is not amenable to a Markov process. 8 of 8