# Decision Maths Lesson 14 – Simulation. Wiltshire Simulation There are many times in real life where we need to make mathematical predictions. How long.

## Presentation on theme: "Decision Maths Lesson 14 – Simulation. Wiltshire Simulation There are many times in real life where we need to make mathematical predictions. How long."— Presentation transcript:

Decision Maths Lesson 14 – Simulation

Wiltshire Simulation 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.

Wiltshire Simulation 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.

Wiltshire Simulation 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.

Wiltshire Simulation 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.

Wiltshire Simulation 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 minute00 – 19 2 minutes20 – 49 3 minutes50 – 89 4 minutes90 – 99

Wiltshire Simulation 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 minute00 – 19 2 minutes20 – 49 3 minutes50 – 89 4 minutes90 – 99

Wiltshire Using 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.

Wiltshire Exercise Probability 1/103/102/104/10 Range Probability 1/133/135/132/13 Range Probability 4/177/175/171/17 Range

Wiltshire Exercise Probability 1/103/102/104/10 Range00 – 0910 – 4950 – 6970 – 99 Probability 1/133/135/132/13 Range00 – 0607 – 2728 – 6263 – 7677 - 90 Probability 4/177/175/171/17 Range00 – 1920 – 5455 – 7980 - 84

Wiltshire The 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.

Wiltshire The 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.

Wiltshire Pedestrian 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.

Wiltshire Pedestrian 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?

Wiltshire Doctors 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.

Wiltshire Doctors 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.

Wiltshire Arrival 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.

Wiltshire Bank 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. Arrival123 Probability1/31/21/6 Service1234 Probability1/104/103/102/10

Wiltshire Bank Queue Problem Rule to generate arrival times. Rule to generate service times. Arrivalnumbers 1 minute 2 minutes 3 minutes Servicenumbers 1 minute 2 minutes 3 minutes 4 minutes

Wiltshire Bank Queue Problem Rule to generate arrival times. Rule to generate service times. Arrivalnumbers 1 minute00 – 31 2 minutes32 – 79 3 minutes80 – 95 Servicenumbers 1 minute00 – 09 2 minutes10 – 49 3 minutes50 – 79 4 minutes80 – 99

Wiltshire Bank Queue Problem Use the table to calculate the number of people in the queue at any given time. CustomerRandomIntervalRandomserviceArrive Service start Service endWait 11013421130 25128543370 342289457112 4372974711154 5652633915186 68333521218206 76121521420226 81518031522257 95528741725298 101156318293211 13194419323613 1220163320363916 1337295422394317 1427155323434620 1530184424465022 1641221226505224

Wiltshire Bank Queue Problem CustomerRandomIntervalRandomserviceArrive Service start Service endWait 18036331140 2141412452 38031925570 416165367101 5462783810132 6683511113142 73013521214162 89631621516181 9714221618202 106521321820222 11452412022232 124021622223251 136223222425271 1495353327 300 152818542830342 164424823034364

Wiltshire The 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 4Per 3Per 2Per 1 Till A Till B Per 8Per 7Per 5Per 1Till A Till BPer 6Per 4Per 3Per 2

Wiltshire Ex 6B pg 174

Download ppt "Decision Maths Lesson 14 – Simulation. Wiltshire Simulation There are many times in real life where we need to make mathematical predictions. How long."

Similar presentations