simulation basic concepts. need for simulation mathematical models we have studied thus far have...

22
Simulation Simulation Basic Concepts

Post on 21-Dec-2015

215 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Simulation Basic Concepts. NEED FOR SIMULATION Mathematical models we have studied thus far have “closed form” solutions –Obtained from formulas -- forecasting,

SimulationSimulation

Basic Concepts

Page 2: Simulation Basic Concepts. NEED FOR SIMULATION Mathematical models we have studied thus far have “closed form” solutions –Obtained from formulas -- forecasting,

NEED FOR SIMULATIONNEED FOR SIMULATION• Mathematical models we have studied thus far

have “closed form” solutions– Obtained from formulas -- forecasting, inventory,

queuing– Obtained by algorithms -- linear programming,

PERT/CPM

• However, each of these models had to satisfy a restrictive set of assumptions– Many “real-life” situations do not meet these

conditions or are too complex.

• SIMULATIONSIMULATION can be used to get “good” results

Page 3: Simulation Basic Concepts. NEED FOR SIMULATION Mathematical models we have studied thus far have “closed form” solutions –Obtained from formulas -- forecasting,

BACKGROUNDBACKGROUND

• Simulation is, in fact, the most used management science technique

• Simulation is not an optimization procedure like the one used to solve linear programs

• However, if you are considering one of a set of options, simulation can indicate which of these options appears to be the best in the set.

Page 4: Simulation Basic Concepts. NEED FOR SIMULATION Mathematical models we have studied thus far have “closed form” solutions –Obtained from formulas -- forecasting,

BASIC IDEABASIC IDEA

• Recognize the components of the system under study

• Develop a random number mapping that will “map” random numbers from a (computer generated) random number table into events

Page 5: Simulation Basic Concepts. NEED FOR SIMULATION Mathematical models we have studied thus far have “closed form” solutions –Obtained from formulas -- forecasting,

Random Number TableRandom Number Table

Page 6: Simulation Basic Concepts. NEED FOR SIMULATION Mathematical models we have studied thus far have “closed form” solutions –Obtained from formulas -- forecasting,

RANDOM NUMBER MAPPINGSRANDOM NUMBER MAPPINGS• Suppose that the number of students that

miss a statistics class have been observed to be 0, 1, 2, 3, or 4 with the following probabilities:

NUMBER 0 1 2 3 4

PROB. .21 .35 .19 .15 .10

RN Map 00-20 21-55 56-74 75-89 90-99

Page 7: Simulation Basic Concepts. NEED FOR SIMULATION Mathematical models we have studied thus far have “closed form” solutions –Obtained from formulas -- forecasting,

APPROACHAPPROACH

• Generate a set of random numbers and map them into events

• We will choose the first two digits from column 1 of the random number table in the book

Page 8: Simulation Basic Concepts. NEED FOR SIMULATION Mathematical models we have studied thus far have “closed form” solutions –Obtained from formulas -- forecasting,

Simulation of 10 ClassesSimulation of 10 Classes

1 65 2

2 77 3

3 61 2

4 88 3

5 42 1

6 74 2

7 11 0

8 40 1

9 03 0

10 62 2

Class Random # # Absences

Page 9: Simulation Basic Concepts. NEED FOR SIMULATION Mathematical models we have studied thus far have “closed form” solutions –Obtained from formulas -- forecasting,

ANALYSISANALYSISBETTER RESULTSBETTER RESULTS

• We can now analyze “simulated results”Average # absences =

(2+3+2+3+1+2+0+1+0+2)/10 = 1.6

• For better results we can:– Repeat this 10-class simulation many times– Run the simulation for many more than 10

classes

Page 10: Simulation Basic Concepts. NEED FOR SIMULATION Mathematical models we have studied thus far have “closed form” solutions –Obtained from formulas -- forecasting,

PSEUDO RANDOM NUMBERSPSEUDO RANDOM NUMBERS• Random numbers should be uniformly distributed:

– each digit in a random number should have a probability of 1/10 of occurring after any other digit

– no pattern should exist in the random numbers

• Random numbers generated by a computer program are done so by an algorithm and the above conditions may be slightly violated

• The result is that the random numbers are not truly random - they are PSEUDO RANDOM NUMBERS

Page 11: Simulation Basic Concepts. NEED FOR SIMULATION Mathematical models we have studied thus far have “closed form” solutions –Obtained from formulas -- forecasting,

Mid Square Mid Square Random Number Generating Random Number Generating

algorithmalgorithm

• There are many ways to generate “random” numbers. One of the easy algorithm is Mid Mid Square. Square.

Page 12: Simulation Basic Concepts. NEED FOR SIMULATION Mathematical models we have studied thus far have “closed form” solutions –Obtained from formulas -- forecasting,

Mid Square MethodMid Square Method• First, we start with a four-digit seed value, for

example, 71827182. We then square it to get a number up to eight digits long.

– If the number has fewer than eight digits, we pad the left with zeroes until we get eight digits. In our example, 7182^2 gives us 51581124. Now we choose the “middle” four digits of our result,

