Monté Carlo Simulation
 Understand the concept of Monté Carlo
Simulation
 Learn how to use Monté Carlo Simulation to make
good decisions

1
What is Monte Carlo Simulation ?
 Monte Carlo methods are a widely used class of
computational algorithms for simulating the behavior
of various physical and mathematical systems, and for
other computations.
 Monte Carlo algorithm is often a numerical Monte
Carlo method used to find solutions to mathematical
problems (which may have many variables) that cannot
easily be solved, (e.g. integral calculus,…)
 Stochastic simulations using the static model are
often called Monte Carlo Simulations.

2
What is Monte Carlo Simulation ?
 A Monte Carlo simulation is a statistical
simulation technique that provides approximate
solutions to problems expressed mathematically. It
utilizes a sequence of random numbers to perform
the simulation.
 This technique can be used in different domains:
 complex integral computations,
 economics,
 making decisions in specific complex problems, …

3
General Algorithm of Monte Carlo Simulation
 In general, Monte Carlo Simulation is roughly
composed of five steps:
1. Set up probability distributions: what is the probability
distribution that will be considered in the simulation
2. Build cumulative probability distributions
3. Establish an interval of random numbers for each
variable
4. Generate random numbers: only accept numbers that
satisfies a given condition.
5. Simulate trials

4
Examples
 Example 1 and Example 2: using Monte
Carlo simulation for the analysis of real
systems

5
Example 1. HERFY Cake Shop

6
Example 1. HERFY Cake Shop
 The cake seller HERFY shop sells a random number of cakes each
day. HERFY manager wants to determine a policy for managing
his inventory of cakes (e.g. how many cakes should he prepare
in 10 days).
 We can use Monte Carlo simulation to analyze HERFY inventory…
Demand Frequency Probability for cakes
0 10 0.05
1 20 0.1
2 40 0.2
3 60 0.3
4 40 0.2
5 30 0.15
200 1.00
=10/200
© 2006 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
Example 1. HERFY Cake Shop
Step 1: Set up the probability distribution for cake sales.
Using historical data HERFY Shop determined that 5% of the time 0
cakes were demanded, 10% of the time 1 cake was demanded, etc…
P(1) = 10%

© 2006 by Prentice Hall, Inc.

Upper Saddle River, NJ 07458

Demands
Example 1. HERFY Cake Shop
Step 2: Build a Cumulative Probability Distribution
15% of the time the demand was 0 or 1 cake
P(0) + P(1) = 5% + 10%

Demands
Example 1. HERFY Cake Shop
Demand
Probability
Random
Number
Interval
0 10 0.05 0.05 01 - 05
1 20 0.10 0.15 06 - 15
2 40 0.20 0.35 16 - 35
3 60 0.30 0.65 36 - 65
4 40 0.20 0.85 66 - 85
5 30 0.15 1.00 86 - 00
Step 3: Establish an interval of random numbers.
Must
be
in
correct
proportion
Note: 5% of the
time 0 cakes are
demanded, so the
random number
interval contains 5%
of the numbers
between 1 and 100
Example 1. HERFY Cake Shop
Step 4: Generate random numbers.
52
37
82
69
98
96
33
50
88
90
50
27
45
81
66
74
30
06
63
57
02
94
52
69
33
32
30
48
88
14
02
83
05
34
50
28
68
36
90
62
27
50
18
36
61
21
46
01
14
82
87
88
02
28
49
36
87
21
95
50
24
18
62
32
78
74
82
01
53
74
05
71
06
49
11
13
62
69
85
69
13
82
27
93
74
30
35
94
99
78
56
60
44
57
82
23
64
49
74
76
09
11
10
24
03
32
23
59
95
34
34
51
08
48
66
97
03
96
46
47
03
11
10
67
23
89
62
56
74
54
31
62
37
33
33
82
99
29
27
75
89
78
68
64
62
30
17
12
74
45
11
52
59
37
60
79
21
85
71
48
39
31
35
12
73
41
31
97
78
94
66
74
90
95
29
72
17
55
15
36
80
02
86
94
59
13
25
91
85
87
90
21
90
89
29
40
85
69
68
98
99
81
06
34
35
90
92
94
25
57
34
30
90
01
24
00
92
42
72
28
32
32
73
41
38
73
01
09
64
34
55
84
16
98
49
00
30
23
00
59
09
97
69
98
93
49
51
92
92
16
84
27
64
94
17
84
55
25
71
34
57
50
44
95
64
16
46
54
64
61
23
01
57
17
36
72
85
31
44
30
26
09
49
13
33
89
13
37
58
07
60
77
49
76
95
51
16
14
85
59
85
40
42
52
39
73

