+ All Categories
Home > Documents > Decision Maths Lesson 14 – Simulation. Wiltshire Simulation There are many times in real life...

Decision Maths Lesson 14 – Simulation. Wiltshire Simulation There are many times in real life...

Date post: 14-Dec-2015
Category:
Upload: cassandra-brookens
View: 213 times
Download: 0 times
Share this document with a friend
24
Decision Maths Lesson 14 – Simulation
Transcript

Decision Maths

Lesson 14 – Simulation

WiltshireSimulation

There are many times in real life where we need to make mathematical predictions.

How long should a set of traffic lights stay red. How long should appointments be at a doctors

surgery. What is the best queueing system for a bank or

building society branch to operate to satisfy its customers.

In all the above the situations; you could observe what would happen in real life and try lots of scenarios.

But in many situations it can be better to create a simulation to study.

This can clearly be less time consuming and cost effective.

WiltshireSimulation

Simulation means the imitation of the operation of a system.

You will have clearly heard of flight simulators that can be used to train pilots.

In this lesson we will be looking at Stochastic simulations.

This is where you study situations where chance effects the outcome.

The methods used are commonly called Monte Carlo methods.

Monte Carlo is associated with gambling, dice, and roulette wheels.

Many of the methods use these random devices to model situations.

WiltshireSimulation

Think about the following situation: At a bank

20% of customers spend 1 minute at the window.

30% of customers spend 2 minutes at the window.

40% of customers spend 3 minutes at the window.

10% of customers spend 4 minutes at the window

The bank wish to investigate different queuing systems by using a computer to simulate the times that customers spend at the cashier window.

WiltshireSimulation

They use the following simulation: The computer generates random numbers from 00 –

99 inclusive. (this can also be done on your calculator)

A rule is devised which assigns a service time to each randomly generated number that reflects the percentages already given.

20% of the customers spend 1 minute at the window. So 20% of the random numbers can be used to

represent this outcome. We could use the numbers 00 – 19.

WiltshireSimulation

The following table shows how the rest of the numbers could be used.

The way the simulation works is you now generate a random number and this will represent 1 person.

The table will indicate how long that simulated person will spend at the cashier.

Time Simulated Customer is at window

Random numbers

1 minute 00 – 19

2 minutes 20 – 49

3 minutes 50 – 89

4 minutes 90 – 99

WiltshireSimulation

A cashier serves 5 people in a row; generate a possible scenario working out how long it takes to serve everyone.

Example: 72, 74, 17, 98, 57 This queue would take 3 + 3 + 1 + 4 + 3 = 14 minutes to

serve.

Time Simulated Customer is at window

Random numbers

1 minute 00 – 19

2 minutes 20 – 49

3 minutes 50 – 89

4 minutes 90 – 99

WiltshireUsing Random Numbers

When using random numbers it is important that every outcome is uniformly distributed.

An example to avoid would be rolling two dice and adding totals together.

The P(total 2) = 1/36 but the P(total 7) = 1/6. You should choose your numbers carefully

but you could be clever and not use all the numbers in certain cases.

Assign the following distributions random numbers.

WiltshireExercise

Probability 1/10 3/10 2/10 4/10

Range

Probability 1/13 3/13 5/13 2/13 2/13

Range

Probability 4/17 7/17 5/17 1/17

Range

WiltshireExercise

Probability 1/10 3/10 2/10 4/10

Range 00 – 09 10 – 49 50 – 69 70 – 99

Probability 1/13 3/13 5/13 2/13 2/13

Range 00 – 06 07 – 27 28 – 62 63 – 76 77 - 90

Probability 4/17 7/17 5/17 1/17

Range 00 – 19 20 – 54 55 – 79 80 - 84

WiltshireThe Collectors Problem

A manufacturer of breakfast cereals is giving away cards with pictures of football teams on them.

There are 6 different cards in the set;

Argentina, Brazil, Columbia, Denmark, England, France.

There is only one card in a box at a time and they are distributed randomly.

Naturally a football fan would like to collect all 6 cards.

WiltshireThe Collectors Problem

i) Simulate the number of packets the fan will have to buy in order to collect all six cards.

ii) Perform the simulation several times, recording the number of packets the collector buys before having a complete set.

iii) Display the data and find the mean number of packets bought.

iv) How would you carry out the simulation if there where 10 cards in the set.

WiltshirePedestrian Crossing

A pedestrian crossing in a busy city centre is studied. At peak times pedestrians arrive at the crossing at a

rate of 1 every 10 seconds. You can model this by assuming that in any 5-second

period there is a 0.5 chance of 0 pedestrians and a 0.5 chance of 1 pedestrian arriving.

