Lecture #8: Monte Carlo Method
Total Page:16
File Type:pdf, Size:1020Kb
Lecture #8: Monte Carlo method ENGG304: Uncertainty, Reliability and Risk Edoardo Patelli Institute for Risk and Uncertainty E: [email protected] W: www.liv.ac.uk/risk-and-uncertainty T: +44 01517944079 A MEMBER OF THE RUSSELL GROUP Edoardo Patelli University of Liverpool 18 March 2019 1 / 81 Lecture Outline 1 Introduction 2 Monte Carlo method Random Number Generator Sampling Methods Buffon’s experiment Monte Carlo integration Probability of failure 3 Summary 4 Computer based class Some useful slides Assignments Edoardo Patelli University of Liverpool 18 March 2019 2 / 81 Introduction Programme ENGG304 1 28/01/2019 Introduction 2 08/02/2019 Human error 3 11/02/2019 Qualitative risk assessment: Safety analysis 4 18/02/2019 Qualitative risk assessment: Event Tree and Fault Tree 5 25/02/2019 Tutorial I 6 04/03/2019 Model of random phenomena 7 11/03/2019 Structural reliability 8 18/03/2019 Monte Carlo simulation I + Hands-on session 9 25/03/2019 Tutorial II 10 01/04/2019 Monte Carlo simulation II + Tutorial III (Hands-on session) Edoardo Patelli University of Liverpool 18 March 2019 3 / 81 Introduction Summary Lecture #7 Safety Margin Fundamental problem Performance function defined as “Capacity” - “Demand” Safety margin: M = C − D = g(x) 2 For normal and independent random variables: M ∼ N(µM ; σM ) q 2 2 µM = µC − µD σM = σC + σD Reliability index β β = µM /σM represents the number of standard deviations by which the mean value of the safety margin M exceeds zero Edoardo Patelli University of Liverpool 18 March 2019 4 / 81 Introduction Summary Lecture #7 Safety Margin Fundamental problem Performance function defined as “Capacity” - “Demand” Safety margin: M = C − D = g(x) 2 For normal and independent random variables: M ∼ N(µM ; σM ) q 2 2 µM = µC − µD σM = σC + σD Reliability index β β = µM /σM represents the number of standard deviations by which the mean value of the safety margin M exceeds zero Edoardo Patelli University of Liverpool 18 March 2019 4 / 81 Introduction Summary Lecture #7 Reliability index Geometrical Interpretation/1 Edoardo Patelli University of Liverpool 18 March 2019 5 / 81 Monte Carlo method Introduction Lecture Outline 1 Introduction 2 Monte Carlo method Random Number Generator Sampling Methods Buffon’s experiment Monte Carlo integration Probability of failure 3 Summary 4 Computer based class Some useful slides Assignments Edoardo Patelli University of Liverpool 18 March 2019 6 / 81 Monte Carlo method Introduction What is the Monte Carlo method? Edoardo Patelli University of Liverpool 18 March 2019 7 / 81 Monte Carlo method Introduction Monte Carlo method Computation technique based on random numbers Numerical experiment by generating a random sequence of number with prescribed probability distribution. Collecting quantity of interest Edoardo Patelli University of Liverpool 18 March 2019 8 / 81 Monte Carlo method Introduction Monte Carlo method How did Monte Carlo simulation get its name? Name derived from the Principality of Monaco Edoardo Patelli University of Liverpool 18 March 2019 9 / 81 Monte Carlo method Introduction Monte Carlo method How did Monte Carlo simulation get its name? Name derived from the Principality of Monaco Edoardo Patelli University of Liverpool 18 March 2019 9 / 81 Monte Carlo method Introduction Monte Carlo method Origins 1777 Comte de Buffon - earliest documented use of random sampling Edoardo Patelli University of Liverpool 18 March 2019 10 / 81 Monte Carlo method Introduction Monte Carlo method Origins 1777 Comte de Buffon - earliest documented use of random sampling 2 ∗ L P(needle intersects the grid) = πt Edoardo Patelli University of Liverpool 18 March 2019 10 / 81 Monte Carlo method Introduction Monte Carlo method Origins 1777 Comte de Buffon - earliest documented use of random sampling 2 ∗ L P(needle intersects the grid) = πt Edoardo Patelli University of Liverpool 18 March 2019 10 / 81 Monte Carlo method Introduction Monte Carlo method Origins 1777 Comte de Buffon - earliest documented use of random sampling 2 ∗ L P(needle intersects the grid) = πt Edoardo Patelli University of Liverpool 18 March 2019 10 / 81 Monte Carlo method Introduction Monte Carlo method Origins 1777 Comte de Buffon - earliest documented use of random sampling 2 ∗ L P(needle intersects the grid) = πt 1786 Laplace suggested to estimate π by random sampling Edoardo Patelli University of Liverpool 18 March 2019 10 / 81 Monte Carlo method Introduction Monte Carlo method Origins 1777 Comte de Buffon - earliest documented use of random sampling 2 ∗ L P(needle intersects the grid) = πt 1786 Laplace suggested to estimate π by random sampling http://mste.illinois.edu/reese/ buffon/bufjava.html Edoardo Patelli University of Liverpool 18 March 2019 10 / 81 Monte Carlo method Introduction Monte Carlo method Modern time 1930s, Enrico Fermi first experimented with the Monte Carlo Fermiac tools (transport of neutrons) Edoardo Patelli University of Liverpool 18 March 2019 11 / 81 Monte Carlo method Introduction Monte Carlo method Manhattan Project 1942-1946 Calculation of the explosive yield of atomic bomb Stanislaw Ulam suggested to used ENIAC for “method of statistic trials” Metropolis suggested the name “Monte Carlo” Von Neumann developed the first computer code (1947) Edoardo Patelli University of Liverpool 18 March 2019 12 / 81 Monte Carlo method Introduction Is it really used? Edoardo Patelli University of Liverpool 18 March 2019 13 / 81 Monte Carlo method Examples Monte Carlo applications Solution of integrals, differential equation, complex systems etc... Simulation random events Cryptography, Decision-Making Games Edoardo Patelli University of Liverpool 18 March 2019 14 / 81 Monte Carlo method Examples Monte Carlo applications Solution of integrals, differential equation, complex systems etc... Simulation random events Cryptography, Decision-Making Games Edoardo Patelli University of Liverpool 18 March 2019 14 / 81 Monte Carlo method Examples Monte Carlo applications Solution of integrals, differential equation, complex systems etc... Simulation random events Cryptography, Decision-Making Games Edoardo Patelli University of Liverpool 18 March 2019 14 / 81 Monte Carlo method Examples Monte Carlo applications Solution of integrals, differential equation, complex systems etc... Simulation random events Cryptography, Decision-Making Games Edoardo Patelli University of Liverpool 18 March 2019 14 / 81 Monte Carlo method Main components Monte Carlo method Main components Random number generator Probability distribution functions (describing the model) Sampling rules (how to sample from PDFs) Error estimator Variance reduction technique Computational resources Edoardo Patelli University of Liverpool 18 March 2019 15 / 81 Monte Carlo method Random Number Generator Lecture Outline 1 Introduction 2 Monte Carlo method Random Number Generator Sampling Methods Buffon’s experiment Monte Carlo integration Probability of failure 3 Summary 4 Computer based class Some useful slides Assignments Edoardo Patelli University of Liverpool 18 March 2019 16 / 81 Monte Carlo method Random Number Generator Random Number Generator Definition A tool or method able to generate an (automatic) sequence (of number) in which each term is unpredictable Edoardo Patelli University of Liverpool 18 March 2019 17 / 81 Monte Carlo method Random Number Generator Type of Random Number Generators Definitions True random Each element has equal probability of being chosen from the set Pseudo-random A finite set that display qualities of random numbers Edoardo Patelli University of Liverpool 18 March 2019 18 / 81 Monte Carlo method Random Number Generator Type of Random Number Generators True Random Number Generator vs Pseudo Random Number Generator Pseudo-Random True Random Number Number Generators Generators Characteristic Excellent efficiency Poor efficiency Deterministic Non-deterministic Periodic Aperiodic Applications Edoardo Patelli University of Liverpool 18 March 2019 19 / 81 Monte Carlo method Random Number Generator Type of Random Number Generators True Random Number Generator vs Pseudo Random Number Generator Pseudo-Random True Random Number Number Generators Generators Characteristic Excellent efficiency Poor efficiency Deterministic Non-deterministic Periodic Aperiodic Applications Simulation and Mod- elling, Video Games, Security Edoardo Patelli University of Liverpool 18 March 2019 19 / 81 Monte Carlo method Random Number Generator Type of Random Number Generators True Random Number Generator vs Pseudo Random Number Generator Pseudo-Random True Random Number Number Generators Generators Characteristic Excellent efficiency Poor efficiency Deterministic Non-deterministic Periodic Aperiodic Applications Simulation and Mod- Lottery and Draws, elling, Video Games, Random Sampling, Security Games and Gambling Edoardo Patelli University of Liverpool 18 March 2019 19 / 81 Monte Carlo method Random Number Generator Pseudo-Random Number Generator Anyone who considers arithmetical methods of producing random digits is, of course, in a state of sin (John Von Neumann, 1951) Edoardo Patelli University of Liverpool 18 March 2019 20 / 81 Monte Carlo method Random Number Generator Pseudo-Random Number Generator Characteristics Approximate the PDF Statistically independent Should pass a battery of statistical tests Be aperiodic Difficult to prove whether a sequence of numbers is random Edoardo Patelli University of Liverpool 18 March 2019 21 / 81 Monte Carlo method Random Number Generator Pseudo-Random Number Generator Characteristics Approximate