Sunteți pe pagina 1din 11

ASSIGNMENT

BY: NEEL SHETH


REG NO: 13BCE0432
TO : Prof. Vijaykumar Manupati
Course: Operations Research
Course code: MEE0437

Monte Carlo Simulation

The Monte Carlo method of simulation was developed by the two mathematicians
John Von Neumann and Stanislaw Ulam, during World War II to study how far
neutrons would travel through different materials, The technique provided an
approximate but quite workable solution to the problem.
Monte Carlo relies heavily on two famous theorems from probability theory, namely
the law of large numbers (LLN) and the central limit theorem (CLS).
The technique employs random numbers and is used to solve problems that involve
probability and wherein physical experimentation is impracticable and formulation
of mathematical model is impossible. It is a method of simulation by sampling
technique. The steps involved in carrying out Monte Carlo simulation are:
1. Select the measure of effectiveness (objective function) of the problem. It
is either to be maximized or minimized. For example, it may be idle time
of service facility in a queuing problem or number of shortages or the total
inventory cost in an inventory control prob.
2. Identify the variables that affect the measure of effectiveness significantly.
3. Determine the cumulative probability distribution of each variable
selected in step 2.Plot these distributions with values of the variables
along x-axis and cumulative probability along the y-axis.
4. Get a set of random numbers.
5. Consider each random number as a decimal value of the cumulative
probability distribution. Enter the cumulative distribution plot along the yaxis. Project this point horizontally till it meets the distribution curve. Then
project the point of intersection down on the x-axis.
6. Record the values generated in Step 5.Substitute the formula chosen for
measure of effectiveness and find its simulated value.
7. Repeat Step5. And Step 6. Until sample is large enough to the satisfaction
of the decision maker.
This is one of the main application areas of simulation modeling is Industrial
Engineering and Operations Research. Typical applications involve the simulation of
inventory processes, job scheduling, vehicle routing, queuing networks, and
reliability systems. An important part of Operations Research is Mathematical
Programming (mathematical optimization), and here Monte Carlo techniques have
proven very useful for providing optimal design, scheduling, and control of industrial
systems, as well offering new approaches to solve classical optimization problems
such as the traveling salesman problem, the quadratic assignment problem, and the
satisfiability problem. The MCM is also used increasingly in the design and control of
autonomous machines and robots .
Stocastic Situation with Monte Carlo Simulation:

Q> Determining value of Pi experimentally by simulation.


Ans:
In simple Monte Carlo simulation to approximate the value of
points
that satisfy
satisfying

in the unit square and determining the ratio


. In a typical simulation of sample size

we

randomly select

, where is number of points


there were
points

Using this data we obtain,

and

Every time a Monte Carlo simulation is made using the same sample size
slightly different value. The values converge very slowly of the order
consequence of the Central Limit Theorem.

it will come up with a


. This property is a

Q> Area Under a Curve using Monte Carlo Simulation (Determined).


Ans:
Monte Carlo simulation can be used to approximate the area
.First,

we

must

determine

the

under a curve

rectangular

box

where

is

number

An

of points
, and
"estimate"

re

that
we
for

containing

as

follows.

Second, randomly pick points in , whe


uniformly distributed random variables over
as follows:
, where
approximation,

for

lie

the

are chosen from independent


, respectively. Third, calculate the ratio
.

in .The
can
accuracy

area is
use
of

the

computed
the
above

using the
formula

computation

.
Q> Let W be a real valued random variable with cumulative distribution function (cdf)

is

F(w) := P(W w) and let G(x, w) := |x w|, where x, w IR.


