Papers
Topics
Authors
Recent
Search
2000 character limit reached

End-to-end differentiable network traffic simulation with dynamic route choice

Published 13 Apr 2026 in eess.SY | (2604.11380v1)

Abstract: Optimization using network traffic flow models require computing gradients of objective functions with respect to model parameters. Conventional approaches rely on numerical differentiation or derivative-free methods that does not scale well with the parameter dimension, or on adjoint methods that require manual derivation for each specific model. This study proposes a novel end-to-end differentiable network traffic flow simulator based on the Link Transmission Model (LTM), incorporating general node models and a dynamic user optimum (DUO) route choice model. We observe that the LTM operates on continuous aggregate state variables (cumulative vehicle counts) through piecewise-linear $\min$/$\max$ operations, which admit subgradients almost everywhere and thus require no smooth relaxation for automatic differentiation (AD). We incorporate the DUO route choice model and its logit extension to explicitly consider endogenous dynamic route choice of travelers while preserving differentiability, because the diverge ratios are continuous functions of per-destination vehicle counts. The resulting simulator computes exact gradients via reverse-mode AD in a single backward pass regardless of the parameter dimension. In order to demonstrate the capability of the proposed model, we solved a dynamic congestion toll optimization problem on Chicago-Sketch dataset with around 2500 links and 1 million vehicles with 15 000 decision variables. The proposed model successfully derived a high quality solution with 10 000 iterations that took about 2 hours, meaning that 1 simulation run and gradient derivation took 0.8 second. The simulator, implemented in Python and JAX, is released as an open-source software named UNsim (https://github.com/toruseo/UNsim).

Authors (1)

Summary

  • The paper introduces a scalable end-to-end differentiable traffic simulator that leverages the Link Transmission Model integrated with dynamic user optimum route choice.
  • It employs logit-based smoothing and reverse-mode automatic differentiation to compute exact gradients for high-dimensional network parameters.
  • Numerical experiments on toy and city-scale networks demonstrate significant reductions in total travel time and validate the effectiveness of the approach.

End-to-End Differentiable Macroscopic Network Traffic Simulation Incorporating Dynamic Route Choice

Introduction and Motivation

The paper "End-to-end differentiable network traffic simulation with dynamic route choice" (2604.11380) addresses a pivotal methodological gap in large-scale traffic network optimization and sensitivity analysis: the computation of exact gradients of objective functions with respect to model parameters in dynamic macroscopic traffic flow simulators that fully incorporate endogenous, time-dependent route choice. Existing approaches for gradient computation either lack scalability (brute-force or derivative-free methods), suffer from high implementation burden (adjoint methods with model-specific derivations), or fail to handle essential network complexities (lack of support for endogenous discrete route selection). The work proposes a differentiable simulation framework based on the Link Transmission Model (LTM), augmented with general node models and a continuous-time Dynamic User Optimum (DUO) route choice, enabling exact gradient computation via reverse-mode automatic differentiation (AD).

Theoretical Framework and Differentiable Model Formulation

The proposed simulator leverages LTM's foundation in the kinematic wave theory, operating on cumulative vehicle counts as continuous aggregate state variables. The LTMโ€™s update rules and node transfer logic are encoded as compositions of arithmetic, minโก\min, and maxโก\max operationsโ€”functions that are subdifferentiable almost everywhere. Crucially, route choice is modeled endogenously via a DUO mechanism, where vehicles' turning decisions at each node are determined by instantaneous least-cost routing. To resolve the issue of zero gradients prevalent in pure shortest-path assignment, a logit-based smoothing over path costs is introduced, yielding differentiable diverge ratios as a soft function of the evolving simulation state.

All componentsโ€”link demand/supply, node flow allocation (including the Incremental Node Model for general intersections), cumulative count updates, and per-destination flow trackingโ€”are expressed in a form compatible with efficient AD frameworks. The model avoids surrogate smoothing or relaxation strategies that inject physical inconsistencies, and by maintaining differentiability almost everywhere, exact gradients are obtained even for high-dimensional parameterizations (e.g., network-wide time-varying tolls, link FDs, OD demand).

The simulation and differentiation pipeline is implemented in Python/JAX, exploiting vectorization and GPU acceleration. The open-source release, UNsim, provides a scalable platform for gradient-based network optimization and learning.

Numerical Experiments and Key Results

Verification on a Toy Network

The differentiability and correctness of the computed gradients are investigated using a Y-merge toy network. Partial derivatives of total travel time (TTT) and vehicle-level travel times with respect to link-level parameters (e.g., free-flow speed, merge priorities, demand rates) are computed and shown to have qualitatively expected signs and magnitudes. For example, increasing demand rates lead to larger TTT, while increased free-flow speeds reduce it, and merge priorities demonstrably influence route-specific delays under congestion. These outcomes confirm that the proposed differentiable LTM+DUO framework accurately captures sensitivities without approximation bias.

Large-Scale Application: Dynamic Congestion Pricing in Chicago-Sketch Network

The model's scalability and gradient quality are stress-tested via a dynamic congestion pricing optimization on the Chicago-Sketch network (2,500+ links, ~1 million vehicles, ~15,000 decision variables for time-dependent link tolls). The objective is minimization of TTT plus an L2L_2 toll regularization, solved with the Adam optimizer using exact gradients propagated through the simulator.

Performance Metrics

  • Computation: One forward simulation and gradient computation (including endogenous routing and full network dynamics) requires โ‰ˆ0.8 seconds on a server-class GPU. 10,000 optimization steps are completed in ~2 hours.
  • Optimality: TTT is reduced from 1,120,159 veh-hr (no toll) to 496,366 veh-hr under optimal tolling, indicating a 55.7% reduction in total network delay.
  • Interpretability: Learned tolls are spatially concentrated in and around the congested downtown core, effectively realizing a form of perimeter control. Toll dynamics and network MFD analysis reflect congestion mitigation and throughput enhancement, with high tolls imposed during peak demand pulses.

Robustness

Objective and gradient convergence is stable; the AD-derived gradients show physically reasonable patterns (e.g., high magnitude in initial iterations, plateauing as the optimum is approached). The incorporation of logit smoothing in DUO is critical for ensuring meaningful nonzero gradients in the route choice submodule.

Methodological Implications

This paper demonstrates that physically consistent, piecewise-linear macroscopic traffic simulation with dynamic endogenous routing can be rendered fully differentiable at network scale without model-specific adjoint derivations or surrogate relaxation. The ability to efficiently and exactly differentiate trip-level and aggregate network objectives with respect to high-dimensional parameters enables direct application of scalable first-order optimization algorithms and sensitivity diagnostics to network design, demand calibration, tolling, FD calibration, and real-time control tasks.

Key technical advances facilitating this outcome include:

  • Formulation of LTM, node models, and DUO route choice as a static computation graph of differentiable primitives.
  • Introduction of logit-DUO as a differentiable relaxation for route choice, avoiding zero-gradient dead ends.
  • Efficient implementation via JAX enabling practical simulation and gradient throughput on GPU hardware for city-scale networks.

Connections to Machine Learning and Future Directions

The differentiable simulation paradigm opens the door for hybrid physicalโ€“data-driven models: neural architectures for OD demand, personalized route utility, or parameter inference can be composed as differentiable modules within the traffic simulation pipeline and optimized end-to-end. This facilitates the development of physics-informed learning frameworks for network flow modeling, demand forecasting, and control policy training. Other promising avenues include integration of differentiable traffic simulation into reinforcement learning environments for transportation, and the use of higher-order gradients for bilevel sensitivity analysis.

Practical limitations noted by the author include frequent occurrence of zero gradients in certain regimes (due to the information propagation and zero-gradient regions inherent in the LWR-LTM model), highlighting a potential need for artificial viscosity or alternative optimization routines in highly non-smooth objective landscapes. Further improvements in model expressiveness, numerical stability, and broader integration of deep learning architectures remain subject to future work.

Conclusion

The paper establishes a robust, scalable, and physically consistent framework for end-to-end differentiable macroscopic traffic simulation with endogenous, dynamic route choice. The approach delivers exact, efficiently computed gradients at network scale, bridging a key methodological gap in traffic assignment, network control, and large-scale transport optimization. The UNsim codebase provides a high-performance, open-source platform for both traditional and AI-enabled transportation science workflows, with clear implications for next-generation learning-augmented simulation and control in complex networked systems.

Paper to Video (Beta)

No one has generated a video about this paper yet.

Whiteboard

No one has generated a whiteboard explanation for this paper yet.

Open Problems

We haven't generated a list of open problems mentioned in this paper yet.

Collections

Sign up for free to add this paper to one or more collections.