Anda di halaman 1dari 30

Decision Support for Management:

Simulation

Dr Valentina Plekhanova
CISM02: Decision Support for Management
Unit 10

Unit 10: Learning Outcomes


1.
2.
3.
4.

To understand the principles of simulation


To describe the features of a simulation approach
To understand the different simulation models
To understand the different simulation methodologies that are applied
in practice
5. To be able to explain the limitations of simulation
6. To be able to explain the key stages of the simulation process
7. To understand the principles of generation of random numbers
8. To complete a manual simulation
9. To interpret information generated from a simulation
10.To understand the Monte Carlo simulation
11.To describe the key characteristics of the Monte Carlo simulation
12.To be able to apply simulation techniques to the practical problems
CISM02 Decision Support for Management

Unit 10

Mathematical Models
Reminder

Mathematical Models

Static Models

Analytical Models

Dynamic Models

Numeric Models

Numeric Models

Analytical Models

Simulation Models

From F. Neelamkavil, Computer Simulation and Modelling, 1987

CISM02 Decision Support for Management

Unit 10

Variables of the Real System


Reminder

Realworld
System

Input Variables
(Observable)

Output Variables
(Observable)

X X . X
Barrier to observation
Non-observable Variables

CISM02 Decision Support for Management

Unit 10

Modelling and Simulation:


Elements and Relations
Reminder

Real World System


Modelling

Model

Computer
Simulation

Simulation is emulation of reality using mathematical model.


CISM02 Decision Support for Management

Unit 10

Modelling and Simulation:


Elements and Relations
Reminder

Models represent reality, simulation imitates it.


Simulation always involves the manipulation of a model; it is, in
effect, a way of manipulating a model so that it yields a motion picture
of reality.
Simulation: experimentation on the model
Simulation modelling is an experimental and applied methodology with seeks to:
Describe the behaviour of systems
Conduct theories or hypotheses that account for the observed behaviour
Use these theories to predict future behaviour, that is, the effects that will be
produced by changes in the system or in its method of operation.
CISM02 Decision Support for Management

Unit 10

What is Simulation?
Simulation is emulation of reality using mathematical model.
The Oxford English Dictionary describes simulation as:
"The technique of imitating the behaviour of some situation or system
(economic, mechanical, etc.) by means of an analogous model,
situation, or apparatus, either to gain information more conveniently
or to train personnel."

CISM02 Decision Support for Management

Unit 10

Simulation: Definition
All simulation models are so-called input-output models.
That is, they yield the output of the system given the input to its
interacting subsystems.
Simulation models are run rather that solved in order to obtain the
desired information or results.
They are incapable of generating a solution on their own in the sense of
analytical models; they can only serve as a tool for the analysis of the
behaviour of a system under conditions specified by the experimenter.
Thus, simulation is not a theory but a methodology of problem solving.

CISM02 Decision Support for Management

Unit 10

Simulation & Cognition


At the most general level Simulation should be considered as a form of
Cognition.
Cognition = action or process of acquiring knowledge.
There are three basic methods how to get an information (knowledge)
of objective reality: Experiment, Analysis, Simulation.
Let's take one practical example to demonstrate the nature of these
three methods.
The system being investigated is a gas station with one attendant. The
question is "what is the average time spent by a car in the gas station".
To get the answer we have three possibilities:

CISM02 Decision Support for Management

Unit 10

Experiment & Analysis


Experiment: take stop watches and measure the time every car spends
in the station. Count the cars, at the end sum all times and divide them
by the number of cars.
Analysis: use a formula of the Queuing Theory to compute the average
time spent in the system directly. To use a formula you will have to
assume certain queuing model which means a considerable
simplification of the real system and you will need some quantitative
parameters (here arrival intensity - number of cars arriving per time unit
and service intensity - number of cars served per time unit).

CISM02 Decision Support for Management

Unit 10

10

Simulation
Simulation: write a simulation model that generates randomly arrivals of
cars and duration of services. It must also sequence properly all
activities to have a one-to-one correspondence with the real system.
Also observation, collection of statistical data, and evaluation must be
programmed (for each car compute the time spent, accumulate these
times, count number of cars, at the end compute and display the
average).

