2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving,...

36
Team #4138 Page 1 of 36 For office use only T1 ________________ T2 ________________ T3 ________________ T4 ________________ For office use only F1 ________________ F2 ________________ F3 ________________ F4 ________________ 2013 16th Annual High School Mathematical Contest in Modeling (HiMCM) Summary Sheet (Please attach a copy of this page to your Solution Paper.) Team Control Number: 4138 Problem Chosen: B Please type a summary of your results on this page. Please remember not to include the name of your school, advisor, or team members on this page. Queues are formed whenever the demand for service exceeds the service availability. A queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring customer satisfaction and will even yield more profit for businesses and companies. Problem B concerns the queuing system of a bank. In order to determine the minimal changes for servers required to accomplish the bank manager‟s goal, we build four models based on the data provided. Model 1 aims to determine whether the current situation is satisfactory or not. Based on the two charts provided and by applying mathematical formulas to the program, customers‟ arrival time, waiting time and departure time are calculated. This process is repeated 10,000 times in order to get a more accurate average value. Model 1 proves that the current situation does not meet the manager‟s goal. Thus Model 2 is built. In Model 2, we try to carry out a reservation plan. Part of the customers get a chance to schedule their visiting time in advance so that they can avoid queuing and get service right away. Yet the results are slightly improved. In Model 3, we suggest opening one more counter. The results are significantly improved. The average queue length is 0.16 people and the average waiting time is 0.12 minutes.

Transcript of 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving,...

Page 1: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 1 of 36

For office use only

T1 ________________

T2 ________________

T3 ________________

T4 ________________

For office use only

F1 ________________

F2 ________________

F3 ________________

F4 ________________

2013

16th Annual High School Mathematical Contest in Modeling (HiMCM) Summary

Sheet

(Please attach a copy of this page to your Solution Paper.)

Team Control Number: 4138

Problem Chosen: B

Please type a summary of your results on this page. Please remember not

to include the name of your school, advisor, or team members on this page.

Queues are formed whenever the demand for service exceeds the service availability.

A queuing system is composed of customers‟ arriving, waiting if necessary, being

served and then leaving. Good queuing system will bring customer satisfaction and

will even yield more profit for businesses and companies.

Problem B concerns the queuing system of a bank. In order to determine the minimal

changes for servers required to accomplish the bank manager‟s goal, we build four

models based on the data provided.

Model 1 aims to determine whether the current situation is satisfactory or not. Based

on the two charts provided and by applying mathematical formulas to the program,

customers‟ arrival time, waiting time and departure time are calculated. This process

is repeated 10,000 times in order to get a more accurate average value.

Model 1 proves that the current situation does not meet the manager‟s goal. Thus

Model 2 is built. In Model 2, we try to carry out a reservation plan. Part of the

customers get a chance to schedule their visiting time in advance so that they can

avoid queuing and get service right away. Yet the results are slightly improved.

In Model 3, we suggest opening one more counter. The results are significantly

improved. The average queue length is 0.16 people and the average waiting time is

0.12 minutes.

Page 2: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 2 of 36

Model 4 is built to improve Model 3 and to ensure a higher cost performance. In this

model, the extra counter will be opened temporarily according to the queue length.

Adopting this plan, the service at the bank perfectly meets the manager‟s goals.

We also evaluate the strengths and weaknesses in our models and discuss about

further study approaches.

In order to explain our plans and to convince the bank to adopt our methods, we

provide a non-technical letter to the bank manager.

Through our study, we believe that one day people will not jump the queue but will

jump for queuing---- because of joy.

Page 3: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 3 of 36

PROBLEM B

TEAM #4138

Page 4: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 4 of 36

SUMMARY

Queues are formed whenever the demand for service exceeds the service availability.

A queuing system is composed of customers‟ arriving, waiting if necessary, being

served and then leaving. Good queuing system will bring customer satisfaction and

will even yield more profit for businesses and companies.

Problem B concerns the queuing system of a bank. In order to determine the minimal

changes for servers required to accomplish the bank manager‟s goal, we build four

models based on the data provided.

Model 1 aims to determine whether the current situation is satisfactory or not. Based

on the two charts provided and by applying mathematical formulas to the program,

customers‟ arrival time, waiting time and departure time are calculated. This process

is repeated 10,000 times in order to get a more accurate average value.

Model 1 proves that the current situation does not meet the manager‟s goal. Thus

Model 2 is built. In Model 2, we try to carry out a reservation plan. Part of the

customers get a chance to schedule their visiting time in advance so that they can

avoid queuing and get service right away. Yet the results are slightly improved.

In Model 3, we suggest opening one more counter. The results are significantly

improved. The average queue length is 0.16 people and the average waiting time is

0.12 minutes.

Model 4 is built to improve Model 3 and to ensure a higher cost performance. In this

model, the extra counter will be opened temporarily according to the queue length.

Adopting this plan, the service at the bank perfectly meets the manager‟s goals.

We also evaluate the strengths and weaknesses in our models and discuss about

further study approaches.

In order to explain our plans and to convince the bank to adopt our methods, we

provide a non-technical letter to the bank manager.

Through our study, we believe that one day people will not jump the queue but will

jump for queuing---- because of joy.

Page 5: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 5 of 36

Contents

1. Introduction ................................................................................................................................... 6

2. Restatement of the Problem and Analysis ..................................................................................... 7

