340ch5 bank sim examples

12
CECS 340 Discrete Event Systems Modeling and Simulation Chapter 5 Bank Simulation E xample A Multiteller Bank with Jockeying Description of the System A bank with five tellers opens its doors at 9 a.m. and closes its doors at 5 p.m., but operates until all the customers in line by 5 p.m. have been served. Ea ch teller ha s a sepa rate queue. An arr iving cust omer  joins the shortest line. If two queues have the same length, the customer joins the leftmost queue (the one closest to the door). When a customer at the end of a line notices a departure that makes another line shorter than the customer’s present one, the customer can change to the shorter line. Dr. Tracy Bradley Maples (Spring 2003) 1

Upload: oluseun-osho

Post on 05-Apr-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

8/2/2019 340Ch5 Bank Sim Examples

http://slidepdf.com/reader/full/340ch5-bank-sim-examples 1/12

CECS 340 Discrete Event Systems Modeling and Simulation

Chapter 5 Bank Simulation Example

A Multiteller Bank with Jockeying

Description of the System

A bank with five tellers opens its doors at 9 a.m. and closesits doors at 5 p.m., but operates until all the customers in

line by 5 p.m. have been served.

Each teller has a separate queue. An arriving customer

 joins the shortest line. If two queues have the same length,

the customer joins the leftmost queue (the one closest to the

door). When a customer at the end of a line notices adeparture that makes another line shorter than the

customer’s present one, the customer can change to the

shorter line.

Dr. Tracy Bradley Maples (Spring 2003) 1

8/2/2019 340Ch5 Bank Sim Examples

http://slidepdf.com/reader/full/340ch5-bank-sim-examples 2/12

Question(s) to be Answered About this System

The bank’s management is concerned about the quality of 

service currently provided to customers and is thinking of 

adding one or more new tellers. How many tellers should

they add?

Why is simulation necessary?

Simulation will be used to answer this question because

hiring one or more new tellers, training them, and then

watching to see how the system is effected would be

impractical and expensive.

Dr. Tracy Bradley Maples (Spring 2003) 2

8/2/2019 340Ch5 Bank Sim Examples

http://slidepdf.com/reader/full/340ch5-bank-sim-examples 3/12

High-level Model of the System

Pictorial Representation:

The customer being served by teller 3 completes service,

causing the customer from the tail of queue 2 to jockey.

Dr. Tracy Bradley Maples (Spring 2003) 3

8/2/2019 340Ch5 Bank Sim Examples

http://slidepdf.com/reader/full/340ch5-bank-sim-examples 4/12

Input to the System

• The interarrival times of customers are exponential

random variables with mean 1 minute.

• The service times of customers are exponential random

variables with mean 4.5 minutes.

Output Statistics to be Gathered

For each case, n = 5, 6, and 7 tellers,

• Average number of customers in the queue

• Average delay in the queue

• Maximum delay in the queue

Notes on jockeying:

Let ni be the total number of customers (in the queue plus

in service) in front of teller i at a particular instant. If the

completion of a customer’s service at teller i causes n j > ni

+ 1 for some teller  j, then the customer from the tail of 

queue j jockeys to the tail of queue i.

Dr. Tracy Bradley Maples (Spring 2003) 4

8/2/2019 340Ch5 Bank Sim Examples

http://slidepdf.com/reader/full/340ch5-bank-sim-examples 5/12

If there are two or more such tellers  j (i.e., customers

wanting to move), the customer corresponding to the

closest queue to the left of teller i will jockey.

Dr. Tracy Bradley Maples (Spring 2003) 5

8/2/2019 340Ch5 Bank Sim Examples

http://slidepdf.com/reader/full/340ch5-bank-sim-examples 6/12

Simulation Design and Implementation

Event description Event type

Arrival of a customer to the bank 1

Departure of a customer upon

completion of service

2

Bank closes its doors at 5 p.m. 3

Dr. Tracy Bradley Maples (Spring 2003) 6

8/2/2019 340Ch5 Bank Sim Examples

http://slidepdf.com/reader/full/340ch5-bank-sim-examples 7/12

Data Structures Needed

• Event list (one)

Storing for each entry:

Event time

Event type

Teller number if event type 2

• Teller lists (for each teller)

Storing for each entry:

Time of arrival to queue

• Teller busy bit (for each teller)

Dr. Tracy Bradley Maples (Spring 2003) 7

8/2/2019 340Ch5 Bank Sim Examples

http://slidepdf.com/reader/full/340ch5-bank-sim-examples 8/12

Subprogram Purpose

Arrive Processes type 1 events.

Depart (Teller_Num) Processes type 2 events, where

Teller_Num is the number of the

teller completing service.

Jockey(Teller_Num) Jockeys a customer from one

queue to another where

Teller_Num is the number of the

teller completing service.

(Jockey is called from Depart and

is not an event routine.)

Bank_Closes Cancels the next scheduled

arrival, thus preventing any future

arrivals.

Report Generates a report and is called

from the main program when the

simulation ends.

Dr. Tracy Bradley Maples (Spring 2003) 8

8/2/2019 340Ch5 Bank Sim Examples

http://slidepdf.com/reader/full/340ch5-bank-sim-examples 9/12

Flowchart for subroutine Arrive

Dr. Tracy Bradley Maples (Spring 2003) 9

8/2/2019 340Ch5 Bank Sim Examples

http://slidepdf.com/reader/full/340ch5-bank-sim-examples 10/12

Flowchart for Subroutine Depart

Dr. Tracy Bradley Maples (Spring 2003) 10

8/2/2019 340Ch5 Bank Sim Examples

http://slidepdf.com/reader/full/340ch5-bank-sim-examples 11/12

Flowchart for Subroutine Jockey

Dr. Tracy Bradley Maples (Spring 2003) 11

8/2/2019 340Ch5 Bank Sim Examples

http://slidepdf.com/reader/full/340ch5-bank-sim-examples 12/12

Sample Output From the Simulation

Dr. Tracy Bradley Maples (Spring 2003) 12