12 Simulation
12 Simulation
S I M U L AT I O N
12.1 INTRODUCTION
It is also a modeling approach to problem solving. A solution may be obtained from a model (either by
conducting experiments on it or by mathematical analysis). Inspite of phenomenal achievements in methods, all
practical problems are so complex that it is difficult to get results. Model presents reality and it is a way of
manipulating a model so that it yields a motion picture (dynamic) of reality. Simulation in general is regarded as
a method of last resort i.e. one has to use this technique when all else fail. Before, we discuss the simulation
technique, let us review the alternative tools used in decision making. Simulation models can be categorized as
following two types:
Iconic simulation models
Analogue simulation models
Apart from classifying simulation as Iconic and Analogue, simulation models can be classified as Deterministic
and Probabilistic. A simulation model can be deterministic if the values of the factors employed in the equation
are exactly known. However, simulation is essentially probabilistic if the values of the factors employed in the
equation are not known, but are estimated.
Simulation is the process of building, testing and operating models of real-world phenomena through the use of
mathematical relationship that exist among critical factors. This technique is useful for solving complex
problems that cannot be readily solved by other techniques. Simulation can be conducted by manipulation of
physical models. For example, one might have a physical model of a machine and actually keep on increasing its
speed to determine at what point it would begin to jam, fly apart or walk across the floor. With no loss, one may,
instead, use a mathematical model in which each of the terms represent one of the variables, and observe the
effect on the others when different values are given to one or more of the terms. With the help of computer, it is
possible to examine what will happen in an enormous number of cases-without spending a prohibitive amount
of time. Because large electronic computers have become easily accessible in recent years, management can
simulate complex situations in order to determine the best course of action.
Simulation
The main objective of simulation is to initiate a real world situation mathematically then to study its properties
and operating characteristics and finally to draw conclusion and make action decision based on the results of the
simulation. The appropriate result could only be obtained if the model truly represents the real system. Some of
the major objectives of simulation are as follows:
To obtain the solution of a complex problem that is too complex to solve by other operations research
techniques.
To carry out the analysis in short time as well as on lower cost manually or by use of computers.
To explore a hypothetical system and/or to design the improved system.
The steps used in developing a simulation model may vary according to the situations. However, following are
some basic steps commonly used for building a simulation model:
d) Validation of result:
Determining whether a simulation model is an accurate representation of a real world system is called
validation. Some degree of validation must take place throughout the simulation study. However,
validation during the modeling of the system and when simulation results become available is particularly
important. Determining whether the parameters, the random variables and their respective probability
distribution and the data collected on the system is essential for maintaining model validity. The
assumptions of the model should also be tested empirically. For example, if a theoretical probability
distribution is fit for random variable, such as repair time, then statistical tests can be used to determine the
adequacy of the fit, under some assumptions, the results for system performance can be derived analytically
or manual computation.
175
A Text Book of Operational Research and Food Plant Management
Monte Carlo Simulation uses random numbers and is used to solve problems, which involve conditions of
uncertainty and where mathematical formulation is impossible. Monte Carlo Simulation is a substitute for the
mathematical evaluation of a model. This technique of simulation uses experimentation with the help of
probability theory. Random samples taken from the probability distribution are analogous to observation made
on the system itself. The result of simulation can be made more close to real situation by increasing the number
of observations. However, without selection of appropriate model, increasing number of observation does not
guarantee the representation of real system. Monte Carlo Simulation technique consists of following steps:
The random number used in Monte Carlo Simulation can be obtained from statistical random number tables or
computer generated random number tables. Random numbers are list of number of specific digits (e.g. 2,4) that
are uniformly distributed and there is no similar pattern in the sequence of number presented in tables. While
selecting a random numbers, the starting point may be chosen randomly i.e. any number in any row or column
and proceed in the same column or row to next number, but a consistent and unvaried pattern should be
followed in drawing random numbers. If random numbers are to be selected for more than one concerned
variables, then different random numbers for each variable should be used since same random numbers could
imply dependence among different variables. The use of computer is necessary to draw valid conclusion from a
large number of simulations. For random number, refer appendix 1)
Operational Gaming
It refers to simulation involving two or more competing players. The best examples are military games and
business games. Both allow participants to match their management and decision-making skill in hypothetical
situation of conflict.
System Simulation method involves the reproduction of the operating environment and the system allows for
analyzing the response from the environment to alternative management actions. This method is quite
complicated and tends to be costly.
Simulations are regarded as the operation research techniques used when other techniques are not useful to
solve specific managerial techniques. Thus it is sometime viewed as “Last weapon of operational research.”
The few merits and demerits of operational research are highlighted below:
Merits
Simulation can be used to solve complex managerial problem, where other techniques cannot be used
or does not give the desired output. This is because, some managerial problem cannot be exactly be
viewed or observed. For example “What will be the scenario when nuclear reactor is blasted?” In this
condition the future happening can be simulated and a forecast can be made.
176
Simulation
Since simulations are simply a copy of real world system, it does not interfere with the real world
system. Considering the nuclear reactor, to simulate it need not to be blasted, but the dummy work can
be done. Thus it minimizes the possible risk inherent in experimenting with actual system.
Simulations use the probability distribution and random numbers, which represent more close to real
world system compared to others like exponential and Poisson distribution in Queuing models, normal
distribution in Inventory and Network techniques etc.
Development of computers and simulation software has made simulation work easier. Thus it saves
time in managerial decision and can carry out large simulation problem in short time and higher
accuracy.
Demerits
Simulation as we have discussed is a simulated condition of real world system, which might differ from
exact real situation. Thus the solution from simulation is not always a optimum solution. It is regarded
as an appropriate behavior of a given set of inputs. The accuracy of simulation result depends on
closeness of model to the real situation.
The development of model is not easier task. As we know, inaccurate model do not give the accurate
result. Thus the major limitation of simulation is its complication, longer process and thus expensive for
construction of model.
Each simulation model is unique. The solution obtained from one situation cannot be related or
associated with other situation. Simply simulation related to queuing problem differs from inventory
problem, and the later differ from other decision-making problems.
Considering Monte Carlo Simulation, its use is limited to condition when variables can be related to the
random numbers.
Simulation does not generate optimal solutions to problems, as do other management science
techniques such as EOQ, LPP, and Network (CPM/PERT). It is a trial and error approach that may
produce different solutions in repeated runs of experiment. Thus it is not a precise approach and the
solutions are subjected to errors.
In practical use, cases that include numerous variables, the simulation technique needs computers, thus
in case where computers are not available larger or real situation (practical) problems cannot be
simulated.
In an inventory model, that require decision regarding stock to keep is based on the past data i.e. past demand
pattern. The simulation of inventory problems gives ideas about stock situation if any fixed amount of stock is
kept. The following two solved examples provide detailed information how to solve simulation of inventory
related problems.
Solved example 1
A company has the following past information about sell of its product. Considering the sequence of random
number as 92, 38, 70, 96, 92, 82, 63, 18, 27 and 44 simulate the demand for the next 10 days. Also determine the
stock situation if the manager decides to make 20 products every day. Also estimate the daily average demand
for product on the basis of simulated data.
Demand (Daily) 0 5 10 15 20 25
No. of days 10 20 15 40 12 3
Solution:
According to given demand pattern, probability, cumulative probability and Block numbers and digits are
allocated in table12.1.
Table12.1: Allocation of block numbers
Demand No. of days Probability Cumulative Block number of digit
probability allocated
0 1 0.01 0.01 00
5 20 0.2 0.21 01 to 20
10 15 0.15 0.36 21 to 35
15 40 0.4 0.76 36 to 75
20 15 0.15 0.91 76 to 90
25 19 0.09 1 91 to 99
177
A Text Book of Operational Research and Food Plant Management
The simulated demand for next 10 days is given in table 12.2. Also given the stock level if the stock is kept 20
every day.
Table 12.2: Determination of demand and stock level
Day Random Simulated Stock kept Stock Cumulative stock
number demand remained remained
1 92 25 20 -- 0
2 38 15 20 5 5
3 70 15 20 5 10
4 96 25 20 - 10
5 92 25 20 - 10
6 82 20 20 - 10
7 63 15 20 5 15
8 18 5 20 15 30
9 27 10 20 10 40
10 44 15 20 5 45
170 45
Result
From Table 12.2, the manager can predict the stock to keep for next 10 days. If the manager wants to find
simulated expected demand, it is 170/10=17 products per day. Similarly, if the manager kept 29 stocks each day,
45 products will remain unsold in end of 10 days. (Note The simulated demand 17 can be compared with non-
simulated expected demand. The non-simulated expected demand can be obtained by multiplying demand with
probability and adding all these values as: (0x0.01+5x0.2+10x0.15+15x0.4+25x0.15+25x0.09=14.5 )
Solved example 2
A store manager found the following demand pattern for product X for past 80 days.
Solution:
Table12.3: Determination of probability and allocation of block numbered digit
Demand No. of days Probability Cumulative Block number of digit
probability allocated
0 35 35/80=0.44 0.44 00 to 43
1 25 25/80=0.31 0.75 44 to 74
2 15 15/80=0.19 0.94 75 to 93
3 5 5/80=0.06 1.00 84 to 99
80
Now, random variables are assigned to the block number of digit allocated as shown in table 12.3.Also the
beginning and ending inventory are shown in table 12.4.
Table12.4 : Allocation of random number and determination of beginning and ending inventory
Day Random Demand (a) Beginning Reorder Ending inventory (d+b+c-a)
number inventory (b) (c)
1 82 2 7 - 5
2 43 0 5 - 5
3 80 2 5 2 5
4 46 1 5 - 4
5 15 0 4 2 6
6 32 0 6 - 6
7 72 1 6 - 5
8 57 1 5 2 6
178
Simulation
Hence from above table 7, it is found that the store manager will have 5, 5, 5, 4, 6, 6, 5 and 6 number of product X
on respective 1 to 8 days.
In solving the Queuing problems we have assumed that the service rate follows the negative exponential
probability distribution and arrivals follow Poisson probability distributions. However, if the arrivals/ service
time distributions are not standard i.e. any of the assumptions is not valid then the available mathematical
analysis cannot give proper results. Under such circumstances, Monte Carlo Simulation is there to help the
investigators. In this method as discussed in 5 and 7, random numbers are generated depending on the arrival
and service time distribution. Though, the results so obtained, are approximate, but are workable. In general,
larger the sample size more will be the accuracy of results. This is the main reason, that the simulation is
generally performed on a computer by having bigger sample size.
Solved example 3
A warehouse has one dock, which is used to unload railroad freight cars. Incoming freight cars are delivered to
the warehouse during the night. It takes exactly half a day to unload a car. If more than two cars are waiting to
be unloaded on a given day, some are postponed until the following day. Past experience had indicated that the
number of cars arriving during the night has the frequencies shown as follows:
Solution:
It is a one channel queuing problem with a service rate of 2 per day and arrival rate of 1.5 per day and arrivals
are not Poisson and service is fixed. Hence conventional queuing model cannot be applied, so simulation can be
used to analyze this situation.
Assigning random digits (Block number) to the arrivals is given in table 12.5.
179
A Text Book of Operational Research and Food Plant Management
2 96 4 4 2 2
3 55 2 4 2 2
4 50 1 3 2 1
5 29 1 2 2 0
6 58 2 2 2 0
7 51 1 1 1 0
8 04 0 0 0 0
9 86 3 3 2 1
10 24 1 2 2 0
11 39 1 1 1 0
12 47 1 1 1 0
13 60 2 2 2 0
14 65 2 2 2 0
15 44 1 1 1 0
Total 30
Average 30/15= 2
Table 12.5 simulates 15 days operation (in addition to the three to get started). During most of the period there is
little delay. However, for more accurate results, the simulation could be carried out on for more days. From the
simulation the average number of arrivals is found to be 2 per day.
Solved example 4
Mr. X is a famous hair stylist. Customers have to take appointments previously by phone. The receptionist of Mr.
X allocate time to each customer, who want service from Mr. X. Mr. X schedules all his appointment averaging
on 40 minutes service time. However, some categories of service take more or less than 40 minutes depending on
the types of hair styling. The following summary shows the various categories of hair styling, their probabilities
and time actually needed to complete the works.
Simulate the saloon and determine average waiting time for customers as well as idleness of Mr. X. assume that
the customers arrive at exact time given by receptionist starting at 9 A.M. Use the following random numbers:
68, 95, 23, 92, 35, 61.
Solution:
The cumulative probability distribution and random number allocation is shown in table 12.7.
The various parameter of queuing system such as arrival pattern of customers, service time, waiting time in the
context of the given problem is shown in table 12.8and 12.9.
180
Simulation
2 9:40 95 Bhuvan 60
3 10:20 23 Jitendra 50
4 11:00 92 Bhuvan 60
5 11:40 35 Amitab 40
6 12:20 61 Rajesh 35
Table 12.9: Computation of arrivals, departure, waiting of customers and Mr. X idle time
Time Customer number Customer number and Mr. X idle time Customer number
arrival and exit time remained to exit waiting for service
9:00 1 arrives 1 (35) - -
9:35 1 exit - 5 min. -
9:40 2 arrives 2 (60) - -
10:20 3 arrives 2 (20) - 3
10:40 2 exit 3 (50) - -
11:00 4 arrives 3 (30) - 4
11:30 3 exit 4 (60) - -
11:40 5 arrives 4 (50) - 5
12:20 6 arrives 4 (10) - 5, 6
12:30 4 exit 5 (40) - 6
1:10 5 exit 6 (35) - -
1:45 6 exit and end - - -
Hence from the table it was found that Mr. X was idle for 5 min. during the simulated time.
Average waiting time is computed in table 12.10.
Thus from the above simulation, it is found that Mr. X remains idle for 5 minutes in simulated time interval 9:00
A.M. to 1:45 P.M. On this time interval 6 customers are served and average waiting time of customer is 25
minutes.
12.7 EXERCISE
1 Dr. X is a dentist, who schedules all his patient for 30 minutes appointments. Some of the patients take
more or less than 30 minutes depending on the types of dental work to be done. The following
summary shows the various categories of work, their probabilities and time actually needed to
complete the works.
Simulate the dentist clinic for 4 hours determining the average waiting time for the patients as well as
the idle time of the doctor. Assume that all the patients show up at the clinic at exactly their scheduled
arrival time starting at 8:00 A.M. Use the following random number for handling above problems: 40,
81, 11, 34, 25, 66, 17, 79.
Ans: Idle time of doctor =0
Average waiting time of patient=35.6min.
181
A Text Book of Operational Research and Food Plant Management
2 A fruit seller keeps stocks of apples. Past experience shows the daily demand (in dozen) as given below:
Daily demand: 0 10 15 20 25 30
No. of days: 10 30 25 20 10 5
Consider the following sequence of random numbers: 18, 25, 73, 12, 54, and 96.
Simulate the demand for next 7 days. Find out the stock situation of the fruit seller if he decides to stock
18 dozen apples every day. Also estimate the daily average demand of apples (dozen) on the basis of
simulated data.
Ans: Average simulated demand for next 7 days = 15 dozen/day.
3. A bakery keeps stock of a popular brand of fruitcake. Past experience indicate the daily demand as
follows:
Daily demand (dozen) 0 10 20 30 40 50
Probability 0.05 0.20 0.15 0.50 0.70 0.03
Use the random numbers as 48, 78, 19, 57, 77, 15, 14, 58 and 09 and simulate the demand for the next 10
days. Also find out the stock situation if the owner of the bakery decides to make 30 cakes on the basis
of simulated data and compute the expected demand.
Ans: Expected simulated demand=22 (dozen) packets per day.
Expected demand based on past data=24.3 packets per day.
182