-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Welcome to the ifn-transport wiki!
The python code is for Traffic Assignment based on Ideal Flow Network (IFN). The current version of this code was tested in Python 3.7.
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:
- The traffic assignment software are very expensive (about $10,000 per license and you need to pay maintenance fee per year).
- 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.
- 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.
- 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.
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.
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.
- 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
- Create another text file and copy and paste the following, then save it as link.txt.
LinkNo,Node1,Node2,Dist,Lanes
1,1,2,1000,1
2,2,3,1000,1
3,3,1,1000,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
- 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)
- Run the ifn.py and you get the result. The values in the links in the network represent the link congestion level.
- 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.
- 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.
- Modify the scenario name in ifn.py and then run the program
- The results can be seen and compare with the previous scenario. The average speed is improving with the additional lane 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.
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.
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.