3. General Assumptions .................................................................................................................... 7

4. Variables ........................................................................................................................................ 8

5. Model 1-----Analysis of the Current Situation ............................................................................ 10

5.1 Introduction ....................................................................................................................... 10

5.2 Establishment of Model 1 ................................................................................................. 10

6. Model 2-----Reservation System ................................................................................................. 14

6.1 Introduction ....................................................................................................................... 14

6.2 Establishment of Model 2 ................................................................................................. 14

7. Model 3-----Multi-Counter System ............................................................................................. 17

7.1 Introduction ....................................................................................................................... 17

7.2 Establishment of Model 3 ................................................................................................. 17

8. Model 4-----Temporary Multi-Counter System .......................................................................... 20

8.1 Introduction ....................................................................................................................... 20

8.2 Establishment of Model 4 ................................................................................................. 20

9. Evaluations .................................................................................................................................. 23

9.1 Strengths ........................................................................................................................... 23

9.2 Weaknesses ....................................................................................................................... 23

10. Further Study Approaches ......................................................................................................... 24

11. Appendix ................................................................................................................................... 25

11.1 A Letter to the Bank‟s Manager ....................................................................................... 25

11.2 Reference ......................................................................................................................... 26

11.3 Matlab Code .................................................................................................................... 26

Model 1: Analysis ........................................................................................................... 26

Model 2: Reservation ...................................................................................................... 28

Model 3: Multi-Counter .................................................................................................. 31

Model 4: Temporary Multi-Counter ................................................................................ 33

Page 6: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 6 of 36

1. Introduction

Queuing is rarely one‟s favorite activity. Yet our daily life always involves queuing.

No matter when one is waiting for a bus, or at the ticket office trying to book a seat

for the show, lining up is always necessary and required.

Queuing has become the base of efficiency and organization. The principle behind it

is very simple: the demand for service often exceeds the amount of service that can be

offered. How to turn queuing into a more efficient process has thus been a main focus

of businesses.

Two things are crucial to solving the queuing problem. The first is the serving spirit of

the staff. The second is technical support. Staff should highly devote themselves to

their positions, reaching for better customer satisfaction and better service. Technical

support determines how advanced the queuing system is. On a given situation with

stable number of customers, available staff and equipment, the queuing system

directly affects the service quality.

Businesses are trying various queuing system. For instance, Disney theme park has a

system called FASTPASS which is designed to shorten waiting lines. It saves a place

in a line by offering customers the chance to schedule their ride for a later time,

allowing them to leave, enjoy the park and return later during their given times1. Near

the cashier of Carrefour supermarket, a slogan reads „If there are four customers

waiting before you, please press the button. Reduce your waiting time by every

second in cashier line is our commitment.‟2 More and more restaurants are adopting a

new approach, namely „phone queuing‟. After getting a waiting number on the phone,

one can leave the spot instead of sitting in the queue. When the restaurant is ready to

serve that customer, a phone call will be processed to notify him/her to come and

dine.

All the methods above involve Queuing Theory, which is highly related to

mathematical analysis and modeling. But the queuing theory cannot be perfectly

applied to solving real life problems since a lot of factors are not ideal, such as

non-steady-state conditions, undefined service times, unstructured queue disciplines

and non-exponential service times.

Therefore, in the process of solving the queuing problem, establishing a mathematical

model is merely the first step.

1 www.disney.com

2 www.carrefour.com

Page 7: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 7 of 36

2. Restatement of the Problem and Analysis

According to the bank manager‟s guidelines, the number of people waiting in a line

should be 2 or even less on average and the customers should wait less than 2 minutes

for the service. Other essential information is also provided. „The bank estimates it

serves about 150 customers per day.‟ Two charts provided clearly demonstrate the

existing arrival and service times.

To start with, a mathematical model should be established in order to analyze whether

the current situation fits the manager‟s expectations.

3. General Assumptions

Our study is generally based on the following assumptions:

(1) Originally the bank had only one in- use counter.

(2) The customers are served continuously, with no intervals in between.

(3) All the service the customers require for are done and are only able to be done at

the teller‟s.

(4) If more counters should be added, every counter would have the same working

speed.

(5) The bank is able to afford the extra cost of opening extra counters, if needed.

(6) The queuing discipline is First Come First Served (FCFS).

Page 8: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 8 of 36

4. Variables

n Number of people to be served by the end of the day

m Number of times the calculating process is to be

repeated

totime total time during which reservation is available

periods Length of each time section (must be the submultiple

of ‘totime’)

reserves Places for reservation in each section

arrivetime Interval between customers‟ arrival

servicetime Service time needed for a certain customer

bank(matrix) Size: 5*n

bank(1,j) The arrival time for the jth

customer

bank(2,j) The service time needed for the jth

customer

bank(3,j) The waiting time period for the jth

customer

bank(4,j) The departure time for the jth

customer

bank(5,j) The total number of people in the system when the jth

customer arrives (including the jth

customer)

bank(6,j) The time when the jth

customer get the service

bank(7,j) Whether a customer has made a reservation (in Model

2) ; Whether the temporary counter is open (in Model

4)

debut (row vector) Size: totime/periods

debut(j) The number code for the first customer entering the

system during the jth

time section

fin(row vector) Size: totime/periods

fin(j) The number code for the last customer entering the

system during the jth

time section

number The total number of people in the system when a