The first pedestrian to arrive at the crossing will press the button to request the lights.

The lights then show ‘don`t cross’ for 25 seconds and then ‘cross’ for 5 seconds.

During the 5 second period all the people waiting can cross.

WiltshirePedestrian Crossing

i) Use a coin to simulate a period of about 100 seconds, drawing your results in a table.

ii) Use the results of your simulation to display results on:

a) The number of people crossing each time.

b) The total lengths of time for which the traffic is allowed to flow freely.

iii) How could this model be made more realistic?

WiltshireDoctors Surgery

A Doctor is analysing the amount of time that patients spend in her surgery waiting room.

Her first appointment is at 09:00. Appointments are made at 10 minute

intervals. Her last appointment is at 11:20 Each patients visit can vary from 5 to 15

minutes. Patients can arrive up to 5 minutes early, but

they are never late.

WiltshireDoctors Surgery

i) Making suitable assumptions simulate the doctors surgery for 3 mornings.

(think about using a table to help you).

ii) Find the patients average waiting time.

WiltshireArrival and service time

This example can clearly be looked at in more detail.

With any example that involves queuing (pedestrian problem) a more complex analysis is required.

One possibility is to study the inter-arrival times or intervals.

This just means the time that elapses between successive arrivals.

We can use random numbers to explore the possibilities between arrivals.

WiltshireBank Queue Problem

A small building society has just one service counter. During lunchtime hours long queues sometimes build up. The following tables were drawn up by observing customers at

the building society during lunchtime. The first shows the duration of a persons service time.

The second shows the time that elapses between customers arriving a the bank.

Simulate the branch for 30 minutes.

Arrival 1 2 3

Probability 1/3 1/2 1/6

Service 1 2 3 4

Probability 1/10 4/10 3/10 2/10

WiltshireBank Queue Problem

Rule to generate arrival times.

Rule to generate service times.

Arrival numbers

1 minute

2 minutes

3 minutes

Service numbers

1 minute

2 minutes

3 minutes

4 minutes

WiltshireBank Queue Problem

Rule to generate arrival times.

Rule to generate service times.

Arrival numbers

1 minute 00 – 31

2 minutes 32 – 79

3 minutes 80 – 95

Service numbers

1 minute 00 – 09

2 minutes 10 – 49

3 minutes 50 – 79

4 minutes 80 – 99

WiltshireBank Queue Problem

Use the table to calculate the number of people in the queue at any given time.

Customer Random Interval Random service ArriveService

startService

end Wait

1 10 1 34 2 1 1 3 0

2 51 2 85 4 3 3 7 0

3 42 2 89 4 5 7 11 2

4 37 2 97 4 7 11 15 4

5 65 2 63 3 9 15 18 6

6 83 3 35 2 12 18 20 6

7 61 2 15 2 14 20 22 6

8 15 1 80 3 15 22 25 7

9 55 2 87 4 17 25 29 8

10 1 1 56 3 18 29 32 11

11 13 1 94 4 19 32 36 13

12 20 1 63 3 20 36 39 16

13 37 2 95 4 22 39 43 17

14 27 1 55 3 23 43 46 20

15 30 1 84 4 24 46 50 22

16 41 2 21 2 26 50 52 24

WiltshireBank Queue Problem

Customer Random Interval Random service ArriveService

startService

end Wait

1 80 3 63 3 1 1 4 0

2 14 1 4 1 2 4 5 2

3 80 3 19 2 5 5 7 0

4 16 1 65 3 6 7 10 1

5 46 2 78 3 8 10 13 2

6 68 3 5 1 11 13 14 2

7 30 1 35 2 12 14 16 2

8 96 3 16 2 15 16 18 1

9 7 1 42 2 16 18 20 2

10 65 2 13 2 18 20 22 2

11 45 2 4 1 20 22 23 2

12 40 2 16 2 22 23 25 1

13 62 2 32 2 24 25 27 1

14 95 3 53 3 27 27 30 0

15 28 1 85 4 28 30 34 2

16 44 2 48 2 30 34 36 4

WiltshireThe queuing discipline

For any queuing system there is normally a set of rules, called the queuing discipline.

FIFO or First in First out. It is possible to have one single queue waiting for multiple tills.

This is commonly seen at petrol stations or the self service tills in Sainsbury`s.

Finally you can have lots of tills each with there own single queue.

Again this is a common sight in supermarkets.

Per 4 Per 3 Per 2 Per 1Till A

Till B

Per 8 Per 7 Per 5 Per 1 Till A

Till BPer 6 Per 4 Per 3 Per 2

WiltshireEx 6B pg 174


Recommended