You are on page 1of 25

Operation Research /Operational Research (OR)

Chapter 6- Queuing theory


or Definition:- Queuing theory is the mathematical study of waiting lines queues. It is branch of applied probability theory. Queuing Theory can be used to describe these real world queues, or more abstract queues, such as are often found in many branches of computer science, for example in operating system design. It relies heavily on mathematics, especially statistics. Examples Banks/supermarkets - waiting for service Computers - waiting for a response Failure situations - waiting for a failure to occur e.g. in a piece of machinery public transport - waiting for a train or a bus Need for Queuing theory: - Optimum utilization of resource considering the better customer service. Costs:- Co = Cost of operating the service facility Cw = Cost of waiting customers per unit line Total cost = Co +Cw. When Co is less, Cw increases and vice versa. This is shown in the below figure.

Operation Research /Operational Research (OR)

Terminologies Queuing theory : Customer, Server are principal player Source:-from where customers are generated. Finite & Infinite Facility:- Where the service is provided to the customer

Queue:- Customer in the line waiting for the service at facility Interarrival time: - time between the arrival of two successive customers. Helps to analyze the arrival process. Service time:- The time required to complete the service at facility. Helps to analyze the service. Queue size: - Number of customer s in the queue. Can be infinite as in mail order facility. Queue discipline (FCFS, LCFS, SIRO) :- Order in which customer are selected from the queue. Imp factor in analysis of models. Main are FCFS: - First come, First Service

Operation Research /Operational Research (OR)

LCFS: - Last come, First Service SIRO: - Service in Random order Priority, Round Robin Jockey:- Behavior of human from changing his/hers queue Balk: - Reject from joining a queue altogether Renege: - Break up from a queue

Pure Birth & Death Models

Pure Birth Model Only arrival is allowed

Pure Death Model Only departure is allowed

Arrival rate in exponential distribution - Service rate in exponential distribution

At = inter arrival time Customer at t =0 is 0

Dt = inter departure time Customer at t=0 is N

p0 (t) Probability of no arrivals during time pt N(t) Probability of no departure during time t

Operation Research /Operational Research (OR)

p0 (t) = p(At>t) = 1- p(At<t) = 1- (1-e t) = e t

pN (t) = p(Dt<t) = 1- p(Dt>t) = 1- (1-e t) = e t

Pure Birth Model

Pure Death Model

p0 (h)=e h = 1 h + ( h)2/2! - ( h)3/3! +... ~p1 (h)=e h = 1 h + ( h)2/2! - ( h)3/3! +... ~ N h where h is very small time interval h

p1 (h) = 1- p0 (h)= 1- (1 h ) = h pn(t)= Prob of n customers at time t

pN-1(h)=1-pN (h)= (1 h) = h pn(t)= Prob of n customers at time t

pn(t+h)= pn(t) p0 (h)+ pn-1(t) p1 (h) = pn(t)(1 h)+pn-1(t) h p0(t+h)= p0(t) p0 (h) = p0(t) (1 h)

pn(t+h)= pn(t) pN (h)+ pn+1(t) pN-1 (h) = pn(t) (1 h)+ pn+1(t) h pN(t+h)= pN(t) pN (h) = pN(t)(1 h)

Pure Birth Model

Pure Death Model

Operation Research /Operational Research (OR)

Lim h0 [pn(t+h)- pn(t)]/h = - pn(t) + pn-1(t) = pn(t) i.e. 1st derivative of pn(t) Lim h0 [p0(t+h)- p0(t)]/h = - p0(t) = p0(t)

Lim h0 [pn(t+h)- pn(t)]/h = - pn(t) pn(t) + pn+1(t) = pn(t) i.e. 1st derivative of pn(t)

Lim h0 [pn(t+h)- pN(t)]/h = - pN(t) = pN(t)

i.e. 1st derivative of p0(t)

i.e. 1st derivative of pN(t) p0(t)= p1(t)

pn(t) =[(t)n e- t ] ]/ n! is a Poisson distribution p0(t)= e- t

pn(t) =[( t)N-n e- t ] ]/ (N-n)! is a Poisson distr pN(t)= e- t p0(t)= 1- pn(t) (from n=1 to n=N)

