+ All Categories
Home > Documents > Monte Carlo Methods

Monte Carlo Methods

Date post: 15-Mar-2016
Category:
Upload: ruth-baldwin
View: 47 times
Download: 4 times
Share this document with a friend
Description:
Monte Carlo Methods. Mark A. Novotny Dept. of Physics and Astronomy Mississippi State U. [email protected]. Random topics about random things for random people. Supported in part by NSF DMR0120310 and ITR/AP(MPS)0113049. Where is Monte Carlo?. Europe Principality of Monaco - PowerPoint PPT Presentation
56
NIHES EERC Oct. 25, 2002 Monte Carlo Methods Mark A. Novotny Dept. of Physics and Astronomy Mississippi State U. [email protected] Supported in part by NSF DMR0120310 and ITR/AP(MPS)0113049 Random topics about random things for random people
Transcript
Page 1: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Monte Carlo MethodsMark A. Novotny

Dept. of Physics and Astronomy

Mississippi State U.

[email protected]

Supported in part by NSF DMR0120310 and ITR/AP(MPS)0113049

Random topics about random things for random people

Page 2: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Where is Monte Carlo?

• Europe• Principality of Monaco• Monte Carlo is 1 of 5

regions of Monaco• Monte Carlo founded in

1866 by Prince Charles III• Renowned casino,

luxurious hotels, beaches, …

Page 3: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

What is a Monte Carlo simulation?

