Week 3: Implementation-ish
April 7, 2026
Since my last post, I’ve made solid progress on the implementation side of things. I got a working version of the Metropolis-Hastings Schelling simulation running on simple grid graphs. It was genuinely exciting to see it come together — you start with a randomly scattered configuration of agents, run a few thousand iterations, and watch distinct clusters of the same “color” slowly form. The global unhappiness H(f) drops over time and then stabilizes once the chain finds a local minimum, which lines up with what the theory predicts.
One thing that took me a while to understand was the proposal distribution φ. Since φ is proportional to e^(-ζH(f)), the chain is more likely to propose configurations that reduce unhappiness. Getting this to behave correctly with the acceptance criterion took some debugging, but once it clicked, the simulations started looking right.
I also spent time this week better understanding the Metropolis-Hastings algorithm itself. I had a very basic understanding from my reading last week, but actually implementing it forced me to think carefully about each step — sampling a candidate configuration, computing the acceptance ratio, and deciding whether to move forward or stay put. Doing it by hand in code made the mechanics much more concrete.

Leave a Reply
You must be logged in to post a comment.