BUSA6001 Computer Simulation
BUSA 6001
Computer Simulation
Session 3 – Monte Carlo simulation
1
Monte Carlo simulation
• Named after the famous gambling resort
• Numerical method that uses random numbers to solve
problems that are too complex or difficult to be solved by
mathematical formulae
• Need not involve computers, although it usually does: MS
Excel add-ins like @Risk and Crystal Ball
BUSA6001 Computer Simulation
3 - MCS
Slide 2
2
1
BUSA6001 Computer Simulation
Example: the area of a Greek island
• Islands tend to have irregular shapes, for which there is no
neat mathematical formula (like 𝐴 = 𝜋𝑟 !)
• Could enclose a map of the island inside a 10 by 10 grid
• Count the number of totally orange squares, 𝑁
• For each square that is only partially
orange, estimate the fraction that is
orange and then add them all up (𝐹)
• Area ≈
!"#
$%%
BUSA6001 Computer Simulation
3 - MCS
Slide 3
3
Disadvantages
• Time consuming
• Inaccurate, since partial squares require estimation by eye
• Could increase the grid resolution to 100 by 100 .. or (a
slightly smarter idea) just increase it for the partial squares
• More accurate, but a lot more time consuming
• Still relies on human judgment
BUSA6001 Computer Simulation
3 - MCS
Slide 4
4
2
BUSA6001 Computer Simulation
Monte Carlo simulation approach
•
•
•
•
•
•
Enclose a map of the island inside a 1 by 1 square
Shoot a dart at the square at random
Dart lands inside orange area: a hit
Dart lands outside orange area: a miss
Repeat a large number (𝑆) of times
Count the total number of hits (𝐻)
"
• Area ≈ #
• The more shots, the more accurate the estimate
• This trade-off between speed and accuracy is a feature of all
computer simulation models
BUSA6001 Computer Simulation
3 - MCS
Slide 5
5
The underlying maths
• Use a RNG to obtain a pair of uniform random numbers that
represent the (𝑥, 𝑦) coordinates of the point X
• This represents a binomial distribution, where each dart is a
“trial” and 𝑝, the probability of success, equals the proportion
of the square which is orange
• Monte Carlo simulation allows us to estimate the value of 𝑝
and hence the area of the island
1
0
BUSA6001 Computer Simulation
1
3 - MCS
Slide 6
6
3
BUSA6001 Computer Simulation
Application of Monte Carlo simulation
in project management
BUSA6001 Computer Simulation
3 - MCS
Slide 7
7
Characteristics of projects
• A one-off unique endeavour to do something that has not
been done that way before
• Has a beginning (start date) and an end (deadline)
• Usually has a fixed budget
Cost
• Cost –Time – Quality trade offs
• Can be divided into activities
Quality
(specification)
BUSA6001 Computer Simulation
3 - MCS
Time
Slide 8
8
4
BUSA6001 Computer Simulation
Example: building a house
– Draw designs
– Dig foundations
– Build walls
– Build roof
– Fit windows and doors
– Plaster walls
– Install plumbing
– Install central heating
– Electrical wiring
– Decorate rooms
BUSA6001 Computer Simulation
3 - MCS
Slide 9
9
Project management
• Activities require resources (raw material, equipment, labour)
which need to be available when, and only when, they are
needed
• Some activities need to be completed before others can start
• To ensure completion on time, within budget and to the
required specification, projects need tight planning and
control
• Traditional approach: critical path method
BUSA6001 Computer Simulation
3 - MCS
Slide 10
10
5
BUSA6001 Computer Simulation
Critical path method
• List all the activities, their durations and their immediate
prerequisites (the activities that must be completed before
that activity can start)
• Draw a project network representing the logical connections
between the activities
• Identify the critical path
• The project manager can then specify start and end dates for
all the activities, and ensure all the required resources are
available in the right place and at the right time
BUSA6001 Computer Simulation
3 - MCS
Slide 11
11
Example: making a wooden chair
Activity
Buy wood
Buy paint
Make chair
Paint chair
BUSA6001 Computer Simulation
A
B
C
D
Duration
(days)
2
1
4
1
3 - MCS
Prerequisites
A
B,C
Slide 12
12
6
BUSA6001 Computer Simulation
Project network
2
A
4
2
1
C
B
D
3
1
1
4
• Activities = arcs (arrows): start/end points = nodes (circles)
• Network shows logical connections between activities: e.g., C
can’t start until A has finished. You can’t make the chair until
you have bought the wood!
• Node 1 = start node; node 4 = end node
BUSA6001 Computer Simulation
3 - MCS
Slide 13
13
Paths
• There are two paths through the network:
– A-C-D (length 2 + 4 + 1 = 7)
– B-D (length 1+1 =2)
• The critical path is the longest path through the network: in
this case, A-C-D
2
A
4
2
1
B
C
3
1
BUSA6001 Computer Simulation
3 - MCS
D
1
4
Slide 14
14
7
BUSA6001 Computer Simulation
The critical path
• The critical path tells us how long the whole project will take
(in this case 7 days)
• Activities on the critical path must start on time, or else the
whole project will be delayed
• To complete the project, we must complete every activity
• We have some slack for activities off the critical path: e.g. we
have 6 days to do activity B, although it only takes one day
• Knowing which activities are critical is vital management
information: the project manager knows where to focus
attention to avoid the whole project being delayed
BUSA6001 Computer Simulation
3 - MCS
Slide 15
15
Drawbacks of the critical path method
• The critical path method assumes that all activity durations
are known with certainty
• Other (complicated) methods have been developed to
overcome this problem, but these all make assumptions
which may not be true in practice
BUSA6001 Computer Simulation
3 - MCS
Slide 16
16
8
BUSA6001 Computer Simulation
The solution – Monte Carlo simulation!
• Replace fixed activity durations with probability distributions
• Captures all the variability and uncertainty of the real world
• Can model alternative chains of activities: e.g. if activity X
takes less than 2 months then follow Plan A, otherwise follow
Plan B
• Either use specialist project management software, or Excel
add-ins like @Risk
• In the @Risk workshop you will build a Monte Carlo
simulation for a construction project
BUSA6001 Computer Simulation
3 - MCS
Slide 17
17
MCS of a bachelor degree
• A coin randomly generates heads (H) or tails (T)
• Each coin toss represents taking your exams in years 1, 2 and
3 of a 3-year undergraduate degree
• H = pass, T = fail (and resit, i.e. toss again)
• Three successive T’s = you are kicked out
• HHH and no T’s = First class degree
• Try it tomorrow in your breakout group
• How many of you will get Firsts?
BUSA6001 Computer Simulation
3 - MCS
Slide 18
18
9
BUSA6001 Computer Simulation
References
• Professor Brailsford’s notes
BUSA6001 Computer Simulation
3 - MCS
Slide 19
19
10