You are on page 1of 51

SIMULATION

SIMULATION vs. OPTIMIZATION


In an optimization model, the values of the decision variables are outputs.

The result of the model is a set of values for the decision variables that will maximize (or minimize) the value of the objective function.
In a simulation model, the values of the decision variables are inputs. The model evaluates the objective function for a particular set of values. The result of the model is a measure of the quality of a suggested solution and the variability in various performance measures due to randomness in the 2 inputs.

Introduction
Simulation allows you to quickly and inexpensively acquire knowledge concerning a problem that is usually gained through experience (which is often costly and time consuming). An experimental device (simulator) will act like (simulate) the system of interest in a quick, costeffective manner.

Goal: To create an environment in which information about alternative actions can be obtained through experimentation.
3

When should simulation be used?


Simulation is one of the most frequently used tools of quantitative analysis today because:

1. Analytical models may be difficult or impossible to obtain, depending on complicating factors.


2. Analytical models typically predict only average or steady-state (long-run) behavior. 3. Simulation can be performed with a variety of software on a PC or workstation. The level of computing and mathematical skill required to design and run a simulator has been substantially reduced.
4

Steps in simulation
1. Problem formulation 2. Set objectives and overall project plan

Phase 1 Problem Definition

3. Model conceptualization

4. Data Collection

Phase 2
Model Building

5. Model Translation No No 6. Verified Yes 7. Validated Yes 8. Experimental Design 9. Model runs and analysis Yes No 11. Documentation, reporting and implementation No

Phase 3

Experimentation

Phase 4

Implementation

10. More runs

Simulation and Random Variables


MONTE CARLO METHOD: Simulation models are often used to analyze a decision under risk. Under risk, the behavior of one or more factors is not known with certainty. For example: demand for a product during the next month

the return on an investment


the number of trucks that will arrive to be unloaded The factor that is not known with certainty is called the random variable. The behavior of the random variable can be described by a probability distribution.
6

Who uses Monte Carlo simulation? Simulation and Random Variables


GM uses simulation for activities such as forecasting net income for the corporation, predicting structural and purchasing costs, and determining its susceptibility to different kinds of risk (such as interest rate changes and exchange rate fluctuations). This information is used by the CEO to determine which products come to market. Lilly uses simulation to determine the optimal plant capacity for each drug. Proctor and Gamble uses simulation to model and optimally hedge foreign exchange risk. Sears uses simulation to determine how many units of each product line should be ordered from suppliersfor example, the number of pairs of Dockers trousers that should be ordered this year. 7

Conversion of a Random No. to a Uniform Distribution

200 Random Numbers Generated Between 0 and 100

200 Uniform Discrete Random Numbers Generated Between 20 and 100

10

The Cumulative Distribution Function (CDF). Consider a random variable, D, the demand. The CDF for D [called F(x)] is then defined as the probability that D takes on a value < x.

F(x) = Prob{D < x}


Knowing the probability distribution for D, the CDF for key values of D is: X F(x) 8 0.1 9 0.3 10 0.6 11 0.8 12 0.9 13 1.0

11

Here is a graph of the CDF. To generate a discrete demand using the graph:
Probability

1.2

1 0.8 0.6 0.4 0.2


u

Step 1: Locate the particular value of U on this axis

F(x)

Step 2: Read the particular value of the random quantity, d, on this axis d x

0 7 8 9 10 11 12 13

14
12

THE GENERAL METHOD APPLIED TO CONTINUOUS DISTRIBUTIONS: The two-step process for generating a continuous random variable W is shown below: The cumulative
Probability 1.1 1

F(x)=Prob{W<x}

distribution function of W As before, first locate the value (u) of the random variable U Then, read the particular value of the random quantity, W, on this axis 13

0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0

F(w)

w
1 2 3 4 5 6 7 8 9

x 10

Generating from the Exponential Distribution. The exponential distribution is often used to model the time between arrivals in a queuing model. Its CDF is given by: F(x) = Prob{t>T} = e-lT Where 1/l is the mean of the random variable T. Therefore, we want to solve the following equation for w: u = e-lT The solution is: T = -1/l ln(u) where we can get u from Random number which represents cumulative distribution function
14

Generating from the Normal Distribution. The normal distribution plays an important role in many simulation and analytic models. Consider drawing a random demand from a normal distribution with a mean (m) of 1000 and a standard deviation (s) of 100. If Z is a unit normal random variable (normally distributed with a mean of 0 and a standard deviation of 1) then m + Zs is a normal random variable with mean m and standard deviation s. So, we can draw from a unit normal distribution. Excel has a built-in function that can do this: = NORMINV( RAND() , 1000, 100) Excel will automatically return a normally distributed 15 random number with mean 1000 and std. dev. 100.

MAINTAINANCE PROBLEM

16

Corrective Maintenance versus Preventive Maintenance


The Heavy Duty Company has just purchased a large machine for a new production process. The machine is powered by a motor that occasionally breaks down and requires a major overhaul. Therefore, a second standby motor is kept, and the two motors are rotated in use. The breakdowns always occur on the fourth, fifth, or sixth day that the motor is in use. Fortunately, it takes fewer than three days to overhaul a motor, so a replacement is always ready.

Cost of Replacement Cycle that Begins with Breakdown

Replace a Motor Lost production during replacement Overhaul a motor Total

$2,000 5,000 4,000 17 $11,000

Probability Distribution of Breakdowns

Day 1, 2, 3

Probability of a Breakdown 0

Corresponding Random Numbers

4
5 6 7 or more

0.25
0.5 0.25

0.0000 to 0.2499
0.2500 to 0.7499 0.7500 to 0.9999

18

Computer Simulation of Corrective Maintenance


Breakdown Random Time Since Last Cumulative Number Breakdown Day Cost Cumulative Cost Distribution of Time Between Breakdowns Number Prob Cumu. Prob of Days no. 0.25 0.5 0.25 0 0.25 0.75 $11,000 4 5 6

1 2 3 4 5 6 7 8 9 10 26 27 28 29 30

0.1343 0.1523 0.9091 0.6161 0.6223 0.0026 0.6920 0.6155 0.7805 0.9189 0.6869 0.6415 0.3599 0.1493 0.4700

4 4 6 5 5 4 5 5 6 6 5 5 5 4 5

4 8 14 19 24 28 33 38 44 50 128 133 138 142 147

$11,000 $11,000 $11,000 $11,000 $11,000 $11,000 $11,000 $11,000 $11,000 $11,000 $11,000 $11,000 $11,000 $11,000 $11,000

$11,000 $22,000 $33,000 $44,000 $55,000 $66,000 $77,000 $88,000 $99,000 $110,000 $286,000 $297,000 $308,000 $319,000 $330,000

Breakd own Cost

Average Cost per Day $2,245

19

Preventive Maintenance Options


Preventive maintenance would involve scheduling the motor to be removed (and replaced) for an overhaul at a certain time, even if a breakdown has not occurred. The goal is to provide maintenance early enough to prevent a breakdown. Scheduling the overhaul enables removing and replacing the motor at a convenient time when the machine is not in use, so no production is lost.

Cost of Replacement Cycle that Begins without a Breakdown Replace a motor on overtime Lost production during replacement Overhaul a motor before a breakdown Total $3,000 0 3,000
20

$6,000

Replace Motor on 4 Days


Cycle Random Number Time Until Scheduled Time Event That Cumulative Breakdown Until ReplacementConcludes Cycle Day Cost Cumulative Cost Distribution of Time Between Breakdowns

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

0.3926 0.4904 0.8207 0.6811 0.1084 0.1032 0.5737 0.0718 0.5408 0.9918 0.9948 0.1657 0.1035 0.3365 0.1650 0.4908 0.0267 0.1388 0.9297 0.5908 0.1035 0.6132 0.5361 0.0726 0.0593 0.7241 0.3092 0.4092 0.2356 0.6483

5 5 6 5 4 4 5 4 5 6 6 4 4 5 4 5 4 4 6 5 4 5 5 4 4 5 5 5 4 5

4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4

Replacement Replacement Replacement Replacement Breakdown Breakdown Replacement Breakdown Replacement Replacement Replacement Breakdown Breakdown Replacement Breakdown Replacement Breakdown Breakdown Replacement Replacement Breakdown Replacement Replacement Breakdown Breakdown Replacement Replacement Replacement Breakdown Replacement

4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120

$6,000 $6,000 $6,000 $6,000 $11,000 $11,000 $6,000 $11,000 $6,000 $6,000 $6,000 $11,000 $11,000 $6,000 $11,000 $6,000 $11,000 $11,000 $6,000 $6,000 $11,000 $6,000 $6,000 $11,000 $11,000 $6,000 $6,000 $6,000 $11,000 $6,000

$6,000 $12,000 $18,000 $24,000 $35,000 $46,000 $52,000 $63,000 $69,000 $75,000 $81,000 $92,000 $103,000 $109,000 $120,000 $126,000 $137,000 $148,000 $154,000 $160,000 $171,000 $177,000 $183,000 $194,000 $205,000 $211,000 $217,000 $223,000 $234,000 $240,000

Probability 0.25 0.5 0.25 Breakdown Cost Replacement Cost Replace After

Number Cumulative of Days 0 4 0.25 5 0.75 6 $11,000 $6,000 4 days

21
Average Cost per Day $2,000

Replace Motor After 5 Days


Cycle Random Number Time Until Breakdown Scheduled Time Until Replacement Event That Concludes Cycle Cumulative Day Cost Cumulative Cost Distribution of Time Between Breakdowns

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

0.3543 0.2204 0.0583 0.8282 0.9815 0.4620 0.7658 0.4318 0.8745 0.9448 0.0987 0.5796 0.7489 0.2480 0.5809 0.9055 0.5844 0.0157 0.0949 0.1892 0.9239 0.1051 0.8739 0.5229 0.6667 0.3945 0.7721 0.2253 0.6972 0.5078

5 4 4 6 6 5 6 5 6 6 4 5 5 4 5 6 5 4 4 4 6 4 6 5 5 5 6 4 5 5

5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5

Breakdown Breakdown Breakdown Replacement Replacement Breakdown Replacement Breakdown Replacement Replacement Breakdown Breakdown Breakdown Breakdown Breakdown Replacement Breakdown Breakdown Breakdown Breakdown Replacement Breakdown Replacement Breakdown Breakdown Breakdown Replacement Breakdown Breakdown Breakdown

5 9 13 18 23 28 33 38 43 48 52 57 62 66 71 76 81 85 89 93 98 102 107 112 117 122 127 131 136 141

$11,000 $11,000 $11,000 $6,000 $6,000 $11,000 $6,000 $11,000 $6,000 $6,000 $11,000 $11,000 $11,000 $11,000 $11,000 $6,000 $11,000 $11,000 $11,000 $11,000 $6,000 $11,000 $6,000 $11,000 $11,000 $11,000 $6,000 $11,000 $11,000 $11,000

$11,000 $22,000 $33,000 $39,000 $45,000 $56,000 $62,000 $73,000 $79,000 $85,000 $96,000 $107,000 $118,000 $129,000 $140,000 $146,000 $157,000 $168,000 $179,000 $190,000 $196,000 $207,000 $213,000 $224,000 $235,000 $246,000 $252,000 $263,000 $274,000 $285,000

Probability 0.25 0.5 0.25

Number Cumulative of Days 0 4 0.25 5 0.75 6

Breakdown Cost $11,000 Replacement Cost $6,000 Replace After 5 days

Average Cost per Day $2,021 22

Design of Docking Facilities. In the following model, trucks of different sizes carrying different types of loads, arrive at a warehouse to be unloaded.

T r u c k

D o c k 3

T r u c k

D o c k 2

T r u c k

D o c k 1

Exit

Entrance

Truck waiting

Truck waiting
23

The uncertainties are: When will a truck arrive? What kind and size of load will it be carrying?

How long will it take to unload the trucks?


Each uncertain quantity would be a random variable characterized by a probability distribution.

The planners must address a variety of design questions:


How many docks should be built?

What type and quantity of material-handling equipment are required?


How many workers are required over what 24 periods of time?

1. The design of the unloading dock will affect its cost of construction and operation. 2. Management must balance the cost of acquiring and

using the various resources against the cost of


having trucks wait to be unloaded.

25

Determination of Inventory Control Policies. Simulation can be used to study inventory control models.
Factory

Warehouse 1 Demand

