Skip to content

ben-hudson/pytorch-route-choice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pytorch-route-choice

PyTorch implementations of route choice models for transportation networks. Sparse operations via PyTorch Geometric and implicit differentiation via torchdeq.

Models

Installation

pip install git+https://github.com/ben-hudson/pytorch-route-choice

Examples

Example Description
recursive_logit_example.py Learn edge rewards from sampled paths via maximum likelihood
maxent_irl_example.py Maximum Entropy IRL by matching observed feature counts
purc_example.py Learn utility rates from observed edge flows
markov_traffic_example.py Traffic equilibrium on the Sioux Falls network using deep equilibrium models

Traffic equilibrium on the Sioux Falls network

Sioux Falls link costs according to the Markovian Traffic Equilibrium model.

Development

pip install -e .
pytest tests

Architecture Notes

  • The core computation solves linear fixed-point problems x = Ax + b via message passing on sparse graphs, using torchdeq for implicit differentiation.
  • Graph data uses PyTorch Geometric's edge_index (COO format) convention: [2, num_edges] tensor.
  • MarkovRouteChoice is aliased to RecursiveLogitRouteChoice.
  • RecursiveLogitRouteChoice requires batch dimensions for inputs (use .unsqueeze(0) for single instances).
  • node_dim is specified as a negative offset (default -1) to support batched operations.

About

Some route choice models implemented in PyTorch.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages