Skip to content

I found the additional constraints in coding largely influence the results of intelligent driver model (IDM)-based traffic flow simulation. I report some of them here.

License

Notifications You must be signed in to change notification settings

gotrafficgo/idm_and_constraints

Repository files navigation

Intelligent Driver Model and its Constraints in Coding

Background: When the simulated traffic behaves unexpectedly, adding extra constraints is the most direct and straightforward solution (e.g., enforcing speed>0, moving distance>0).

Model focused: Intelligent Driver Model (IDM) proposed by Martin Treiber et al

Conclusion: I found that

  • The original IDM seems to have some drawbacks (Experiment 1).
  • Extra constraints largely influence the results of original IDM-based traffic flow simulation (Experiments 2 and 3).
  • The IDM Plus ✅ seems more reasonable (Experiment 4).

Note 1: I don’t think directly implementing the model with arbitrary constraints in coding is a rigorous attitude.

Note 2: I’m fairly confident that there are no errors in the code. If you found errors or knew someone has improved the model, please kindly reach out to me (he.zb@hotmail.com), which will be very helpful! I am particularly surprised that few studies actually report these (the conclusion was made based on my communication with some friends who are very familiar with the IDM), even though the IDM is now widely used in academia (a review) and industry (e.g., SUMO).

Issues (Possible)

EXPERIMENT 1 (Original IDM): No extra constraints. I observe:

  • After escaping the stop-and-go wave, the vehicle’s speed cannot return to high speed
  • Wave speed = -16 km/h

Diagram

EXPERIMENT 2: All constraints taking effect. I observe:

  • The stop-and-go wave continuously propagates upstream
  • The decelerating process is too sharp -- Here, it is the sharp deceleration, but it is still unknown for other scenarios. The extremely unfortunate case is: It would significantly affect the results if it happened in some critical moments.
  • Wave speed = -10 km/h

Diagram

EXPERIMENT 3: Only Constraint 2 not taking effect. I observe:

  • Collision occurs
  • Wave speed = -9 km/h

Diagram

EXPERIMENT 4 (IDM Plus): No extra constraints. ✅ I observe:

  • This seems to be very reasonable.
  • Wave speed = -16 km/h
  • But, I still don't quite understand why the stop-and-go wave dissipates by itself.

Diagram

IDM

  • Original IDM (Page 254, Traffic Flow Dynamics (2nd Edition)). Obvious issue in the equation: (s*(v, Δv) / s)^2 > 0, so if v = v0, we will have a = a* (- positive) < 0, i.e., negative acceleration. It means that if the subject vehicle has reached the desired speed (v0), its acceleration will be negative (In real world, the acceleration should be zero, isn't it).

$$ a = a^* \left(1 - \left(\frac{v}{v_0}\right)^4 - \left(\frac{s^*(v,\Delta v)}{s}\right)^2 \right) $$

  • IDM Plus ✅ (Page 265, Traffic Flow Dynamics (2nd Edition))

$$ a = \min\Biggl[ a^* \Bigl( 1 - \Bigl( \frac{v}{v_0} \Bigr)^4 \Bigr), \ a^* \left( 1 - \left(\frac{s^*(v, \Delta v)}{s} \right)^2\right) \Biggr] $$

Constraints

Constraint 1: in vehicle.update_acceleration()

# -------------------------------        
### Additional Constraint 1
if self.with_additional_constraint_1 is True:
    if a < -b_desired:
        a = -b_desired
    if a > a_max:
        a = a_max
# -------------------------------    

Constraint 2: in vehicle.update_speed()

# -------------------------------        
### Additional Constraint 2
if self.with_additional_constraint_2 is True:            
    if self.vehicle_front is not None:
        s = self.vehicle_front.position - self.position - self.L
        s = max(s, 0.01)  # prevent division by zero
        v_max_allowed = s / delta_t
        v_new = min(v_new, v_max_allowed)
# -------------------------------      

Constraint 3: in vehicle.update_acceleration()

# -------------------------------        
### Additional Constraint 3
if self.with_additional_constraint_3 is True:
    s = max(s, 0.1) 
# -------------------------------

Constraint 4: in vehicle.update_speed()

# -------------------------------        
### Additional Constraint 4
if self.with_additional_constraint_4 is True:
    v_new = max(v_new, 0)
# -------------------------------

Constraint 5: in vehicle.update_position()

# -------------------------------   
### Additional Constraint 5
if self.with_additional_constraint_5 is True:
    d = max(d, 0)
# -------------------------------

Citation

If you find this work useful, please consider citing the project

@misc{ZhengbingHe2025,
  author = {He, Zhengbing},
  title = {Intelligent Driver Model and its Constraints in Coding},
  howpublished = {\url{https://github.com/gotrafficgo/idm_and_constraints}},
  year = {2025},
  note = {GitHub repository}
}

About

I found the additional constraints in coding largely influence the results of intelligent driver model (IDM)-based traffic flow simulation. I report some of them here.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages