Unit 06 β Simulation
Monte Carlo simulation done by hand: turning probabilities into random-number ranges, then simulating production against a lorry, stock against demand, and customers through a single counter β the 10-mark Q2 of both papers.
Simulation was a full 10-mark Q2 in both papers β the biggest single question in either paper Final QP p. 2 Re-Exam QP p. 2. It is pure procedure: no theory, no formula to forget, just a table you fill in carefully. That makes it the safest 10 marks on the paper.
- Final Q2 β simulate a single-counter queue for 12 customers, then read five values off your table. Solved β
- Re-Exam Q2 β simulate daily production against a lorry of fixed capacity and average the waiting units and empty spaces. Solved β
- Assignment 9 β two production problems, one bakery profit problem, one car-wash queue. Solved β
1. What Simulation Is β the Monte Carlo Method Core syllabus concept
1Understand the Concept
Some problems are too messy for a formula β daily production that varies, customers who arrive at random. Simulation imitates the real system on paper: it uses random numbers to generate a realistic sequence of events (Monday's production, the next customer's arrival) according to the known probabilities, then simply counts what happens. The Monte Carlo method is the random-number technique used to do that.
2The six steps β write them as your method line
- Define the problem and the variable that varies (production per day, demand, inter-arrival timeβ¦).
- Write its probability distribution β given in the question.
- Cumulate the probabilities.
- Assign random-number ranges 00β99 in proportion to the probabilities (concept 2).
- Read the random numbers in order and convert each one to a value using the ranges.
- Simulate the rule (ship, sell, serve) day by day or customer by customer, then total and average what the question asks.
3Advantages and limitations β the theory part, if asked
| Advantages | Limitations |
|---|---|
| Handles problems too complex for an analytical formula | Gives an estimate, not an exact optimum |
| Lets managers test a policy ("bake 30 boxes") without risking money | A short run (10β15 trials) can be misleading β more trials, better estimate |
| Easy to explain β it is a table of what happened each day | Results depend on the random numbers used; a different set gives different numbers |
2. Assigning Random-Number Ranges Core syllabus concept
1The rule used by your answer keys
Two-digit random numbers run from 00 to 99 β a hundred equally likely values. Give each outcome as many of them as its probability Γ 100, in order, starting at 00:
This is exactly how the Re-Exam key allocates them: probability 0.04 β 00β03, cumulative 0.13 β 04β12, and so on Key p. 2.
2Worked Example β the inter-arrival times of Final Q2
Inter-arrival time 1, 2, 3, 4, 5 minutes with probabilities 0.2, 0.3, 0.3, 0.1, 0.1. Assign random-number ranges.
- Step 1 β Cumulate, then allocate
Inter-arrival (min) Probability Cumulative Random-number range 1 0.2 0.2 00 β 19 2 0.3 0.5 20 β 49 3 0.3 0.8 50 β 79 4 0.1 0.9 80 β 89 5 0.1 1 90 β 99 - Step 2 β Check the last range ends at 99
0.2 + 0.3 + 0.3 + 0.1 + 0.1 = 1.0, and the last range finishes at 99 β. If it does not, a probability has been copied wrongly.
Write the cumulative probabilities as two-digit numbers: 20, 50, 80, 90, 100. Each range ends one below its cumulative and starts at the previous cumulative: 00β19, 20β49, 50β79, 80β89, 90β99. A random number of exactly 20 therefore belongs to the second outcome.
- Starting at 01 instead of 00. Both conventions exist in textbooks, but your faculty's keys use 00β99. Mixing them shifts every boundary number into the wrong outcome.
- Overlapping ranges such as 00β20 and 20β49. Every random number must map to exactly one outcome.
- Not showing the table. The cumulative column and the ranges carry marks even if a later step goes wrong.
3. Production and Dispatch β the Lorry Problem Asked in the 2025-26 papers
1Understand the Concept
Daily output varies, but the vehicle that takes it away has a fixed capacity. Some days output is more than the vehicle holds and units are left waiting; other days it is less and the vehicle leaves with empty spaces. Simulation estimates both averages.
2The rule for each day β with the backlog carried forward
Units that miss today's lorry are still there tomorrow, so they join tomorrow's load. Assignment 9 says so in words, and the Re-Exam key treats day 2 that way (two scooters waiting after two days of 153) Key p. 2.
3Worked Example β Re-Exam Q2, the scooter lorry
Daily production 146β154 scooters with probabilities 0.04, 0.09, 0.12, 0.14, 0.11, 0.10, 0.20, 0.12, 0.08. A lorry takes 152 at a time. Using the random numbers 80, 81, 76, 75, 64, 43, 18, 26, 10, 12, 65, 68, 69, 61, 57, find the average number of scooters waiting per day and the average number of empty spaces on the lorry.
- Step 1 β Random-number ranges
Production / day Probability Cumulative Random-number range 146 0.04 0.04 00 β 03 147 0.09 0.13 04 β 12 148 0.12 0.25 13 β 24 149 0.14 0.39 25 β 38 150 0.11 0.5 39 β 49 151 0.1 0.6 50 β 59 152 0.2 0.8 60 β 79 153 0.12 0.92 80 β 91 154 0.08 1 92 β 99 - Step 2 β Simulate 15 days
Day RN Production Waiting from yesterday Available Shipped Left waiting Empty spaces 1 80 153 0 153 152 1 0 2 81 153 1 154 152 2 0 3 76 152 2 154 152 2 0 4 75 152 2 154 152 2 0 5 64 152 2 154 152 2 0 6 43 150 2 152 152 0 0 7 18 148 0 148 148 0 4 8 26 149 0 149 149 0 3 9 10 147 0 147 147 0 5 10 12 147 0 147 147 0 5 11 65 152 0 152 152 0 0 12 68 152 0 152 152 0 0 13 69 152 0 152 152 0 0 14 61 152 0 152 152 0 0 15 57 151 0 151 151 0 1 Day 2: 1 scooter waiting from day 1 + 153 made = 154 available; 152 go, 2 wait. Days 3β5 make exactly 152, so the 2 are still waiting. Day 6 makes 150: the 2 waiting fill the lorry to 152 exactly.
- Step 3 β Averages Average scooters waiting = 9 Γ· 15 = 0.6 per day Average empty spaces = 18 Γ· 15 = 1.2 per day
The key shows 2 scooters waiting after day 2 β so it is carrying the backlog forward β and 0 empty spaces on day 6 for the same reason. But it then shows 0 waiting on days 3, 4 and 5, although those days produce exactly 152 and nothing clears the 2 already waiting. Its total of 3 waiting (average 3/15) should be 9 (average 0.6); its empty-space total of 18 is right Key p. 2. If an examiner asks you to treat each day separately instead, say so and simply drop the "waiting from yesterday" column.
4. Inventory and Profit Simulation Core syllabus concept
1Understand the Concept
Here demand is the random variable and the decision is a fixed stocking policy ("bake 30 every morning"). Each simulated day you compare demand with stock: sell the smaller of the two, salvage what is left over, and count any shortage as lost sales (and lost goodwill if a cost is given).
2The daily profit equation
3Worked Example
A vendor buys 30 newspapers a day at βΉ5 and sells them at βΉ8; unsold copies fetch βΉ1 as scrap. Demand is 20, 30 or 40 with probabilities 0.2, 0.5, 0.3. Simulate 5 days with random numbers 45, 12, 81, 67, 33 and find the average daily profit.
- Step 1 β Ranges
Demand Probability Cumulative Random-number range 20 0.2 0.2 00 β 19 30 0.5 0.7 20 β 69 40 0.3 1 70 β 99 - Step 2 β Simulate
Day RN Demand Sold Unsold Short Profit (βΉ) 1 45 30 30 0 0 8Γ30 + 1Γ0 β 150 = 90 2 12 20 20 10 0 8Γ20 + 1Γ10 β 150 = 20 3 81 40 30 0 10 8Γ30 + 1Γ0 β 150 = 90 4 67 30 30 0 0 8Γ30 + 1Γ0 β 150 = 90 5 33 30 30 0 0 8Γ30 + 1Γ0 β 150 = 90 - Step 3 β Average
Total profit = βΉ380; average = 380 Γ· 5 = βΉ76 per day
Day 3 is the interesting one: demand was 40 but only 30 were bought, so 10 sales were lost. A question may ask for that lost revenue separately (10 Γ βΉ8 = βΉ80).
5. Simulating a Queue Asked in the 2025-26 papers
1Understand the Concept
When arrivals and service times follow given discrete distributions (not Poisson/exponential), you cannot use the Unit 5 formulas β so you simulate. Two random-number streams drive it: one for the gap between arrivals, one for the length of each service.
2The columns of the table, in order
Service starts = MAX(arrival time, previous service end). If the customer arrives after the server is free, there is no wait and the server was idle in between; if before, the customer waits. Get this column right and every other column follows by addition.
3Worked Example β Final Exam Q2 (10 marks)
Inter-arrival times 1β5 min (probabilities 0.2, 0.3, 0.3, 0.1, 0.1); service times 1, 3, 5 min (0.2, 0.5, 0.3). The first customer arrives at time 0. Arrival random numbers (customers 2β12): 61, 55, 01, 33, 19, 25, 79, 93, 18, 49, 92. Service random numbers (customers 1β12): 28, 01, 61, 85, 67, 53, 62, 79, 66, 63, 33, 77. Find (1) service start of customer 11, (2) waiting time of customer 5, (3) arrival time of customer 4, (4) time in system of customer 9, (5) service end of customer 7.
- Step 1 β Ranges for both distributions
Inter-arrival (min) Probability Cumulative Random-number range 1 0.2 0.2 00 β 19 2 0.3 0.5 20 β 49 3 0.3 0.8 50 β 79 4 0.1 0.9 80 β 89 5 0.1 1 90 β 99 Service time (min) Probability Cumulative Random-number range 1 0.2 0.2 00 β 19 3 0.5 0.7 20 β 69 5 0.3 1 70 β 99 - Step 2 β The simulation table
Cust RN (arrival) Inter-arrival Arrival time RN (service) Service time Service starts Waiting Service ends Time in system Server idle 1 β 0 0 28 3 0 0 3 3 0 2 61 3 3 01 1 3 0 4 1 0 3 55 3 6 61 3 6 0 9 3 2 4 01 1 7 85 5 9 2 14 7 0 5 33 2 9 67 3 14 5 17 8 0 6 19 1 10 53 3 17 7 20 10 0 7 25 2 12 62 3 20 8 23 11 0 8 79 3 15 79 5 23 8 28 13 0 9 93 5 20 66 3 28 8 31 11 0 10 18 1 21 63 3 31 10 34 13 0 11 49 2 23 33 3 34 11 37 14 0 12 92 5 28 77 5 37 9 42 14 0 - Step 3 β Read off the five answers
(1) Customer 11 service starts at minute 34
(2) Customer 5 waits 5 minutes
(3) Customer 4 arrives at minute 7
(4) Customer 9 spends 11 minutes in the system
(5) Customer 7 service ends at minute 23
β All five match the official key Key p. 2. Totals worth quoting if asked: average wait 5.67 min, average time in system 9 min, server idle 2 min.
- Using the first arrival random number for customer 1 when the question says customer 1 arrives at time 0. In Final Q2 the arrival stream starts at customer 2.
- Adding the service time to the arrival time instead of to the service start time.
- Reading off the wrong column. "Time spent in the system" is end β arrival; "waiting time in queue" is start β arrival.