© 2006 by Prentice Hall, Inc.

Upper Saddle River, NJ 07458
Example 1. HERFY Cake Shop
Step 5: Simulate a series of trials.
Using random number table on previous slide, simulated demand
for 10 days is:
Random number: 52 06 50 88 53 30 10 47 99 37
Simulated demand: 3 1 3 5 3 2 1 3 5 3
Tires Interval of
Demanded Random Numbers
0 01 - 05
1 06 - 15
2 16 - 35
3 36 - 65
4 66 - 85
5 86 - 100
1
2
3

Total Average
29 2.9
Example 1. HERFY Cake Shop
Step 5: Simulate a series of trials.
Using random number table on previous slide, simulated demand
for 10 days is:
Random number: 52 06 50 88 53 30 10 47 99 37
Simulated demand: 3 1 3 5 3 2 1 3 5 3
Tires Interval of
Demanded Random Numbers
0 01 - 05
1 06 - 15
2 16 - 35
3 36 - 65
4 66 - 85
5 86 - 100
1
2
3

Total Average
29 2.9

Expected
demand = ∑(probability of i units) x (demand of i units)
= (0.05)(0) + (0.1)(1) + (0.2)(2) + (0.3)(3) + (0.2)(4) + (0.15)(5)
= 0 + 0.1 + 0.4 + 0.9 + 0.8 + 0.75
= 2.95 cakes

5

i =0
Example 2. SEC Power Company

14
Example 2. SEC Power Company
 SEC provides power to Riyadh city.
 The company is concerned about generator failures
because a breakdown costs about $75 per hour versus a
$30 per hour salary for repair persons who work 24 hours
a day, seven days a week.
 Management wants to evaluate the service maintenance
cost, simulated breakdown cost, and total cost.
 We can use Monte Carlo simulation to analyze SEC system
costs.
© 2006 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
Example 2. SEC Power Company © 2006 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
½ 5 0.05 0.05 01 - 05
1 6 0.06 0.11 06 - 11
1 ½ 16 0.16 0.27 12 - 27
2 33 0.33 0.60 28 - 60
2 ½ 21 0.21 0.81 61 - 81
3 19 0.19 1.00 82 - 00
Number
of
Times
Observed
Cumulative
Probability
Random
Number
Interval
Steps 1-3: Determine probability, cumulative probability, and
random number interval - BREAKDOWNS.
Total 100 1.00
Example 2. SEC Power Company © 2006 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
1 28 0.28 0.28 01 - 28
2 52 0.52 0.80 29 - 80
3 20 0.20 1.00 81 - 00
Repair
Time
Required
(Hours)
Probability
Cumulative
Probability
Steps 1-3: Determine probability, cumulative probability, and
random number interval - REPAIRS.
Total 100 1.00
Example 2. SEC Power Company © 2006 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
1 57 2 2:00 2:00 7 1 3:00 1
2 17 1.5 3:30 3:30 60 2 5:30 2
3 36 2 5:30 5:30 77 2 7:30 2
4 72 2.5 8:00 8:00 49 2 10:00 2
5 85 3 11:00 11:00 76 2 13:00 2
: : : : : : : : :
14 89 3 4:00 6:00 42 2 8:00 4
15 13 1.5 5:30 8:00 52 2 10:00 4.5
Simulation
Trial
Random
Number
Time
Repair
Can
Begin
Random
Number
Time
Repair
Ends
Repair
Time
No.
of
hrs.
Machine
is
down
Time
b/t
Breakdowns
Time
of
Breakdown
Example 2. SEC Power Company © 2006 by Prentice Hall, Inc.
Upper Saddle River, NJ 07458
Cost Analysis
 Service maintenance =
34 hrs of worker service X $ 30 per hr = $1,020
 Simulate machine breakdown costs =
44 total hrs of breakdown X $75 lost per hr of downtime
= $ 3,300
 Total simulated maintenance cost of the current system =
service cost + breakdown costs = $1,020 + $3,300
= $4,320

