Вы находитесь на странице: 1из 4

Monte-Carlo Simulations:

This technique tries to model and study the behaviour of systems by including the randomness
of the processes involved in the system. It is one of the most powerful techniques used in the
simulation and modeling of stochastic systems. Here, we do not make any assumptions about
the models, instead we describe the behaviour as complete as we can and follow the items
contributing to the process.

Monte Carlo simulation is a type of simulation that relies on repeated random sampling and
statistical analysis to compute the results. This method of simulation is very closely related to
random experiments, experiments for which the specific result is not known in advance. In this
context, Monte Carlo simulation can be considered as a methodical way of doing so-called what-
if analysis. We will emphasis this view throughout this tutorial, as this is one of the easiest ways
to grasp the basics of Monte Carlo simulation.

We use mathematical models in natural sciences, social sciences, and engineering disciplines to
describe the interactions in a system using mathematical expressions. These models typically
depend on a number of input parameters, which when processed through the mathematical
formulas in the model, results in one or more outputs. A schematic diagram of the process is
shown below

This model fits quite nicely in discrete or semi-discrete systems where all or some of the
variables are stochastic.

The input parameters for the models depend on various external factors. Because of these
factors, realistic models are subject to risk from the systematic variation of the input parameters.
A deterministic model, which does not consider these variations, is often termed as a base case,
since the values of these input parameters are their most likely values. An effective model should
take into consideration the risks associated with various input parameters. In most
circumstances, experimenters develop several versions of a model, which can include the base
case, the best possible scenario, and the worst possible scenario for the values of the input
variables.
In Monte Carlo simulation, we identify a statistical distribution which we can use as the source
for each of the input parameters. Then, we draw random samples from each distribution, which
then represent the values of the input variables. For each set of input parameters, we get a set
of output parameters. The value of each output parameter is one particular outcome scenario in
the simulation run. We collect such output values from a number of simulation runs. Finally, we
perform statistical analysis on the values of the output parameters, to make decisions about the
course of action (whatever it may be). We can use the sampling statistics of the output
parameters to characterize the output variation.

Simulating a simple queue:


There are two random processes characterized by two distribution functions:

Arrival process, time between events has the distribution fa(t).

Service process, service time has the a distribution fs(t).

TimeNow = 0

QSize = 0

ServerBusy = False

Read SimulationTime

NextArrivalTime = Random_fa ()

NextDepartureTime = SimulationTime+1

/* Loop until simulation time is exhausted */

While (TimeNow < SimulationTime) do

TimeNow = TimeNow + dt /*Advance the time */

/* Is it time for a new arrival? */

If (TimeNow ≥ NextArrivalTime)

/* Push in the Q and generate a time for next arrival */

QSize = QSize+1

NextArrivalTime = TimeNow + Random_fa ()

EndIf
/* Is it time for job completion? */

If (ServerBusy == True) AND (NextDepartureTime ≥ TimeNow) then

/* Remove from the Q and release the server */

QSize = QSize - 1

ServerBusy = False

Endif

/* Check whether the server is idle and there is a job to be served */

If (ServerBusy == False) AND (QSize > 0) then

/* Server is now busy. Select a time for job completion */

ServerBusy = True

NextDepartureTime = TimeNow + Random_fs ()

Endif

CollectQStatistics

Endwhile

ComputeDelaysAndStats

  p 
 A C
  p 2

  p 3 D

Suppose you want to simulate the above system. This will involve the processing patterns at each
centre together with the arrival and departure processes. Let us look into the departure process
at A. Leaving A, the job could be placed at B, C or D with probabilities p1, p2 & p3 respectively.
To decide which centre may be chosen we generate a random number (x) between 0..1, then use
the following simple algorithm

If (0 <= x <= p1) then place job in B

If (p1 < x <= p1+p2) then place job in C


If ( (p1+p2) <x<= 1) then place job in D

Note that p1+p2+p3 = 1.

Above models could be extended to simulate all the dynamics of such systems in order to predict
the performance when unusual patterns are employed. The technique could also be deployed in
order to understand the dynamics of systems where the user can vary the parameters in an
effort to get the simulation results to closely match the known behaviour of the system.

Monte Carlo techniques are extensively used in a wide range of engineering applications. In
electronics, these techniques are used to study and predict the characteristics of semic
conductor devices. These methods trace a large number of particles (electrons and holes) for a
long time and use averaging methods to compute performance measures for the devices.

Note that the results you would obtain using any simulation technique, Monte-Carlo included,
will be as good as the model you started with. In other words, bad models will produce bad
results.

Monte-Carlo methods are also extensively used by the financial sector in order to understand
the impact of risk and uncertainty in financial, project management, cost, and other forecasting
models.

Вам также может понравиться