Introduction to Simulation Introduction to Simulation Gambling Game Reading: Law, Sections 1.1, 1.2, 1.8 Definitions More on Simulation Key Issues in Simulation Peter J. Haas Basic point estimates and confidence intervals Discrete-Event Simulation Course Goals CS 590M: Simulation Spring Semester 2020 1 / 33 2 / 33 A Gambling Game Is the following game a good bet over the long run? ◮ A fair coin is repeatedly flipped until | #heads − #tails | = 3 ◮ Player receives $8.99 at the end of the game but must pay $1 How Can Computers Help Us Make Better Decisions for each coin flip Under Uncertainty? Approaches to answering the question: ◮ Try to compute the answer analytically (not easy) ◮ Play the game multiple times and use average reward to estimate expected reward (time-consuming) ◮ Use the power of the computer to experiment—Simulation! 3 / 33 4 / 33
Simulating the Gambling Game and Birds Simulation: Definitions Definition 1 A technique for studying real-world dynamical systems by imitating Simulating coin flips on a computer: Pseudorandom numbers their behavior using a mathematical model of the system ◮ U “looks like” a uniform random number between 0 and 1 implemented on a digital computer ◮ To generate: ◮ Python: U = random.random() Definition 2 ◮ C: U = (float)rand() / MAX RAND A controlled statistical sampling technique for stochastic systems ◮ Java: U = Math.random() ◮ Then “heads” if 0 ≤ U ≤ 0 . 5 and “tails” if 0 . 5 < U ≤ 1 Q: Example of non-stochastic simulation? The need for careful simulation [Demo] Simulation for science [NetLogo Demo] Definition 3 A numerical technique for solving complicated probability models (analogous to numerical integration) 5 / 33 6 / 33 Monte Carlo methods More on Simulation Why simulation is awesome (mostly) ◮ Most frequently used tool of practitioners ◮ Interdisciplinary: spans Computer Science, Statistics, Probability, and Number Theory For static numerical problems Applications Example: Numerical integration with many dimensions ◮ WWII Manhattan Project: von Neumann, Teller, Turing Will cover briefly in the course and homework Advantages and disadvantages 7 / 33 8 / 33
Simulation vs Machine Learning Simulation Resources ◮ TOMACS: ACM Transactions on Modeling and Computer Simulation ◮ OR/MS Today (biennial simulation software survey) ◮ INFORMS Simulation Society; see www.informs.org/Community/Simulation-Society ◮ Winter Simulation Conference proceedings; see http://informs-sim.org ◮ Over 40 years of conference papers searchable by keyword ◮ Introductory and advanced tutorials can be especially useful ◮ Society for Computer Simulation; see http://www.scs.org. Will the mechanism that ◮ ACM SIGSIM; see www.sigsim.org generates data now generate it See Sokolowski and Banks (Ch. 7) for extensive listing of in the future? simulation organizations and applications (Not if I change the Allows What-If analyses mechanism) 9 / 33 10 / 33 Overview of Simulation Process Mathematical simulation model states, events, clocks state transitions + modeling Input distributions - Probability theory Decision problem Introduction to Simulation - Fit distribution from data (Choose design or (maximum likelihood, Bayes) Real-world system operating policy) (existing or proposed) Gambling Game Definitions More on Simulation Point estimates and confidence intervals Key Issues in Simulation - Simple means (SLLN and CLT based) Discrete-time Markov chain (DTMC) - Nonlinear functions of means, quantiles Continuous-time Markov chain (CTMC) Basic point estimates and confidence intervals (Taylor series, sectioning, jackknife, bootstrap) Semi-Markov process (SMP) - Steady-state quantities: time-avg limits, delays Generalized semi-Markov process (GSMP) (regenerative, batch means, jackknifing) Discrete-Event Simulation Stochastic process definition Efficiency improvement Course Goals - Common random numbers, antithetic variates, Sample path generation conditional Monte Carlo, control variates, importance sampling Experimental design - Factor screening - Sensitivity analysis Uniform random numbers - Metamodeling Non-uniform random numbers - Inversion, accept-reject, Optimization composition, convolution, - Continuous (Robbins -Monro) alias method - Ranking and selection Time-advance mechanism -Discrete optimization Event list management Output analysis 11 / 33 12 / 33
Key Issues in Simulation Example of Model Formulation: Gambling game � 1 if U i ≤ 0 . 5; 1. What questions are we trying to answer? Outcome of i th toss: H i = ◮ Complex, often dynamic 0 if U i > 0 . 5 (see Sawyer and Fuqua slides in Practitioner’s Gallery) # of heads in first n tosses: S n = ◮ Identify stakeholders and available resources ◮ Continual interplay with stakeholders during project # of tails in first n tosses: ◮ See also Conway & McClain http://pubsonline.informs.org/doi/pdf/10.1287/ited.3.3.13 # heads - #tails: length of game: L = 2. How to model the system? ◮ State definition, random variables, etc. reward for game: X = ◮ Operational vs policy models: different levels of detail ◮ “As simple as possible” vs model re-use Goal: estimate µ = E [ X ] 13 / 33 14 / 33 Key Issues, Continued Key Issues, Continued 5. How do we verify the simulation? 3. Is the quantity that we are trying to estimate well ◮ Verification: Correctness of the computer implementation of defined? the simulation model ◮ Single-server queue with ρ > 1 ◮ Good coding practices: ◮ In gambling game, µ defined iff P ( L < ∞ ) = 1 and E [ L ] < ∞ ◮ Moral: do sanity checks! 4. How to generate run on a computer? ◮ Gambling game is easy, industrial strength models are hard ◮ In general, we will use low-level languages ◮ Python, C/C++, Java versus Matlab, R ◮ For deep understanding of foundational principles ◮ Flexibility, low cost, fast execution ◮ Programming ability strengthens your resume 15 / 33 16 / 33
Key Issues, Continued Key Issues, Continued 7. Number and length of simulation runs? 6. How do we validate the simulation? ◮ Validation: Adequacy of the simulation model in capturing 8. Can the simulation be made more efficient? system of interest ◮ Statistical and computational efficiency ◮ Beware of over-fitting: use, e.g., cross validation 9. How do we use simulation to make decisions? [Hastie et al., Elements of Statistical Learning , Sec. 7.10] ◮ Compare systems: ranking and selection ◮ Beware that good fit to current data �⇒ good extrapolation ◮ Set operating or design parameters: stochastic optimization ◮ Aim for insights : trends and comparisions ◮ Set operating policies: reinforcement learning, ◮ Use sensitivity analysis to build credibility Markov decision processes 17 / 33 18 / 33 Point Estimates & Strong Law of Large Numbers Estimating expected reward in gambling game ◮ Replicate experiment (i.e., play game) n times to get Introduction to Simulation X 1 , X 2 , . . . , X n Gambling Game n ◮ Estimate expected reward by µ n = 1 � X i Definitions n i =1 More on Simulation ◮ Why is this a reasonable estimate? Key Issues in Simulation Basic point estimates and confidence intervals Strong law of large numbers Discrete-Event Simulation ◮ Suppose X 1 , X 2 , . . . are i.i.d. with finite mean µ Course Goals ◮ Then, with probability 1, n 1 � X i → µ as n → ∞ n i =1 19 / 33 20 / 33
Recommend
More recommend