CS 521 Computational Science 1 Random Numbers and Monte Carlo Methods Charles Erwin and Jay Hatcher.

Slides:



Advertisements
Similar presentations
Using random numbers Simulation: accounts for uncertainty: biology (large number of individuals), physics (large number of particles, quantum mechanics),
Advertisements

Generating Random Numbers
Random Number Generation Graham Netherton Logan Stelly.
History of Random Number Generators Bob De Vivo Probability and Statistics Summer 2005.
Random Numbers. Two Types of Random Numbers 1.True random numbers: True random numbers are generated in non- deterministic ways. They are not predictable.
Introduction to Sampling based inference and MCMC Ata Kaban School of Computer Science The University of Birmingham.
BAYESIAN INFERENCE Sampling techniques
Optimization methods Morten Nielsen Department of Systems biology, DTU.
Simulation Where real stuff starts. ToC 1.What, transience, stationarity 2.How, discrete event, recurrence 3.Accuracy of output 4.Monte Carlo 5.Random.
Sampling Attila Gyulassy Image Synthesis. Overview Problem Statement Random Number Generators Quasi-Random Number Generation Uniform sampling of Disks,
Computational statistics 2009 Random walk. Computational statistics 2009 Random walk with absorbing barrier.
Stream cipher diagram + + Recall: One-time pad in Chap. 2.
Using random numbers Simulation: accounts for uncertainty: biology (large number of individuals), physics (large number of particles, quantum mechanics),
Using random numbers Simulation: accounts for uncertainty: biology (large number of individuals), physics (large number of particles, quantum mechanics),
Genetic Algorithms Can Be Used To Obtain Good Linear Congruential Generators Presented by Ben Sproat.
1 Lecture 12 Monte Carlo methods in parallel computing Parallel Computing Fall 2008.
Pseudorandom Number Generators
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Parallel Programming in C with MPI and OpenMP Michael J. Quinn.
CSCE Monte Carlo Methods When you can’t do the math, simulate the process with random numbers Numerical integration to get areas/volumes Particle.
Cryptography and Network Security Chapter 7
Random Thoughts 2012 (COMP 066) Jan-Michael Frahm Jared Heinly.
15-853Page :Algorithms in the Real World Generating Random and Pseudorandom Numbers.
Random Number Generation Fall 2013
Cryptography and Network Security Chapter 7 Fifth Edition by William Stallings Lecture slides by Lawrie Brown.
Monte Carlo Methods: Basics
Classical and Quantum Monte Carlo Methods Or: Why we know as little as we do about interacting fermions Erez Berg Student/Postdoc Journal Club, Oct
Computational Methods in Physics PHYS 3437 Dr Rob Thacker Dept of Astronomy & Physics (MM-301C)
Cryptography and Network Security (CS435)
Free energies and phase transitions. Condition for phase coexistence in a one-component system:
Random Numbers CSE 331 Section 2 James Daly. Randomness Most algorithms we’ve talked about have been deterministic The same inputs always give the same.
Random Number Generators Tamer ÖZ. Random Number Generators OUTLINE Randomness And Random Number Usefulness Of Random Numbers Random Number Generators.
Stochastic Algorithms Some of the fastest known algorithms for certain tasks rely on chance Stochastic/Randomized Algorithms Two common variations – Monte.
Introduction to Monte Carlo Simulation. What is a Monte Carlo simulation? In a Monte Carlo simulation we attempt to follow the `time dependence’ of a.
Monte Carlo and Statistical Methods in HEP Kajari Mazumdar Course on Particle Physics, TIFR, August, 2009.
Chapter 7 Random-Number Generation
Information Security Lab. Dept. of Computer Engineering 182/203 PART I Symmetric Ciphers CHAPTER 7 Confidentiality Using Symmetric Encryption 7.1 Placement.
Random Numbers and Simulation  Generating truly random numbers is not possible Programs have been developed to generate pseudo-random numbers Programs.
P T A typical experiment in a real (not virtual) space 1.Some material is put in a container at fixed T & P. 2.The material is in a thermal fluctuation,
Random Number Generators 1. Random number generation is a method of producing a sequence of numbers that lack any discernible pattern. Random Number Generators.
Pseudo-random generators Random Number Generating There are three types of generators table look-up generators hardware generators algorithmic (software)
Monte Carlo Methods.
Monte Carlo Methods in Statistical Mechanics Aziz Abdellahi CEDER group Materials Basics Lecture : 08/18/
Experimental Method and Data Process: “Monte Carlo Method” Presentation # 1 Nafisa Tasneem CHEP,KNU
Monte Carlo Methods Versatile methods for analyzing the behavior of some activity, plan or process that involves uncertainty.
Chapter 7 – Confidentiality Using Symmetric Encryption.
Chapter 7 Confidentiality Using Symmetric Encryption.
, Patrik Huber.  One of our goals: Evaluation of the posterior p(Z|X)  Exact inference  In practice: often infeasible to evaluate the posterior.
Monte Carlo Process Risk Analysis for Water Resources Planning and Management Institute for Water Resources 2008.
Molecular Modelling - Lecture 2 Techniques for Conformational Sampling Uses CHARMM force field Written in C++
Incremental Integration of Computational Physics into Traditional Undergraduate Courses Kelly R. Roos, Department of Physics, Bradley University Peoria,
Fall 2006CS 395: Computer Security1 Confidentiality Using Symmetric Encryption.
Application of the MCMC Method for the Calibration of DSMC Parameters James S. Strand and David B. Goldstein The University of Texas at Austin Sponsored.
The Markov Chain Monte Carlo Method Isabelle Stanton May 8, 2008 Theory Lunch.
Random numbers in C++ Nobody knows what’s next....
CHAPTER 5 Simulation Modeling. Introduction In many situations a modeler is unable to construct an analytic (symbolic) model adequately explaining the.
G. Cowan Lectures on Statistical Data Analysis Lecture 5 page 1 Statistical Data Analysis: Lecture 5 1Probability, Bayes’ theorem 2Random variables and.
Chapter 7 – Confidentiality Using Symmetric Encryption.
0 Simulation Modeling and Analysis: Input Analysis 7 Random Numbers Ref: Law & Kelton, Chapter 7.
1.  How does the computer generate observations from various distributions specified after input analysis?  There are two main components to the generation.
The Monte Carlo Method/ Markov Chains/ Metropolitan Algorithm from sec in “Adaptive Cooperative Systems” -summarized by Jinsan Yang.
Monte Carlo Methods and Grid Computing
MONTE CARLO SIMULATION
Generating Random Numbers
Monte Carlo methods 10/20/11.
Parallel Programming in C with MPI and OpenMP
Random Number Generation
Metaheuristic methods and their applications. Optimization Problems Strategies for Solving NP-hard Optimization Problems What is a Metaheuristic Method?
Computer Simulation Techniques Generating Pseudo-Random Numbers
Generating Random and Pseudorandom Numbers
Generating Random and Pseudorandom Numbers
Presentation transcript:

CS 521 Computational Science 1 Random Numbers and Monte Carlo Methods Charles Erwin and Jay Hatcher

CS 521 Computational Science 2 Random Numbers

CS 521 Computational Science 3 Introduction What are “Random Numbers?” Where do Random Numbers Come from? How to make Random numbers?

CS 521 Computational Science 4 Random Numbers Not just looking for a random number. –Looking for a sequence of numbers that doesn’t repeat. –Do not want a sequence that is deterministic! Seed: Number that begins the sequence. –Generally the only number that is known initially.

CS 521 Computational Science 5 Why use Random Numbers? Statistical Sampling Cryptography/Cryptanalysis Gaming Analysis of Algorithms Simulation Input

CS 521 Computational Science 6 Where to find Random Numbers Tables of Random Numbers –Classic Example: RAND corp’s A Million Random Digits with 100,000 Normal DeviatesA Million Random Digits with 100,000 Normal Deviates –Generated with Electronic simulation of roulette wheel attached to a computer. –Early example of hardware Random Number generator. Random Number Generator

CS 521 Computational Science 7 Ideas for Random Sequences? von Neumann’s “Squaring” Method –Take a number, square it, and then use the middle digits as the random number. –What about a seed of 0000? Linear Congruential Generator –Xn = (aXn-1 + c) mod m –Xo = seed, modulus m, muliplier a, and increment c –Repeats due to the modular arithmetic that forces wrapping of values into the desired range.

CS 521 Computational Science 8 Linear Congruential Generator Problems (cont)

CS 521 Computational Science 9 Random Numbers from Hardware Linux Example: /dev/random –Generated by many different factors observed by the operating systems –Avoids tracking things such as network traffic that can be manipulated by outsiders. Other inputs for random information: –Readings from a Geiger counter –Detected noise from a radio receiver –Thermal or quantum-mechanical noise, amplified to provide a random voltage source.

CS 521 Computational Science 10 Random Numbers from Hardware (cont) Internal CPU Random Number Generator –Modern Intel chips feature an internal RNG –Samples thermal noise by amplifying the voltage measured across undriven resistors. –Analysis determines it cryptographically sound. Unconventional Source: Lava Lamps –Random bits are extracted from images of the erupting blobs inside six Lava Lite lamps. No longer available. –LavaRnd provided random data using similar methods. –

CS 521 Computational Science 11 Random Numbers from Hardware (cont) Commercial Random Number Generators –Operate from USB or Serial connections –Standard mode is to deliver one byte of data at a time. –Current models pass DIEHARD battery of testsDIEHARD –Very fast generation. –Prices range anywhere from ~$100 to more than $1,000 per unit.

CS 521 Computational Science 12 Software Random Generators Random Number Algorithm an oxymoron. –von Neumann: “Anyone who uses software to produce random numbers is in a state of sin” –Deterministic Random number generators are called “Pseudorandom Number generators” –Clever algorithms can create sequences that are relatively random.

CS 521 Computational Science 13 Modern Generator Example 1 Mersenne Twister by Makoto Matsumoto and Takuji Nishimura Mersenne TwisterMakoto Matsumoto –Period size: 2^ –Freely Available in C source code –Fast (used to be much faster than the C rand() functionality but rand() has since been improved) –Not cryptographically secure

CS 521 Computational Science 14 Modern Generator Example 2 Blum Blum Shub (BBS) by Lenore Blum, Manuel Blum and Michael Shub Blum Blum Shub Lenore Blum Manuel BlumMichael Shub –Xn+1 = (Xn)2 mod M –M=pq is the product of two large primes p and q –Proven to be cryptographically secure –Very slow

CS 521 Computational Science 15 Summary of Algorithms Different generators are more appropriate for specific circumstances. –For Cryptanalysis or Cryptography, finding an algorithm which is cryptographically secure is essential. –For Simulations such as Monte-Carlo, a fast algorithm is preferred.

CS 521 Computational Science 16 Summary (cont.) If your application is security based, your choices are limited to cryptographically secure random number generators. Otherwise, use the normal algorithm analysis questions of correctness and complexity.

CS 521 Computational Science 17 Quick list of References Linear Congruential Generator: Randomness as a Resource: Hardware Random Number Generators: Mersenne Twister: mat/MT/emt.htmlhttp:// mat/MT/emt.html Blum Blum Shub: Shub_pseudorandom_number_generatorhttp://en.wikipedia.org/wiki/Blum-Blum- Shub_pseudorandom_number_generator DIEHARD Random Tests: Security Requirements for Random Numbers: Intel’s internal RNG:

CS 521 Computational Science 18 Monte Carlo Methods

CS 521 Computational Science 19 Introduction “Monte Carlo” was coined by Metropolis during the Manhattan Project of WWII Named after a resort town in Monaco famous for its casinos Monte Carlo methods use statistical simulation to approximate a solution to a problem

CS 521 Computational Science 20 Integration Methods Direct Sampling Random Walk and Markov Chains

CS 521 Computational Science 21 Integration Methods (cont) Direct Sampling –Importance Sampling –Stratified Sampling –Adaptive Monte Carlo –VEGAS algorithm –Recursive Stratified Sampling

CS 521 Computational Science 22 Integration Methods (cont) Markov Chain Monte Carlo (MCMC) –Random Walks –Metropolis-Hastings Algorithm –Gibbs Sampling

CS 521 Computational Science 23 Optimization Methods Genetic Algorithms Simulated Annealing Parallel Tempering

CS 521 Computational Science 24 Optimization Methods (cont) Genetic Algorithms –Explore solution space using subsequent generations –Generations that are better are combined and/or mutated to try to produce an even better solution

CS 521 Computational Science 25 Optimization Methods (cont) Simulated Annealing –Inspired by annealing in metallurgy –Nearby solutions are compared to the global temperature T –T is gradually decreased

CS 521 Computational Science 26 Optimization Methods (cont) Parallel Tempering –Run two or more simulations concurrently at different temperatures –Pay attention to overlap between the two systems and use the overlap to pick more likely solutions

CS 521 Computational Science 27 Other Methods Direct Simulation –Stochastic simulation of rarefied gas flows –DSMC DemoDSMC Demo Dynamic Monte Carlo –models the dynamic behaviors of molecules Quantum Monte Carlo –Applies MC to the Schrödinger wave equation in quantum mechanics

CS 521 Computational Science 28 Example: Approximating π π is 4 times the number of darts in the shaded part of the quadrant divided by the total darts in the quadrant Buffon’s Needle

CS 521 Computational Science 29 Applications Radiation transport Operations research Nuclear criticality Design of nuclear reactors Design of nuclear weapons Statistical physics Phase transitions Wetting and growth of thin films Reinforcement Learning Genetic Programming Atomic wave functions and Intranuclear cascade reactions eigenvalues Thermodynamic properties Long chain coiling polymers Reaction kinetics Partial differential equations Large sets of linear equations Numerical integration Uncertainty analysis Development of statistical tests Cell population studies Combinatorial problem Search and optimization Signal detection WarGames

CS 521 Computational Science 30 References and Additional Info Introduction to Monte Carlo Methods – Adaptive and Recursive Monte Carlo Methods – The WWW Virtual Library: Monte Carlo Methods – The Basics of Monte Carlo Simulations – Advanced Monte Carlo Methods – Monte Carlo Methods (Reinforcement Learning) – Buffon’s Needle (applet) – Direct Simulation MC –