350 likes | 635 Views
Chapter 20. Simulation. 20.1 The Essence of Simulation. Simulation: flexible, powerful, and intuitive Widely used to imitate (simulate) the operation of an entire process or system with software Simulation in operations research
E N D
Chapter 20 Simulation
20.1 The Essence of Simulation • Simulation: flexible, powerful, and intuitive • Widely used to imitate (simulate) the operation of an entire process or system with software • Simulation in operations research • Uses probability distributions to randomly generate various events that occur in the system • Model runs the simulated system to obtain statistical observations
20.1 The Essence of Simulation • Simulation of the Universe • Simulation of sports outcomes
The Essence of Simulation • Simulation models • Define of the state of the system • Identify the possible states of the system that can occur • Identify the possible events that would change the system state • Clock (record) the passage of time • Use a method to randomly generate events • Have a formula to identify state transitions
The Essence of Simulation • Simulation is relatively expensive: • When dealing with complex systems • Useful when the stochastic system is too complex to be analyzed with mathematical models • Types of simulation • Discrete-event • Continuous
The Essence of Simulation • Discrete-event simulation • Changes in system state occur noncontinuously over time • Can be used to model a continuous system • Greatly simplifies the analysis • Focus of this chapter
The Essence of Simulation • Example 1: a coin flipping game • Game rules • Each play involves repeatedly flipping an unbiased coin until the difference between the number of heads and tails tossed is three • If you decide to play, you must pay $1 for each coin flip. You are not allowed to quit during a play • You receive $8 at the end of each play of the game • Simulation could be used to decide whether to play this game
The Essence of Simulation • Excel simulation of the coin flipping game • Shown on next slide • Repeat simulations many times • To obtain a more reliable estimate of an average outcome • Example: Figure 20.2 shows a spreadsheet created to record 14 plays of the game • Be wary of making conclusions based on too small a sample size
The Essence of Simulation • Example 2: An M/M/1 queueing system • Mean arrival rate: 3 per hour • Mean service rate: 5 per hour • Simulation clock records elapsed time starting at time 0 • N(t)represents number of customers in the system at time t • Events that change system state • Arrival of a customer • Service completion for a customer
The Essence of Simulation • State transition formula for Example 2 • Methods for advancing time • Fixed-time incrementing • Next-event incrementing
The Essence of Simulation • Fixed-time incrementing • Advance time by a small fixed amount • Update the system • Determine what event occurred during the elapsed time interval • Determine the resulting state of the system • Record desired system performance information • Repeat • Computer generates a random number • To determine whether or not event occurs
The Essence of Simulation • Next-event incrementing • Advance time to the next event of any kind • Update the system • Determine its new state • Randomly generate the time until the next event that can occur from this state • Record desired system performance information • Repeat • Excel Queueing Simulator can be used to apply next-event incrementing
20.2 Some Common Types of Applications of Simulation • Application categories • Design/operation of queueing systems • Management of inventory systems • Estimating probability of meeting project deadlines • Design/operation of manufacturing systems • Design/operation of distribution systems • Financial risk analysis • Healthcare
20.3 Generation of Random Numbers • Excel • Use the RAND() function • Random number generator • Algorithm that produces a sequence of numbers that follow a specified probability distribution • Have the appearance of randomness • Random numbers can beinteger or uniform
Generation of Random Numbers • Random numbers generated by computer • Typically integer numbers • Can be converted to uniform numbers • Probability density function for a uniform distribution • If not specified, a =0, and b =1
Generation of Random Numbers • Congruential methods for random number generation • Additive, multiplicative, and mixed • Mixed congruential method • Generates a sequence of random numbers over the range 0 to • Calculates the next random number from the last one obtained • Given an initial random number called the seed
Generation of Random Numbers • Mixed congruential method (cont’d.) • Calculates the number by applying the recurrence relation: Where a, c, and m are positive integers (a < m, c < m) • Cycle length • The number of consecutive numbers in a sequence before repeating a number
Generation of Random Numbers • Multiplicative congruential method • Special case of the mixed congruential method where • Additive congruential method • Special case of the mixed congruential method where , and c is a random number preceding xn in the sequence
20.4 Generation of Random Observations from a Probability Distribution • Simple discrete distributions • Allocate the possible values of a random number to the various outcomes in the probability distribution • In direct proportion to the respective probabilities of those outcomes • The inverse transformation method • Generate a uniform random number r between 0 and 1 • Set and solve for x
Generation of Random Observations from a Probability Distribution • Exponential and Erlang distributions • Method outlined on Pages 914-915 of the text • Simple technique for generating a random observation from a normal distribution • Apply the central limit theorem • If are a sample of uniform random numbers:
Generation of Random Observations from a Probability Distribution • Chi-square distribution • If are n random observations from a normal distribution with mean 0 and standard deviation 1: • A random observation x is given by: • Acceptance-rejection method • Generate a uniform random number between 0 and 1, and set
Generation of Random Observations from a Probability Distribution • Acceptance-rejection method (cont’d.) • Accept x with • To be the desired random observation • Otherwise, reject x and repeat the 2 steps • To randomly generate the event of accepting or rejecting x: • Generate a uniform random number r2 between 0 and 1 • If x is rejected, repeat the 2 steps
20.5 Outline of a Major Simulation Study • Steps • Formulate the problem and plan the study • Collect the data and formulate the simulation model • Check the accuracy of the simulation model • Select the software and construct a computer program • Test the validity of the simulation model
Outline of a Major Simulation Study • Steps (cont’d.) • Plan the simulations to be performed • Conduct the simulation runs and analyze the results • Present recommendations to management
20.6 Performing Simulations on Spreadsheets • When studying simple systems • It is possible to run simulations quickly and easily on spreadsheets • Standard Excel package • Comes with basic simulation capability • Add-ins expand the capability • Frontline Systems’ Analytic Solver Platform
Performing Simulations on Spreadsheets • Example: Freddie the Newsboy’s problem • Application of ASPE to this problem on Pages 922-930 of the text • Accuracy of a simulation • Measured by the standard error • s is the standard deviation • n is the number of trials
Performing Simulations on Spreadsheets • Parameter analysis report in ASPE
20.7 Conclusions • Simulation is a tool for estimating the performance of complex stochastic systems • Provides statistical estimates rather than exact results • Compares alternatives rather than generating an optimal one • Can be a slow and costly method