Remember that time two years ago when Nitin Gadkari said he’s planning to introduce a law that mandates replacing horns with the sound of indian classical instruments? (news article if you don’t.) Some might call it unrealistic, but it came up in a conversation and I thought the man was ahead of his time so I wrote a toy agent-based simulation of chaotic traffic and hooked it up to VCV rack to see what happens.
The simulation, written in python with Mesa, initializes vehicles as agents following simple rules (similar to boid flocking). The rules are:
- If I’m feeling cramped (other agents close to me just ahead of me that I can collide with), decelerate. If I’m not feeling cramped, accelerate until I reach my top speed.
- Steer away from neighbors just ahead of me so I can try to overtake or go around them. Also steer away from the side of the road and try to align my direction with the general flow of traffic.
- If I’m being forced to decelerate, honk! And honk again if I haven’t honked in a while! Honks send out MIDI triggers to be synthesized in VCV Rack.
Running a simulation with these rules, we start to observe emergent behaviour like three-phase traffic.