which is 58115811 in our example.

• We divide by 10,000 to get our first random number, e.g. 0.5811. We repeat this process indefinitely…

Page 13: Simulation Basic Concepts. NEED FOR SIMULATION Mathematical models we have studied thus far have “closed form” solutions –Obtained from formulas -- forecasting,

Mid Square MethodMid Square Method

i zi (z

i)2 Middle four

digits Pseudo-random

num

0 7182 51581124 5811 0.5811

1 5811 33767721 7677 0.7677

2 7677 58936329 9363 0.9363

3 9363 87665769 6657 0.6657

4 6657 44315649 3156 0.3156

5 3156 09960336 9603 0.9603

6 9603 92217609 2176 0.2176

7 2176 04734976 7349 0.7349

Page 14: Simulation Basic Concepts. NEED FOR SIMULATION Mathematical models we have studied thus far have “closed form” solutions –Obtained from formulas -- forecasting,

BENEFIT OF USINGBENEFIT OF USING PSEUDO RANDOM NUMBERS PSEUDO RANDOM NUMBERS

• The string of pseudo random numbers can be regenerated

• This allows us to compare policies under exactly the same conditions

Page 15: Simulation Basic Concepts. NEED FOR SIMULATION Mathematical models we have studied thus far have “closed form” solutions –Obtained from formulas -- forecasting,

PROBABILITIES AND RANDOM PROBABILITIES AND RANDOM NUMBERSNUMBERS

• Typically computer generated random numbers are numbers between 0 and 1– We can “lop off” the decimal for convenience

• The probabilities of possible events will be expressed as 1-digit, 2-digit, 3-digit, or …. probabilities -- the random numbers we use/assign should be of the same length

Page 16: Simulation Basic Concepts. NEED FOR SIMULATION Mathematical models we have studied thus far have “closed form” solutions –Obtained from formulas -- forecasting,

USING EXCEL TO GENERATE USING EXCEL TO GENERATE RANDOM EVENTSRANDOM EVENTS

1. Create a 3-column LOOKUP table• Column 1 – Lower Limit of the RN Interval• Column 2 – Probability in the RN interval• Column 3 – The corresponding X value for

the interval

2. Create a series of random numbers by =RAND()=RAND() and drag down.

• Copy the random numbers then go to: EDIT/PASTE SPECIAL/VALUESEDIT/PASTE SPECIAL/VALUES and paste the same set of numbers on top of themselves (otherwise they will change anytime <Enter> is pressed.)

3. To get the corresponding simulated results enter VLOOKUP(A,B,C)VLOOKUP(A,B,C) and drag, where:

• A = cell with the random number in it• B = location of the table (i.e. $A$2:$C$7) make address of table

absolute

• C = the column that has the simulated result in the table (3)

Page 17: Simulation Basic Concepts. NEED FOR SIMULATION Mathematical models we have studied thus far have “closed form” solutions –Obtained from formulas -- forecasting,

RANDOM NUMBER MAPPINGSRANDOM NUMBER MAPPINGS• Suppose that the number of students that miss

a statistics class have been observed to be 0, 1, 2, 3, or 4 with the following probabilities:

NUMBER 0 1 2 3 4

PROB. .21 .35 .19 .15 .10

(Table)

RN Map 00-20 21-55 56-74 75-89 90-99

(Pseudo RN)

RN Map .00 .21 .56 .75 .90

(Beginning Interval)

Page 18: Simulation Basic Concepts. NEED FOR SIMULATION Mathematical models we have studied thus far have “closed form” solutions –Obtained from formulas -- forecasting,

Create Probability TableCreate Probability Table

Page 19: Simulation Basic Concepts. NEED FOR SIMULATION Mathematical models we have studied thus far have “closed form” solutions –Obtained from formulas -- forecasting,

Create Lower Limits For IntervalsCreate Lower Limits For Intervals

0

=A3+B3Drag down

Page 20: Simulation Basic Concepts. NEED FOR SIMULATION Mathematical models we have studied thus far have “closed form” solutions –Obtained from formulas -- forecasting,

Generate Random NumbersGenerate Random Numbers=RAND()Drag down

You will get different numbers

Highlight cells B11:B25 – copyLeave cursor in cell B11.

Page 21: Simulation Basic Concepts. NEED FOR SIMULATION Mathematical models we have studied thus far have “closed form” solutions –Obtained from formulas -- forecasting,

Get Simulated ResultsGet Simulated Results

=VLOOKUP(B11,$A$3:$C$7,3)Drag down

Where therandom number is

Where thetable is

Put in $ signs

Column ofLookup table

that hasSimulated

results

Page 22: Simulation Basic Concepts. NEED FOR SIMULATION Mathematical models we have studied thus far have “closed form” solutions –Obtained from formulas -- forecasting,

ReviewReview

• Simulation can be used to approximate complex systems

• Use of pseudorandom numbers

• Random Number Mapping into Events

• Calculations

• How to Gain More Confidence

• Use of Lookup Tables and Excel’s RAND() and VLOOKUP functions