certain customer arrives (not including that certain

customer)

member (row vector) Size: n

member(1:j) Number of people already served when the jth

customer

entered the system

x (matrix) Size: m*6

x(i,j) The possibility of the interval between two customers‟

arrival being j-1 in the ith

time the calculation is

repeated

y (matrix) Size: m*6

y(i,j) The possibility of the service time needed for a

customer being j in the ith

time the calculation is

repeated

Page 9: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 9 of 36

X (row vector) Size: m*6

X(1,j) The possibility of intervals between two customers‟

arrival being j-1 in all the times the calculation is

repeated

Y (row vector) Size: m*6

Y(1,j) The possibility of service time needed for each

customer being j in all the times the calculation is

repeated

averwait (row vector) Size: m

averwait(1,j) The average waiting time for a customer in the jth

time

the calculation is repeated

averline (row vector) Size: m

averline(1,j) The average length of the queue in the jth

time the

calculation is repeated

Averageline The average length of the queue in all the times the

calculation is repeated

Averagewait The average waiting time for a customer in all the

times the calculation is repeated

a,b,c,h,i,j Recurring variables

Listed above are all the variables used in modeling.

Page 10: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 10 of 36

5. Model 1-----Analysis of the Current

Situation

5.1 Introduction

Before starting our study, we have to determine the basic characteristics of queuing

process. The five basic characteristics of queuing processes are: (1) arrival pattern of

customers, (2) service pattern of customers, (3) queue discipline, (4) system capacity

and (5) number of service channels.3 According to what has been provided in the

problem, (1) and (2) are already known. We can also tell that the system capacity is

150 people since the bank is estimated to serve 150 people every day. In Chapter 3 of

the present paper, we made assumptions of (3) and (5). Thus the study can begin.

5.2 Establishment of Model 1

Concerning that „The bank estimates it serves about 150 customers per day‟, as is

stated in the problem, we mainly based our model on the limit of customer number of

150.

According to the two tables (see Table 1 and 2) provided, we built an initial model to

analyze the current situation. The program is designed to get an average waiting time

and the average length of the queue.

Time between

arrival(min.)

Probability

0 0.10

1 0.15

2 0.10

3 0.35

4 0.25

5 0.05

(Table 1)

3 Constantin, H., 2011, Markov Chains and Queuing Theory, participation paper for VIGRE REU, University of

Chicago.

Page 11: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 11 of 36

Service Time(min.) Probability

1 0.25

2 0.20

3 0.40

4 0.15

(Table 2)

We created a new 5x150 matrix called “bank”:

1st customer 2

nd … 150

th

Arrival time (tA)

Service time (tS)

Waiting time period

(tw)

Departure time (tD)

Number of people in

the system (N)

(Matrix--bank)

The idea of the model is greatly based on the use of the ‘bank’ matrix.

Firstly, total number of people to be served by the end of the day (n) and the number

of times the program is to be cycled (m) should be input. In this given case, n equals

150. The bigger m is, the more accurate the result will be. Here for m, we chose

10,000.

In the second step, the program randomly arranges the intervals between each

customer and the service time needed based on Table 1 and Table 2. To reach this goal,

we used the rand function.

In order to simplify the calculation, we limit the interval of rand to (0, 1).

Rand∈(0,1)

As the possibility of the occurrence of different intervals between customers‟ arrival

and service time needed are provided, we can know that: If arrivetime ranges between

a certain interval and the length of that interval equals to the possibility of occurrence

of a certain time period between arrival, then one of the blanks in the first row should

be given the value of that certain period.

arrivetime∈(a, b) (0≤a<1, 0≤b<1,b>a )

Page 12: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 12 of 36

For example, the possibility of the time between arrivals being 2 minutes is 0.10.

When b-a=0.10, the time between arrivals of that specific point is 2 minutes. It is the

same logic process for the random picking of service time needed for each customer.

As the program shall be run as many times as possible, errors may occur regarding to

the possibility of occurrence of service time and arrive time. We use the program to

determine how many times each possible value occurs, both for service time and time

between arrivals. The result is very close to the given value and they varied so little

between each other that it can be ignored, shown as below:

In the brackets are the given probabilities and outside the brackets are the

probabilities after simulation. The first row represents the probabilities of average

time between customer‟s arrivals. The second represents the probabilities of average

service time needed for one customer.

(Comparison between the given probabilities and the probabilities after simulation)

After the program randomly picked the values, the values of time between arrivals are

given to the first row of the matrix „bank‟ and the values of the service time needed

for a certain customer are given to the second. Then using the function „cumsum‟, we

turn the values of time between customers‟ arrival into their arrival time. This makes

it easier to calculate their waiting time length.

(The first row of ‘bank’)

We start with the first customer to arrive. The first customer will be referred to as 1.

The waiting time of 1: tW1=0

The departure time of 1: tD1=tA1+tS1

As 1 is the first to arrive, he can be directly served. Applying this to common

circumstances, we have to divide the customers into two kinds. The first are those that

do not have to wait to get their service. They arrive after others have left. The second

is those that have to wait before they are served. When they arrive, the customer(s)

before them hasn‟t left.

The nth

customer will be referred to as n.

Page 13: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 13 of 36

Understanding the use of cumsum, we know that:

The arrival time of the nth

customer: tA=tA1+tA2+…+tAn

For those who do not have to wait, we have:

