1
Stats 318: Lecture
Agenda: Markov Chain Monte Carlo
The traveling salesman problem
Solution by simulated annealing
2
The traveling salesman problem
d cities labelled cfw_1, 2, . . . , d
distances between city i and city j : d(i, j ).
Problem nd a t
Stats 318
Spring 2012
Solution to Homework 2
Exercise 1.13
Suppose x S are such that it attains the minimum for
P t (y, x) > 0 since the chain is irreducible. We have
1 ( x)
2 (x) .
For any other state y , t > 0 such that
P t (z, x)1 (z )
t
z S P (z, x)2
Stats 318
Spring 2012
Solution to Homework 1
Problem 1 A Beautiful Fern! It is important to use a scatter plot to see the gure. The code is below.
%Simulate the MC from problem 1, hw1
function leaf(n)
% Store matrices A
A(1:2,
A(1:2,
A(1:2,
A(1:2,
1:2,
1:
1
Stats 318: Lecture
Agenda: Markov Chain Monte Carlo
The Propp Wilson algorithm
Exact sampling of the Ising model
2
Ising Model
n by n spin array
Iv = 1, v = (v1 , v2 ), 1 v1 , v2 n
Energy
E (I ) =
1
2
Iv Iv
v v
where the sym v v symbolizes all pai
Exercise 6.2
n
If (Xt ) is the random walk on Sn corresponding to the top-to-random shuing on n cards. Let top 1 be the
time until the card initially one card from the bottom rises to the top, plus one more. Let card n 1 denote
the original one card from
Randomized stopping time
Proof: Suppose X0 = x, if is a stopping time, then Bt = Bt,1 . Bt,t t such that
cfw_ = t = cfw_X0 , ., Xt Bt
= cfw_f (x, Z1 ) Bt,1 , ., f (Bt,t1 , Zt ) Bt,t
= cfw_(x, Z1 ) f 1 (Bt , 1), ., f (Bt,t1 , Zt ) Bt,t
= cfw_(Z1 , ., Z
1
Stats 318: Lecture
Agenda: Markov Chain Monte Carlo
1D Ising model
Swendsen Wang algorithm
2
One dimensional Ising model
State space is cfw_1, 1d
Distribution at temperature T
T (I ) exp
1
T
d1
Ii Ii+1
i=1
3
Swendsen Wang algorithm
Auxiliary bond va
1
Stats 118: Lecture
Agenda: Markov Chain Monte Carlo
Simulated tempering
Applications to 1D Ising model
2
Parallel tempering algorithm
Current state: s1 , s2 , . . . , sm
1. Parallel step: update every si with their respective MCMC scheme
2. Swapping s
1
Stats 318: Lecture
Agenda: Markov Chain Monte Carlo
The Metropolis algorithm
The hard spheres model
The Ising model
The Gibbs sampler
Examples
2
Metropolis algorithm
1. Intialize X0
2. Repeat
Sample y from the distribution Q(Xt , )
Sample U U [0,
Stats 318
Spring 2012
Homework 6
Due Monday, June 4
The problem of counting the number of solutions to a knapsack instance can be dened as follows: given
items with sizes a1 , a2 , . . . , an > 0 and an integer b > 0, nd the number of vectors x = (x1 , x2