R-Forge Logo

Welcome to the TravelR project (Travel Demand Modeling in R)!

The TravelR project hosts tools for building travel demand models in R, including highway assignment with practical features such as multi-class equilibrium assignment, network turn penalties, select link analysis, and network skims.

Project Status

The definitive project status is maintained on the TravelR project page. Downloads of the built package will be available there (for the latest released version of R) once the R-Forge build service is back in action.

TravelR will be discussed at the R User Conference in Gaithersburg, Maryland, on Thursday, July 22, 2010. The presentation abstract is here (PDF).

The TravelR project's first package, not suprisingly named "travelr", is in "pre-alpha" state (the code is not quite complete, what is there sort of works, but what works and what doesn't is changing daily and sometimes hourly). A very preliminary version of the package is expected to be surreptitiously released some time in May 2010, and announced to a close circle of co-conspiratoRs. Subscribe to the travelr-announce e-mail list to see what's happening, or email the lead developer if you would like to join the inner circle.

History, Motivation and Philosophy

Some travel model developers and users have been using R very happily for years, but the ability to do a complete model in R has eluded us since there hasn't been a good way to do highway assignment. The TravelR project was initiated to bridge that gap. The mastermind behind TravelR is Jeremy Raw, a professional travel demand modeler (and erstwhile professional software developer). Please be aware that TravelR is a "hobby" project for which no one is currently getting paid. Work on the project happens in Jeremy's (rather limited) spare time.

Please attend to the Yamas and Niyamas as you contemplate this body of work.


The intended audience for TravelR is two-fold:

Design Goals

To support these two audiences, there are two design goals:


To meet the "industrial-strength" goal, the initial set of features include the following:

Matrix Re-Aggregation
Allows a matrix to be summed or factored to a different number of rows and columns based on a correspondence table. So if you need to map census blocks to transportation analysis zones, zones to districts, or any such similar operation, you are no longer left to struggle with obscure R strategies.
Iterative Proportional Fitting
a.k.a. 'Fratar' expansion, which grows a seed matrix toward new marginal totals, expressed either as absolute targets, or as fractions or percents of the current marginal totals. Travel demand modelers love this function and are lost without it. Plus it helps you do trip distribution models (that's what T.J. Fratar invented it for).
Highway Networks
Allows flexible coding of highway networks so you mostly won't have to rename your link or node attributes, and interoperates with some other cool R packages (e.g. igraph). As long as you can provide the network as tables that R can import (CSV, DBF, ODBC) and you understand which fields hold labels for the "from" and "to" nodes, you can make a highway network that TravelR can use
Equilibrium Highway Assignment
The raison d'être for the package. Supports a handful of (initially link-based) methods: The assignment driver function is extensible, so new algorithms can be added at the user level without rebuilding the package
Production Support
The highway assignment and other functions should scale up to problems of real-world size and complexity. Features that initially support that goal include:
"Fast enough"
We intend to optimize performance enough that we can model "life-size" networks in R, in our lifetime. Version 0.1 is probably not yet fast enough, but it's much faster than we expected it to be when we first got started, and it's not too slow to be useful.
Multi-Class Assignment
Supported from the ground up, allowing class-by-class network subsets, demand matrices, and cost functions, in a way that makes it relatively painless to try out multi-class assignment with new assignment algorithms
Turn Penalties
Useful for simplifying network topology as well as applying static or dynamic path costs at network junctions; turn prohibitions and penalties are implemented in path-building at the C++ level using numeric cost vectors, so the evaluation of paths with penalties remains fast even if the turn penalties are recomputed at each equilibrium iteration
Select Link Analysis
Extracts demand matrices and link flows from paths that intercept certain links, and is integrated into the assignment algorithms so as to extract correctly weighted equilibrium flows for intercepted links
Network Skims
Another mainstay of travel demand modeling, "skimming" a network generates a numeric origin/destination matrix by applying a function to a vector of values associated with the links along a set of network paths (e.g. adding up the link lengths to get an origin-destination total path distance). The goal is to have skimming operate like R's series of "apply" functions (paths + link value vector + function -> matrix, where "function" is passed a vector subset of values for each origin-destination path in turn)

Unimplemented Features and Other Limitations

Certain desirable features are still missing.

No path-based highway assignment. All the implemented algorithms are link-based, which is easier and "cheaper" in terms of time and memory. Someone who really comprehends the implementation of path-based assignment is invited to contribute data structures and algorithmic ideas.

No dynamic assignment. Like path-based assignment, it's on the list but it would be helpful to get input on how to do it efficiently.

No function to load and skim Transit Networks. The requirements for transit networks are a bit more cumbersome than highway networks. We plan to get there, but a lot of that depends on time and interest (As noted above, TravelR is currently a "hobby" project, in that no one is explicitly getting paid to work on it and time is not always available). It may also depend on getting someone involved in the project who has had a bit more practical experience coding and analyzing transit networks.

The travelr package currently does everything in memory. You need to fit your model into that limit, which is not as bad as it sounds: we're currently testing four-class assignment on a network with 15,000 links and 980 zones and coming in around 300 megabytes for a full equilibrum assignment run (that's probably a "mid-size" network by professional standards).

TravelR and Open Source

TravelR is open source software. It is intended to work, to be modifiable by informed users, and to be "free" in useful ways. We would be thrilled if it caught on and lots of people found it useful, but we don't expect it to appeal to many of the people who buy and use commercial travel demand modeling software: the fact that it is free means that it takes work, rather than money, to get it to do what you want. But for modelers who are doing work anyway (especially those who are already working with R), and who want to try out innovative modeling approaches, the TravelR project will hopefully become a useful part of the toolbox.

To use this R package successfully, you need to know what you're doing (both in R and in travel demand modeling). There is very little "canned" stuff in it, though we are putting together some detailed working models as examples. You need to be able to write network cost functions (and know in detail what a network cost function is supposed to do), and you probably need to have external tools for coding your highway network (there are some useful free and open source tools for that). There are no explicit data management or user interface tools in the project, although you can cobble together a lot from other R packages.

That said, it is our hope that many travel modelers will find TravelR useful and accessible enough that it will inspire them to try out some new things.


The path management code is written in C++ and the rest of the package is in R. The code is open source, copyrighted, and licensed under the GNU public license, version 2 or later.

Further details

The R-Forge project summary page is located here. Look there for news, and (soon) to download the bleeding edge package itself. A CRAN package will become available once the bleeding is under control.