Ans:
For any w IR, the function G(, w) is convex, and hence the corresponding expected value
function g(x) := IE{|x W|} = Z + |x w|dF(w) (2.1) is also convex.
A minimizer x of g(x), over IR, is given by the median x = F 1(1/2) of the distribution of W,
i.e. x is such that F(x ) 1/2 and F(x) 1/2, where F(x ) denotes the left side limit of F(x) at x
= x.
If F(w) is continuous, then x is a median iff F(x)=1/2, while if the event {W = x} can
happen with positive probability, then F(x) can be bigger than half.
Note also that it can happen that the minimizer x is not unique. If we replace W by its mean ,
then clearly the minimizer of the function G(x, ) = |x |, over x IR, is given by .
In general, the mean can be different from the 3 median F 1(1/2). Note that in this example a
minimizer xN of the corresponding sample average function gN (x), over IR, is given by sample median
F1 N (1/2), where F N denotes the empirical cdf based on the considered sample.

Q> Stochastic process It, t = 1, 2, ..., governed by the recursive equation


It = [It1 + R(xt, Vt) Dt] +, (2.5) with initial value I0.
Ans:
Here Vt are random vectors, Dt are random numbers, R(, ) is a real valued
function of two vector variables, and vectors xt represent decision variables.
The above process It can describe the waiting time of t-th customer in a G/G/1
queue, where Dt is the interarrival time between the (t 1)-th and t-th customers
and R(xt, Vt) is the service time of (t 1)-th customer.
Alternatively, we may view It as an inventory of a certain product at time t, with Dt
and R(xt, Vt) representing the demand and production (or reodering) of the product
at time t. Suppose that the process is considered over a finite horizon at periods t =
1, ..., T.
Our goal then is to minimize (or maximize) the expected value of an objective
function involving I1, ..., IT . For instance, one may be interested in maximizing the
expected value of a profit given by (cf. Albritton, Shapiro and Spearman [1])
G(x, W) := X T t=1 {t min[It1 + R(xt, Vt), Dt] htIt} . (2.6)
Here x := (x1, ..., xT ) is a vector of decision variables, W := (V1, ..., VT , D1, ..., DT )
is a random vector of the involved random variables, and t and ht are non negative
parameters representing the marginal profit and the holding cost, respectively, of
the product at period t.

Note that the profit function G(x, W) can be also written in the form
G(x, W) = PT t=1 {t(Dt + min[It1 + R(xt, Vt) Dt, 0]) htIt} = PT t=1
{t[Dt + (It1 + R(xt, Vt) Dt) It] htIt} = PT t=1 tR(xt, Vt) + PT 1 t=1 (t+1
t ht)It + 1I0 (T + hT )IT . (2.7)
It is also possible to consider a stationary distribution of the process It (if it exists)
and to optimize an associated objective function. Typically, probability measure of
such 5 stationary distribution cannot be written in a closed form. This introduces
additional technical difficulties into the problem. In this paper we mainly deal with
problems over a finite horizon where involved probability distributions are governed
by finite dimensional random vectors. If the initial value I0 is sufficiently large, then
with probability close to one variables I1, ..., IT stay above the zero. If, moreover,
R(xt, Vt) are linear in Vt, then I1, ..., IT become linear functions of the random data
vector W. In that case components of the random vector W can be replaced by their
means.
In many practical situations, however, the process It hits the zero with high
probability over the considered horizon T. In such cases the corresponding expected
value function g(x) := IE G(x, W) cannot be written in a closed form and one needs
to use say a Monte Carlo simulation procedure in order to evaluate g(x).

Queuing Systems

IN CERTAIN STOCHASTIC service systems, it is sometimes necessary to provide


simultaneous service to more than one customer in order to perform the requested
task. Also different customers have different demands and time of arrival. So with
random demands and random arrival time it is not possible to serve all customers
simultaneously. This leads to formation of Queue Systems where a systematic order
of service is maintained based on parameters like arrival time, service time and
queue discipline. This constraints help in providing an efficient solution while
avoiding disorder to the randomness in a system making queuing process an
integral and necessary part of solutions.
The aim of all investigations in queueing theory is to get the main performance
measures of the system which are the probabilistic properties ( distribution function,
density function, mean, variance ) of the following random variables: number of
customers in the system, number of waiting customers, utilization of the server/s,
response time of a customer, waiting time of a customer, idle time of the server,
busy time of a server. Of course, the answers heavily depends on the assumptions
concerning the distribution of interarrival times, service times, number of servers,
capacity and service discipline. It is quite rare, except for elementary or Markovian
systems, that the distributions can be computed. Usually their mean or transforms
can be calculated.

To characterize a queueing system we have to identify the probabilistic properties of


the incoming flow of requests, service times and service disciplines.
The arrival process can be characterized by the distribution of the interarrival times
of the customers, denoted by A(t), that is
A(t) = P( interarrival time < t).
In queueing theory these interarrival times are usually assumed to be
independent and identically distributed random variables.
The other random variable is the service time, sometimes it is called service
request, work. Its distribution function is denoted by B(x), that is
B(x) = P( service time < x).
The service times, and interarrival times are commonly supposed to be independent
random variables. The structure of queue and queue discipline tell us the number of
servers, the capacity of the system, that is the maximum number of customers
staying in the system including the ones being under service. The queue discipline
determines the rule according to the next customer is selected.

The most commonly used laws are


FIFO - First In First Out: who comes earlier leaves earlier
LIFO - Last Come First Out: who comes later leaves earlier
RS - Random Service: the customer is selected randomly
Priority.

Queue Discipline:

FIFO - First In First Out: who comes earlier leaves earlier

In FIFO the first customer to arrive is offered the service first. Used in majority of
daily operations has a wide area of application. The process to implement is also
relatively simple. The system maintains an record of customers arrival time and
based on the arrival the service is provided. Application of FIFO strategy ranges
from Pizza Delivery, Any Ticket Booking, Order Booking to CPU scheduling, vehicle
scheduling, Assembly line scheduling.

LIFO - Last Come First Out: who comes later leaves earlier

In LIFO the last customer to arrive is offered the service first. It has a wide range of
applications. The process to implement involves keeping a record of arrival time and
servicing the last one to arrive. It can be easily understood as a stack of dishes,
where the last to be placed is at top and is the first one to be picked. In CS LIFO
strategy has numerous application from data management to interrupt handling. In
non CS fields LIFO has applications in accounting, supply management and logistics
field.

RS - Random Service: the customer is selected randomly

In RS any customer from a pool is offered the service at random. In such cases the
process usually maintains only the record of the customer that it is there or not. It
has application in cases like selecting lottery nos. where lot of people register and
one is selected using a random no. generator. Also in fields like job transfer in
military and other institutiions one can select a personel from a list at random to
avoid any partiality or favorism. This particular method is used when the service to
be offered is limited and all ar to be given an equal chance.

Priority

In Priority each customer is assigned a priority no and based on this value the
customers are serviced. The application of this process is solely based on priority
nos and different systems generate priority nos. based on different parameters. It

has application in various fields like emergency healthcare, goods and logistics
supply, sales and PR management etc.

Arrival Process:
In many practical situations we are interested in measuring how many times a
certain event occurs in a specific time interval or in a specific length or area or
when a process arrives and when it is to be serviced. For instance:
1 the number of phone calls received at an exchange or call centre in an
hour;
2 the number of customers arriving at a toll booth per day;
3 the number of flaws on a length of cable;
4 the number of cars passing using a stretch of road during a day
Poisson distribution process plays a key role in modelling such problems.

Poisson Arrival Process


A commonly used model for random, mutually independent message arrivals is the Poisson process. The
Poisson distribution can be obtained by evaluating the following assumptions for arrivals during an
infinitesimal short period of time delta t

The probability that one arrival occurs between t and t+delta t is t + o( t), where is a constant,
independent of the time t, and independent of arrivals in earlier intervals. is called the arrival
rate.

The number of arrivals in non-overlapping intervals are statistically independent.

The probability of two or more arrivals happening during t is negligible compared to the
probability of zero or one arrival, i.e., it is of the order o( t).

Combining the first and third assumption, the probability of no arrivals during the interval t, t+ delta t is
found to be 1- t + o( t).
Arrival Rate
The arrival rate

is expressed in the average number of arrivals during a unit of time.

