Académique Documents
Professionnel Documents
Culture Documents
Introduction to
Monte Carlo Methods
V. Sundararajan
Evolutionary Computing Team
Scientific and Engineering Computing Group
C-DAC, Pune 411 007
vsundar@cdac.in
vijayraghavan.sundararajan@gmail.com
Introduction to Monte Carlo Methods
Contents
1. What is Optimisation?
2. Methods of optimisation and simulations
3. Introduction to Monte Carlo methods
4. Random Walk
5. Simple Monte Carlo
6. Metropolis Monte Carlo
7. Simulated Anealing
8. Applications:
a) Structure Optimisation
b) Protein polymer Simulations
Introduction to Monte Carlo Methods
Optimisation
• What is optimisation?
– Finding minimum or maximum of a function
• Categories:
– Unimodal
– Multimodal
– Combinatorial
Introduction to Monte Carlo Methods
Class of Methods
• Enumerative – not for complex multimodal or combinatorial
– Calculating function for all possible states
– In a way, Random walk
• Calculus based – works well for unimodal problems
– Steepest descent
– Conjugate Gradient
– Newton Raphson (Variable Metric)
• Stochastic – Widely usable for all types of problems
– Monte Carlo
– Simulated Annealing
– Nature inspired (Evolutionary Strategies, Genetic Algorithms, Ant
colony, Artificial immune systems, genetic programming, gene
expression programming, etc.)
Introduction to Monte Carlo Methods
Efficiency Comparison
Maximum efficiency
1.0
Calculus
Stochastic
Efficiency
Enumerative
Taken from
Goldberg’s book, Chap 1
Introduction to Monte Carlo Methods
Introduction to
Monte Carlo Methods
Introduction to Monte Carlo Methods
a/A = n/N
A – Area of the land;
a – area of the pond;
N – Total no of pebbles;
n – no of pebbles falling in to the pond
Introduction to Monte Carlo Methods
N n(H) n(H)/N
100 52 0.52
1000 485 0.485
10000 5105 0.5105
0.50
100000 50893 0.50893
Introduction to Monte Carlo Methods
HISTORY
L d
Introduction to Monte Carlo Methods
HISTORY
• Lord Kelvin (1901) used random sampling to aid in
evaluation of integrals of the K.E that appears in kinetic
theory of gases.
• Courant, Fredricks & Lewy (1928) showed the
equivalence of the behaviour of random walks to solutions
of certain PDE.
• In 1930s Enrico Fermi made certain numerical
experiments that would now be called MC calculations.
• During Second World War (late 1940s) people like Von
Neumann, Fermi, Uram and Metropolis and advent of
digital computers gave a strong inputs to the advancement
of Monte Carlo.
• Most of the computations to start with were pilot studies,
as the computation power increased, more ambitious
calculations were made and lessons learnt
Introduction to Monte Carlo Methods
Structure Optimisation
Energy
0.0
r
Introduction to Monte Carlo Methods
Hierarchy of methods
• Random walk
• Monte Carlo
• Metropolis Monte Carlo
• Simulated Annealing
• Population Monte Carlo
Introduction to Monte Carlo Methods
Random Walk
• Start from a random point
• Calculate the energy
• Start a loop over no of RW steps (nrws)
– Start a loop over no of variables
• Propose a random step
• Calculate the energy
– End of loop over no of variables
• End of loop over nrws
Introduction to Monte Carlo Methods
Structure Optimisation
Random Walk
Initiate
Propose Change
Evaluate Obj. Fun.
Iterate over Statistics
Particles &
No of steps
Termination
Condition
Stop
Introduction to Monte Carlo Methods
Random Walk
Computer Exercise
Simulations and Optimisation
Monte Carlo
Initiate
Propose Change
Evaluate Obj. Fun.
Termination
Condition
For minimization
Stop DeltaE = Final-Initial
Introduction to Monte Carlo Methods
Random Walk
Monte Carlo
Computer Exercise:
Monte Carlo simulations
Propose Change
Evaluate Obj. Fun.
r < exp(-deltaE)
Favourable?
Iterate over Accept
Particles &
No of MMC steps Reject Statistics
Termination
Condition
For minimization
Stop
Delta = Final-Initial
Introduction to Monte Carlo Methods
1.0
Accept any random step
Only if it is probabilistically
Favourable
0.0
r < exp(-deltaE)
deltaE
Introduction to Monte Carlo Methods
Computer Exercise:
Monte Carlo simulations
Repeat the exercise with Metropolis Monte Carlo
method and comment on your results compared
to the random walk process as well as Monte
Carlo method.
Introduction to Monte Carlo Methods
Computer Exercise
Simulation using Monte Carlo
Simulated Annealing
• Start from a random point
• Calculate the energy
• Start a loop over Temperature T
• Start a loop over no of MMC steps (nmcs)
• Start a loop over no of variables
• Propose a random step
• Calculate the eneergy
• Accept the step if r < exp(-deltaE/T) accept otherwise,
reject it (r is a random number in the range [0,1])
• End of loop over no of variables
• End of loop over nmcs
• End of loop over Temperature (decrease temp)
Introduction to Monte Carlo Methods
Simulated Annealing
Initiate
Propose Change
Evaluate Obj. Fun.
r < exp(-deltaE/T)
Iterate over Favourable?
Particles, Accept
Temp T &
No of MC steps Reject Statistics
Termination
Condition
For minimization
Stop
deltaE = Final-Initial
Introduction to Monte Carlo Methods
Simulated Annealing
exp(-deltaE/T)
1.0
Accept any random step
Only if it is probabilistically
Favourable
0.0
r < exp(-deltaE/T)
deltaE/T
Introduction to Monte Carlo Methods
hovering around an
average value
NMCS
iterations
Introduction to Monte Carlo Methods
Computer Exercise:
Monte Carlo simulations
Consider molecules like water, carbon-di-oxide, and
benzene and obtain their equilibrium structure
using simulated annealing. Collect required
information like values of A,B, etc from web and
use them.
A 13-atom cluster using Lennard-Jones potential be
simulated.
Introduction to Monte Carlo Methods
Possible Applications of MC
• Multi-dimensional integration
• Volume enclosed by irregular surfaces
• Optimisation
• Molecular Modeling
• Simulations (percolation, ideal gas, ising model)
• Molecules
• Nuclear reactor – prediction of criticality
• Games