Exponential Random variable

Poisson

Time between successive Number of arrivals n, during a period T arrivals, t

Operation Research /Operational Research (OR)

Range Density function Mean Value Cumulative probability

t> 0 f(t)= e- t 1/ time units p(t< A)=1- e- A

n=0.1.2.3.. pn(T) =[(T)n e- T ] ]/ n!


T arrivals during T

pn<N(T) = p0(T)+ p1(T) + p2(T) pN(T

P( no arrivals during period A) p(t>A) = e- A

p0(A)=e- A

Problem :In a state, rate of birth of babies is one in every 12 minutes. Time between birth is in exponential in nature. Find the following a) The average number of births per year. b) The probability that no births in any one day c) The probability of issuing 50 Birth certificates in 3 hrs given that 40 certificates were issued during the first 2 hrs of the 3 hr period.

Solution:-

Operation Research /Operational Research (OR)

= 24*60/12 = 120 births/day

a)Total number of births/year = t = 120* 365 = 43,800 birth/yr b) Prob of no births in any one day = p0(1)= e- t = e- 120*1 = 0 c) Remaining certificates =50- 40 =10 Remaining time = 3-2 = 1hr So reqd to find prob issuing 10 certificates in one hour Convert in /hour unit , = 120/24 = 5 birth /hour. So p10(1)= (5*1)10 e- 5 / 10! = 0.0183 Note :-pn(T) =[(T)n e- T ] ]/ n!

Problem :The florist section stocks 18 dozen roses at the beginning of each week. Per day sale is average 3 dozen. (One dozen at a time). Actual demand follows Poisson distribution. When stock level reaches 5 dozens, new stock of 18 dozens will be placed for delivery at the beginning of the following week.. All roses left at t he end of the week are disposed off. Determine a) The prob of placing order in any one day of the week. b) The average no of dozen roses that will be discarded at the end of the week.

Solution:= 3 dozens/day

Operation Research /Operational Research (OR)

Prob of placing an order by the end of the day (t) =pn<5 (t) = p0 (t) +p1(t) +p2(t)+p3(t)+p4(t)+p5(t) =p0(t)+(t)N-n e-t /(N-n)! Where t=1 ,2,37 where po(t) = 1- pn(t) where n=1 to N

Days ut pn<5 (t)

1 3

2 6

3 9

4 12

5 15

6 18

7 21

0.0000 0.0088 0.1242 0.4240 0.7324 0.9083 0.9755

The average number of roses (in dozen) discarded at the end of week = = npn(7) = 0.664 Dozens

Days u=3 ut N= dozen e-ut 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

1 3 0.0498 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0001 0.0002 0.0008 0.0027 0.0081 0.0216 0.0504 0.1008 0.1680 0.2240 0.2240

2 6 0.0025 0.0001 0.0001 0.0003 0.0009 0.0022 0.0052 0.0113 0.0225 0.0413 0.0688 0.1033 0.1377 0.1606 0.1606 0.1339 0.0892 0.0446

3 9 0.0001 0.0053 0.0058 0.0109 0.0194 0.0324 0.0504 0.0728 0.0970 0.1186 0.1318 0.1318 0.1171 0.0911 0.0607 0.0337 0.0150 0.0050

4 12 0.0000 0.0630 0.0383 0.0543 0.0724 0.0905 0.1056 0.1144 0.1144 0.1048 0.0874 0.0655 0.0437 0.0255 0.0127 0.0053 0.0018 0.0004

5 15 0.0000 0.2511 0.0847 0.0960 0.1024 0.1024 0.0956 0.0829 0.0663 0.0486 0.0324 0.0194 0.0104 0.0048 0.0019 0.0006 0.0002 0.0000

6 18 0.0000 0.5314 0.0936 0.0884 0.0786 0.0655 0.0509 0.0368 0.0245 0.0150 0.0083 0.0042 0.0019 0.0007 0.0002 0.0001 0.0000 0.0000

7 21 0.0000 0.7730 0.0640 0.0518 0.0395 0.0282 0.0188 0.0116 0.0067 0.0035 0.0017 0.0007 0.0003 0.0001 0.0000 0.0000 0.0000 0.0000