Some Interesting Properties

The probability Pn of n packet arrivals in a time interval T becomes

Pn

( T)^n
= ----- exp{- T}
n!

The distribution of the number of arrivals in a time interval of t,t+T is


independent of starting time t.

The probability of n other arrivals, in addition to a given "test" arrival that is


known to be present is exactly the same as the probability of n arrivals
without any a priori assumptions. The test arrival has no influence on other
arrivals. This property is used, for instance, in the calculation of the
throughput of random-access schemes, such as slotted ALOHA, in radio
networks with capture.

The probability of no arrivals during period of duration T is

f(T)

= exp{-

T}

where f ( ) is the probability density function of the duration between two


arrivals. Thus, interarrival times have a negative exponential distribution with
mean 1/ .

Q> Show that given one arrival has occurred in the interval [0, t], then the
customer arrival time is uniformly distributed in [0, t]. Precisely, let X
denote the arrival time of the single customer, then for 0 < x < t, P[X x]
= x/t.
Solution
P[X x] = P[N ( x) = 1|N ( t) = 1]
= P[N ( x) = 1 and N ( t) = 1]/ P[N ( t) = 1]
= P[N ( x) = 1 and N ( t ) N ( x) = 0] /P[N ( t) = 1]
= P[N ( x) = 1] P[N ( t ) N ( x) = 0]/ P[N ( t) = 1]
= xe x e ( t x )/ te t
=xt.
Q> Customers arrive at a soft drink dispensing machine according to a
Poisson process with rate . Suppose that each time a customer deposits
money, the machine dispenses a soft drink with probability p. Find the pmf
for the number of soft drinks dispensed in time t. Assume that the
machine holds an infinite number of soft drinks.

Solution
Let N ( t) be the number of soft drinks dispensed up to time t, and X ( t) be the
number of customer arrivals up to time t.

Service Process:

In most queuing situations, the arrival of customers occurs in a totally random fashion.
Randomness here means that the occurrence of an event (e.g., arrival of a customer or
completion of a service) is not influenced by the length of time that has elapsed since
the occurrence of the last event.
Random interarrival and service times are described quantitatively in queuing
models by the exponential distribution, which is defined as
f(t) = Ae-Ac , t > 0

The definition of E {t} shows that A is the rate per unit time at which events (arrivals or
departures) are generated. The fact that the exponential distribution is completely random
is illustrated by the following example: If the time now is 8:20 A.M. and the last arrival
has occurred at 8:02 A.M., the probability that the next arrival will occur by 8:29 is
a function of the interval from 8:20 to 8:29 only, and is totally independent of the length
of time that has elapsed since the occurrence of the last event (8:02 to 8:20). This result
is referred to as the forgetfulness or lack of memory of the exponential.
Let the exponential distribution, fit), represent the time, t, between successive

events. If S is the interval since the occurrence of the last event, then the forgetfulness
property implies that
P{t > T + Sit> S} = P{t > T}

Q>
A service machine always has a standby unit for immediate replacement upon failure. The time
to failure of the machine (or its standby unit) is exponential and occurs every 5 hours, on the average.
The machine operator claims that the machine "has the habit" of breaking down every
night around 8:30 P.M. Analyze the operator's claim.
Ans: The average failure rate of the machine is = 1 / 5 failure per hour. Thus, the exponential
distribution of the time to failure is
Regarding the operator's claim, we know offhand that it cannot be correct because it conflicts
with the fact that the time between breakdowns is exponential and, hence, totally random.
The probability that a failure will occur by 8:30 P.M. cannot be used to support or refute the operator's
claim, because the value of such probability depends on the time of the day (relative to
8:30 P.M.) at which it is computed. For example, if the time now is 8:20 P.M., the probability that
the operator's claim will be right tonight is

which is low. If the time now is 1:00 P.M., the probability that a failure will occur by 8:30 P.M. increases
to approximately .777 (verify!). These two extreme values show that the operator's claim cannot
be supported.

S-ar putea să vă placă și