# Simulation Problems (Examples)

In this section, we will show you an example of simulation. This is your first example so read it carefully.

## Simulation Example: The Lajwaab Bakery Shop Problem

The Lajwaab Bakery Shop keeps stock of a popular brand of cake. Previous experience indicates the daily demand as given below:

Daily demand Probability
0 0.01
15 0.15
25 0.20
35 0.50
45 0.12
50 0.02

Consider the following sequence of random numbers:
21, 27, 47, 54, 60, 39, 43, 91, 25, 20

Using this sequence, simulate the demand for the next 10 days. Find out the stock situation, if the owner of the bakery shop decides to make 30 cakes every day. Also estimate the daily average demand for the cakes on the basis of simulated data.

Solution.

Using the daily demand distribution, we obtain a probability distribution as shown in the following table.

Table 1

On small screens, scroll horizontally to view full calculation

Daily demand Probability Cumulative probability Random Numbers
0 0.01 0.01 0
15 0.15 0.16 1-15
25 0.20 0.36 16-35
35 0.50 0.86 36-85
45 0.12 0.98 86-97
50 0.02 1.00 98-99

At the start of simulation, the first random number 21 generates a demand of 25 cakes as shown in table 2. The demand is determined from the cumulative probability values in table 1. At the end of first day, the closing quantity is 5 (30-25) cakes.

Similarly, we can calculate the next demand for others.

Table 2

Demand Random Numbers Next demand Daily production = 30 cakes
Left out Shortage
1 21 25 5
2 27 25 10
3 47 35 5
4 54 35 0
5 60 35   5
6 39 35   10
7 43 35   15
8 91 45   30
9 25 25   25
10 20 25   20
Total   320   10

Total demand = 320
Average demand = Total demand/no. of days
The daily average demand for the cakes = 320/10 = 32 cakes.