CISM02 Decision Support for Management

Unit 10

11

Experiment:
Advantages & Disadvantages
These three methods can not be ranked because all of them have
advantages and disadvantages. They can be compared only in the
context of certain particular case taking into account various criteria.
Nevertheless some basic facts are obvious:
Experiment is always the most accurate method, that should be used
whenever it is feasible. Unfortunately very often the experiment is:
Too dangerous (behaviour of a nuclear reactor in critical situations,
landing with a plane with one jet off, etc.)
Too expensive (all cases that cause a damage, long experiments
studying throughput of a data network using leased phone lines, etc.)
Not possible at all if the system being investigated is not available
(evaluation of more possible alternatives in the design stage.)
CISM02 Decision Support for Management

Unit 10

12

Analysis:
Advantages & Disadvantages
Analysis (mostly mathematical) is typically based on strong
assumptions that are rarely true in practical life. Another possible
drawback of analytical methods is too complicated apparatus used
and/or too time consuming computation. An example of this is analysis
of Queuing Networks.
On the other hand using formulae gives mostly fast results and it is
possible to check a large number of alternatives by simply inserting
different values of parameters to the formula(e). Experimental methods
are mostly much more time consuming.
Another problem of analysis is availability of necessary parameters.
Their exact measuring is also not necessarily feasible or it is
impossible in the design stage. Using estimated data or data taken
from other similar systems decreases credibility of results.
CISM02 Decision Support for Management

Unit 10

13

Simulation:
Advantages & Disadvantages (1)
Simulation is also an experimental method. Instead of experimenting
with the real system the experiments are performed with the simulation
model (whose design is thus the key point of simulation studies). Also
simulation has many drawbacks. Here are the most important ones:

Too demanding creation of simulation models. Programming


simulation models in general languages is too difficult. There are
efficient simulation languages but their mastering represents a big
initial investment not always justified. There are simulation tools based
typically on some graphical technique that simplify or even automate
creation of simulation models of certain class of systems.

CISM02 Decision Support for Management

Unit 10

14

Simulation:
Advantages & Disadvantages (2)
Limited knowledge of the system being simulated. First of all some
quantitative parameters must be known. In the above example it is
necessary to generate random intervals between arrivals and random
service times. Here simulation is much more flexible than analysis simulation languages support generation of random numbers with
practically any distribution. In the above example both random figures
can be based on any (e.g. experimentally obtained) distributions.
Nevertheless any distribution needs either several parameters (if it is
a theoretical one) or directly the Distribution Function (if the
distribution is obtained by measuring). There can be also things in the
system (typically in the design stage) that can not be quantified and
often it is necessary to accept the fact that there might be aspects we
are not aware of at all.
CISM02 Decision Support for Management

Unit 10

15

Simulation:
Advantages & Disadvantages (3)
Too time consuming computation. An example is analysis of large
scale systems with many components working in parallel. Because
application of real parallelism is still not common, such systems are
simulated by a program performed by a single processor.
Parallel activities are then performed one at a time (even if the user
has an impression of parallelism and during the design of the
simulation model "thinks in parallel"). The result of this is the fact that
simulation could be much slower than the real time (1 second of the
model time takes 10 minutes of the CPU time). This of course
disables application of simulation in real time control.

CISM02 Decision Support for Management

Unit 10

16

Simulation: Rule of Thumb


A general rule of thumb could be like that:
"If the experiment is feasible, use it. It is always the best method
because all aspects could be taken into account. Even if other methods
were used during the design stage, experiment can serve as a final
evaluation of the system. If the experiment is not feasible try to find an
appropriate analytical method. If it is not available, use simulation."
Simulation is not only the last resort as it looks like in the above rule.
Simulation can contribute very much to understanding of the system
being analysed not only by supplying answers to the questions that
were originally given. Very often creation of the simulation model is the
first occasion where certain things are taken into account. Specification
of the simulated system can (and often it does) reveal errors or
ambiguities in the system design. So simulation can help very much by
avoiding future very expensive updating of the ready system.
CISM02 Decision Support for Management

Unit 10

17

Simulation Process:
a Descriptive Process
Simulation is the process of developing a model of a problem and
estimating measures of the problems performance by performing
sampling experiments on the model.
Simulation differs significantly form the modelling-solution framework
where we stress the formulation and development of analytical models
and the analytical solutions. In most cases the analytical solutions are in
the form of algorithms (e.g. that yielded optimal solutions).
Simulation emphasises neither of these factors it is a descriptive
modelling process as opposed to a normative process.

McKeown
CISM02 Decision Support for Management

Unit 10

18

Simulation Models
Reminder
Simulation models can be classified according to the time at which state
transitions occur. This way there is differentiation between continuous and
discrete simulation models.
In a continuous simulation, the state of the model changes continuously with
the times.
In a discrete simulation, the state transition occurs at intervals, i. e. at discrete
times.
Discrete simulation models are further differentiated into time-controlled,
event-driven, activity-oriented, process-oriented and transaction-oriented
simulation models.

CISM02 Decision Support for Management

Unit 10

19

Types of Simulation
There are three general types of simulation:
Analogue model
Continuous model
Discrete model

The analogue model replaces the original (physical) system by an


analogy which is easier to manipulate. A typical example is the
representation of a mechanical system by an equivalent electrical
system where the latter is simply to modify.
Unlike the analogue model, both continuous and discrete simulations
are basically mathematical models.

CISM02 Decision Support for Management

Unit 10

20

10

Continuous Models
Continuous models represent the system experiencing smooth
changes in characteristics over time.
The objective of the model is to plot the simultaneous (continuous)
variations of the different characteristics with time.
For example, in an inventory system the output might include time
changes of inventory levels, sales, unsatisfied demand, and
backorders.

CISM02 Decision Support for Management

Unit 10

21

Discrete Models
In discrete models a system is simulated by observing it only at
selected points in time.
These points coincide with the occurrence of certain events which
are crucial to effecting changes in systems performance.
The most common type of simulation is the discrete model.
A discrete event is something that occurs at an instant of time.
For example, pushing an lift button, starting of a motor, stopping of a
motor, and turning on a light, are all discrete events because there is
an instant of time at which each occurs.
CISM02 Decision Support for Management

Unit 10

22

11

Event-Type or Discrete Simulation or


Discrete Event Simulation (1)
Informally, a discrete-event simulation, or event-based simulation,
permits the system's state transitions to depend on asynchronous
discrete incidents that are called events.
The heart of a discrete model is the identification of the events which
completely describe the behaviour of the system.
Each event defines a point in time which signifies the termination of
one or more activities and/or the beginning of new ones.

CISM02 Decision Support for Management

Unit 10

23

Discrete Event Simulation (2)

Discrete Event Simulation (DES) concerns the modelling of a system


as it evolves over time by representing the changes as separate
events.

This is the opposite of Continuous Simulation where the system


evolves as a continuous function (differential).
A simulation based solely on differential equations in which time is
an independent variable is a time-based simulation because state
transitions depend on time.

CISM02 Decision Support for Management

Unit 10

24

12

Discrete Event Simulation (3)


Some examples illustrate these differences:
Suppose you are interested in how long the average airplane waits in a
queue for its turn to use an airport runway, but not interested in the
details of how an airplane moves once it is cleared for takeoff. You might
use discrete-event simulation in which the relevant events include the
approach of a new airplane to the runway and the clearance for takeoff
of an airplane in the queue.
Suppose you are interested in the trajectory of an airplane as it takes
off. You would probably use time-based simulation because finding the
trajectory involves solving differential equations.

CISM02 Decision Support for Management

Unit 10

25

Discrete Event Simulation (4)