tWn=0

tDn=tAn+tSn

For those who have to wait to get service, we have:

The waiting time of n: tWn=tD(n-1)-tAn

The departure time of n: tDn=tD(n-1)+tSn

By repeating the calculation 10,000 times we get relatively accurate values:

Average waiting time=4.9333352

Average line length=2.185336

(Results of Model 1)

We can tell from the results that the current queuing system does not meet the

manager‟s goal and is not satisfying. Based on the analysis, we start to carry out plans

for the bank to improve their service.

Page 14: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 14 of 36

6. Model 2-----Reservation System

6.1 Introduction

We have noticed that in many banks, there is VIP Service. Yet this kind of priority

service is mainly offered to golden credit card holders. The majority of customers are

left with no priorities. In this problem, the customers have not been classified. We

assume they are of the same customer group. Through Model 2, we try to simulate

how the situation will be like if part of the group is given priorities. The kind of

priority we choose for this part of the study is customer reservation. The model is

developed under the circumstance of only one available service counter.

6.2 Establishment of Model 2

Based on the knowledge of Overall management, we decided reservations should be

open to those who are in need of service that only occupies a time period of one or

two minutes. In Model 2, the matrix „bank‟ is slightly rearranged.

1st customer 2

nd … 150

th

Arrival time (tA)

Service time (tS)

Waiting time period

(tw)

Departure time (tD)

Number of people in

the system (N)

The time when

customers get the

service (tG)

Reservation status

(the original ‘bank’ matrix)

In the last row, 1 represents customers with reservation and 0 represents those

without.

Page 15: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 15 of 36

Suppose the nth

customer made a reservation. He is given the right to be served right

when he arrived at the bank after the current customer being served has left. Using

Model 2, we simulate the process.

The first part of the program does not vary from the previous two. For those who did

not make a reservation, we still have:

(1) For those who do not need to wait,

tW=0

tD=tA+tS

(2) For those who have to wait for their service,

The waiting time: tW1=tD0-tA1

The departure time: tD1=tD0+tS1

When the computer reaches a customer who has made a reservation, the matrix „bank‟

varies.

As this specific customer (the nth

) is given the right to be served right away, his

position marked in „bank‟ will be moved to an intermediate variable. The original

place of the nth

customer will be taken by the (n-1) th

. The first customer here means

the first customer in line when the nth

customer enters the bank. The matrix looks like

this:

Customer

with

reservation(n)

1st

customer

… n-1th

Arrival time (tA)

Service time (tS)

Waiting time

period (tw)

Departure time (tD)

Number of people

in the system (N)

The time when

customers get the

service (tG)

Reservation

status

(‘bank’--- when there is a customer who has made a reservation)

Page 16: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 16 of 36

This process will be repeated until all the customers with reservation are moved to the

first few columns.

Through programming, we learned that to serve 150 customers per day, a working

time period around 400 minutes is needed.

(Last few columns of original ‘bank’ indicating the total service time)

As the bank is able to serve limited customers in a given time period, it is better for us

to equally allocate all places that are available for reservation into several time

periods. The length of these time periods should be short. The shorter the time periods

are the bigger benefit the reservation system will bring.

Total number of customers in need of service that occupies a time period of one or

two minutes equals to:

(0.25+0.20)*150=67.5

The number of total places available must not be greater than 67.5. As this number

increases, the waiting time and queue length decrease. Thus opening 67 places for

reservation will be of most benefit.

Through calculations, the best result we got is when the whole work day is divided

into 12 thirty-minute long sections and each section has 5 available places for

reservations. Results are as below:

The results have been slightly improved. The waiting time has been reduced by 0.8

minutes and the line length has been reduced by 0.02 people. Yet these still cannot

meet the manager‟s goal. Thus we introduce Model 3---- Multi-Counter System.

Page 17: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 17 of 36

7. Model 3-----Multi-Counter System

7.1 Introduction

According to the analysis in Model 1, the current queuing system does not meet the

manager‟s goal. We try to improve the bank‟s queuing system by adding one more

counter. As it is not clearly stated in the problem, we assumed earlier in Chapter 3 of

this paper that the bank originally had only one service counter. Thus this chapter will

be discussing and analyzing what the situation will be if there exist two service

counters. This is based on the „multi-channel single-phased‟ system.

7.2 Establishment of Model 3

Model 3 is developed based on Model 1. The main body of the program is similar to

that of Model 1. Yet there are two main differences.

(1) In Model 1, as there was only one counter, we began our analysis with the first

costumer. In Model 3, we should start with the first two customers to arrive as

now two counters are available.

(2) In Model 1, one does not have to wait if and only if there is no one arrived before

him that has not been served. In Models 3, one does not have to wait if there is

zero or one customer left to be served.

For the first customer, similarly, we have:

The waiting time of 1: tW1=0

The departure time of 1: tD1=tA1+tS1

People in the system: N=1

For the second, we have:

The waiting time of 2: tW2=0

Page 18: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 18 of 36

The departure time of 2: tD2=tA2+tS2

People in the system: N=2

Starting from the third customer, he or she might have to wait before getting the

service.

To study the customer group in general, the customers are again divided into two

parts.

The first part includes all the customers that do not have to wait to get their service.

Two types of customers are concerned in this part: Those who arrive when no one is

being served and those who arrive when one customer is being served.

The nth

customer will be referred to as n.