npn(7) 0.0000 0.0640 0.1037 0.1185 0.1129 0.0940 0.0699 0.0466 0.0279 0.0149 0.0071 0.0030 0.0011 0.0003 0.0001 0.0000 0.0000

Operation Research /Operational Research (OR)

Generalized Poisson Queuing Model: Includes both arrivals and departures based on the Poisson distribution with time in exponential distribution

Based on the steady state behavior of the queue (long run) and not considering the transit ( warm up behavior) Assumes both arrival rate and departure rate are state dependent ( and are continuously changing and depends on the number of customers in the facility) This model derives as a function of n and n. And using pn , determine the other measures like Average Queue length

Operation Research /Operational Research (OR)

Average waiting time Average utilization of the facility

Transition rate diagram

Steady state number in the Queue is n For any small interval h only one event can occur

Operation Research /Operational Research (OR)

If at time t, number =n, for t+h, n can change to n+1 with one arrival at the rate n and n-1 with one departure n State 0 can be changed to 1 when = 0 is undefined as system is empty and no departure. Under steady state conditions, for n >0 , Expected rate of arrival =Expected rate of of departures Expected rate of flow into system with state n = n-1 pn-1 + n+1 pn+1 Expected rate of flow out of system with state n =( n+ n) pn Equating the above two equations, we get balance equation
n-1 pn-1 + n+1 pn+1 =( n+ n) pn

where n=1,2,3

When n=0, we get 0p0 =1p1 Or p1 = 0p0 / 1 or (0 / 1)*p0 When n =1, we get 0p0 + 2p2 =(1+ 1) p1 So p2 ={(1+ 1) p1 - 0p0} / 2 Sub substituting for p1 we get p2 ={(1+ 1) (0 / 1)*p0 - 0p0} / 2 = p0{(1 0 / 1) + 0 - 0)}/ 2 = (1 0 / 2 1 ) p0 In general,

Operation Research /Operational Research (OR)

pn = {(n-1 n-2 n-3.. 0) /(n+1 n n-1.. 1 )} p0 Where P0 = 1- Pn where n= 1 to infinite Problem :- A grocery shop has 3 counters and condition for operation of each counter is based on the number of customers and given as below Customers 1 to 3 . 1 counter in operation. Customers 4 to 61 & 2 are in operation Customers > 6 All 3 in operation Arrival of customer to the shop in Poisson distribution with mean rate as 10/hr. and average departure time is in exponential and average or mean is 12 minutes. Determine the steady state probability pn of n customers in the queue Solution :n = = 10 customer/hour.

For n =1,2,3 only 1 counter operates So n = 60/12 = 5 customers /hour For n= 4,5,6 2 counter operates and So n = 5*2= 10 customers /hour For n = 7,8 3 counters operates . So n = 5*3 = 15 customers /hour

N 1

Pn P1

Equation (0/1)p0 = 10/5p0 =2p0

Operation Research /Operational Research (OR)

2 3

P2 p3

(1 0/ 21)p0 =10*10/(5*5)p0 =4p0 (2 1 0/ 3 21)p0 =10*10*10/(5*5*5)p0 =8p0

Pn

Equation

4 5 6

P4 p5 P6

(32 1 0/ 4 3 21)p0 =104/( 10*53)p0 =8p0 (4 3 2 1 0/ 5 4 3 21)p0 =105/( 102*53)p0 =8p0

(5 4 3 2 1 0/ 65 4 3 21)p0 =106/( 103*53) p0 = (10/5)3* (10/10)3 p =8p0

pn