•In a Monte Carlo simulation we attempt to follow the `time dependence’ of a model for which change, or growth, does not proceed in some rigorously predefined fashion (e.g. according to Newton’s equations of motion) but rather in a stochastic manner which depends on a sequence of random numbers which is generated during the simulation.•Landau and Binder, A Guide to Monte Carlo Simulations in Statistical Physics (Cambridge U. Press, Cambridge U.K., 2000), p. 1.

Page 4: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Birth of the Monte Carlo method

• Los Alamos National Laboratory• 1953 Physical Review• Metropolis, Rosenbluth,

Rosenbluth, Teller, and Teller• Conferences/MonteCarloMethods/

“The only good Monte Carlo is a dead Monte Carlo.” Trotter and Turkey, 1954

Page 5: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

OUTLINE

• Random numbers• Integrals via Monte

Carlo• Importance Sampling

Monte Carlo• Dynamic Monte Carlo• Decay of nuclei (birth-

death processes)

• Random motion in 1 dimension

• Long-time simulations (Monte Carlo with Absorbing Markov Chains, MCAMC)

• Parallel dynamic Monte Carlo simulations

Page 6: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

OUTLINE

• Random numbers• Integrals via Monte

Carlo• Importance Sampling

Monte Carlo• Dynamic Monte Carlo• Decay of nuclei (birth-

death processes)

• Random motion in 1 dimension

• Long-time simulations (Monte Carlo with Absorbing Markov Chains, MCAMC)

• Parallel dynamic Monte Carlo simulations

Page 7: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

(not-really, but almost) Random Numbers

• Uniformly distributed numbers in [0,1]• How good is `good enough’?• `religious question’• Linear congruential, R250R250, Marsaglia, 4-tap4-tap,

system supplied

•Anyone who considers arithmetical methods of producing random digits is, of course, in a state of sin.•John von Neumann (1951)

Page 8: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

(not-really, but almost) Random Numbers from R250

• Xn = XOR( Xn-p , Xn-q )• XOR(,) is exclusive OR operator• With p2+q2+1=prime • (p and q are Mersine primes)

• R98: p=98, q=27• R250: p=250, q=103• R1279: p=1279, q=216 or 418• R9689: p=9689, q=84, 471, 1836, 2444, or 4187

Page 9: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

OUTLINE

• Random numbers• Integrals via Monte

Carlo• Importance Sampling

Monte Carlo• Dynamic Monte Carlo• Decay of nuclei (birth-

death processes)

• Random motion in 1 dimension

• Long-time simulations (Monte Carlo with Absorbing Markov Chains, MCAMC)

• Parallel dynamic Monte Carlo simulations

Page 10: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Calculate =pi using Monte Carlo

• Set Nin=0• Do N times

o Calculate 3 random numbers, r1, r2, r3

o Let x=r1

o Let y=r2

o Use r3 to choose quadrant (change signs of x and y)

o If x2+y2.le.1 set Nin=Nin+1

• Estimate for =pi = 4 Nin / N

Page 11: Monte Carlo Methods

Calculate using Monte Carlo

N=103 N=104 N=105

Live or die by the Law of Large Numbers

Page 12: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

OUTLINE

• Random numbers• Integrals via Monte

Carlo• Importance Sampling

Monte Carlo• Dynamic Monte Carlo• Decay of nuclei (birth-

death processes)

• Random motion in 1 dimension

• Long-time simulations (Monte Carlo with Absorbing Markov Chains, MCAMC)

• Parallel dynamic Monte Carlo simulations

Page 13: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Importance Sampling Monte Carlo

• Old way: choose points with equal probability from rectangle with a<xi<b and

0<y<y0; and then use estimate yestimate=i f(xi) (b-a) y0

• Rather choose points with importance of the value of the function at that point to the integral, p(x)

• Estimate of integral yestimate=i p-1(xi) f(xi)

a b

y0

0

Page 14: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

OUTLINE

• Random numbers• Integrals via Monte

Carlo• Importance Sampling

Monte Carlo• Dynamic Monte Carlo• Decay of nuclei (birth-

death processes)

• Random motion in 1 dimension

• Long-time simulations (Monte Carlo with Absorbing Markov Chains, MCAMC)

• Parallel dynamic Monte Carlo simulations

Page 15: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Dynamic Monte Carlo

• For Static Monte Carlo the order of generation of points does not matter (like finding the integrals)

• For Dynamic Monte Carlo the order does matter• This gives a Markov chain method, governed by the Master

Equation

Page 16: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

OUTLINE

• Random numbers• Integrals via Monte

Carlo• Importance Sampling

Monte Carlo• Dynamic Monte Carlo• Decay of nuclei (birth-

death processes)

• Random motion in 1 dimension

• Long-time simulations (Monte Carlo with Absorbing Markov Chains, MCAMC)

• Parallel dynamic Monte Carlo simulations

Page 17: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Birth and Death processes

• Decay (death) of nuclei (organisms)• rate =0.001 /msec• N0=100

• N(t) = N0 exp(- t)

• t1/2 = ln(2)/= 693.15

Page 18: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Birth and Death processes• Start with N=N0 individuals• Start time t=0• Assume that decay (death) constant <1• For each nucleus which has not yet decayed

Generate a random number 0<r<1 Nucleus decays if r<, and set N=N-1, else the

nucleus remains• When done sampling all remaining nuclei, set

t=t+1• Repeat until all nuclei have decayed

Page 19: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Birth and Death processesEvent Driven --- n-fold way

• Start with N=N0 individuals• Start time t=0• Assume that decay (death) constant <1• For each nucleus which has not yet decayed

Generate a random number 0<r<1 Nucleus decays if r<, and set N=N-1, else the nucleus

remains• When done sampling all remaining nuclei, set t=t+1• Repeat until all nuclei have decayed

May be VERY SLOW if decay rate is small!!!

Does the nucleus decay? No no no no no no no no no no no no no no no ...

Page 20: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Birth and Death processesEvent Driven -- or -- n-fold way

• Start with N=N0 individuals• Start time t=0• Assume that decay (death) constant <1• Until all the nuclei have decayed do:

Generate two random number 0<r1 ,r2<1 Calculate time to leave current state: t=-ln(r1)/(N ) Set t = t + t Set N = N - 1 Use r2 to pick which of remaining nuclei decayed

One decay every algorithmic step, no matter how small is

Page 21: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Birth and Death processes

• Birth and death of organisms• grow=0.001 /msec

die =0.001 /msec

• N0=100

Page 22: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

OUTLINE

• Random numbers• Integrals via Monte

Carlo• Importance Sampling

Monte Carlo• Dynamic Monte Carlo• Decay of nuclei (birth-

death processes)

• Random motion in 1 dimension

• Long-time simulations (Monte Carlo with Absorbing Markov Chains, MCAMC)

• Parallel dynamic Monte Carlo simulations

Page 23: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Random Walker coagulation

Albena, Bulgaria model (2002)

Page 24: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Random Walker coagulation

Albena, Bulgaria model (2002)

Page 25: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Random Walker coagulation

Page 26: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Random Walker coagulation

Event driven (n-fold way)

One algorithmic step

step from current configuration

Page 27: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Random Walker coagulation

Monte Carlo with Absorbing Markov Chains (MCAMC) (s=2)

In one algorithmic step

step out of low valleys

Page 28: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Random Walker coagulation

Average time until coagulation

All algorithms statistically the same

Page 29: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Random Walker coagulation

Different algorithms

require different amounts of computer time

Page 30: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Random motion --- ion channel flow

Random motion (of a random walker) through a channel

Page 31: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Random motion --- ion channel flow

Page 32: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Random motion --- ion channel flow

Page 33: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Random motion --- ion channel flow

Page 34: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Random motion --- ion channel flow

Page 35: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Random motion --- ion channel flow

Average lifetimes the same for all algorithms

Computer times different for different algorithms

Page 36: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Random motion --- ion channel flow

Square lattice for random walker, lifetime is time to get from one end to another

Page 37: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

OUTLINE

• Random numbers• Integrals via Monte

Carlo• Importance Sampling

Monte Carlo• Dynamic Monte Carlo• Decay of nuclei (birth-

death processes)

• Random motion in 1 dimension

• Long-time simulations (Monte Carlo with Absorbing Markov Chains, MCAMC)

• Parallel dynamic Monte Carlo simulations

Page 38: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Monte Carlo for Ising models

Page 39: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Monte Carlo for Ising models

Use spin classes for Ising model --- square lattice has 10 spin classes

•Every spin belongs to one of 10 classes

•Probability of flipping a spin in each class is the same

•If chosen, probability of flipping spin in class i is p(i)

•Number of spins in class i is ci

Page 40: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Monte Carlo for Ising models

A GAME

Page 41: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Monte Carlo for Ising models

MCAMC

n-fold way

Page 42: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Monte Carlo for Ising models

n-fold way

with needed Bookkeeping

Page 43: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Monte Carlo for Ising models

MCAMC

Page 44: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Monte Carlo for Ising models

Square lattice Ising model

Page 45: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Monte Carlo for Ising models

MCAMC

resultssquare Ising

Page 46: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Monte Carlo for Ising models

Age of universe in femtoseconds?

10-15 seconds

Page 47: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

OUTLINE

• Random numbers• Integrals via Monte

Carlo• Importance Sampling

Monte Carlo• Dynamic Monte Carlo• Decay of nuclei (birth-

death processes)

• Random motion in 1 dimension

• Long-time simulations (Monte Carlo with Absorbing Markov Chains, MCAMC)

• Parallel dynamic Monte Carlo simulations

Page 48: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Dynamic Monte CarloParallel Discrete Event Simulations

• Dynamics for Materials• Dynamics for biological

and ecological models• Dynamics of Magnets• Cell-phone switching• Spread of infectious

diseases• Resource allocation

following terrorist attacks• War-game scenarios

Page 49: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

“Nature”?

computers & algorithms

Parallel Discrete Event Simulations

Best is trivial parallelizationEach processor runs same program with

different random number sequence

Page 50: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Two approaches to parallelization

ConservativePE “idles” if causality is not guaranteedutilization, u: fraction of non-idling PEs

i

(site index) i

d=1

Optimistic (or speculative)PEs assume no causality violationsRollbacks to previous states once causality violation is found (extensive state saving or reverse simulation)Rollbacks can cascade (“avalanches”)

d=2

Page 51: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Non-equilibrium surface growthe.g., kinetic roughening as in Molecular Beam Epitaxy

2

1

2 )]()([1)( ttL

twdL

iid

dL

iid t

Lt

1

)(1)( Surface width = w

Surface is FRACTAL

Page 52: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Utilization/efficiencyFinite-size effects for the density of local minima/average growth rate (steady state):

2464.0 u

Lconstuu L

. (d=1)

Page 53: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Implications for scalabilitySimulation reaches steady state for long times

Simulation phase: scalable

Measurement (data management) phase: not scalable

)1(2

.

Lconstuu L

u asymptotic average growth rate (simulation speed or utilization) is non-zero

22 ~ Lw L

wmeasurement at meas:

Page 54: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

Actual implementation

1. Local time incremented 2. If chosen site is on the boundary, PE must wait until min{nn}

Dynamics of a thin magnetic film

Page 55: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

The Physics of Queuing

• PDES applicable to many situations

• Can be made scalable (patent applied for)

• Use ideas from physics to understand & improve computer science & biological applications

Page 56: Monte Carlo Methods

NIHES EERC Oct. 25, 2002

References and LinksNovotny and coworkers

• For a review of advanced dynamic methods see: M.A. Novotny in Annual Reviews of Computational Physics IX, ed. D. Stauffer, (World Scientific, Singapore, 2001), p. 153; preprint xxx.lanl.gov/cond-mat/0109182 click---HERE.

• Metastability: Physical Review Letters, 81, 834 (1998).• Monte Carlo with Absorbing Markov Chains: Physical Review Letters, 74, 1 (1995); erratum

75, 1424 (1995). • Discrete-time n-fold way: Computers in Physics, 9, 46 (1995).• Parallel Discrete Event Simulations, General: Physical Review Letters, 84, 1351 (2000).• Implementation of non-trivial parallel Monte Carlo: Journal of Computational Physics, 153, 488

(1999).• Projective Dynamics: Physical Review Letters, 80, 3384 (1998).• Constrained Transfer Matrix for metastability: Physical Review Letters, 71, 3898 (1993).


Recommended