For those who arrive when no one is being served, we have:

tWn=0

tDn=tAn+tSn

N=1

For those who arrive when one customer is being served, we have:

tWn=0

tDn=tAn+tSn

N=2

The second part includes all the customers that have to wait to get their service.

Still, the nth

customer will be referred to as n.

To determine their waiting time period, the previous two customers before n needs to

be discussed.

If

tD(n-2)>tD(n-1),

Page 19: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 19 of 36

Then

tWn= tD(n-1)-tAn

tDn= tD(n-1)+tSn

Again, repeating the calculation process 10,000 times, we get the results:

(the results of Model 3)

We can see that the average waiting time and the average queue length are greatly

improved. Average waiting time is reduced to 0.10 minutes and the queue length is

reduced to 0.44 people. Thus it meets the manager‟s requirement. Yet we still want to

make further study.

Page 20: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 20 of 36

8. Model 4-----Temporary Multi-Counter

System

8.1 Introduction

The average queue length and the average waiting time are greatly improved in Model

3. As the waiting time has been reduced to 0.16 and the queue length has been

reduced to 0.12, there are a lot of circumstances where one of the counters is free,

with no customers to serve. In order to make the most use of the resources, we carried

out another plan-----Temporary Multi-Counter System. This system is also based on

the „multi-channel single-phased‟ system.

8.2 Establishment of Model 4

Based on the idea of Model 3, we decided that it will be more beneficial for the bank

to have two counters available but one should be open temporarily, according to

different situations. If the number of customers in line exceeds the maximum value,

two counters should both be open. If not, one will be enough to serve the customers.

Two more rows are added to „bank‟:

1st customer 2

nd … 150

th

Arrival time (tA)

Service time (tS)

Waiting time period (tw)

Departure time (tD)

Number of people in the

system (N)

The time when customers

get the service (tG)

The status of the

temporary counter when a

customer is being served

In the last row, 1 marks that the temporary counter is open. 0 marks that it is not.

Suppose there are currently three people in the system, one is being served and the

other two are in line. When it comes to N≥4, a temporary counter should be opened in

Page 21: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 21 of 36

order to meet the manager‟s goal.

When N≥4 (N∈Z), there are at least two people in line. We will label the three

customers as 1, 2 and 3. 1 is currently being served. 2 and 3 are in line. As 4 enters the

system, or when N=4, the second counter is open. As 2 arrived before 4, according to

the „First Come First Serve‟ principle, 2 is moved to the second counter and will be

served there. Thus we have:

The time when 2 get service: tG2=tA4

The waiting time of 2: tW2=tA4-tA2

The departure time of 2: tD2=tA4+tS2

For 3, we have:

(1) If tD2>tD1,

The time when 3 get service: tG3=tD1

The waiting time of 3: tW3=tD1-tA3

The departure time of 3: tD3=tD1+tS3

(2) If tD1>tD2,

The time when 3 get service: tG3=tD2

The waiting time of 3: tW3=tD2-tA3

The departure time of 3: tD3=tD2+tS3

For those who arrive after 3, the formulas above can also be applied.

When N∈{0, 1, 2}, the temporary counter should be closed.

As this process continues, errors may occur. Thus „bank‟ must be modified. When it

comes to a point at which a customer enters and the temporary counter is closed at the

same time, the program should calculate the data in matrix „bank‟ under the situation

of having only one counter in service. If this modification is not made, it will result in

a situation where no one is being served yet there are still customers waiting in line.

When all the situations in which N=4 have been taken into consideration and have

Page 22: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 22 of 36

been calculated, the whole program ends. Yet to get average values that are more

precise, the program still needs to be simulated a couple more times. Due to hardware

limit, we are only able to simulate six times.

Here are the results:

(the results of Model 4)

This clearly meets the manager‟s goal and is of high cost performance.

Page 23: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 23 of 36

9. Evaluations

9.1 Strengths

(1) In Model 1, a simple but efficient way is adopted to arrange the occurrence of

customers‟ arrival and the service time needed.

(2) In Model 3, the average queuing time and the average queue length are greatly

improved.

(3) In Model 4, cost performance is taken into consideration. The result perfectly

meets the manager‟s goals.

9.2 Weaknesses

(1) Due to time limit, we were not able to further enhance Model 2.

(2) Limited by the facilities, we were not able to find a local bank to try our methods.

Page 24: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 24 of 36

10. Further Study Approaches

In this problem, hardly any background information of the bank was provided. As for

bank service, cultural background and regional economic status influence greatly on

customers‟ needs. Due to the lack of information and time limit, we were not able to

provide more detailed plans for the bank. Listed below are our ideas of further study

approaches if more information is provided.

(1) Develop a VIP system based on the existing reservation system. Normally banks

classify customers according to how high their credits are. If given information

regarding to this aspect, a VIP service system can be developed. This may be one

of the possible solutions to the problem.

(2) Optimize the multi-counter solution based on more detailed estimation of

customers‟ arrival and service rate during peak hours. There always exists a

certain time period in a day or a week when more customers arrive than usual. To

deal with these situations, extra counters may have to be opened. If given

information regarding to this aspect, the existing multi-counter solution can be

optimized.

(3) Queuing efficiency also depend on staff‟s working speed. In our analysis,

everything is under ideal situation in which customers are served one by one

without stop in between. Thus in addition to the proposed two plans, we highly