(n-1 n-2.. 5 4 3 2 1 0/ n n-1.. 6 5 4 3 21)p0 = (10/5)3* (10/10 (10/15)n-6p0 =8(2/3)n-6p0

To find p0 :-

Operation Research /Operational Research (OR)

p0+p0(2+4+4*8+ 8*(2/3) + 8*(2/3)2 + 8*(2/3)3 . = 1 p0(1+2+4+4*8+ 8*(2/3) + 8*(2/3)2 + 8*(2/3)3 . = 1 p0{31+8[(2/3) + (2/3)2 +(2/3)3..]} =1 p0 {31+8[ 8/(1- 2/3)]} = 1 p0 (55)=1 or p0 =1/55 Note Geometric sum series xi =1 /(1-x), where mod x <1 and for i= 1,2 ,3n Applying the value of p0 and get the values of others for any value of n p(n)= (8/55)*(2/3)n-6

Operation Research /Operational Research (OR)

Characteristics of the Queuing models :a = Input arrival distribution b = Departure or service time distribution c = Number of parallel server d = Queue or service discipline e = maximum length of queue allowed (in queue + service) f = Size of the calling source (population) Representation of the Queuing models :-

Devised by D.G Kendall in 1953

Devised by A.M Lee d&e in 1953, f in 1968

Standard Notations for arrival & departure distribution i.e a & b are M=Monrovian or Poisson arrivals or departure distribution ( exponential inter arrival or service time distribution) D = Constant time (Deterministic) Ek = Erlang or Gamma distribution (or sum of independent exponential distribution) GI = General distribution of Interarrival time

Operation Research /Operational Research (OR)

G = General Distribution of Service time Standard notation for queue discipline i.e d are FCFS, LCFS, SIRO, GD (general distribution) c = any number e & f = finite number or infinite Steady state measure of performance Ls= Expected number of customers in system Lq = Expected number of customers in queue Ws = Expected waiting time in system Wq = Expected waiting time in queue C bar = Expected number of busy server Ls = npn for n=1 to infinite Lq = (n-c)pn for n=c+1 to infinite Ls= eff Ws Lq =eff Wq Ws = Wq +1/ By multiplying the above eqn by eff on both sides we get Ls = Lq+ eff / Average number of busy server C bar = Ls Lq = eff / Single Server Models:- c=1 M/M/1: GD/infinite/infinite

Operation Research /Operational Research (OR)

Per generalized solution, n= and n = for a for n =0,1,2


effective = and lost = 0

= / =Arrival rate/Service rate = Traffic intensity pn = np0 where n= 0,1,2 p0 (1+ + 2+ 3 .)=1 Assume <1 , & using geometric sum eqn we get p0= 1- with <1 So pn = (1- )pn with <1 so that < . If > means Queue length will increase infinitely and also geometric series will not converge Length of Q , Ls = npn for n=0 to infinte = n(1-)n = (1-) dn /d = /(1- ) Ws = Ls/= 1/ (1- ) =1/ (-) Ws -1/ = / (1- ) Lq = Wq = 2/(1- ) C bar = Ls-Lq = MM/1: FCFS/infinite/infinite: In generalized model, derivation of pn is independent of Queue discipline. i.e Ls,Lq, Ws , Wq values apply to all disciplines Pdf of Wq depends on queue discipline. In FCFS, if n customers are in the system Wq =

Operation Research /Operational Research (OR)

Let = t1 + t2 +tn+1 where t1 is the time required for the customer in service to complete it t2+ t3+..tn are service times for n-1 customers in the queue. tn+1 represents the service time for arriving customer. Then w( / n+1) is the conditional density function of given n customers in the system ahead of the arriving customer w() = ! (n+1)pn for n =0 to infinity

= ( )e ( ) where >0 And Ws = 1/ ( ) M/M/I: GD/N/infinite:Here Q length is lm\limited to N-1 as one is in the service.
n = when n =0,1,2,N-1

=0 when n= N, N+1 So = / , then pn(t) = np0 for n< N =0 for n>N p0 = (1- )/ (1- )N+1 for not equal to 1 = 1/(N+1) for =1 lost = pN
eff = 1- lost = ( 1-pN)

Operation Research /Operational Research (OR)

and eff < Ls can be derived as Ls = npn for n=0 to N = {1-(N+1) N+ NN+1}/{ 1-)(1-N+1)} where is not equal to 1 When =1 , Ls = N/2

Problems
1) A television repairman finds that time spent on his job has an exponential distribution with a mean of 30mins.if he repairs sets in order in which they came in & if the arrival of sets follows a poison distribution approximately with an average rate of 10 per 8-hours day, what is the repairmans expected idle time each day? How many jobs are ahead of the average set just brought in?

Solution: From the data of problem, weve =10/8=5/4set per hour; = (1/30)*60=2set per hour;

a)

