Physics-Constrained Neural ODEs for Learning Traffic Dynamics and Trajectories from Road Entry/Exit Times
Abstract
We consider the problem of learning microscopic traffic dynamics and reconstructing vehicle trajectories from section entry/exit timestamps (EET) recorded by cameras and from the positions of a probe vehicle leading the platoon. The dynamics are difficult to recover as each vehicle's position is measured only at two points, and its trajectory between them is unknown. By combining Neural ODEs with a local density approximation, we learn a follow-the-leader model whose speed--density relation is a neural network. With such sparse data, an unconstrained network may learn physically unrealistic relations, such as negative speeds or non-zero speeds on a fully congested road. We therefore introduce a normalization that, applied to a monotone neural network with a learned regime change, enforces the endpoint conditions, guaranteeing an admissible speed--density relation while provably retaining the ability to approximate any admissible one. We validate the method on first- and second-order simulations, recovering the speed--density relation of the first-order model and reconstructing the trajectories of both models, with mean maximum position errors of 2.50~m and 2.51~m, respectively, on a 125~m road segment. On real-world ring-road data, the proposed model still yields an admissible relation, whereas both baselines violate the constraints; the large spread in the data, however, highlights the limitations of a first-order model with homogeneous driver behaviors.