Week 7: Full Simulation in Code!
April 29, 2026
This week marked the first time that I truly experienced the full capabilities of our code! I created a Metropolis-Hastings algorithm on a lattice structure and let it iterate until the next iteration wouldn’t provide a better energy state. In the random case I chose that meant 10,000 times. As expected, the result proved accurate in theory. However, watching it take place is another story.
Starting from a fully randomized distribution of red and blue agents on the grid with no discernible pattern, I activated the algorithm. In the early stages, there wasn’t much to see… The agent configuration changed slightly in certain areas in order to explore new possibilities. Then, at some point during iteration 1,000, I noticed something: local clusters of similarly colored agents emerge.These pockets of same coloring have formed into groups (at 5,000 iterations). By 10,000 iterations, the lattice has achieved full segregation into red and blue regions.
It gets more interesting when the system reaches this segregated state because after that point, nothing really happens. The chain has reached a point where the value for the function H(f) (unhappiness) is at a local minimum from which it cannot be moved out due to the negative energy being at the minimum. This steady state is what our theoretical model guarantees (something not seen in the standard ABM approach).

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