I’m happy to announce the release of OptimalTransportNetworks.jl, a modern Julia translation of the MATLAB OptimalTransportNetworkToolbox implementing the quantitative spatial model and algorithms described in
Fajgelbaum, P. D., & Schaal, E. (2020). Optimal transport networks in spatial equilibrium. Econometrica, 88(4), 1411-1452.
The model/software uses duality principles to optimize over the space of networks, nesting an optimal flows problem and a neoclasical general-equilibrium trade model into a global network design problem to derive the optimal (welfare maximizing) transport network (extension) from any set of economic fundamantals [population per location, productivity per location for each of N traded goods, endowment of a non-traded good, and (optionally) a pre-existing transport network].
For more information about the model see this folder and the MATLAB User Guide.
The model is the first of its kind and a pathbreaking contribution towards the welfare maximizing planning of transport infrastructure. Its creation has been funded by the European Union through an ERC Research Grant.
Example
The code for this example is in example04.jl. See the examples folder for more examples.
This plot shows the endowments on a map-graph: circle size is population, circle colour is productivity (the central node is more productive), the black lines indicate geographic barriers, and the background is shaded according to the cost of network building (elevation), indicating a mountain in the upper right corner.
This plot shows the optimal network after 200 iterations, keeping population fixed. The size of nodes indicates consumption in each node.
You may wonder why are there multiple roads to certain cities? The reason is decreasing returns to infrastructure (\beta \leq \gamma, where \beta governs the strength of congestion forces and \gamma the returns to infrastructure). This guarantees the global convexity of the problem. In this example \beta = \gamma = 1.
However, we can assume increasing returns to infrastructure, e.g., by setting \gamma = 2. In this case the optimization problem is not globally convex, and the software automatically calls a Simulated Annealing algorithm to approximate the global solution following convex optimization. The result:
In real life, it depends a bit upon the setting. Inside cities, estimates of the empirical relationship between speed, roads, and vehicles by Couture, Duranton, and Turner (2018) using U.S. data imply the DRS/convex case, i.e., congestion forces are strong and it is better to ‘build several smaller roads than a few huge roads’. Outside of cities there is (to my knowlege) not much evidence on this.
Customization and Research Use
While the examples are nice and illustrative, the library permits users to provide custom graphs which must not be dense/fully connected.
My own recent research on Optimal Investments in Africa’s Road Network, considers, amongst other scenarios, optimal $10 billion (2015 USD) upgrades to the trans-African transport network using a sparse graph derived from Open Street Map routes between 47 large (port-)cities - see the simulation code, the following figures are taken from the slides.
I find that optimal upgrades depend not so much on the returns to infrastructure (as the network is fixed/sparse), but rather on heterogeneous road construction costs, the elasticity of substitution between different city-goods (\sigma) and whether social planners are inequality averse (\rho = 2 instead of 0).
I have forked available replication materials for papers using this framework on the OptimalTransportNetworks organization. Further works I am aware of include:
Graff, T. (2024). Spatial inefficiencies in Africa’s trade network. Journal of Development Economics, 103319. https://tilmangraff.github.io/
Gorton, Nicole and Ianchovichina, Elena, Trade Networks in Latin America: Spatial Inefficiencies and Optimal Expansions. Available at SSRN: https://ssrn.com/abstract=4041108 or http://dx.doi.org/10.2139/ssrn.4041108
Kreindler, G., Gaduh, A., Graff, T., Hanna, R., & Olken, B. A. (2023). Optimal Public Transportation Networks: Evidence from the World’s Largest Bus Rapid Transit System in Jakarta (No. w31369). National Bureau of Economic Research. https://www.nber.org/papers/w31369
Going Forward
Community efforts to further improve the code are very welcome. I started the GitHub organization OptimalTransportNetworks to maintain both the Julia and MATLAB libraries, but also to gather/start similar contributions, including replication materials of relevant research papers.
The overall aim of the organization is to develop powerful open tools to solve (large-scale) transport infrastructure allocation problems from an economics/welfare perspective. Global infrastructure investment needs are estimated at 3.5% of global GDP - around 100 trillion USD by 2040 according to some estimates - and transport investments are a good part of that - e.g. 73% of Africa’s estimated ~$400B annual financing gap until 2030 is transportation. So it is high time to start thinking about economic/welfare maximizing planning and develop relevant open tools. If you’re interested in contributing/maintaining or have new ideas/research/approaches, don’t hesitate to reach out - happy to welcome smart minds to the organization.