suggest that the employee should get training.

Page 25: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 25 of 36

11. Appendix

11.1 A Letter to the Bank’s Manager

Dear Manager,

We are a group of high school students interested in mathematical modeling. Having

learned your problem, we established four mathematical models in order to analyze

the current queuing situation at your bank and to try to provide helpful solutions.

First, we used the data that you provided us with to analyze the current situation.

According to our result, the average length of the queue is around 2.18 people and the

average waiting time for each customer reaches a value of 4.94 minutes.

To meet your requirements, we carried out three plans: (1) Adopt a reservation system

(2) Open one more service counter (3) Temporarily open an extra counter.

In the reservation system, customers are provided with a chance to schedule their time

for service in advance. Reservations are open to customers who are in need of

one-minute or two-minute service. Customers with reservation will be served right

away when they arrive at the bank. This system slightly improves the current situation,

but not significantly.

The second approach, adding one more counter, greatly reduces both the waiting time

and the queue length. The average waiting time is reduced to 0.10 minutes and the

queue length is reduced to 0.43 people. But since we do not know whether you are

able to afford opening an extra counter and hiring an extra server, we also introduce

you our third plan.

The third plan is to open an extra counter temporarily according to the queue length.

When the line is or is longer than 4 people, the extra counter will be opened. When it

is or is shorter than 2 people, the extra counter will be closed. This extra counter can

be handled by a back-office staff. When the extra counter is not in service, he can

return to his regular post. This plan ensures a higher cost performance. Thus we

highly recommend this plan.

We strongly hope that you can adopt our plans and that they can be of help to your

bank‟s business. We believe that one day people will not jump the queue but will

jump for queuing--- because of joy.

Sincerely yours,

Team #4138

Page 26: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 26 of 36

11.2 Reference

[1] M. Laguna and J. Marklund, 2005, Business Process Modeling, Simulation and

Design, Pearson Prentice Hall.

[2]Gross, D., Shortle, J. F., Thompson, J. M., and Harris, C. M., 2008, Fundamentals

of queueing theory, 4th

edition, Hoboken, New Jersey.

[3]Sokolowski, J. A. and Banks, C. M., 2008, Principles of modeling and simulation:

a multidisciplinary approach, Hoboken, New Jersey.

[4]Stewart, W. J., 2009, Probability, Markov chains, queues, and simulation: the

mathematical basis of performance modeling, Princeton, New Jersey.

[5]Constantin, H., 2011, Markov Chains and Queuing Theory, participation paper for

VIGRE REU, University of Chicgo.

11.3 Matlab Code

Model 1: Analysis

clear

clc

n=input('number of customers:');

m=input('times to be simulated:');

for j=1:m

for i=1:n

arrivetime=rand;

if arrivetime<0.1

bank(1,i)=0;

end

if 0.10<=arrivetime && arrivetime<0.25

bank(1,i)=1;

end

if 0.25<=arrivetime && arrivetime<0.35

bank(1,i)=2;

end

if 0.35<=arrivetime && arrivetime<0.7

bank(1,i)=3;

Page 27: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 27 of 36

end

if 0.70<=arrivetime && arrivetime<0.95

bank(1,i)=4;

end

if 0.95<=arrivetime

bank(1,i)=5;

end

servicetime=rand;

if servicetime<0.25

bank(2,i)=1;

end

if 0.25<=servicetime && servicetime<0.45

bank(2,i)=2;

end

if 0.45<=servicetime && servicetime<0.85

bank(2,i)=3;

end

if 0.85<=servicetime

bank(2,i)=4;

end

end

for a=0:5

[A]=find(bank(1,:)==a);

x(j,a+1)=length(A);

end

for b=1:4

[B]=find(bank(2,:)==b);

y(j,b)=length(B);

end

bank(1,:)=cumsum(bank(1,:));

bank(3,1) = 0;

bank(4,1) = bank(1,1)+bank(2,1);

bank(5,1) = 1;

member = [1];

for i = 2:n

number = sum(bank(4,member) > bank(1,i));

if number == 0

bank(3,i) = 0;

bank(4,i) = bank(1,i)+bank(2,i);

bank(5,i) = 1;

member = [member,i];

else

bank(3,i)=bank(4,max(member))-bank(1,i);

bank(4,i)=bank(4,max(member))+bank(2,i);

Page 28: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 28 of 36

bank(5,i) = number+1;

member = [member,i];

end

end

bank(5,:)=bank(5,:);

averwait(1,j)=mean(bank(3,:));

averline(1,j)=mean(bank(5,:));

end

for c=1:6

X(1,c)=mean(x(:,c));

end

for c=1:4

Y(1,c)=mean(y(:,c));

end

averageline=mean(averline);

averagewait=mean(averwait);

fprintf('%f(0.1)%f(0.15)%f(0.1)%f(0.35)%f(0.25)%f(0.05)\n',X(1,1)/n,X(1,2)/n,X(1,3)/n,X(1,

4)/n,X(1,5)/n,X(1,6)/n)

fprintf('%f(0.25)%f(0.2)%f(0.4)%f(0.15)\n',Y(1,1)/n,Y(1,2)/n,Y(1,3)/n,Y(1,4)/n)

fprintf('average wait time=%f\naverage line length=%f',averagewait,averageline-1)

Model 2: Reservation

clear

clc

totime=input('input the total time:');