Warehouse 2 Demand

Warehouse 3 Demand

In this model, the factory produces goods that are sent to the warehouses to satisfy customer demand. The random variables are: daily demand at each warehouse and shipping times from factory to warehouse.

26

Simulation can be used to study inventory control models. Some of the operational questions are: When should a warehouse reorder from the factory and how much? How much stock should the factory maintain to satisfy the orders of the warehouses? The main costs are: Cost of holding the inventory Cost of shipping goods from a factory to a warehouse Cost of not being able to satisfy customer demand at the warehouse The objective is to find a stocking and ordering policy 27 that keeps the total cost low while meeting demand.

Generating Random Variables


To generate a random variable, draw a random sample from a given probability distribution.

Two broad categories of random variables:


Discrete Can assume only certain specific values (e.g., integers) Continuous Can take on any fractional value (an infinite number of values)
28 Using a Random Number Generator in a Spreadsheet

A GENERALIZED METHOD: To generate a discrete random variable with the RAND() function in a spreadsheet, two things are needed: 1. The ability to generate discrete uniform random variables 2. The distribution of the discrete random variable to be generated

To generate a continuous random variable, two things are needed:


1. The ability to generate continuous uniform random variables on the interval 0 to 1 2. The distribution (in the form of the cumulative distribution function) of the random variable to 29 be generated

Suppose you want to model a discrete uniform distribution of demand where the values of 8 through 12 all have the same probability of occurring (uniform, equally likely). The spreadsheet has a function, =RAND(), that returns a random number between 0 and 1. However, this will result in a continuous uniform distribution. To create a discrete uniform distribution, use the INT() function. For example:

In general, if you want a discrete, uniform distribution of integer values between x and y, use the formula: 30 INT(x + (y x + 1)*RAND() )

CAPITAL BUDGETING PROBLEM

31

A CAPITAL BUDGETING EXAMPLE: ADDING A NEW PRODUCT LINE Airbus Industry is considering adding a new jet airplane (model A3XX) to its product line. The following financial information is available: Startup Costs Sales Price Fixed Costs (per year) Variable Costs (per year) $150,000 $ 35,000 $ 15,000 75% of revenues

Tax depreciation on the new equipment would be $10,000 per year over the 4 year expected product life. Salvage value of the equipment at the end of the 4 years is estimated to be 0. Airbus cost of capital is 10% and tax rate is 34%.
32

If demand is known, then a spreadsheet can be used to calculate the net present value (NPV). For example, assume that the demand for A3XXs is 10 units for each of the next 4 years:

=C16 + C13
=NPV($D$3,C17:F17)+B17 =-$B$2
33

THE MODEL WITH RANDOM DEMAND It is unlikely that demand will be the same every year. A more realistic model would be one in which demand each year is a sequence of random variables. This model of demand is appropriate when there is a constant base level of demand that is subject to random fluctuations from year to year. Sampling Demand with a Spreadsheet: Assume initially that the demand in a year will be either 8, 9, 10, 11, or 12 units with each value being equally likely to occur. This is an example of a discrete uniform distribution. Now, use the formula =INT(8 + 5*RAND() ) to sample from a discrete uniform distribution on the integers 8, 9, 10, 11, 12 . Multiple trials can be performed by pressing the 34 recalculation key for the spreadsheet (e.g., F9).

Using this formula results in random demands.

=INT(8+5*RAND() )

Hitting the F9 key would result in a different sample of demands, and possibly a different NPV. The demands are random variables, therefore, the NPV 35 is also a random variable.

EVALUATING THE PROPOSAL Two questions need to be answered about the NPV distribution: 1. What is the mean or expected value of the NPV? 2. What is the probability that the NPV assumes a negative value (making the proposal to add the A3XX less attractive)? To answer these questions, a simulation model must be built. To run the simulation automatically and capture the resulting NPV in a separate spreadsheet, use the Data Table command.

36

In the resulting dialog, enter C1 for the column input cell and click OK.

Excel will recalculate the values and store the resulting NPV in the adjacent cells in column B. Note that since a random number generator is used in the formula, you may get different values than these.

37

