Traffic Simulator

A traffic flow simulator based on the Nagel-Schreckenberg cellular automata model. It models multi-lane vehicle dynamics and lane-changing behaviour, and analyses traffic organisation using entropy-based metrics with visualisations of vehicle movement.

Overview

The simulator implements the classic NaSch model and extends it to multiple lanes with probabilistic lane-change rules. Throughput and spatial entropy metrics are tracked over time to characterise different traffic regimes (free flow, congested, jammed).

Tech Stack

  • Python — core simulation
  • NumPy — vectorised cellular automata updates
  • Matplotlib — traffic flow visualisations

Demo

Traffic simulation ordered Ordered lateral distribution

A randomized simulation showing ordered behavior (see lateral distribution on the right)

Traffic simulation disordered Disordered lateral distribution

Another randomized simulation, this time with higher level of disorder (see lateral distribution on the right)

Want to get in touch? Reach out on LinkedIn.