Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Parallel Programming in C with MPI and OpenMP Michael J. Quinn.

Slides:



Advertisements
Similar presentations
RSLAB-NTU Lab for Remote Sensing Hydrology and Spatial Modeling 1 An Introduction to R Pseudo Random Number Generation (PRNG) Prof. Ke-Sheng Cheng Dept.
Advertisements

Prepared 7/28/2011 by T. O’Neil for 3460:677, Fall 2011, The University of Akron.
Generating Random Numbers
Monte Carlo Methods and Statistical Physics
Random Number Generation. Random Number Generators Without random numbers, we cannot do Stochastic Simulation Most computer languages have a subroutine,
SE503 Advanced Project Management Dr. Ahmed Sameh, Ph.D. Professor, CS & IS Project Uncertainty Management.
Efficient Cosmological Parameter Estimation with Hamiltonian Monte Carlo Amir Hajian Amir Hajian Cosmo06 – September 25, 2006 Astro-ph/
Random number generation Algorithms and Transforms to Univariate Distributions.
The General Linear Model. The Simple Linear Model Linear Regression.
Simulation Where real stuff starts. ToC 1.What, transience, stationarity 2.How, discrete event, recurrence 3.Accuracy of output 4.Monte Carlo 5.Random.
Using random numbers Simulation: accounts for uncertainty: biology (large number of individuals), physics (large number of particles, quantum mechanics),
Chapter 6 Continuous Random Variables and Probability Distributions
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Parallel Programming with MPI and OpenMP Michael J. Quinn.
1 Random Number Generation H Plan: –Introduce basics of RN generation –Define concepts and terminology –Introduce RNG methods u Linear Congruential Generator.
Lecture 10 Outline Monte Carlo methods History of methods
Lecture 10 Outline Monte Carlo methods Monte Carlo methods History of methods History of methods Sequential random number generators Sequential random.
Statistics.
K. Desch – Statistical methods of data analysis SS10
CSCE Monte Carlo Methods When you can’t do the math, simulate the process with random numbers Numerical integration to get areas/volumes Particle.
D Nagesh Kumar, IIScOptimization Methods: M1L4 1 Introduction and Basic Concepts Classical and Advanced Techniques for Optimization.
Statistics for Managers Using Microsoft Excel, 4e © 2004 Prentice-Hall, Inc. Chap 6-1 Chapter 6 The Normal Distribution and Other Continuous Distributions.
A) Transformation method (for continuous distributions) U(0,1) : uniform distribution f(x) : arbitrary distribution f(x) dx = U(0,1)(u) du When inverse.
The Monte Carlo Method: an Introduction Detlev Reiter Research Centre Jülich (FZJ) D Jülich
APPENDIX D RANDOM NUMBER GENERATION
Random-Number Generation. 2 Properties of Random Numbers Random Number, R i, must be independently drawn from a uniform distribution with pdf: Two important.
Random Number Generation Fall 2013
Fall 2011 CSC 446/546 Part 6: Random Number Generation.
Optimization of thermal processes2007/2008 Optimization of thermal processes Maciej Marek Czestochowa University of Technology Institute of Thermal Machinery.
ETM 607 – Random Number and Random Variates
Introduction to Monte Carlo Methods D.J.C. Mackay.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. by Lale Yurttas, Texas A&M University Chapter 31.
1 CE 530 Molecular Simulation Lecture 7 David A. Kofke Department of Chemical Engineering SUNY Buffalo
Simulation of Random Walk How do we investigate this numerically? Choose the step length to be a=1 Use a computer to generate random numbers r i uniformly.
1 Statistical Mechanics and Multi- Scale Simulation Methods ChBE Prof. C. Heath Turner Lecture 11 Some materials adapted from Prof. Keith E. Gubbins:
Random Number Generators CISC/QCSE 810. What is random? Flip 10 coins: how many do you expect will be heads? Measure 100 people: how are their heights.
A SCALABLE LIBRARY FOR PSEUDORANDOM NUMBER GENERATION ALGORITHM 806: SPRNG.
Chapter 14 Monte Carlo Simulation Introduction Find several parameters Parameter follow the specific probability distribution Generate parameter.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 4 Curve Fitting.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Parallel Programming in C with MPI and OpenMP Michael J. Quinn.
Random-Number Generation Andy Wang CIS Computer Systems Performance Analysis.
CS433 Modeling and Simulation Lecture 15 Random Number Generator Dr. Anis Koubâa 24 May 2009 Al-Imam Mohammad Ibn Saud Islamic University College Computer.
CPSC 531: RN Generation1 CPSC 531:Random-Number Generation Instructor: Anirban Mahanti Office: ICT Class Location:
Chapter 7 Random-Number Generation
Module 1: Statistical Issues in Micro simulation Paul Sousa.
Basic Concepts in Number Theory Background for Random Number Generation 1.For any pair of integers n and m, m  0, there exists a unique pair of integers.
Random Number Generators 1. Random number generation is a method of producing a sequence of numbers that lack any discernible pattern. Random Number Generators.
Monte Carlo Methods.
Experimental Method and Data Process: “Monte Carlo Method” Presentation # 1 Nafisa Tasneem CHEP,KNU
Monte Carlo Methods1 T Special Course In Information Science II Tomas Ukkonen
Simulated Annealing.
Monte Carlo Methods So far we have discussed Monte Carlo methods based on a uniform distribution of random numbers on the interval [0,1] p(x) = 1 0  x.
APPENDIX D R ANDOM N UMBER G ENERATION Organization of chapter in ISSO* – General description and linear congruential generators Criteria for “good” random.
Monté Carlo Simulation  Understand the concept of Monté Carlo Simulation  Learn how to use Monté Carlo Simulation to make good decisions  Learn how.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 22.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 3.
Molecular Modelling - Lecture 2 Techniques for Conformational Sampling Uses CHARMM force field Written in C++
Pseudo-random-number generators. Random numbers: the numbers generated by a stochastic process They are indispensible in any simulations based on radom.
Parallel Random Number Generation
EMIS 7300 SYSTEMS ANALYSIS METHODS FALL 2005 Dr. John Lipp Copyright © 2005 Dr. John Lipp.
Gil McVean, Department of Statistics Thursday February 12 th 2009 Monte Carlo simulation.
G. Cowan Lectures on Statistical Data Analysis Lecture 5 page 1 Statistical Data Analysis: Lecture 5 1Probability, Bayes’ theorem 2Random variables and.
0 Simulation Modeling and Analysis: Input Analysis 7 Random Numbers Ref: Law & Kelton, Chapter 7.
MONTE CARLO METHOD DISCRETE SIMULATION RANDOM NUMBER GENERATION Chapter 3 : Random Number Generation.
Introduction to Computer Simulation of Physical Systems (Lecture 10) Numerical and Monte Carlo Methods (CONTINUED) PHYS 3061.
1.  How does the computer generate observations from various distributions specified after input analysis?  There are two main components to the generation.
Parallel Programming in C with MPI and OpenMP
Subject Name: Operation Research Subject Code: 10CS661 Prepared By:Mrs
Lecture 2 – Monte Carlo method in finance
Statistical Methods for Data Analysis Random number generators
Where real stuff starts
Presentation transcript:

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Parallel Programming in C with MPI and OpenMP Michael J. Quinn

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 10 Monte Carlo Methods

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Objectives Introduce Monte Carlo methods Introduce Monte Carlo methods Introduce techniques for parallel random number generation Introduce techniques for parallel random number generation

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Outline Monte Carlo method Monte Carlo method Sequential random number generators Sequential random number generators Parallel random number generators Parallel random number generators Generating non-uniform random numbers Generating non-uniform random numbers Monte Carlo case studies Monte Carlo case studies

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Monte Carlo Method Solve a problem using statistical sampling Solve a problem using statistical sampling Name comes from Monaco’s gambling resort city Name comes from Monaco’s gambling resort city First important use in development of atomic bomb during World War II First important use in development of atomic bomb during World War II

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Applications of Monte Carlo Method Evaluating integrals of arbitrary functions of 6+ dimensions Evaluating integrals of arbitrary functions of 6+ dimensions Predicting future values of stocks Predicting future values of stocks Solving partial differential equations Solving partial differential equations Sharpening satellite images Sharpening satellite images Modeling cell populations Modeling cell populations Finding approximate solutions to NP-hard problems Finding approximate solutions to NP-hard problems

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Example of Monte Carlo Method Area = D 2 Area =  D 2 /4 D D

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Example of Monte Carlo Method Area = D 2

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Absolute Error Absolute error is a way to measure the quality of an estimate Absolute error is a way to measure the quality of an estimate The smaller the error, the better the estimate The smaller the error, the better the estimate a: actual value a: actual value e: estimated value e: estimated value Absolute error = |e-a|/a Absolute error = |e-a|/a

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Increasing Sample Size Reduces Error nEstimateError 1/(2n 1/2 ) , , , ,000, ,000, ,000, ,000,000,

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Mean Value Theorem

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Estimating Mean Value The expected value of (1/n)(f(x 0 ) + … + f(x n-1 )) is f

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Why Monte Carlo Works

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Why Monte Carlo is Effective Error in Monte Carlo estimate decreases by the factor 1/n 1/2 Error in Monte Carlo estimate decreases by the factor 1/n 1/2 Rate of convergence independent of integrand’s dimension Rate of convergence independent of integrand’s dimension Deterministic numerical integration methods do not share this property Deterministic numerical integration methods do not share this property Hence Monte Carlo superior when integrand has 6 or more dimensions Hence Monte Carlo superior when integrand has 6 or more dimensions

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Parallelism in Monte Carlo Methods Monte Carlo methods often amenable to parallelism Monte Carlo methods often amenable to parallelism Find an estimate about p times faster Find an estimate about p times faster OR OR Reduce error of estimate by p 1/2 Reduce error of estimate by p 1/2

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Random versus Pseudo-random Virtually all computers have “random number” generators Virtually all computers have “random number” generators Their operation is deterministic Their operation is deterministic Sequences are predictable Sequences are predictable More accurately called “pseudo-random number” generators More accurately called “pseudo-random number” generators In this chapter “random” is shorthand for “pseudo- random” In this chapter “random” is shorthand for “pseudo- random” “RNG” means “random number generator” “RNG” means “random number generator”

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Properties of an Ideal RNG Uniformly distributed Uniformly distributed Uncorrelated Uncorrelated Never cycles Never cycles Satisfies any statistical test for randomness Satisfies any statistical test for randomness Reproducible Reproducible Machine-independent Machine-independent Changing “seed” value changes sequence Changing “seed” value changes sequence Easily split into independent subsequences Easily split into independent subsequences Fast Fast Limited memory requirements Limited memory requirements

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. No RNG Is Ideal Finite precision arithmetic  finite number of states  cycles Finite precision arithmetic  finite number of states  cycles  Period = length of cycle  If period > number of values needed, effectively acyclic Reproducible  correlations Reproducible  correlations Often speed versus quality trade-offs Often speed versus quality trade-offs

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Linear Congruential RNGs Multiplier Additive constant Modulus Sequence depends on choice of seed, X 0

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Period of Linear Congruential RNG Maximum period is M Maximum period is M For 32-bit integers maximum period is 2 32, or about 4 billion For 32-bit integers maximum period is 2 32, or about 4 billion This is too small for modern computers This is too small for modern computers Use a generator with at least 48 bits of precision Use a generator with at least 48 bits of precision

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Producing Floating-Point Numbers X i, a, c, and M are all integers X i, a, c, and M are all integers X i s range in value from 0 to M-1 X i s range in value from 0 to M-1 To produce floating-point numbers in range [0, 1), divide X i by M To produce floating-point numbers in range [0, 1), divide X i by M

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Defects of Linear Congruential RNGs Least significant bits correlated Least significant bits correlated  Especially when M is a power of 2 k-tuples of random numbers form a lattice k-tuples of random numbers form a lattice  Especially pronounced when k is large

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Lagged Fibonacci RNGs p and q are lags, p > q p and q are lags, p > q * is any binary arithmetic operation * is any binary arithmetic operation Addition modulo M Addition modulo M Subtraction modulo M Subtraction modulo M Multiplication modulo M Multiplication modulo M Bitwise exclusive or Bitwise exclusive or

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Properties of Lagged Fibonacci RNGs Require p seed values Require p seed values Careful selection of seed values, p, and q can result in very long periods and good randomness Careful selection of seed values, p, and q can result in very long periods and good randomness For example, suppose M has b bits For example, suppose M has b bits Maximum period for additive lagged Fibonacci RNG is (2 p -1)2 b-1 Maximum period for additive lagged Fibonacci RNG is (2 p -1)2 b-1

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Ideal Parallel RNGs All properties of sequential RNGs All properties of sequential RNGs No correlations among numbers in different sequences No correlations among numbers in different sequences Scalability Scalability Locality Locality

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Parallel RNG Designs Manager-worker Manager-worker Leapfrog Leapfrog Sequence splitting Sequence splitting Independent sequences Independent sequences

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Manager-Worker Parallel RNG Manager process generates random numbers Manager process generates random numbers Worker processes consume them Worker processes consume them If algorithm is synchronous, may achieve goal of consistency If algorithm is synchronous, may achieve goal of consistency Not scalable Not scalable Does not exhibit locality Does not exhibit locality

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Leapfrog Method Process with rank 1 of 4 processes

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Properties of Leapfrog Method Easy modify linear congruential RNG to support jumping by p Easy modify linear congruential RNG to support jumping by p Can allow parallel program to generate same tuples as sequential program Can allow parallel program to generate same tuples as sequential program Does not support dynamic creation of new random number streams Does not support dynamic creation of new random number streams

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Sequence Splitting Process with rank 1 of 4 processes

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Properties of Sequence Splitting Forces each process to move ahead to its starting point Forces each process to move ahead to its starting point Does not support goal of reproducibility Does not support goal of reproducibility May run into long-range correlation problems May run into long-range correlation problems Can be modified to support dynamic creation of new sequences Can be modified to support dynamic creation of new sequences

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Independent Sequences Run sequential RNG on each process Run sequential RNG on each process Start each with different seed(s) or other parameters Start each with different seed(s) or other parameters Example: linear congruential RNGs with different additive constants Example: linear congruential RNGs with different additive constants Works well with lagged Fibonacci RNGs Works well with lagged Fibonacci RNGs Supports goals of locality and scalability Supports goals of locality and scalability

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Other Distributions Analytical transformations Analytical transformations Box-Muller Transformation Box-Muller Transformation Rejection method Rejection method

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Analytical Transformation

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Exponential Distribution 1.0

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Example 1: Produce four samples from an exponential distribution with mean 3 Produce four samples from an exponential distribution with mean 3 Uniform sample: 0.540, 0.619, 0.452, Uniform sample: 0.540, 0.619, 0.452, Take natural log of each value and multiply by -3 Take natural log of each value and multiply by -3 Exponential sample: 1.850, 1.440, 2.317, Exponential sample: 1.850, 1.440, 2.317, 7.072

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Example 2: Simulation advances in time steps of 1 second Simulation advances in time steps of 1 second Probability of an event happening is from an exponential distribution with mean 5 seconds Probability of an event happening is from an exponential distribution with mean 5 seconds What is probability that event will happen in next second? What is probability that event will happen in next second? 1/5 1/5 Use uniform random number to test for occurrence of event Use uniform random number to test for occurrence of event

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Box-Muller Transformation Cannot invert cumulative distribution function to produce formula yielding random numbers from normal (gaussian) distribution Cannot invert cumulative distribution function to produce formula yielding random numbers from normal (gaussian) distribution Box-Muller transformation produces a pair of standard deviates g 1 and g 2 from a pair of normal deviates u 1 and u 2 Box-Muller transformation produces a pair of standard deviates g 1 and g 2 from a pair of normal deviates u 1 and u 2

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Box-Muller Transformation repeat v 1  2u v 2  2u r  v v 2 2 until r > 0 and r < 1 f  sqrt (-2 ln r /r ) g 1  f v 1 g 2  f v 2

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Example Produce four samples from a normal distribution with mean 0 and standard deviation 1 Produce four samples from a normal distribution with mean 0 and standard deviation 1 u1u1u1u1 u2u2u2u2 v1v1v1v1 v2v2v2v2rf g1g1g1g1 g2g2g2g

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Different Mean, Std. Dev. g 1  s f v 1 + m g 2  s f v 2 + m Standard deviationMean

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Rejection Method

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Example Generate random variables from this probability density function Generate random variables from this probability density function

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Example (cont.) So  h(x)  f(x) for all x

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Example (cont.) xixixixi uiuiuiui u i  h(x i ) f(x i ) Outcome Reject Accept Reject Accept Two samples from f(x) are and 1.306

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Case Studies (Topics Introduced) Neutron transport (Monte Carlo time) Neutron transport (Monte Carlo time) Temperature inside a 2-D plate (Random walk) Temperature inside a 2-D plate (Random walk) Two-dimensional Ising model (Metropolis algorithm) Two-dimensional Ising model (Metropolis algorithm) Room assignment problem (Simulated annealing) Room assignment problem (Simulated annealing) Parking garage (Monte Carlo time) Parking garage (Monte Carlo time) Traffic circle (Simulating queues) Traffic circle (Simulating queues)

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Neutron Transport

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Example D (0-  ) Angleu(0-1)L (-ln u) LcosD Dist.Absorb?(0-1) (no) (no) (no) Monte Carlo Time 3.0

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Temperature Inside a 2-D Plate Random walk

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Example of Random Walk

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 2-D Ising Model

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Metropolis Algorithm Use current random sample to generate next random sample Use current random sample to generate next random sample Series of samples represents a random walk through the probability density function Series of samples represents a random walk through the probability density function Short series of samples highly correlated Short series of samples highly correlated Many samples can provide good coverage Many samples can provide good coverage

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Metropolis Algorithm Details Randomly select site to reverse spin Randomly select site to reverse spin If energy is lower, move to new state If energy is lower, move to new state Otherwise, move with probability  = e -  /kT Otherwise, move with probability  = e -  /kT Rejection causes current state to be recorded another time Rejection causes current state to be recorded another time

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Room Assignment Problem ABCDEF A B C D E F “Dislikes” matrix Pairing A-B, C-D, and E-F leads to total conflict value of 32.

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Physical Annealing Heat a solid until it melts Heat a solid until it melts Cool slowly to allow material to reach state of minimum energy Cool slowly to allow material to reach state of minimum energy Produces strong, defect-free crystal with regular structure Produces strong, defect-free crystal with regular structure

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Simulated Annealing Makes analogy between physical annealing and solving combinatorial optimization problem Makes analogy between physical annealing and solving combinatorial optimization problem Solution to problem = state of material Solution to problem = state of material Value of objective function = energy associated with state Value of objective function = energy associated with state Optimal solution = minimum energy state Optimal solution = minimum energy state

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. How Simulated Annealing Works Iterative algorithm, slowly lower T Iterative algorithm, slowly lower T Randomly change solution to create alternate solution Randomly change solution to create alternate solution Compute , the change in value of objective function Compute , the change in value of objective function If  < 0, then jump to alternate solution If  < 0, then jump to alternate solution Otherwise, jump to alternate solution with probability e -  /T Otherwise, jump to alternate solution with probability e -  /T

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Performance of Simulated Annealing Rate of convergence depends on initial value of T and temperature change function Rate of convergence depends on initial value of T and temperature change function Geometric temperature change functions typical; e.g., T i+1 = T i Geometric temperature change functions typical; e.g., T i+1 = T i Not guaranteed to find optimal solution Not guaranteed to find optimal solution Same algorithm using different random number streams can converge on different solutions Same algorithm using different random number streams can converge on different solutions Opportunity for parallelism Opportunity for parallelism

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Convergence Starting with higher initial temperature leads to more iterations before convergence

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Parking Garage Parking garage has S stalls Parking garage has S stalls Car arrivals fit Poisson distribution with mean A Car arrivals fit Poisson distribution with mean A Stay in garage fits a normal distribution with mean M and standard deviation M/S Stay in garage fits a normal distribution with mean M and standard deviation M/S

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Implementation Idea Current Time Times Spaces Are Available 15 Car CountCars Rejected 2

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Traffic Circle

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Traffic Circle Probabilities F N0.33 E0.50 S0.25 W0.33DNESWN E S W

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Traffic Circle Data Structures

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Summary (1/3) Applications of Monte Carlo methods Applications of Monte Carlo methods  Numerical integration  Simulation Random number generators Random number generators  Linear congruential  Lagged Fibonacci

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Summary (2/3) Parallel random number generators Parallel random number generators  Manager/worker  Leapfrog  Sequence splitting  Independent sequences Non-uniform distributions Non-uniform distributions  Analytical transformations  Box-Muller transformation  Rejection method

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Summary (3/3) Concepts revealed in case studies Concepts revealed in case studies  Monte Carlo time  Random walk  Metropolis algorithm  Simulated annealing  Modeling queues