Skip to content
Kardi Teknomo edited this page Oct 5, 2023 · 4 revisions

Welcome to the ifn-transport wiki!

IFN-Transport is an extension of Ideal Flow Network (IFN) for transportation networks synthesis and analysis written in Python. The online version of IFN-Transport is also available in Revoledu. This document is the user guide to use the python code for Traffic Assignment based on Ideal Flow Network (IFN). The current version of this program should be run in Python 3.7 or higher version. The code include sample scenarios and documentation.

You do not need to know python programming language to use the program. You need to download python 3.7 or above including IDLE. If you know python programming language, it would be your advantage because you can analyze the results in more details than what explained in this Wiki.

One appealing reason why transportation engineers should use IFN Transport is because the existing transportation models only encourage widening the road in order to solve traffic congestion. IFN provides an alternative model that enable the engineers to justify the reduction of road width in order to reduce traffic congestion.

Imagine sharing the road width equally for vehicles and pedestrians. How are we going to justify the important of walkway? It is actually cheaper because all the utility lines (water, internet, sewerage, electricity) can be put under the walkway and it is cheaper to open the tiles of the walkway than to destroy the asphalt or concrete road. If the government will think of long-term solution, they should create the same amount of walkway width and vehicle road width. It would also make the city very beautiful. City who honor pedestrian would eventually honor themselves. This is where the IFN kicked in. Using IFN, we think in term of overall network balance solutions and therefore we can actually reduce the road width for vehicular traffic (and provide wider width for walkway) in order to reduce traffic congestion. Check this video on YouTube about the concept of Rebalancing Congestion. Note that we should use maximum congestion instead of averaging the performance.

What is Traffic Assignment?

Almost everyone hates traffic congestion. What can we do about it? Almost everybody has some kind of ideas to solve the traffic congestion that we face every day. The problem is how to quantify our ideas such that we can evaluate which among our ideas would really work. This is where you need the tool, called traffic assignment software, to help you in modeling the road network, get the current network performance, and then create scenarios to alter the current road network on computer based on your ideas. Comparing the network performance of these scenarios would help you understand which ideas would work and which ideas would not work and which best ideas should be implemented.

Implementing your ideas directly in the actual road construction would cost a lot of time and money and the public would suffer in your experiment. Instead, you should try first all the possible ideas on computer and then you can propose to your government on your ideas. Knowing the exact amount of saving based on the propose scenario would also help you in quantifying the justification of the actual construction.

Given a road network, we would like to know what would be the flow and congestion level and network performances. Traffic assignment is a model to help us in assigning the flow and determine the congestion level on each link. Knowing the congestion level on each link, the program would also help us in finding the other link characteristics such as speed, travel time, delay and other network performances. Our goal in creating this program is to equip you with the best tools to test your creativity such that it can democratize the task to solve the traffic congestion in your own city. We are hoping that anyone (not necessarily as transportation engineer or transportation expert), equipped with these tools, can help in solving the traffic congestion quantitatively through science rather than merely based on opinions.

Many existing traffic assignment models exist but in general, most of them suffer several problems:

  1. The traffic assignment software are very expensive (about $10,000 per license and you need to pay maintenance fee per year).
  2. Many traffic assignment software are very complicated. The commercial demos are very nice with very lucrative animation but when it comes to solve the real world problem, you start to get a lot of doubt. You need to be a transport expert to input the data and to run the program.
  3. Many traffic assignment software requires extensive data, especially Origin-Destination (OD) demand data. The data input are tremendously very expensive to gather and without those data, you are not able to model properly. If you input with any data, then garbage in garbage out.
  4. The algorithm inside these commercial software are often heuristics and you treat them as black box without knowing how does it work and what are the assumptions behind the black box.
  5. They encourage road widening as the solution of traffic congestion. IFN-Transport is probably the only tool that provide the alternative way to justify road narrowing in order to balance the traffic congestion.

In contrast, IFN is open source, free to use and free to modify and free to distribute. The usage is relatively very simple, which will be explained in the user guide and it does not requires extensive data. The ideal flow network itself has strong mathematical background, based on Markov Chain and Maximum Entropy maximization whose assumptions are clearly stated. The IFN model is based on mathematical theory and not based on heuristic approach. The more data you have, it would be more accurate but at the most parsimony level, the model can be run without any data aside from the network itself. Based on the maximum entropy principle, we assume the maximum doubt when you have no data.

Installation