Expected idle time of repairman each day equals

Operation Research /Operational Research (OR)

Number of hour for which the repairman remains busy in an 8- hour day is given by 8(/) =8*(5/8)=5hours Hence, the idle time for repairman in an 8-hour day will Be 8-5=3hours. b) expected number of TV sets in system Ls= (/- ) = (5/4)/2-(5/4) =5/3=2 TV sets.

2) At a public telephone booth in an post-office arrivals are considered to be Poisson with an average inter-arrival time of 12mins.the length of phone call may be assumed to be distributed exponentially with an average of 4mins calculate the following a) What is the probability that a fresh arrival will not have to wait for the phone?

b) What is the probability that arrival will not to wait more than 10mins before phone is free

c) What is the average length of queue that form from time to time

Solution: From the data of problem

Operation Research /Operational Research (OR)

Weve =1/12=0.085permin and =1/4=0.025permin; /=4/12=0.33

a) Probability that the arrival will not have wait is given by 1-p(w>0)=1-=10.33=0.67

b) Probability that the arrival will have wait for at least is given by p(w10)= (0.165)tdt=0.063 - )e -(- )tdt= 0.165)e -

This shows that 6.3% of arrivals on an average will have to wait for 10mins or more before can use the phone c) The average of length of the queue form from time is Ls= ( /- ) = (0.25/0.25-0.085)=0.25/0.165=1.5=2customers

3) In the production shop of a company, the break down of the machine is found to be Poisson distributed with average rate of 3machines per hour. The break down at one machine cost Rs 40per

Operation Research /Operational Research (OR)

hour to the company. There are 2 choices before the company for hiring the repairman. One of the repairman is slow but cheap; the other is fast but expensive. The slow-cheap repairman demands Rs 20 per hour and will repair broken down machines exponentially at the rate of 4per hour. The fast expensive repairman demands Rs 30per hour and will repairs machines exponentially at rate of 6per hour. Which repairman should be hired?

Solution: the total expected hourly cost for both the repairmen is equal to the total wages paid plus cost due to machine break down (non-productive machine hours) Cost of non-productive time=average number of machine in the system into cost of idle machine = Ls*(Rs 40per hour) = (/- )*40

For slow cheap repairman: weve =3 machines per hours: =4 machines per hours Ls=(/- )=3/4-3=3machine Cost of non-productive machine time=40*3=Rs 120 Total cost of cheap repairman= (40*3) +20=140

Operation Research /Operational Research (OR)

For fastexpensive repairman: weve =3 machines per hours: =6 machines per hours Ls=(/- )=3/6-3=1machine cost of non-productive machine time=40*1=Rs 40 Total cost of expensive repairman= (40*1)+30=Rs 70

The company should hire fast but expensive repairman.

4) The shipping company has a single unloading berth with ships arriving in a Poisson fashion at an average rate of 3per day the unloading time distribution for an ship with n unloading crews is found to be exponential with average unloading time 1/2n days. The company has a labor with out regular working hour and to avoid long waiting lines the company has a policy of using as many unloading crews an ship as there are ships waiting in line or being unloaded.

Operation Research /Operational Research (OR)

a) Under this condition what will be the average number of unloading crews working at any time? b) What is the probability that more 4crews will be needed?

Solution: given that =3ships per day. Let us assume that at any time, there are n-ships in the system (waiting in queue & being unloaded).since the service rate depended on waiting line, Therefore, n=2n ships per day or 2 ships per day (mean service rate with one unloading crews) Since is constant & service rate increases with increases in queue length n= n when there n-ships in the queue & pn=
n e (/)

a) Ls=

pn=

n e (/)

=3/2=1.5 crews

b) The probability that more than 4crews will be needed is same the probability that there at least 5ships in system at any given time & is given by

Operation Research /Operational Research (OR)

n=

n-

n=1-(p0+

p1 +p2+ p3 +p4)

=1-e-3/2(563/128)=0.019