Suppose you are interested in how long the airplanes wait in the queue
but you want to model the takeoff in some detail instead of using a
statistical distribution to model the length of time that each plane uses
the runway.
You might use a combination of time-based simulation and discreteevent simulation, where the time-based aspect controls details of a
plane's takeoff and the discrete-event aspect controls the queuing
behaviour.

CISM02 Decision Support for Management

Unit 10

26

13

Discrete Events: an Example


Activities such as moving a train from point A to point B are not discrete
events because they have a time duration.
However, we can model an event like this as two separate discrete
events: the event of the train leaving point A, and the event of the train
arriving at point B.
If we associate a time value with each discrete event, then we can model
the duration activities as the difference between the times associated
with the events marking the beginning and the end of each activity.
For example, we can specify that the arrival at point B occurs 3 hours
and 37 minutes after leaving point A. Therefore, we can see that if the
train leaves point A at 7:53 pm, then it will arrives at point B at 11:30 pm.

CISM02 Decision Support for Management

Unit 10

27

Discrete Event Simulation:


an Example (1)
The purpose of a discrete event simulation is to study a complex
system by computing the times that would be associated with real
events in a real-life situation.
In the train example above, suppose that we know that when the train
arrives at point B, a load is transferred to a second train that arrives at
point C after 45 minutes.
That is, the second train's departure from point B is triggered by the first
train's arrival, and the arrival at point C occurs with a delay of 45
minutes after the departure from point B.
In this simple example, we can use discrete event simulation to
determine that the second train will arrive at point C at 12:15 am.

CISM02 Decision Support for Management

Unit 10

28

14

Discrete Event Simulation:


an Example (2)
One way to carry out a simulation is to use the real-time clock (the
clock on the wall) to time the delays, and to read the value on the clock
as each event completes in order to see what would happen. However,
this would take unnecessarily long.
For example, it would be silly to wait 3 hours and 37 minutes to
determine the arrival time of the first train when a simple calculation
suffices.
So, the idea of a discrete event simulation is to compute, as quickly as
possible, the physical times that "would" occur in real time in a physical
system, but without actually waiting for the delays between events to
occur in real time.

CISM02 Decision Support for Management

Unit 10

29

Discrete Event Simulation:


Key Stages
Experiment
Initial Test
Build a Model

Modifications/Refinements

Data Collection
.
CISM02 Decision Support for Management

Unit 10

30

15

Discrete Event Simulation (1)


There are also three approaches to describing the discrete simulation:

Event

This approach describes an instantaneous change, usually from a stop event to a start
event. This is the most common one used, easy to understand and efficient and is
acceptable to implement.

Activities

Represents a duration. Essentially groups a number of events in order to describe an


activity carried out by an entity e.g. a machine loading. This approach is easy to
understand and to implement but is not efficient.

Process

This approach groups activities to describe the life cycle of an entity e.g. a machine.
This is less common and more difficult to plan and implement, but is generally
thought to be the most efficient.

CISM02 Decision Support for Management

Unit 10

31

Discrete Event Simulation

(2)

The event approach describes an event as an instantaneous change


and such events are usually paired, e.g. start of machine loading, end
of machine loading, etc. Activities describe a duration, e.g. machine
loading, and are therefore very similar to pairs of events. The process
approach joins collections of events or activities together to describe
the life cycle of an entity, in this case a machine.
The event approach is easy to understand and computationally
efficient but is more difficult to implement than the activity approach.
On the other hand whilst activity approach is relatively easy to
understand it suffers from poor execution efficiency.

CISM02 Decision Support for Management

Unit 10

32

16

Basics of Simulation (1)


In random sampling from a probability distribution, we usually require
three things:
1. A set of random numbers
2. A way of converting these numbers into another set of numbers,
random variates, which have the same distribution as the variable
involved.
3. A sampling-estimating procedure.

CISM02 Decision Support for Management

Unit 10

33

Random Numbers (1)


There is no problem in obtaining random numbers for simulations
performed by hand.
Lots of tables of such numbers are available. When a computer is to be
used in simulation, however, we can seldom afford to fill the computers
memory with a large number of random digits. Consequently, programs
have been developed for generating what are called pseudorandom
numbers. Two of the more commonly used generating procedures are
the midsquare and congruential techniques.