There is no need for installation on the FN-Transport itself. Simply download the zip file and unzip the whole code into a local folder. You need to install the latest Python 3.x in order to run this software.

Run the IFN-Transport

Run main.py in any Python IDE.

Alternatively, go into the folder where you unzip the code of IFN Transport and change directory into that folder in Command Line and type:

python main.py

IFN Tutorial

IFN requires input of a network structure (nodes and links that connects the nodes). Let us prepare our first simplest network, which consist of three nodes and three links.

  1. Create a text file and copy and paste the following, then save it as node.txt.

NodeID,X,Y

1,0,0

2,0,3

3,3,4

  1. Create another text file and copy and paste the following, then save it as link.txt.

LinkID,Node1,Node2,Capacity,Distance,MaxSpeed

1,1,2,1000,1000,40

2,2,3,1000,250,30

3,3,1,1000,2000,25

  1. Create another text file and copy and paste the following, then save it as scenario.txt.

ScenarioName=MyScenario

Node=node.txt

Link=link.txt

  1. Open ifn.py using Idle (the official IDE of python) and at the bottom, change the scenario file into

if name == 'main':

  scenario='scenario.txt'

IFN (scenario)

  1. Run the ifn.py and you get the result. The values in the links in the network represent the link congestion level.
  2. Now you can alter the link file into link2 where the second link from node 2 to node 3 would have 2 lanes. Save this link file as link2.txt.
  3. Now we need to modify the scenario where we still use the same nodes but only the number of lane is changing by changing the link file and the scenario name in the scenario file. Save the scenario file as scenario2.txt.
  4. Modify the scenario name in ifn.py and then run the program
  5. The results can be seen and compare with the previous scenario. The average speed is improving with the additional lane for instance from 17 km/hour into 23 km/hour. The travel time is also improving from 3.45 min/km now becomes 2.88 min/km. Similar result happen with the delay.

Agreement of the Inputs

Each scenario in IFN requires three files: scenario file, node file and link file.

Scenario File

At the minimum, the scenario file consists of scenario name, a pointer to the node file and a pointer to the link file. The keywords on the left hand side of the equal sign must be kept unaltered. The right hand side of the equal sign can be anything.

ScenarioName=MyScenario

Node=node.txt

Link=link.txt

The scenario name would be used to determine the name of the output files.

Inside the scenario file, you can also add additional parameters of the model based on the following keywords. The keywords must be on the left hand side (LHS) of the equal sign. The order of the keyword does not matter.

Node File

A node file can be any name but the format must be in CSV. The first row is fixed header

NodeID,X,Y

The header itself can be in any language but the location of each field must be fixed. For instance, the following header is also valid.

myPointID,longitude,latitude

From the second row, you can specify the actual node-ID and the coordinate location in X and Y. The node-ID must be an integer number. There is no limit of the number of node and the node-ID is not necessarily in order. The coordinate location can be floating numbers or integers

Link File

A link file can be any name but the format must be in CSV. The first row is fixed header

LinkID,Node1,Node2,Capacity,Distance,MaxSpeed

The header itself can be in any language but the location of each field must be fixed.

When downloading from OpenStreetMap (OSM), the program will first automatically compute the maximum speed and the capacity of each link before computing everything else. That means if you have your own maximum speed and link capacity for all links, then you can specify them in the links file. The result of this download frm OSM would be as follow:

LinkID,Node1,Node2,Capacity,Distance,MaxSpeed,NumLane,RoadWidth,RoadType,RoadName

Calibration Basis

The IFN would automatically calibrate the result based on certain assumptions. You can select between the two assumptions below:

  1. Maintain the maximum congestion level
  2. Maintain the demand of flow in the entire network
  3. Based on real observation flow from teh field survey

Maintaining the maximum congestion level would require you to specify the maximum allowable congestion parameter. The default value of the maximum allowable congestion is one. This option would set the maximum congestion level to your specification. It means you want to keep the maximum congestion in any link to be a constant among the scenarios that you are comparing. This option will help you to know what would be the maximum demand of flow that you can accommodate in your network.

Maintaining the total flow in the network indicates that you want to keep the demand to be constants among the scenarios that you are comparing. This option will set the total flow (including the flow in the dummy links) to be constant as to you total flow specification. This option will help you to know what would be the maximum congestion level given the total flow demand in the network.

In the scenario file, you can optionally specify the basis of calibration. If you set calibrationBasis=totalFlow then the program maintains the total flow in the network. This means you want to keep the total demand in the network to be invariant among all the scenarios. If the calibrationBasis=maxCongestion then it would maintain the maximum congestion level to be equaled to specified maximum allowable congestion parameter.

