Introduction to Simulation Spring 2010 Dr. Louis Luangkesorn University of Pittsburgh January 19, 2010 Dr. Louis Luangkesorn ( University of Pittsburgh ) Introduction to Simulation January 19, 2010 1 / 24 Outline 1 Goals 2 Introduction to Simulation What is simulation Advantages Disadvantages Analysis 3 Modeling process 4 Discrete event Software 5 Next steps Dr. Louis Luangkesorn ( University of Pittsburgh ) Introduction to Simulation January 19, 2010 2 / 24
Goals Introduction to Simulation Tutorials Goal: Overview of the major areas of research in simulation A broad overview of one topic a week First weeks are an overview of the topic and the basics of simulation NOT: How to build a simulation NOT: How to model Dr. Louis Luangkesorn ( University of Pittsburgh ) Introduction to Simulation January 19, 2010 3 / 24 Major topics Goals Introduction to simulation and modeling Simulation library and random variates generation Input probability distributions Output Analysis Verification and validation Design of experiments Comparing alternative systems Dr. Louis Luangkesorn ( University of Pittsburgh ) Introduction to Simulation January 19, 2010 4 / 24
Introduction to Simulation Introduction to simulation What is simulation? What are advantages of simulation? What are disadvantages of simulation? What drives simulation design and analysis? Dr. Louis Luangkesorn ( University of Pittsburgh ) Introduction to Simulation January 19, 2010 5 / 24 Introduction to Simulation What is simulation What is simulation Numerical evaluation of a system under study. A system is a collection of entities that act and interact together toward the accomplishment of some logical end. Discrete systems are where the state variables change instantaneously as separated points in time. Continuous system are where the state variables change continuously with respect to time, even if we model this through time steps. Dr. Louis Luangkesorn ( University of Pittsburgh ) Introduction to Simulation January 19, 2010 7 / 24
Introduction to Simulation What is simulation Alternatives to simulation Analytic models : if tractable Experiments with real system : expensive Physical models : expensive Dr. Louis Luangkesorn ( University of Pittsburgh ) Introduction to Simulation January 19, 2010 8 / 24 Introduction to Simulation What is simulation Types of simulation Discrete systems are where the state variables change instantaneously as separated points in time. Continuous system are where the state variables change continuously with respect to time, even if we model this through time steps. A static model is a representation at a particular point in time, or when time plays no role. Monte Carlo models A dynamic model represents systems that evolve over time. Determiniistic model does not contain any probabilistic components. But it may be intractible so you may use iterative methods similar to simulation to solve it. Stochastic models have some random input components. Dr. Louis Luangkesorn ( University of Pittsburgh ) Introduction to Simulation January 19, 2010 9 / 24
Introduction to Simulation Advantages What are advantages to simulation Few barriers to tractibility - but feasibility is a factor. Assumptions are explicit - no restrictions based on model. Easy to explain - relationships in model apparent to non-specialists First choice - simulation is consistantly among the most used subject areas within operations research (usually only behind statistical analysis) Tool of last resort Even though simulation allows for arbitrary complexity, we still have to consider the art of modeling. George Box: All models are wrong, some models are useful. Dr. Louis Luangkesorn ( University of Pittsburgh ) Introduction to Simulation January 19, 2010 11 / 24 Introduction to Simulation Advantages Advantages to simulation - methodology Dynamic systems - models display system result changes over time Individual sample paths - models show effects on individual entities Statistical results - models show variation on effects across population SIR simulation Number of occurances (of 1000) 0 50 100 150 200 0 20 40 60 80 100 Number infected (of 100) Dr. Louis Luangkesorn ( University of Pittsburgh ) Introduction to Simulation January 19, 2010 12 / 24
Introduction to Simulation Disadvantages What are disadvantages to simulation Scale - Requires explicit tracking of entities and interactions. Complex - Modeling systems with many different types of entities and interactions is complex and arduous. Methodology - There is a tendency to regard simulation building as a programming exercise instead of an analytical one. Stochastic output - Output of simulation models is itself a random variable, not an answer. Requires statistical analysis. Insight - Simulation models tend to focus on the detail, so the model itself does not give insight into the system. Dr. Louis Luangkesorn ( University of Pittsburgh ) Introduction to Simulation January 19, 2010 14 / 24 Introduction to Simulation Analysis What drives analysis Simulation budget - The time and resources available to run a simulation study. Data collection - Time to collect and interpret data. Input modeling - Time to generate stochastic inputs. Model runs - Time to run the model. Measures of variation - Need to run multiple replications at multiple treatments. Dr. Louis Luangkesorn ( University of Pittsburgh ) Introduction to Simulation January 19, 2010 16 / 24
Modeling process The wrong way Simulation is flexible - design detailed model which mirrors every aspect of the real world system. Program model. Run model using arbitrary input parameters. Dr. Louis Luangkesorn ( University of Pittsburgh ) Introduction to Simulation January 19, 2010 17 / 24 Another way Modeling process Identify the system of interest - What is under study and why. This yields a descriptive model. Describe the behaviors and interactions of entities in the model. This is the formal model. Build the model. Analytic if possible. Describe behaviors with algorithms otherwise. Ask if the computer program does what it is intended to do. This is verification and validation. Build a statistical model of the stochastic output. Design of experiments. Develop insights and inferences about the actual system. Dr. Louis Luangkesorn ( University of Pittsburgh ) Introduction to Simulation January 19, 2010 18 / 24
Modeling process Modeling process Figure: Simulation chain of inference Dr. Louis Luangkesorn ( University of Pittsburgh ) Introduction to Simulation January 19, 2010 19 / 24 Another way Modeling process Start small - Build the simplest model which captures the essense of the system under study. Improve incrementally - Add features to improve the representatino of reality. Test frequently - Does the addition add to the models ability to represent reality for purpose of the objective of the model. Backtrack and simplify. Dr. Louis Luangkesorn ( University of Pittsburgh ) Introduction to Simulation January 19, 2010 20 / 24
Discrete event simulation Discrete event System state changes occur at discrete points in time. events Process view describes for each entity Resource requirements Activities Delays Decisions Event view advances time directly from one event to the next. Most commercial simulation software attempts to present the Process view. Most programming libraries implement Event view. Dr. Louis Luangkesorn ( University of Pittsburgh ) Introduction to Simulation January 19, 2010 21 / 24 Discrete event Software Simulation software A simulation should have the following components: System state: The collection of state variables which describe the system. Simulation clock: A variable giving the current value of simulated time. Event list: A list containing the next time when each type of event will occur. Statistical counters: Variables used for storing statistical information about system performance. Initialization routine: Initialize the simulation model at time zero. Timing routine: Determines the next event from the event list and then advances the simulation clock to that event. Event routine: Updates the system state when a particular event occurs. Library routines: Generate random observations from probability distributions. Report generator: Computes estimates of the desired measures of performance and produces a report when the simulation ends. Main program: Invokes the timing routine to determine the next event then transfers control to the corresponding event routine to update the system state. Dr. Louis Luangkesorn ( University of Pittsburgh ) Introduction to Simulation January 19, 2010 23 / 24
Next steps Next steps Introduction to simulation and modeling Simulation library and random variates generation Input probability distributions Output Analysis Verification and validation Design of experiments Comparing alternative systems Dr. Louis Luangkesorn ( University of Pittsburgh ) Introduction to Simulation January 19, 2010 24 / 24