CISM02 Decision Support for Management

Unit 10

34

17

Random Numbers:
Midsquare Technique (2)
The midsquare procedure consists of taking a four-digit number (more
elaborative techniques may use up to ten digits), preferably (but not
necessarily) selected at random, squaring it, taking the four digits
starting at the third from the left, recording them, squaring them, and so
on.
For example, if we start with 3182, by squaring we obtain 10,125,124.
We then take the four digits, 1251, record them, square them, and so on.
Eventually this procedure will return to the number with which it started.
The length of the cycle generally falls between 10 4 and 10 6 .

CISM02 Decision Support for Management

Unit 10

35

Random Numbers:
Congruential Technique (3)
The congruential procedure, although more complicated, may yield
cycles as large as 1012 . This procedure consists of letting

X n 1 KX n (mod M )
This is, Xn+1 is equal to the number that remains after KXn is divided by M.
This method was first reported by Lehmer (1951), who used K=23, M= 10 1 .
8

He obtained a sequence of eight-digit numbers with a cycle length of 5,882,352.

CISM02 Decision Support for Management

Unit 10

36

18

Random Variates from


a Specified Probability Distribution (1)
The procedure for converting random numbers into numbers drawn
from a specified probability distribution is a relatively simple one in
principle, although it may be quite difficult in practice.
Suppose that we plot the relevant distribution in a cumulative form as in figure
below:
Cumulative probability
1.0 (1000)

F(x)
Random number

Random variate

X
CISM02 Decision Support for Management

Unit 10

37

Random Variates from


a Specified Probability Distribution (2)
We divide the vertical scale of probability into, say, one thousand parts.
When a random number is selected, it is located on this scale and
projected horizontally over to the function.
Then one projects down to the abscissa and reads the corresponding
random variate.
It can be seen that variates under the steepest part of the function
where the probability is most dense are most likely to be selected.

CISM02 Decision Support for Management

Unit 10

38

19

The Structure of Simulation (1)


In formulating a simulation model an important consideration is how the
simulation will be made to progress through time.
This is particularly important for computer simulation models as the
time flow mechanism must be build into the computer program.
There are two general types of time mechanism:
Fixed time increments the system is updated by uniform increments
of time.
Variable time increments the system is updated to the time when the
next event is due to take place.
Hull, et al., 1977
CISM02 Decision Support for Management

Unit 10

39

Deterministic Model Example


An example of a deterministic model is a calculation to determine the
return on a 5-year investment with an annual interest rate of 7%,
compounded monthly.
The model is just the equation below:
Ym

F=P(1+r/m)

The inputs are the initial investment (P = $1000), annual interest rate
(r = 7% = 0.07), the compounding period (m = 12 months), and the
number of years (Y = 5).

CISM02 Decision Support for Management

Unit 10

40

20

Deterministic Model Example


One of the purposes of a model such as this is to make predictions and
try "What If?" scenarios.
You can change the inputs and recalculate the model and you'll get a
new answer.
You might even want to plot a graph of the future value (F) vs. years
(Y). In some cases, you may have a fixed interest rate, but what do you
do if the interest rate is allowed to change?
For this simple equation, you might only care to know a worst/best case
scenario, where you calculate the future value based upon the lowest
and highest interest rates that you might expect.

CISM02 Decision Support for Management

Unit 10

41

A Hand Simulation:
Attendant Problem (1)
Let us consider an example which introduces the nature of simulation.
The filling station is managed by a single attendant who serves the
customers directly, each one taking between one and six minutes of his
time (the longer times corresponding to customers needing oil and a
battery and tyre check as well as petrol). The management problem to
be resolved is that of whether it would be worthwhile to employ a
second attendant to improve the service given to customers. For the
purposes of the example a change to self-service is not a feasible
alternative.
The aim of the simulation is, therefore, to test the effect that employing
the second attendant has on the queuing time of customers without
going to the trouble and expense of hiring one.
Kidd, 1985, pp.233
CISM02 Decision Support for Management