To get a summary of the 100 iterations, use Excels builtin data analysis tool. Click on Tools Data Analysis. If you do not have this option, click on the Add-in option on the Tools menu and in the resulting dialog, click on Analysis ToolPak. After clicking OK, the Data Analysis dialog will open.

Select the Descriptive Statistics option and click OK. 38

In the resulting dialog, choose the Input Range to include the 100 iterations.

Now click on Output Range and enter the cell where the output will be placed.

In addition, select Summary Statistics and click OK.

39

The resulting analysis gives the estimated mean NPV and standard deviation.

Downside Risk and Upside Risk: To get a better idea about the range of possible NPVs that could occur, look 40 at the minimum and maximum NPVs.

Distribution of Outcomes: Now we ask the question: How likely will these extreme outcomes occur? To answer this, examine the shape of the distribution of the NPV by creating a histogram.

Click on Tools Data Analysis and choose Histogram.

In the resulting dialog, set the input range and choose to save the results in a worksheet called NPV Distribution.

41

In the resulting analysis, the Frequency (column B) indicates the number of trials that fell into the bins (categories) defined by column A.

The cumulative % column indicates the cumulative percentage of observations that fall into each category 42 or bin.

The histogram gives a visual representation of the distribution of NPVs. Note that it is somewhat bell shaped.

43

How Reliable is the Simulation? Now the two questions about the distribution can be answered:

1. What is the mean or expected value of the NPV?


In this trial, the mean is $12,100. 2. What is the probability that the NPV assumes a negative value (making the proposal to add the A3XX less attractive)? In this trial, the probability is <15%. The next questions to ask are: 1. How much confidence do we have in the answers from the first trial? 2. Would we be more confident if we ran more trials?
44

For a 95% confidence interval, the formula is:

estimated mean + 1.96(standard deviation)


In this case, the standard deviation is the standard error (the standard deviation divided by the square root of the number of trials). Based on this trial, the upper and lower confidence limits are: =$E$4-1.96*$E$8/SQRT($E$16)

=$E$4+1.96*$E$8/SQRT($E$16) So, we have 95% confidence that the true mean NPV is 45 somewhere between $9,679 and $14,521.

THE MODEL WITH RANDOM DEMAND It is unlikely that demand will be the same every year. A more realistic model would be one in which demand each year is a sequence of random variables. This model of demand is appropriate when there is a constant base level of demand that is subject to random fluctuations from year to year. Sampling Demand with a Spreadsheet: Assume initially that the demand in a year will be either 8, 9, 10, 11, or 12 units with each value being equally likely to occur. This is an example of a discrete uniform distribution.

46

OTHER DISTRIBUTIONS OF DEMAND Originally, we started with equal mean demands of 10 for each period (year). Then, we allowed for random variation in mean demand (between 8 and 12 units) and discrete distribution.

Now, assume the mean demand will stay the same over the next four years, somewhere between 6 and 14 units a year, with all values being equally likely. This scenario can be modeled as a continuous, uniform distribution between 6 and 14.
In addition, we can explore the impact of different demand distributions on the NPV.
47

Inventory Problem
The daily demand of an item has the following distribution:
Demand per day (units) No. of days on which demand occurred 0 4 1 10 2 15 3 39 4 22 5 10

When an order is placed to replenish inventory there is a delivery time lag, which follows the following distribution:
Lead time (days) No. of times of occurrence 2 24 3 12 4 4

The management is of the opinion that proportion of stockouts should not exceed 5%.
48

Advantage of Simulation
1. It is particularly well-suited for problems that are difficult or impossible to solve mathematically.
2. It allows an analyst or decision maker to experiment with system behavior in a controlled environment instead of in a real-life setting that has inherent risks. 3. It enables a decision maker to compress time in order to evaluate the long-term effects of various alternatives. 4. It can serve as a mode for training decision makers by enabling them to observe the behavior of a system under different conditions.
49

Limitations of Simulation
1. Probabilistic simulation results are approximations, rather than optimal solutions. 2. Good simulations can be costly and time-consuming to develop properly; they also can be time-consuming to run, especially in cases in which a large number of trials are indicated. 3. A certain amount of expertise is required in order to design a good simulation, and this may not be readily available. 4. Analytical techniques may be available that can provide better answers to problems.
50

THANK YOU

51

You might also like