Implement Car-Following model
User story
Describe your new feature as a user story:
- As a Traffic Engineer
- I want to have collision prevention for vehicles ahead even on turnings
- in order to have vehicles react the correct way to vehicles ahead.
Acceptance criteria
How will you know when the feature complete, or good enough to deploy to a live environment? Your criteria should be testable in both QA and unit tests.
- Vehicles would increase speed to the max if there isn't a vehicle ahead or there is a big enough gap ahead.
- Vehicles would decrease speed if depending on the gap of the vehicle ahead
Notes
Paper: Traffic at the edge of Chaos: https://arxiv.org/abs/adap-org/9502005
Section 2.1
Implement the following rules:
- Acceleration of free vehicles: Each vehicle of speed v < vmax with gap ≥ v+1 accelerates to v+1: v → v+1.
- Slowing down due to other cars: Each vehicle (speed v) with gap ≤ v−1 reduces its speed to gap: v → gap.
- Randomization: Each vehicle (speed v) reduces its speed by one with probability 1/2: v → max[ v − 1, 0 ] (takes into consideration individual fluctuations).
- Movement: Each vehicle advances v sites.