Lec4 computer simulation Modeling and Simulation.pdf

  • 1.
    Monté Carlo Simulation Understand the concept of Monté Carlo Simulation  Learn how to use Monté Carlo Simulation to make good decisions  1
  • 2.
    What is MonteCarlo Simulation ?  Monte Carlo methods are a widely used class of computational algorithms for simulating the behavior of various physical and mathematical systems, and for other computations.  Monte Carlo algorithm is often a numerical Monte Carlo method used to find solutions to mathematical problems (which may have many variables) that cannot easily be solved, (e.g. integral calculus,…)  Stochastic simulations using the static model are often called Monte Carlo Simulations.  2
  • 3.
    What is MonteCarlo Simulation ?  A Monte Carlo simulation is a statistical simulation technique that provides approximate solutions to problems expressed mathematically. It utilizes a sequence of random numbers to perform the simulation.  This technique can be used in different domains:  complex integral computations,  economics,  making decisions in specific complex problems, …  3
  • 4.
    General Algorithm ofMonte Carlo Simulation  In general, Monte Carlo Simulation is roughly composed of five steps: 1. Set up probability distributions: what is the probability distribution that will be considered in the simulation 2. Build cumulative probability distributions 3. Establish an interval of random numbers for each variable 4. Generate random numbers: only accept numbers that satisfies a given condition. 5. Simulate trials  4
  • 5.
    Examples  Example 1and Example 2: using Monte Carlo simulation for the analysis of real systems  5
  • 6.
    Example 1. HERFYCake Shop  6
  • 7.
    Example 1. HERFYCake Shop  The cake seller HERFY shop sells a random number of cakes each day. HERFY manager wants to determine a policy for managing his inventory of cakes (e.g. how many cakes should he prepare in 10 days).  We can use Monte Carlo simulation to analyze HERFY inventory… Demand Frequency Probability for cakes 0 10 0.05 1 20 0.1 2 40 0.2 3 60 0.3 4 40 0.2 5 30 0.15 200 1.00 =10/200 © 2006 by Prentice Hall, Inc. Upper Saddle River, NJ 07458
  • 8.
    Example 1. HERFYCake Shop Step 1: Set up the probability distribution for cake sales. Using historical data HERFY Shop determined that 5% of the time 0 cakes were demanded, 10% of the time 1 cake was demanded, etc… P(1) = 10%  © 2006 by Prentice Hall, Inc.  Upper Saddle River, NJ 07458  Demands
  • 9.
    Example 1. HERFYCake Shop Step 2: Build a Cumulative Probability Distribution 15% of the time the demand was 0 or 1 cake P(0) + P(1) = 5% + 10%  Demands
  • 10.
    Example 1. HERFYCake Shop Demand Probability Random Number Interval 0 10 0.05 0.05 01 - 05 1 20 0.10 0.15 06 - 15 2 40 0.20 0.35 16 - 35 3 60 0.30 0.65 36 - 65 4 40 0.20 0.85 66 - 85 5 30 0.15 1.00 86 - 00 Step 3: Establish an interval of random numbers. Must be in correct proportion Note: 5% of the time 0 cakes are demanded, so the random number interval contains 5% of the numbers between 1 and 100
  • 11.
    Example 1. HERFYCake Shop Step 4: Generate random numbers. 52 37 82 69 98 96 33 50 88 90 50 27 45 81 66 74 30 06 63 57 02 94 52 69 33 32 30 48 88 14 02 83 05 34 50 28 68 36 90 62 27 50 18 36 61 21 46 01 14 82 87 88 02 28 49 36 87 21 95 50 24 18 62 32 78 74 82 01 53 74 05 71 06 49 11 13 62 69 85 69 13 82 27 93 74 30 35 94 99 78 56 60 44 57 82 23 64 49 74 76 09 11 10 24 03 32 23 59 95 34 34 51 08 48 66 97 03 96 46 47 03 11 10 67 23 89 62 56 74 54 31 62 37 33 33 82 99 29 27 75 89 78 68 64 62 30 17 12 74 45 11 52 59 37 60 79 21 85 71 48 39 31 35 12 73 41 31 97 78 94 66 74 90 95 29 72 17 55 15 36 80 02 86 94 59 13 25 91 85 87 90 21 90 89 29 40 85 69 68 98 99 81 06 34 35 90 92 94 25 57 34 30 90 01 24 00 92 42 72 28 32 32 73 41 38 73 01 09 64 34 55 84 16 98 49 00 30 23 00 59 09 97 69 98 93 49 51 92 92 16 84 27 64 94 17 84 55 25 71 34 57 50 44 95 64 16 46 54 64 61 23 01 57 17 36 72 85 31 44 30 26 09 49 13 33 89 13 37 58 07 60 77 49 76 95 51 16 14 85 59 85 40 42 52 39 73  © 2006 by Prentice Hall, Inc.  Upper Saddle River, NJ 07458
  • 12.
    Example 1. HERFYCake Shop Step 5: Simulate a series of trials. Using random number table on previous slide, simulated demand for 10 days is: Random number: 52 06 50 88 53 30 10 47 99 37 Simulated demand: 3 1 3 5 3 2 1 3 5 3 Tires Interval of Demanded Random Numbers 0 01 - 05 1 06 - 15 2 16 - 35 3 36 - 65 4 66 - 85 5 86 - 100 1 2 3  Total Average 29 2.9
  • 13.
    Example 1. HERFYCake Shop Step 5: Simulate a series of trials. Using random number table on previous slide, simulated demand for 10 days is: Random number: 52 06 50 88 53 30 10 47 99 37 Simulated demand: 3 1 3 5 3 2 1 3 5 3 Tires Interval of Demanded Random Numbers 0 01 - 05 1 06 - 15 2 16 - 35 3 36 - 65 4 66 - 85 5 86 - 100 1 2 3  Total Average 29 2.9  Expected demand = ∑(probability of i units) x (demand of i units) = (0.05)(0) + (0.1)(1) + (0.2)(2) + (0.3)(3) + (0.2)(4) + (0.15)(5) = 0 + 0.1 + 0.4 + 0.9 + 0.8 + 0.75 = 2.95 cakes  5  i =0
  • 14.
    Example 2. SECPower Company  14
  • 15.
    Example 2. SECPower Company  SEC provides power to Riyadh city.  The company is concerned about generator failures because a breakdown costs about $75 per hour versus a $30 per hour salary for repair persons who work 24 hours a day, seven days a week.  Management wants to evaluate the service maintenance cost, simulated breakdown cost, and total cost.  We can use Monte Carlo simulation to analyze SEC system costs. © 2006 by Prentice Hall, Inc. Upper Saddle River, NJ 07458
  • 16.
    Example 2. SECPower Company © 2006 by Prentice Hall, Inc. Upper Saddle River, NJ 07458 ½ 5 0.05 0.05 01 - 05 1 6 0.06 0.11 06 - 11 1 ½ 16 0.16 0.27 12 - 27 2 33 0.33 0.60 28 - 60 2 ½ 21 0.21 0.81 61 - 81 3 19 0.19 1.00 82 - 00 Number of Times Observed Cumulative Probability Random Number Interval Steps 1-3: Determine probability, cumulative probability, and random number interval - BREAKDOWNS. Total 100 1.00
  • 17.
    Example 2. SECPower Company © 2006 by Prentice Hall, Inc. Upper Saddle River, NJ 07458 1 28 0.28 0.28 01 - 28 2 52 0.52 0.80 29 - 80 3 20 0.20 1.00 81 - 00 Repair Time Required (Hours) Probability Cumulative Probability Steps 1-3: Determine probability, cumulative probability, and random number interval - REPAIRS. Total 100 1.00
  • 18.
    Example 2. SECPower Company © 2006 by Prentice Hall, Inc. Upper Saddle River, NJ 07458 1 57 2 2:00 2:00 7 1 3:00 1 2 17 1.5 3:30 3:30 60 2 5:30 2 3 36 2 5:30 5:30 77 2 7:30 2 4 72 2.5 8:00 8:00 49 2 10:00 2 5 85 3 11:00 11:00 76 2 13:00 2 : : : : : : : : : 14 89 3 4:00 6:00 42 2 8:00 4 15 13 1.5 5:30 8:00 52 2 10:00 4.5 Simulation Trial Random Number Time Repair Can Begin Random Number Time Repair Ends Repair Time No. of hrs. Machine is down Time b/t Breakdowns Time of Breakdown
  • 19.
    Example 2. SECPower Company © 2006 by Prentice Hall, Inc. Upper Saddle River, NJ 07458 Cost Analysis  Service maintenance = 34 hrs of worker service X $ 30 per hr = $1,020  Simulate machine breakdown costs = 44 total hrs of breakdown X $75 lost per hr of downtime = $ 3,300  Total simulated maintenance cost of the current system = service cost + breakdown costs = $1,020 + $3,300 = $4,320