periods=input('input the length of each section:');

reserves=input('the reservation tickets in each section:');

for j=1:10000

bank=zeros(1,1);

for i=1:1000

arrivetime=rand;

if arrivetime<0.1

bank(1,i)=0;

end

if 0.10<=arrivetime && arrivetime<0.25

bank(1,i)=1;

end

if 0.25<=arrivetime && arrivetime<0.35

bank(1,i)=2;

end

Page 29: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 29 of 36

if 0.35<=arrivetime && arrivetime<0.7

bank(1,i)=3;

end

if 0.70<=arrivetime && arrivetime<0.95

bank(1,i)=4;

end

if 0.95<=arrivetime

bank(1,i)=5;

end

servicetime=rand;

if servicetime<0.25

bank(2,i)=1;

end

if 0.25<=servicetime && servicetime<0.45

bank(2,i)=2;

end

if 0.45<=servicetime && servicetime<0.85

bank(2,i)=3;

end

if 0.85<=servicetime

bank(2,i)=4;

end

if sum(bank(1,:))>totime

break

end

end

bank(7,1:length(bank))=0;

bank(1,:)=cumsum(bank(1,:));

bank7=find(bank(2,:)==1 | bank(2,:)==2);

for a=1:totime/periods

debut(a)=find(bank(1,:)>=(a-1)*periods,1);

fin(a)=find(bank(1,:)<=a*periods,1,'last');

end

for a=1:totime/periods

if length(find(bank(2,debut(a):fin(a))==1 | bank(2,debut(a):fin(a))==2))<=reserves

bank(7,bank7(find(bank7>=debut(a),1):find(bank7<=fin(a),1,'last')))=1;

else

while sum(bank(7,debut(a):fin(a)))<reserves

random=rand;

bank(7,bank7(fix(random*(find(bank7<=fin(a),1,'last')-find(bank7>=debut(a),1)))+find(bank

7>=debut(a),1)))=1;

end

end

Page 30: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 30 of 36

end

bank(3,1) = 0;

bank(4,1) = bank(1,1)+bank(2,1);

bank(5,1) = 1;

bank(6,1)=bank(1,1);

member = [1];

for i=2:length(bank)

number = sum(bank(4,member) > bank(1,i));

if number == 0

bank(3,i) = 0;

bank(4,i) = bank(1,i)+bank(2,i);

bank(5,i) = 1;

member = [member,i];

else len_mem = length(member);

bank(3,i)=bank(4,len_mem)-bank(1,i);

bank(4,i)=bank(4,len_mem)+bank(2,i);

bank(5,i) = number+1;

member = [member,i];

end

bank(6,i)=bank(4,i-1);

end

bank(7,1)=0;

res=find(bank(7,:)==1);

for i=1:length(res)

chan(1:7,1)=bank(1:7,res(i));

change=find(bank(6,:)>=bank(1,res(i)),1);

while bank(7,change)==1

change=change+1;

if change>length(bank)

break

end

end

if isempty(change)==1

break

end

y=res(i)-1;

while y>=change

bank(1:7,y+1)=bank(1:7,y);

bank(3:4,y+1)=bank(3:4,y+1)+chan(2,1);

bank(5,y+1)=bank(5,y+1)+1;

bank(6,y+1)=bank(6,y+1)+chan(2,1);

chan(3,1)=chan(3,1)-bank(2,y);

chan(4,1)=chan(4,1)-bank(2,y);

chan(5,1)=chan(5,1)-1;

Page 31: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 31 of 36

chan(6,1)=chan(6,1)-bank(2,y);

y=y-1;

end

bank(1:7,change)=chan(1:7,1);

end

meanline(j)=mean(bank(5,:));

meanwait(j)=mean(bank(3,:));

end

averageline=mean(meanline);

averagewait=mean(meanwait);

fprintf('average wait time=%f\naverage line length=%f',averagewait,averageline-1)

Model 3: Multi-Counter

clear

clc

for j=1:10000

bank=zeros(1,1);

for i=1:300

arrivetime=rand;

if arrivetime<0.1

bank(1,i)=0;

end

if 0.10<=arrivetime && arrivetime<0.25

bank(1,i)=1;

end

if 0.25<=arrivetime && arrivetime<0.35

bank(1,i)=2;

end

if 0.35<=arrivetime && arrivetime<0.7

bank(1,i)=3;

end

if 0.70<=arrivetime && arrivetime<0.95

bank(1,i)=4;

end

if 0.95<=arrivetime

bank(1,i)=5;

end

servicetime=rand;

if servicetime<0.25

bank(2,i)=1;

Page 32: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 32 of 36

end

if 0.25<=servicetime && servicetime<0.45

bank(2,i)=2;

end

if 0.45<=servicetime && servicetime<0.85

bank(2,i)=3;

end

if 0.85<=servicetime

bank(2,i)=4;

end

if sum(bank(1,:))>400

break

end

end

bank(1,:)=cumsum(bank(1,:));

bank(3,1:2) = 0;

bank(4,1) = bank(1,1)+bank(2,1);

bank(4,2) = bank(1,2)+bank(2,2);

bank(5,1:2) = 1;

member = [1 2];

for i = 3:length(bank)

number = sum(bank(4,member) > bank(1,i));

if number == 0

bank(3,i) = 0;

bank(4,i) = bank(1,i)+bank(2,i);

bank(5,i) = 1;

member = [member,i];

else

if number ==1

bank(3,i) = 0;

bank(4,i) = bank(1,i)+bank(2,i);

bank(5,i) = 2;

member = [member,i];

else

len_mem = length(member);

if bank(4,i-1)<=bank(4,i-2)

bank(3,i)=bank(4,i-1)-bank(1,i);

bank(4,i)=bank(4,i-1)+bank(2,i);

else

bank(3,i)=bank(4,i-2)-bank(1,i);

bank(4,i)=bank(4,i-2)+bank(2,i);

end

bank(5,i) = number+1;

member = [member,i];

Page 33: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 33 of 36

end

end

end

averwait(1,j)=mean(bank(3,:));

averline(1,j)=mean(bank(5,:));

end

averageline=mean(averline);

averagewait=mean(averwait);

fprintf('average wait time=%f\naverage line length=%f',averagewait,averageline-1)

Model 4: Temporary Multi-Counter

clear

clc

n=input('number of the customers:');

m=input('times to be simulated:');

for j=1:m

for i=1:n

arrivetime=rand;

if arrivetime<0.1

bank(1,i)=0;

end

if 0.10<=arrivetime && arrivetime<0.25

bank(1,i)=1;

end

if 0.25<=arrivetime && arrivetime<0.35

bank(1,i)=2;

end

if 0.35<=arrivetime && arrivetime<0.7

bank(1,i)=3;

end

if 0.70<=arrivetime && arrivetime<0.95

bank(1,i)=4;

end

if 0.95<=arrivetime

bank(1,i)=5;

end

servicetime=rand;

if servicetime<0.25

bank(2,i)=1;

Page 34: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 34 of 36

end

if 0.25<=servicetime && servicetime<0.45

bank(2,i)=2;

end

if 0.45<=servicetime && servicetime<0.85

bank(2,i)=3;

end

if 0.85<=servicetime

bank(2,i)=4;

end

end

bank(1,:)=cumsum(bank(1,:));

bank(3,1) = 0;

bank(4,1) = bank(1,1)+bank(2,1);

bank(5,1) = 1;

bank(6,1)=bank(1,1);

member = [1];

for i = 2:n

number = sum(bank(4,member) > bank(1,i));

if number == 0

bank(3,i) = 0;

bank(4,i) = bank(1,i)+bank(2,i);

bank(5,i) = 1;

bank(6,i)=bank(1,i);

member = [member,i];

else

bank(3,i)=bank(4,max(member))-bank(1,i);

bank(4,i)=bank(4,max(member))+bank(2,i);

bank(5,i) = number+1;

bank(6,i)=bank(1,i)+bank(3,i);

member = [member,i];

end

end

bank(7,:)=0;

g=0;

while g==0

forthp=find(bank(5,:)==4 & bank(7,:)==0,1);

if isempty(forthp)==1

break

end

firsttem=find(bank(6,:)>bank(1,forthp),1);

bank(3,firsttem)=bank(1,forthp)-bank(1,firsttem);

bank(4,firsttem)=bank(1,forthp)+bank(2,firsttem);

h=1;

Page 35: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 35 of 36

while find(bank(1,:)<bank(1,firsttem+h) & bank(1,firsttem+h)<bank(4,:))>2

if sum(bank(4,1:firsttem+h-1)>bank(1,firsttem+h))==1 ||

sum(bank(4,1:firsttem+h-1)>bank(1,firsttem+h))==0

bank(3,firsttem+h)=0;

bank(4,firsttem+h)=bank(1,firsttem+h)+bank(2,firsttem+h);

bank(5,firsttem+h)=1;

bank(6,firsttem+h)=bank(1,firsttem+h);

else

if bank(4,firsttem+h-1)<=bank(4,firsttem+h-2);

bank(3,firsttem+h)=bank(4,firsttem+h-1)-bank(1,firsttem+h);

bank(4,firsttem+h)=bank(4,firsttem+h-1)+bank(2,firsttem+h);

else

bank(3,firsttem+h)=bank(4,firsttem+h-2)-bank(1,firsttem+h);

bank(4,firsttem+h)=bank(4,firsttem+h-2)+bank(2,firsttem+h);

end

end

bank(7,firsttem+h)=1;

h=h+1;

if firsttem+h>length(bank)

break

end

end

member=1:firsttem+h-1;

for i = firsttem+h:n

if firsttem+h>n

break

end

number = sum(bank(4,member) > bank(1,i));

if number == 0

bank(3,i) = 0;

bank(4,i) = bank(1,i)+bank(2,i);

bank(5,i) = 1;

bank(6,i)=bank(1,i);

member = [member,i];

else

bank(3,i)=bank(4,max(member))-bank(1,i);

bank(4,i)=bank(4,max(member))+bank(2,i);

bank(5,i) = number+1;

bank(6,i)=bank(1,i)+bank(3,i);

member = [member,i];

end

end

end

Page 36: 2013student.sfls.cn/HIMCM_MCM/Team4138.pdfA queuing system is composed of customers‟ arriving, waiting if necessary, being served and then leaving. Good queuing system will bring

Team #4138 Page 36 of 36

averwait(j)=mean(bank(3,:));

averline(j)=mean(bank(5,:));

end

averageline=mean(averline);

averagewait=mean(averwait);

fprintf('average wait time=%f\naverage line length=%f',averagewait,averageline)