Unit 10

42

21

A Hand Simulation:
Attendant Problem (2)
There is a need for knowledge of the behaviour of a system in advance
of making changes to it and also the system is subject to random or
erratic events.
Customers do not arrive regularly and it takes different amounts of time
to serve them.

First we need to make a formal record of the current behaviour of the


system. (see Table below).

Kidd, 1985, pp.233


CISM02 Decision Support for Management

Unit 10

43

A Hand Simulation:
Attendant Problem (3)
Time

Events

08-01

Car
No

Service
Time

Time

No of arrivals

08-02

Car arrives; attendant serves it

08-03

Car arrives; waits for service

08-04

Car arrives; joins queue

08-05

Car leaves; attendant services next car in queue

08-08

08-09

08-10

10

10

11

08-12

12

08-13

13

08-06
08-07

08-11

Car leaves; attendant services next car

Car leaves; attendant returns to his office

08-14

2 Cars arrive; attendant services one of them

14

08-16

Car arrives; joins queue

15

16

Kidd, 1985, pp.233


CISM02 Decision Support for Management

Unit 10

44

22

A Hand Simulation:
Attendant Problem (4)
Server

Server

Server

0
Server

. 7

Server

Server

Server
Server

Server

Server

8
Server

Server

4
Server

11

One Attendance
CISM02 Decision Support for Management

Server

Server

Server

Server
Server

Server
Server

Server
Server

10

Server

Server
Server

Server

Server

10
Server

Server

Server

Server

Server

Server

Server
Server

11

Server

Two Attendances
Unit 10

45

A Hand Simulation:
Attendant Problem (5)
A much longer simulation run would be needed to show the extent of the
improvement.
A major shortcoming of the hand simulation is the way it handles random
events. The randomness of customer behaviour is governed by the
observation made on a particular day and at a particular time.
If what happened when these observations were made was not typical,
the simulation results will not relate to representative behaviour of the
filling station.

Kidd, 1985, pp.233


CISM02 Decision Support for Management

Unit 10

46

23

A Hand Simulation:
Attendant Problem (6)
In order to overcome this difficulty an improved mechanism for handling
random events is needed.
One way of approaching this problem is to increase the range of initial
observations, but this may be very time-consuming and may still provide
only a limited set of observations.
A better way is to use the original observations to establish a pattern in
the random events and then to sample from the pattern rather than from
a particular set of observations. In this way an almost limitless number of
typical days can be created.

Kidd, 1985, pp.233


CISM02 Decision Support for Management

Unit 10

47

Monte Carlo Simulation


A technique which has had a great impact in many different fields of
computational science is a technique called "Monte Carlo Simulation."
This technique derives its name from the casinos in Monte Carlo - a
Monte Carlo simulation uses random numbers to model some sort of a
process.
This technique works particularly well when the process is one where
the underlying probabilities are known but the results are more difficult
to determine.
A great deal of the CPU time on some of the fastest computers in the
world is spent performing Monte Carlo simulations because we can
write down some of the fundamental laws of physics but cannot
analytically solve them for problems of interest.
CISM02 Decision Support for Management

Unit 10

48

24

Monte Carlo Simulation


Monte Carlo simulation is a method for iteratively evaluating a
deterministic model using sets of random numbers as inputs.
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.

CISM02 Decision Support for Management

Unit 10

49

Simulation vs. Monte Carlo Simulation


Some authors use the terms Monte Carlo simulation and simulation (discrete
system simulation) synonymously.
However, there is a distinction between the two.
Both simulation and Monte Carlo simulation imply that the simulation model
is influenced by random events; however, the system being modelled is
deterministic in the case of Monte Carlo simulation, and stochastic
(presence of random phenomena) in the case of simulation.
In other words, Monte Carlo simulation is performed by using an approximate
stochastic model of a deterministic system whereas in simulation both the
real system and its model are stochastic in nature.

CISM02 Decision Support for Management

Unit 10

50

25

What are the characteristics of