When you have real flow data based on observation on the field survey, you can specify calibrationBasis=realFlow.

Travel Time Model

There are two options of travel time models being used in IFN:

  1. Greenshield model
  2. BPR model

Using Greenshield’s traffic model, we assume the speed-density relationship is linear and the congestion level (which is equal to the flow/capacity) is set to be between zero and one. Since the congestion level is normalized to be between zero and one, it is easier to interpret the meaning of congestion level. However, the Greenshield tends to have higher speed than BPR (for the same congestion level) and only operates when the traffic is not so congested.

BPR model produces better variation of speed and travel time even when the traffic is congested. However, in BPR model, the congestion level (which is equal to the flow/capacity) can go beyond 1, which make the definition of capacity somewhat confusing. Transportation engineers is often using BPR model in conjunction with the capacity derived from Highway Capacity Manual (HCM).

In the scenario file, you can optionally specify the travel time model. If you want to set the travel time model to be Greenshield, then you put the following line in the scenario file: travelTimeModel=Greenshield

Without specifying the travel time model, the program will use BPR travel time model as the default model of IFN. If you want to explicitly state that the travel time model is BPR, then you put the following line in the scenario file: travelTimeModel=BPR

Cloud Node

For more advance users, you need to know that the IFN requires the network to be strongly connected. If it happens that your network is weakly connected, then you need to create a cloud node and connect each of the source node (or source component) in the network into the cloud node through dummy links and connect the cloud node to each of the sink node (or sink component) in the network using dummy links. When you use a cloud node, you need to specify the node ID of the cloud node. This parameter will affect to hide all the dummy links from showing and the link performance of the dummy links would be set to nan (not-a-number). The network performance would be free from the dummy links. If you do not specify the cloud node, the program assume that your network has no cloud node and no dummy links and the network must be strongly connected.

Future Development

There are a lot of fun stuff to develop further and if you have any critics, comments or suggestions to improve, drop me a note. I would welcome your contribution by any means, your programming time, donation or scientific ideas and so on.

Do your part

We hope you find this program useful for your study or work. You can help your own city by setting the base network on your city, and compute the scenarios that most likely will help to solve traffic congestion in your city. Share your ideas in social media and compare it with your friends. Talk with your city government about your ideas.

References

If you would like to know more about the scientific basis of this work. The following publications are the foundations of Ideal Flow analysis. Kindly read and cite any of the following papers in your references if you use this software.

  • Teknomo, K.(2019), Ideal Flow Network in Society 5.0 in Mahdi et al, Optimization in Large Scale Problems - Industry 4.0 and Society 5.0 Applications, Springer, p. 67-69
  • Teknomo, K. and Gardon, R.W. (2019) Traffic Assignment Based on Parsimonious Data: The Ideal Flow Network, 2019 IEEE Intelligent Transportation Systems Conference (ITSC), 1393-1398.
  • Teknomo, K., Gardon, R. and Saloma, C. (2019), Ideal Flow Traffic Analysis: A Case Study on a Campus Road Network, Philippine Journal of Science 148 (1): 5162.
  • Teknomo, K. (2018) Ideal Flow of Markov Chain, Discrete Mathematics, Algorithms and Applications, doi: 10.1142/S1793830918500738
  • Teknomo, K. and Gardon, R.W. (2017) Intersection Analysis Using the Ideal Flow Model, Proceeding of the IEEE 20th International Conference on Intelligent Transportation Systems, Oct 16-19, 2017, Yokohama, Japan
  • Teknomo, K. (2017) Ideal Relative Flow Distribution on Directed Network, Proceeding of the 12th Eastern Asia Society for Transportation Studies (EASTS), Ho Chi Minh, Vietnam Sept 18-21, 2017.
  • Teknomo, K. (2017) Premagic and Ideal Flow Matrices. https://arxiv.org/abs/1706.08856
  • Gardon, R.W. and Teknomo, K. (2017) Analysis of the Distribution of Traffic Density Using the Ideal Flow Method and the Principle of Maximum Entropy, Proceedings of the 17th Philippine Computing Science Congress, Cebu City, March 2017
  • Teknomo, K. (2015) Ideal Flow Based on Random Walk on Directed Graph, The 9th International collaboration Symposium on Information, Production and Systems (ISIPS 2015) 16-18 Nov 2015, Waseda University, KitaKyushu, Japan.

Known Issues

See: closed-issues