1
MODULE 1: INTRODUCTION TO SIMULATION
Module outline:
• What is Simulation?
• Simulation Terminology
• Components of a System
• Models in Simulation
• Typical applications
• References
WHAT IS SIMULATION? simulation may be defined as a technique that imitates the operation of a real world
system or processes as it evolves over time. It involves the generation of an artificial
history of the system and observation of that artificial history to obtain information and
draw inferences about the operating characteristics of the real system. Simulation
educates us on how a system operates and how the system might respond to changes. It
enables us to test alternative courses of action to determine their impact on system
performance. Before an alternative is implemented, it must be tested. Although
performing tests with the “real thing” would be ideal. This is seldom practically feasible.
The cost associated with changing/improving a system may be very high both in the
term of capital required to implement the change and losses due to interruption in
production operations and other losses. In most cases experimentation with the
proposed alternative is practically impossible. In addition, as the cost of proposed
changes (alternative solutions) increase, so does the cost of physically experimenting.
As an example, suppose a heavy-duty conveyor is being considered as an alternative to
the existing material handling method (by trucks) for improving productivity and
speeding up the production operations in a factory (seeFigre3). It is obvious that
installing the proposed conveyor on a test basis would probably not be cost effective.
Therefore, experimentation with alternative configurations would be practically
impossible. In stead, experimentation with a representative model of the system would
probably make more sense.
Simulation is a means of experimenting with a detailed model of a real system to
Determine how the system will respond to changes in its environment, structure, and its
underlying assumption [Harrel (1996)]. Management Scientist uses a wide variety of
analytical tools to model, analyze, and solve complex decision problems. These tool
include linear programming, decision analysis, forecasting, Queuing theory and
Alternative 1: Use lift-truck
2
Point A Point B
(Warehouse) (Factory)
Alternative 2: use a conveyor
Point A
(warehouse ) . . . . . . . . Point B
(Factory)
Figure 3. Material handling alternatives
Simulation. Many of these tools often require the user to make some simplifying model
assumptions or they apply only to special types of problems. For instance, linear
programming applies only to well-structured situations that can be modeled with linear
objective function and linear constraints. In addition, we assume that all data are known
with certainty. Most real world problems exhibit significant uncertainty, which
generally is quite difficult to deal with analytically.
For situations in which a problem does not meet the assumptions required by standard
analytical modeling methods, simulation can be a valuable approach to modeling and
solving the problem. A recent survey of management science practitioners show that
simulation and statistical have the highest rate of application over all other analytical
tools. (1). It should be noted that simulation should not be used indiscriminately as a
substitute for sound analytical models. Many situations exist where analytical tools are
the more appropriate. The modelers need to understand the advantages and
disadvantages of different methods and use them appropriately.
SIMULATION TERMINOLOGY
The art and science of simulation uses a unique set of vocabulary of terms which enables
practitioners communicate specific concepts. We must, therefore consider the meaning
of these terms before we can begin studying actual simulation techniques. The following
list contains the key words and concepts that every modeler should know.
System:
A system as defined here is a group of objects that are joined together in some regular
interaction or interdependence for the accomplishment of some purpose. An example is a
production system manufacturing Television units. The machines, components parts, and
workers operate jointly along the assembly line to produce a good quality television set.
Similarly, the physical facilities of a hospital, its nursing staffs, physicians, and
administrative staff would be an example of a health care system. A jet aircraft is an
3
excellent example of a complex system consisting of numerous mechanical, electronic,
chemical and human components. A major corporation, together with its customers and
its suppliers, represent another example of a system containing complex interacting
components
A system is often affected by changes occurring outside of the system. Such changes are
said to happen in the system environment (Gordon 1978). In modeling a system, it is
necessary to determine the boundary between the system and its environment.
Systems can be categorized as Discrete or continuous. A discrete system is one in which
the state variables (see below) change only at a discrete set of points in time. A bank is
an example of a discrete system since the number of customers in the bank (a state
variable), change only when a customer arrives or departs. Figure 1-1 shows how the
number of customers changes only at discrete points in time.
Number of customers 3 -
Waiting in line or Figure 1-1
being served 2 -
1 -
Time
In a continuous system the state variables change continuously over time. An example is
the temperature of a point inside or outside of a steel coil cooling after heat treatment.
Figure 1-2 shows how state variable (temperature) changes over time
Temperature (F)
of a point inside Figure 1-2
a steel coil while
cooling
Time
COMPONENTS OF A SYSTEM
Entity. An object of interest in the system (example: products in an inventory system)
Attribute: A property of an entity (i.e., Weight of the product)
State: The state of a system can be thought of the collection of all variables required to
describe the system at any point in time, with respect to the objective of the
study. The state of the system is determined by assigning a particular value to
each of these variables. In the case of jet aircraft (see above). The state of the
system would be determined by such factors (state variables) as the aircraft’s
Speed, altitude, direction of travel, weather condition, number of passengers
amount of fuel remaining, and operating status. Some of these factors will
remain constant whereas others will vary with time. As a result, the state of the
system can (and often does) change with time. Note that some of these factors
are deterministic, whereas others, like weather conditions, are stochastic.
Event: An instantaneous occurrence that may change the state of the system. In
the
case of the jet aircraft a sudden change in altitude constitutes an event
4
Activity: Time-consuming elements of a system whose starting and ending
coincide with event occurrence.
Decision Variables: Those variables whose values can be specified by the
decision maker at the beginning of a problem, independent of other variables.
The value assigned to a decision variable will normally affect the state of the
system under consideration. We can call state variables as dependent variables
and decision variables as independent variables. For instance, in simulating
average queue length in a service station, the number of pumps is a decision
variable while number of people waiting in line is a state variable. Table 1
of the text list some examples of the simulation terminology.
Cause–and-effect relationships: all systems are governed by certain
relationships that describe the interaction between state variables, decision
variables, and system parameters. These relationships may represent physical
laws, statistical correlations, economic principles, and etc. Mathematically, if
we represent sets of state variables, decision variables, and system parameters
as S, X, and P respectively, for a given system the cause –and-effect
relationship can be expressed as:
(S, X, C) = 0
MODELS.
A model is used to provide some type of description of an actual system. Models can
range from exact physical mock-ups of the system to abstract mathematical
representations. Models of systems may be classified as being physical, graphical, or
symbolic. Physical models also called iconic models may be to the same scale as the
system itself. Example of this sort is an aircraft cockpit model used for pilot training.
Physical models may also be of smaller scale than the system they represent. An Example
is mock-up of building structures used by architects. Some scaled-down physical models
of three-dimensional systems may be two-dimensional, such as scaled templates used in
plant layout design.
Graphical models may be two or three-dimensional representation of systems. They
may be static, such as drawing on a paper, or dynamic such as animated films and
computer graphics. Graphic representations generally enhance communication and
understanding of the abstract models.
Symbolic (mathematical) models are abstract representation of systems and as such
they do not look like the system they represent. In many applications these models are a
more effective way to represent a system because of their ease of construction and
manipulation.
Mathematical models are used to describe the behavior of an actual system. A
simulation model is a particular type of mathematical model of a system. Such models
are comprised of s set of equations that represent the underlying cause-and-effect
relationships within the system.
Suppose the following variables** are used to determine yearly profit for a production
system
P = Gross yearly profit X = Sales volume (# of units)
5
S = Sales price per unit
F = Total fixed cost per year including taxes
C = Variable cost per unit
Assuming all other factors could be ignored, we can easily develop an expression
------------------------------------------------------------------------------------------------------ ** these are Decision variables or system Parameters
(mathematical model) for the gross profit for the business as follows:
P= (X)[S – C] –F (1)
Equations (1) constitute a mathematical model for the system. The model is used to
evaluate the state of the system as well as the performance of the system. Assigning a
set of values X, S, C, and F, the model will provide us with quantitative measures of
system’s performance and a set of values for the state variables). In addition, by
specifying different set of values for the four variable (assuming the can take random
values) and evaluating the model repeatedly for each case, we can determine how the
system responds to changes in decision variables or system parameters.
For example suppose:
X: May take any value between 200000 and 320000 (random variable)
S: The company may decide to sell the product for any value say $4/unit to $5.5/unit
C: variable cost/unit changes from one period to another from $3.5 to $4.1
T: total fixed cost plus taxes per year is constant or changes between $300K to 380K
Depending on what random o fixed value each variable assumes, the value of P, the
performance measure of the system will change. The profit (P) may take negative or
positive values.
Types of Simulation models
Simulation models may be classified as being static or dynamic. A static simulation
model, sometimes called Monte-Carlo Simulation represents a system at a particular
point in time. Monte-Carlo is basically a sampling experiment whose objective is to
estimate the distribution of an outcome variable. For example, we may be interested in
the distribution of net profit from a business for the coming year when sales volume, and
variable cost per unit are uncertain. Consider the following simple case:
Let: P= Gross yearly profit
X= Sales volume (# of units)
S= Sales price per unit
F= Total fixed cost per year including taxes
C= variable cost per unit
Assuming all other factors could be ignored, we can easily develop an expression
(mathematical model) for the gross profit for the business as follows:
P= (X)[S – C] –F
We could input many different values for these variables, X and C, into the model and
determine the value of gross profit (P) for each combination of inputs. If we do this, we
will have created a distribution of the possible values of the gross profit. The output
values (and the distribution) provide an n indication of the likelihood of what we might
expect. Monte-Carlo simulation is often used to estimate the impact of policy changes
and risk involved in decision-making. See more examples of Monte-Carlo simulation in
Chapter 2
6
Dynamic simulation models represent systems as they change over time. System
simulation Explicitly models sequences of events that happen over time. Therefore,
queuing, inventory, manufacturing problems are addressed with system simulation. As
an example, consider the following simple case. The Dynaco Company produces a
product in a two stages manufacturing system as shown below.
Input M Output
Machine #1 Machine #2
Each machine may break down randomly. A review of the historical records on the time
between breakdowns and repair time for each machine, provide the following
information.
Time Between Breakdowns (TBB) Repair Time (RT)
In hours in minutes
Machine #1 Machine #2 Machine #1 Machine #2
TBB Probability TBB Probability RT Probability RT Probability
5 0.08 5 0.04 10 -20 0.27 10 -20 0.16
10 0.18 10 0.15 20 -30 0.35 20 -30 0.30
15 0.24 15 0.37 30 -40 0.29 30 -40 0.41
20 0.39 20 0.43 40-50 0.06 40 -50 0.11
25 0.08 25 0.01 50- 0.03 50- 0.02
30 0.02 30 0.00
35 0.01
The Company is interested in estimating the Average production volume per week, as
well as the average breakdown cost/week (assume they know repair cost per hour). This
is a dynamic situation since the state of the system could change from one hour to the
next. However the state of the system will change only when the normal operation is
interrupted at discrete points in time because of breakdown of one machine or
simultaneous breakdown of both machines. Therefore, this case must be analyzed using
discrete event (system) simulation. In order to answer these questions, it is necessary to
simulate the operation of the system for n units of time and collect data on units
produced, downtimes, and other desired indexes of operations. In chapter 2 we have
provided a number of examples concerning system simulation.
Simulation models that contain no random variables are classified as deterministic
models. These models have a known set of inputs, which will result in a unique set of
outputs. Deterministic arrival would occur at a shipping/receiving dock if all trucks
arrived at the scheduled arrival time (i.e., one truck every 40 minutes, starting 12:00
noon). A stochastic simulation model has one or more random variables as inputs that
will result in random outputs. Since the outputs are random, they can be considered only
an estimate of the true characteristics of a model. For example, the simulation of a two
stages production system (see above) would involve random times between breakdowns
7
(random occurrence time) and random repair times. Thus, the output measures_ the
average production rate per week, the average breakdown cost per week- must be treated
as statistical estimates of the true values of those measures.
It should be noted that a discrete simulation model is not always used to model a discrete
system, nor is a continuous simulation model is used to model a continuous system. In
addition, simulation models may be mixed, both discrete and continuous. The choice of
whether to use a discrete or continuous (or both) simulation model is a function of the
characteristics of the system and the objectives of the study. Because dividing large
batches into smaller elements can closely approximate many continuous processes,
discrete-event simulation modeling method may be employed for many (but certainly not
all) simulation studies of continuous processes. This course primarily emphasizes
discrete, dynamic, and stochastic simulation models. It only provides limited coverage of
the static, continuous and deterministic simulation models.
TYPICAL APPLICATIONS
The application of simulation is vast. The Winter Simulation Conference (WSC) is an
excellent source o learn more about the latest in Simulation theory and applications.
Information bout upcoming WSC ca be obtained from http://www.wintersim.org. During
the early 1980s, a survey was made of major U.S. firms to learn more about their use of
simulation (Reference #2). One major finding was the identification of the functional
areas of the company where simulation was being applied. The results are shown in
Table 1 below. The survey showed that the development of simulation models has
spread beyond Operations research (or Management Science) departments. Other
functional area departments and corporate planning departments use simulation modeling
extensively. More recent reports indicate that the use of simulation continue to grow
rapidly in manufacturing, corporate planning , and finance areas. Growth in these areas
has been aided by the development of specialized programming languages for each area.
Another important recent development has been the increasing use of computer graphics
to generate animated displays of the movement of entities through the simulated system.
The computer graphics provide greater insight into the performance of the system for any
given design. They also add credibility to the results of the simulation study.
There have been numerous applications of simulation in a variety of contexts. Some of
the areas of application, are listed blow:
Manufacturing and Production
Logistic, Transportation and Distribution
Military Operations
Business Process Simulation
Construction Engineering
Health Care
Human Systems
Financial Planning
………………
For a more detailed list of application areas, see Chapter one in your textbook or visit
WSC site.
http://www.wintersim.org/
8
REFERENCES
1. Banks, J., and J. S. Carson, II, Discrete-Event Simulation, Prentice-Hall, 2001
2. Christy, DS. P., and H. J. Watson, “ The Application of Simulation: A survey of
Industry Practice, ” Interfaces, 13(5): 47-52 October 1983
9
Module 2: Brief Introduction to basics. Probability. Simulation, and Random numbers
10
Module 2: Brief Introduction to basics. Probability. Simulation, and Random numbers
• The concept of theoretical and experimental probability
• Simulation, an example
• Random variables
• Assignments
PART I: The concept of Probability: Probability is the study of chances or the likelihood of an event
happening. Directly or indirectly, it plays a role in all of our activities.
For Example, we may say that, it will probably rain today, because most
of the day in August were rainy. However, in Science we need more
accurate way of measuring probability.
A)-Experimental Probability One way to find the probability of an event is to conduct an experiment.
EXAMPLE
A bag contains 10 red marbles, 8 blue marbles and 2 yellow marbles.
Find the experimental probability of getting a blue marble
SOLUTION
11
1)- Take a marble from the bag.
2)- Record the color and return the marble.
3)- Repeat a few times (maybe 10 times).Example:
Trial # 1 2 3 4 5 6 7 8 9 10
Outcome B R R B B R B R B B
4)- Count the number of times a blue marble was picked (Suppose it is
6). The experimental probability of getting a blue marble from the bag
is 6/10 = 3/5 (Discussion: Is this correct?)
B)-Theoretical Probability We can also find the theoretical probability of an event. The equation
used to determine the theoretical probability of an event is:
Example:
A bag contains 10 red marbles, 8 blue marbles and 2 yellow marbles.
Find the theoretical probability of getting a blue marble.
Solution:
There are 8 blue marbles. Therefore, the number of favorable outcomes
= 8. There are a total of 20 marbles. Therefore, the number of total
outcomes = 20
Example:
Find the probability of rolling an even number when you roll a die
containing
the numbers 1-6. Express the probability as a fraction, decimal, ratio
and percent.
Solution:
The possible even numbers are 2, 4, 6. Number of favorable outcomes
=3.
Total number of outcomes =6
Solution:
The possible even numbers are 2, 4, 6. Number of favorable
outcomes = 3.
12
Total number of outcomes = 6
The probability = (fraction) = 0.5 (decimal) = 1to 2 (ratio) = 50%
PART II: Simulation, An example
Consider the following Experiments
Class Exercise: Repeat this Experiment 12 times. Determine the experimental probability of getting an ace. What is the theoretical
probability of getting an ace 6 . compare the outcome from the two.
A Simple Experiment; Toss a die 12 times. Suppose we get the following data;
Trial# 1 2 3 4 5 6 7 8 9 10 11 12
Outcome 3 5 2 6 1 4 5 3 5 4 2 5
Computer Simulation of this experiment: Use the Excel Spreadsheet and generate the outcomes as follows A B C D E F
1 Trial
#
Outcome
2 1 = randbetween(1,6) =If(B2=1,1,0)
3 2
4 3
5 4
6 5
7 6
8 7
9 8
10 9 copy copy
11 10
12 11
13 12
Experiment 1: Tossing a die Outcome: Result of experiment (what we expect to happen)
Possible outcomes from this Experiment (Exp. #1) are the
numbers 1, 2, 3, 4, 5, and 6
Sample Space: List of all possible outcomes
Sample space, S = {1, 2, 3, 4, 5, 6}.
13
14 Totals
➔
=Sum(C2:C13)
RESULTS: Value in Cell C14 C14 Experimental probability = = Total # of outcomes 12 This is the same as determining % of time we get an ace in tossing a die
12 times.
Theoretical Probability= 6 /(12*6) = 1/6 (Explain why?)
PART III: Random Variables NOTE: In order to fully understand this tutorial, you need to know what we
mean by an experiment, the outcomes of an experiment, and probability. For
a brief refresher, see the Appendix 1 attached to this module
Q)- What is a random variable? A)- In many experiments the outcomes of the experiment can be assigned
numerical values. For instance, if you roll a die, each outcome has a value
from 1 through 6. If you ascertain the midterm test score of a student in your
class, the outcome is again a number. A random variable is just a rule that
assigns a number to each outcome of an experiment. These numbers are
called the values of the random variable. We often use letters like X, Y and Z
to denote a random variable. Here are some examples
Examples
1. Experiment: Select a mutual fund; X = the number of companies in
the fund portfolio. The values of X are 2, 3, 4, …
2. Experiment: Select a soccer player; Y = the number of goals the
player has scored during the season. The values of Y are 0, 1, 2, 3, …
3. Experiment: Survey a group of 10 soccer players; Z = the average
number of goals scored by the players during the season.
The values of Z are 0, 0.1, 0.2, 0.3, …., 1.0, 1.1, …
QUESTIONS #1:
4. Experiment: Flip a coin three times. Let X= Total number of heads
you observed. In this experiment, the possible values X (a random
variable) are:
5. Experiment: Throw two dice; X = the sum of the numbers facing up. The
values of X are:
14
6. Experiment: Throw one die over and over until you get a six; X = the
number of throws.
The values of X are.
Discrete and Continuous Random Variables A discrete random variable can take on only specific, isolated numerical values, like the outcome of
a roll of a die, or the number of dollars in a randomly chosen bank account. Discrete random
variables that can take on only finitely many values (like the outcome of a roll of a die) are called
finite random variables. Discrete random variables that can take on an unlimited number of values
(like the number of stars estimated to be in the universe) are infinite discrete random variables.
A continuous random variable, on the other hand, can take on any values within a continuous range
or an interval, like the temperature in Central Park, or the height of an athlete in centimeters.
Examples
Random Variable Values Type
Flip a coin three times; X = the
total number of heads.
{0, 1, 2, 3} Finite
There are only four possible
values for X.
Select a mutual fund; X = the
number of companies in the
fund portfolio.
{2, 3, 4, …} Discrete Infinite
There is no stated upper limit
to the size of the portfolio.
Measure the length of an object;
X = its length in centimeters.
Any positive real number Continuous
The set of possible
measurements can take on any
positive value.
QUESTIONS #2:
Random Variable Check the Type
Throw two dice over and over until you roll a double six;
X = the number of throws. Finite
Discrete Infinite
Continuous
Take a true-false test with 100 questions;
X = the number of questions you answered correctly. Finite
Discrete Infinite
Continuous
Invest $10,000 in stocks;
X = the value, to the nearest $1, of your investment after a
year.
Finite
Discrete Infinite
Continuous
Select a group of 50 people at random;
X = the exact average height (in m) of the group. Finite
Discrete Infinite
Continuous
Using Excel to generate Random Numbers
15
Excel has two useful functions when it comes to creating random numbers.
The RAND function, and the RANDBERWEEN function .
Rand()
The RAND function creates a random decimal number between 0 and 1.
1. Select cell A1.
2. Type RAND() and press Enter. The RAND function takes no arguments.
3. To create a list of random numbers, select cell A1, click on the lower right
corner of cell A1 and drag it down.
Note that cell A1 has changed. That is because random numbers change
every time a cell on the sheet is calculated.
Randbetween (a, b)
The RANDBETWEEN function returns a random whole number
between two boundaries.
1. Select cell A1.
16
2. Type RANDBETWEEN(50,75) and press Enter.
3. If you want to create random decimal numbers between 50 and 75, modify the RAND function as follows:
Assignment 1:
For each of the following experiments, simulate the situation and
1)- Answer the questions asked, in the sequence listed below.
2)- Attach a copy of your excel worksheet. At the end/bottom of each excel sheet , write
down the (excel)
equation you used to generate each column of data, and your final answers.
3)- Write your name on the answer sheets and make sure what you submit is clean and
readable.
Experiment 1 : Tossing a coin
Simulate Tossing a coin 30 times and answer these questions:
1) -Possible outcomes are: ………………………………………………
2)-Sample space, S = ………………………………………………………
3)- Experimental Probability of getting “Tail” ……………………...........
4)- Theoretical Probability of getting “Tail” ……………………………
Experiment 2: Picking a card.
In this experiment, a card is picked from a stack of six cards, which spell the word
PASCAL. (Each letter is written on one card). Simulate the experiment and answer
the following questions:
1) -Possible outcomes are: ………………………………………………
17
2)-Sample space, S = ………………………………………………………
3)- Experimental Probability of getting “A”…………………………… …
4)- Theoretical Probability of getting “A” ………………………………..
Experiment 3: Suppose the ABC trucking Company delivers raw material to your factory. Each
truck carries about 18 tons of raw material. The time between subsequent arrivals of
trucks is random and changes between 30 to 75 minutes. Let us assume that the first
truck always arrives at 8:00 AM.
1)- Simulate the delivery operation for one day (8 hours /day) and
determine how many tons of raw material is delivered in a day. What
time (clock time) the last truck will arrive?
2)- Repeat the simulation in question 1 (above) 5 times and from the output data,
determine Maximum, Minimum, and average tons of raw material delivered
per day.
3)- From the 5 trials in question 2, determine Average number of trucks (arriving) per
day
APPENDIX MODULE 2
Random variables and probability
This lesson is about random variables and the basic language used to describe
populations and samples from populations.
I. Random Variable:
At the end of Chapter 2 we defined A random variable as follows: A
function that assigns a real number to each outcome in the sample space
of random experiment.
Example: X denotes the outcome of experiment, Tossing a die. Then X
can take (randomly) any of the values 1, 2, 3, 4, 5, and 6.
18
Note: The outcome of an experiment need not be a number, for
example, the outcome when a coin is tossed can be 'heads' or 'tails'.
However, we often want to represent outcomes as numbers. A random
variable is a function that associates a unique numerical value with
every outcome of an experiment. The value of the random variable will
vary from trial to trial as the experiment is repeated. There are two
types of random variable - discrete and continuous
A discrete Random Variable is one which may take on only a countable number of distinct values such as 0, 1, 2, 3, 4, ... Discrete random variables are usually (but not necessarily) counts. Examples of discrete random variables include the number of students in registration office, the Friday night attendance at a cinema, the
number of cars passing a toll both. Continuous random variable is one which takes an infinite number of possible values. Continuous random variables are usually measurements. Examples include height, weight, pressure, the time required to run a mile.
Examples 1. A coin is tossed ten times. The random variable X is the number
of tails that are noted. X can only take the values 0, 1, ..., 10, so X is a discrete random variable.
2. A light bulb is burned until it burns out. The random variable Y is its lifetime in hours. Y can take any positive real value, so Y is a continuous random variable.
Introduction to Probability The study of descriptive statistics was concerned with what has
occurred, probability is concerned with what will occur. Many of the
concepts are the same, although some of the vocabulary changes.
Descriptive statistics is concerned with (relative) frequency in the past,
probability with (relative) frequency in the future.
• Vocabulary
• Axioms
• Where do probabilities come from?
Vocabulary
Experiment:
something which generates an outcome (e.g., pick a card, roll a die,
weigh a student, look outdoors)
Outcome: (also called simple event)
19
result of an experiment (e.g., jack of spades, 3 pips, 145 pounds,
partly cloudy)
Sample space: (denoted by S)
set of all possible outcomes of an experiment (e.g., for picking a card
there are 52 possible outcomes, hence 52 points in the sample space)
Event: a set of outcomes, or equivalently, a subset of the sample
space (e.g., for picking a card, events include getting a spade,
getting a deuce, getting a face card)
Note: Sometimes identifying outcomes is subtle. If you roll a pair of dice, is the total number of pips, the pair of values on the two dice, or the ordered
pair of values on the two dice the outcome?
Axioms Of Probability
A probability space entails that a probability be assigned to each outcome.
• The probability of each outcome [denoted P (xi ), where “xi ” is the
ith outcome] is always between 0 and 1.inclusive
• The probability of an event is the sum of the probabilities of the
outcomes (simple events) in the Event.
• P(S)=1; Something has to happen, the probability of the sample space
is 1.
Where do probabilities come from?
• Probabilities may be given, often in the form of a table. For example,
if an experiment has three possible outcomes: Accept , Reject, or
Compromise, one might be given the following table:
Accept Reject Compromise xi (A) ( R) (C)
P (xi ), 0.35 0.25 0.40
Note: Even if say, the 0.40 entry had been missing, you would
have been able to figure it out, since probabilities sum to 1.
• Probabilities my be historical, if it has rained during 1/3 of the days in
June during the past, one may say that the probability of rain for a day
in June is 1/3.
• Probabilities may be theoretical, if a die is fair (and there is any
justice in the universe), since there are six possible outcomes, the
probability of getting 3 pips on the top face is 1/6.
20
Example: Consider the following (incomplete) table of probabilities
associated with rolling an unfair die:
xi 1 2 3 4 5 6
P (xi ) 0.2 0.1 0.2 ? 0.3 0.1
What is the probability of rolling a 5?
What is the probability of rolling an even number (2 or 4 or 6)?
Expressing Probability
A probability is usually expressed in term of a random variable. For the
die rolling example X denotes the outcome. The probability statement can be
written in either of the forms:
• Pr( x=1) = 0.2,
• Pr( x <3) = P1( x=1) + Pr(x=2) = 0.2 +0.1 =0.3
• Pr(2 ≤ x< 4) = Pr(x=2) + Pr (x=3) = 0.1+0.2 =0.30
• Pr(x ≥ 5) = Pr(x=5) + Pr(x=6) = ).3 +0.1 = 0.4 Also, the following expression may be used for the example:
• Pr(x=0) = 0
• Pr(x>6) = 0 If the set of all possible outcomes is denoted as “s” where the set
s: {1, 2, 3, 4, 5, 6], then we can use the following expressions:
• Pr(x ε s ) = 1 • if “s” is divided into a number of mutually exclusive (non-
intersecting) sun-sets s1, s2, ….sk, Then,
s = s1, + s2, + …. + sk, OR s = s1 U s2 U s3…. +U sk
Pr(x ε s ) = Pr (x ε s1 U s2 U s3…. +U sk )
21
22
Module 3: Monte Carlo Simulation
• Introduction to Monte Carlo Simulation
• Random numbers from some common probability distribution
Module 3: Monte Carlo Simulation
• Introduction to Monte Carlo Simulation
• Random numbers from some common probability distribution
PART 1: Introduction to Monte Carlo simulation Computer simulation has to do with using computer models to imitate real life or make
predictions. When you create a model with a spreadsheet like Excel, you have a certain
number of input parameters and a few equations that use those inputs to give you a set of k
outputs (response variables). Figure 1 depicts such a system X1 Y1 X2 y2 ……… ………. OUTPUT INPUT ……… ………. ……… Yk
A production
System
23
X n
This type of model may be deterministic, meaning that you get the same results no matter
how many times you re-calculate. For example the equation for calculating the future value
“F” of a investment of $X now with an interest rate of r% in “n” years F=P(1+r/100)n is a
deterministic model. However, in most systems, some or all input variables(Xi) are
stochastic resulting in output values (Yi) that change stochastically depending on the input
variables
Monte Carlo simulation is a method for iteratively evaluating a deterministic model using
sets of random numbers as inputs. By using random inputs, you are essentially turning the
deterministic model into a stochastic model. This method is often used when the model is
complex, nonlinear, or involves more than just a couple uncertain parameters. A simulation
can typically involve over 10,000 evaluations of the model, a task which in the past was
only practical using super computers.
Example
we used simple uniform random numbers as the inputs to the model. However, a uniform
distribution is not the only way to represent uncertainty. Before describing the steps of the
general MC simulation in detail, a little word about uncertainty propagation:
The Monte Carlo method is just one of many methods for analyzing uncertainty
propagation, where the goal is to determine how random variation, lack of knowledge, or
error affects the sensitivity, performance, or reliability of the system that is being modeled.
Monte Carlo simulation is categorized as a sampling method because the inputs are
randomly generated from probability distributions to simulate the process of sampling from
an actual population. So, we try to choose a distribution for the inputs that most closely
matches data we already have, or best represents our current state of knowledge. The data
generated from the simulation can be represented as probability distributions (or histograms)
or converted to error bars, reliability predictions, tolerance zones, and confidence intervals.
(See Figure 2).
24
Random (Uncertainty) Inputs
Figure 2: the basic principal of stochastic uncertainty propagation
The steps in Monte Carlo simulation of a system shown in Figure 2 are fairly simple, and
can be easily implemented in Excel for simple models. All we need to do is follow the five
simple steps listed below:
Step 1: Create a parametric model of the system, y = f(x1, x2, ..., x n).
Step 2: Generate a set of random inputs, xi1, xi2, ..., x n. (if Xi is a random variable)
Step 3: Evaluate the model and store the results as yi.
Step 4: Repeat steps 2 and 3 for i = 1 to m.
Step 5: Analyze the results using histograms, summary statistics, confidence intervals, etc
Example 1: Monte Carlo Simulation ABC Bakery company, bakes 2500 Loaf of bread per day. Historical data shows that their