Monte Carlo Simulation?
Three characteristics of Monte Carlo Simulation:
1. Random sample generation
2. The input distribution is known
3. Numerical Experiments

The direct output of Monte Carlo simulation method is generation of


Random sampling.
Other performance or statistical outputs are indirect method, which
depend on the applications.

CISM02 Decision Support for Management

Unit 10

51

What are the characteristics of


Monte Carlo Simulation?
The input of the simulation is distribution (based on some theoretical
distribution or from observation).
Numerical experiments characteristic of Monte Carlo simulation lead
us to run many samples before we can get the result.
Only single sample of the simulation will surely give false results. This
happens because Monte Carlo Simulation work based on Monte Carlo
Algorithm.

CISM02 Decision Support for Management

Unit 10

52

26

How the Monte Carlo Algorithm


works?
Monte Carlo Algorithm works based on the Law of Large Numbers.
It says that if you generate large number of samples, eventually you
will get the approximate desire distribution.
A computer simulation with a built-in random process, allowing you
to see the probabilities of different possible outcomes.

CISM02 Decision Support for Management

Unit 10

53

Monte Carlo:
Statistical Sampling Method
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.
Monte Carlo simulation can be defined as a method to generate random
sample data based on some known distribution for numerical
experiments.
Monte Carlo method is a sampling processs used to select sample
values randomly from a probability distribution.
CISM02 Decision Support for Management

Unit 10

54

27

The Estimation of Pi (1)


The area of the square is given by
Ssq=r2
The area of a circle is given by
Scr=r2Pi
the quadrant's area is
Sq=r2Pi/4
The ratio of the area of the quadrant
and the square therefore is
Ratio=Pi/4
Now suppose we pick at random a large number of points inside the square,
then the ratio of total points (inside the square) divided by the number of
points inside the quadrant, will give us an estimate of Pi/4.

CISM02 Decision Support for Management

Unit 10

55

The Estimation of Pi (2)


Suppose r = 1; d=x2

+ y2

Let us pick random coordinates

x,y in the range 0 1.

If d is less than or equal to 1, i.e. d<1


x,y is inside the quadrant.

or d=1, then the point given by

Our estimate of Pi is then 4 times the number of points in the quadrant


divided by the total number of random points.

CISM02 Decision Support for Management

Unit 10

56

28

The Estimation of Pi (3)


We can generate thousands of random (x,y) positions and
determine whether each of them are inside of the circle.
Each time it is inside of the circle, we will add one to a counter.
After generating a large number of points, the ratio of the number of
points inside the circle to the total number of points generated will
approach the ratio of the area of the circle to the area of the square.

CISM02 Decision Support for Management

Unit 10

57

The Estimation of Pi (4):


MatLab Program
The program below can be used to find an approximation of

pi

% pi.m
% Matlab Program to Find pi using Random Numbers
Nrand = input('How Many Random Numbers ');
NInside = 0;
for nloops=1:Nrand
Xrand = rand;
% Generate Random XY Point
Yrand = rand;
Rrand = Xrand^2 + Yrand^2;
% Find its distance from origin
if (Rrand <= 1)
NInside = NInside + 1;
end
end
% disp(['Total Generated: ' num2str(Nrand) ' Inside Pts: ' ...
num2str(NInside)]);
piapprox = 4*NInside/Nrand;
disp([' Approximation to pi = ' num2str(piapprox)]);
CISM02 Decision Support for Management

Unit 10

58

29

Simulation Steps
Reminder
In case a simulation model is developed, the following steps must usually be
taken:

analysis of the simulation requirements


generation and specification of the simulation concept
assessment of the simulation concept
generation of test scenarios
development of the simulation model
testing the simulation model
making available the scenario test data and performing the simulation runs
analysis and evaluation of the simulation results
testing the simulation model
possible upgrade or modification of the simulation model

CISM02 Decision Support for Management

Unit 10

59

Main Practical Steps of a Simulation Study

CISM02 Decision Support for Management

Unit 10

60

30

Anda mungkin juga menyukai