Que Ing

44
Queuing theory (Waiting-line theory) BME405 OPERATIONS RESEARCH B.Tech. Mechanical Engineering Fall Sem 2010-11 Queuing theory (Waiting-line theory) and Simulation model SIVA PRASAD DARLA (Unit – IV) SMBS / VIT

Transcript of Que Ing

Page 1: Que Ing

Queuing theory (Waiting-line theory)

BME405 OPERATIONS RESEARCH

B.Tech. Mechanical Engineering

Fall Sem 2010-11

Queuing theory (Waiting-line theory) and

Simulation model

SIVA PRASAD DARLA

(Unit – IV)

SMBS / VIT

Page 2: Que Ing

Outline for Queuing Theoryq Introduction to Queuing Theoryq Basic elements of Queuing systemq Kendall and Lee notationq Steady state of generalized Poisson queueq Steady state measures of performanceq Single-channel queueing modelq Single-channel queueing modelq Multi-channel queueing model

Page 3: Que Ing

• Shoppers waiting in front of checkout stands in a supermarket

• Cars waiting at a stoplight• Patients waiting at an outpatient clinic• Planes waiting for takeoff in an airport• Broken machines waiting to be serviced by a repairman

Introduction

• Broken machines waiting to be serviced by a repairman• Letters waiting to be typed by a secretary• Programs waiting to be processes by a digital computer

It is direct result of randomness in the operation of service facility.

Page 4: Que Ing

Objective

To determine the characteristics that measure the performance of the system under study

Measure of performance – I

How long a customer is expected to wait before being How long a customer is expected to wait before being serviced?

Measure of performance – II

What is the percentage of time the service facility is not used?

Page 5: Que Ing

Basic elements of the queueing model

Customer

Server

Customer arrival ~ arrivals distribution (single or bulk arrivals)

No time lost between the completion of a service and the admission of a new customer into the facility

Server

Service time ~ service time distribution (single or bulk service)

Service discipline

FCFS, LCFS, SIRO, Priority queue

Page 6: Que Ing

Design of facility and execution of serviceParallel serversQueues in series or tandem queuesNetwork queues (both series and parallel servers)

Queue size – finite due to space limitation or infinite

Basic elements of the queueing model contd..

Queue size – finite due to space limitation or infinite

Calling source

Finite number of customersInfinitely many customers

Page 7: Que Ing

Effect of human behaviorHuman serverHuman customer - Jockey

- Balk- Renege

Basic elements of the queueing model contd..

- Renege

All customers in a queue are expected to “behave” equally while in the facility.

Page 8: Que Ing

Role of the Poisson and exponential distributions

Condition 1: The probability of an event occurring between t and t+s depends only on the length of s.

Condition 2: The probability of an event occurring during a very small interval is positive but less than one.

Condition 3: At most one event can occur during a very small interval.small interval.

Describe a process in which the count of events during a given time interval is Poisson, and equivalently the time interval between successive events is exponential.

Page 9: Que Ing

f(t) = probability density function of time interval t between the occurrence of successive events, t ≥ 0

Role of the Poisson and Exponential distributions

f(t) = λe-λt, t ≥ 0 exponential distribution with mean = 1/λ time units

( ),

!)(

net

tptn

n

λλ −

= n = 0, 1, 2, ….

pn(t) = probability of n events occurring during time t

Poisson distribution with mean = λt events

Page 10: Que Ing

Queueing system (parallel servers)

__Departing customers

Arriving customers

1

2

3

System

Queue Service facility

Schematic diagram of parallel queueing system

3

c

Page 11: Que Ing

Kendall-Lee notation

a / b / c : d / e / f

Main characteristics of queueing system has been standardized in the following format:

where a = arrivals distribution

b = service time (or departures) distributionb = service time (or departures) distribution

c = number of parallel servers

d = service discipline

e = number of customers allowed in system ( in queue + in service)

f = size of calling source

Page 12: Que Ing

Standard notation for arrivals and departures distribution

M – Poisson (or Markovian) arrival or departure distributionD – constant or deterministic interarrival or service timeEk – Erlangian or gamma distribution of interarrival or

service time distribution with parameter kservice time distribution with parameter k

For example

M / M / 4 : GD / N / ∞

Page 13: Que Ing

Steady state model of generalized Poisson queue

n – number of customers in the systemλn – rate of arrival given that n is the number of customers in

the system µn – rate of departure given that n is the number of customers

in the systemin the systempn – the steady-state probability of n customers in system

Page 14: Que Ing

nn-1 n+1

λn-1 λn

µ

Steady state model of generalized Poisson queue

Transition-rate diagram

µn µn+1

Balance equation – Under steady-state condition, the expected rates of flow into and out of state n must be equal

Page 15: Que Ing

Expected rate of

flow into state n = 0(p0+…+pn-2)

λn-1pn-1+ µn+1pn+1=Expected rate of

flow out of state n = λnpn+ µnpn

Balance equation

Steady state model of generalized Poisson queue

+0(pn+2+….)+λn-1pn-1 + µn+1pn+1

λn-1pn-1+ µn+1pn+1 λnpn+ µnpn , n = 1, 2, 3, ..=Balance equation

Transition rate diagram for n = 0

0 1λ0

µ1

Balance equation for n = 0

λ0 p0 µ1 p1 , n = 0=

Page 16: Que Ing

λ0p0 + µ2 p2 = (λ1 + µ1)p1

Recursively

p1 = (λ0/ µ1) p0

For n=0

For n=1

Steady-state probability of n customers in the system (pn)

λ0p0 + µ2 p2 = (λ1 + µ1)p1

For n=2λ1p1 + µ3 p3 = (λ2 + µ2)p2

012

012 pp

µµλλ

=

0123

0123 pp

µµµλλλ

=

Page 17: Que Ing

In general

For n

Steady-state probability of n customers in the system (pn)

n= 1, 2, 3, …..,....................

0121

0321 ppnnn

nnnn µµµµ

λλλλ

−−

−−−=

The value of p0 is determined by

10

=∑∞

=nnp

Page 18: Que Ing

Steady-state measures of performance

pn = steady-state probability of n customers in the systemLs = expected number of customers in systemLq = expected number of customers in queue

Consider a service facility with c parallel servers

(Characterstics of queueing system)

Lq = expected number of customers in queueWs = expected waiting time of a customer in systemWq = expected waiting time of a customer in queue

Expected waiting time in queue

Expected waiting time in system

Expected service time= +

Page 19: Que Ing

Steady-state measures of performance

∑∞

=

=0n

ns npL

∑∞

−= )( nq pcnL

From definition of pn

∑+=

−=1

)(cn

nq pcnL

seffs WL λ=Relationship exists between Ls and Ws

where λeff -effective average arrival rate ∑∞

=

=0n

nneff pλλ

(Little’s formulae)

Page 20: Que Ing

Steady-state measures of performance

Expected waiting time in queue

Expected waiting time in system

Expected service time= +

Relationship exists between Ws and Wq

1+=WWµ1

+= qs WW

µλeff

qs LL +=

Page 21: Que Ing

Steady-state measures of performance

Expected number of busy servers µ

λeffqs LLc =−==

Percent utilization 100*

cc

=

∑∞

=

=→0n

ns npLeff

ss

LW

λ=→

qeffq WL λ=→

c

np

µ1

−=→ sq WW

Given pn, we can compute the system’s measures of performance

qs LLc −=→

Page 22: Que Ing

M/M/1:GD/∞/∞

• n – number of customers in the system• rate of arrival = λn = λ for all n• rate of departure = µn = µ for all n• λn = λ since it is independent of the number in the

system

Single Channel Queueing System

system

Defining ρ = λ / µ

,....................

0121

0321 ppnnn

nnnn µµµµ

λλλλ

−−

−−−= n = 0, 1, 2, ….

,00 pnpn

npn ρ

µλ

== n = 0, 1, 2, ….

Page 23: Que Ing

,11

10 =

− ρp

p0(1+ρ+ρ2+ρ3+….) =1

Assume ρ < 1

M/M/1:GD/∞/∞

po = 1 - ρ

,)1()1( nn

npn ρρρ

µ

λ−=−= n = 0, 1, 2, ….

Page 24: Que Ing

∑∞

=

−=0

)1(n

nn ρρ∑∞

=

=0n

ns npL

M/M/1:GD/∞/∞

2)1()1( −−−= ρρρ

ρρ−

=1 ρ−1

∑∞

=

=0n

ns npLeff

ss

LW

λ=→

qeffq WL λ=→µ1

−=→ sq WWqs LLc −=→

Little’s formulae

Page 25: Que Ing

M/M/1:GD/∞/∞

ρρ−

=1sL

)1(1ρµλ −

== ss

LW

ρρ

µλ

−=−=

1

2

sq LL

)1( ρµρ

λ −== q

q

LW

Page 26: Que Ing

Single Channel Queueing System- M/M/1:GD/∞/∞

Average length of non-empty queueλµ

µ−

=>

= 0)length (queuep

Lq

Probability that an arrival will have to dte t∫

∞−−−= )( )1( λµλ

λProbability that an arrival will have to wait more than or equal to specified time dte

t

t∫ −−−= )( )1( λµ

µλ

λ

Probability that an arrival will have to wait more than or equal to specified time in the system

dtet

t∫∞

−−−= )( )( λµλµ

Page 27: Que Ing

M/M/1:GD/N/∞Single Channel Queueing System

Maximum queue length = N-1

=,0

,λλn

n=0, 1, 2, …., N-1

n=N, N+1, ..

µn = µ for all n=0, 1, 2, …

Let ρ = λ / µ =

,pnρ n ≤ N

1).....1(1 20

0

=++++→=∑=

NN

nn pp ρρρ

Let ρ = λ / µ

=,0

,0ppn

ρ n ≤ N

n > N

p0=,

11

1+−−

Nρρ

,1

1+N

ρ=1

ρ≠1

Page 28: Que Ing

pn=,

11

1n

N ρρρ+−

,1

1+N

∑=

=N

nns npL

0

ρ=1

ρ≠1n=0, 1, 2,…..N

∑=

+−−

=N

n

nN n

011

1 ρρρ

M/M/1:GD/N/∞

)1)(1(})1(1{

1

1

+

+

−−++−

= N

NN NNρρ

ρρρ

ρ=1

ρ≠1

,2N

,)1)(1(

})1(1{1

1

+−−++− +

N

N NNNρρ

ρρρ

Ls=

Page 29: Que Ing

M/M/1:GD/N/∞

λ

NNeff ppppp 0).......( 1210 +++++= −λλ

)1( Neff p−= λλ )( qs LL −= µ

Effective arrival rate (λeff) is

λ )1( p−µλeff

sq LL −=

)1( N

q

eff

qq p

LLW

−==λλ

)1(1

N

s

eff

sqs p

LLWW

−==+=λλµ

µλ )1( N

s

pL

−−=

Page 30: Que Ing

Multi-channel Queueing System M/M/c : GD/∞/∞

ppnλ

=nλ

λn = λ for all n=0, 1, 2, …

=,

,

µµ

µc

nn

n ≤ c

n ≥ cCompute pn for n ≤ c

n ρ0))......(3)(2(

pn

pn µµµµλ

=0!

pn n

n

µλ

=

Compute pn for n ≥ c

( ) 0))........()()(()1().....3)(2(p

cccccp

n

n µµµµµµµµλ

−=

0!p

cc ncn

n

µλ−=

(n-c) times

0!p

n

n

=

ρ

0!p

cc cn

n

= −

ρ

Page 31: Que Ing

M/M/c:GD/∞/∞

11

00 !!

−−

=

=−

+= ∑ ∑c

n cncn

cncn

ccnp

ρρρ,

1

1!!

1

1

0

=

−+= ∑

c

n

cn

ccn ρρρ

Multi-Channel Queueing System

1<cρ

Page 32: Que Ing

Multi-channel Queueing System M/M/c : GD/∞/∞

∑∞

=

−=cn

nq pcnL )(

000 !

pcc

kkpLk

k

ck

kckq ∑∑

=

+∞

=+ ==

ρ 1

00!

−∞

=∑

=k

k

c

ckp

ccρρρ

1cρρ

Let n-c=k

1cρ +

=2

0

)1(

1!

ccc

pc

ρρρ

Here λeff = λµλ

+= qs LL

λq

q

LW = µ

1+= qs WW

02

1

)()!1(p

cc

c

ρρ

−−=

+

Page 33: Que Ing

Multi-channel Queueing System M/M/c : GD/N/∞

Maximum queue size = N-c

=,

,

µµ

µc

nn

n ≤ c

c ≤ n ≤ N

=,0

,λλn

n=0, 1, 2, …., N-1

n=N, N+1, ..

c ≤ n ≤ N

=

− ,!

,!

0

0

pcc

pnp

cn

n

n

n ρ

ρn ≤ c

c ≤ n ≤ N

Page 34: Que Ing

,)1(!

))(1(

!

1

1

0

1−

=

+−

−+∑

c

n

cNcn

cc

cn ρ

ρρρ

,)1(!!

11

0

−−

=

+−+∑

c

n

cn

cNcnρρ

ρ/c ≠ 1

ρ/c = 1

p0 =

Multi-channel Queueing System M/M/c : GD/N/∞

∑=

−=N

cnnq pcnL )( Let n-c = j

1

00

0 !

−−

=

=+

== ∑∑jcN

j

ccN

jcjq c

jpcc

jpLρρρ

Page 35: Que Ing

,)1)(1(1)()!1(

1

2

1

0

−+−−

−−−

−+−+ cNcNc

cccN

cccp

ρρρρ

ρ

,!2

)1)((0 c

cNcNp

c +−−ρ

ρ/c ≠ 1

ρ/c = 1

λ

Lq =

Multi-channel Queueing System M/M/c : GD/N/∞

µλeff

qs LL +=

)1( Neff p−= λλ )( cc −= µ

∑=

−=c

nnpnc

0

)(=c Expected number of idle servers

)( ccLLL qeff

qs −+=+=µλ

Page 36: Que Ing

Outline for Simulation Modelq Introduction to Simulationq Terminologyq Advantages and disadvantagesq Generation of Random Numbersq Monte Carlo method of Simulation

Page 37: Que Ing

Introduction• A computerized imitation of the random behaviour of a system as a

function of time.

• As simulation advances with time, statistics are gathered about the simulated system when there is a change in the behaviour of the system.

• Simulation is performed by jumping on the time scale from one event to the next. This type of modeling is described as “discrete event to the next. This type of modeling is described as “discrete event simulation”.

• In some systems the state changes all the time. In such cases “continuous simulation” is more appropriate, although discrete event simulation can serve as an approximation.

• Approaches for simulation model– Next-event scheduling– Process operation

Page 38: Que Ing

System terminology• State: attribute in the system

• Event: occurrence in time

• Entity: object

• Queue: waiting for something

• Creating: causing an arrival of a new entity

• Scheduling: assigning a new future event

• Random variable: uncertain

• Distribution: mathematical law

Page 39: Que Ing

Advantages and Disadvantagesü Intricate managerial decision problemsü Eliminate the need of costly trial and error methods of trying ou the

new concept on real methods and equipmentü Easy to use and understandü Comparatively flexible and modified to accommodate the changesü Less time for computations of large size problemsü Use for training the operating and managerial staff in the operation

of complex plansof complex plans

• Approximation solutions• Quantifications of the variables is another difficult• Model development is difficult for large and complex problems• Costly• Too much tendency to rely on the simulation models

Page 40: Que Ing

GPSS, GASP

SimScript / SimLab / MODSIM II (http://www.caciasl.com)

SIMPLEX II (http://www.uni-passau.de)

SimProcess (http://www.caciasl.com)

Software

SIMPLE++

ARENA

Witness

Page 41: Que Ing

Generation of Random Numbers• Methods

– Spinning arrow method– Spinning disc method– Mid-square method

8612, square of 8621=741665441665, square of 1665= 02772225

– Congruence method (residue method)ri+1 = (a ri + b) ( modulo m)where a, b and m are constants and the value of r0 is required called seed.

arithmetic operations are always predictable and reproducible

• Pseudo-random numbers

Page 42: Que Ing

Monte Carlo method of simulation

• The basic data regarding the occurrence of various events are known, into which the probabilities of separate events are merged in a step by step analysis to predict the outcome of the whole sequence of events.

• A simulation technique in which statistical distribution functions are created by using a series of random numbers.

Page 43: Que Ing

Example

At a telephone booth, suppose that the customers arrive with an average time (constant) of 1.8 units between one arrival and the next. Service times (constant) are assumed to be 4 time units. Simulate the system by assuming that the system starts at time zero in order to find the average waiting time per customer.

A1 A5A4A3A2 D1 D2 A6 A7 D3 A8 A9

t =0

e1 e2 e3 e4 e6e5 e8e7 e9 e10e11 e12

Page 44: Que Ing

Time Event Customer Waiting time

0 e1 1a --

Simulation run

1.8 e2 2a --3.6 e3 3a --4.0 e4 1d 4-1.8 = 2.2 (customer 2)5.4 e5 4a --7.2 e6 5a --8.0 e7 2d 8-3.6 = 4.4 (customer 3)9.0 e8 6 --

Average waiting time per customer = 3.57 time units.

9.0 e8 6a --10.8 e9 7a --12.0 e10 3d 12-5.4 = 6.6 (customer 4)13.6 e11 8a --

Simulation run stop at 14 time, end 14-7.2 = 6.8 (customer 5)14-9.0 = 5 (customer 6)14-10.8 = 3.2 (customer 7) 14-13.6 = 0.4 (customer 8)