TranOpt Plus

TranOpt Plus ver 1.0 has been released, If you are interested in TranOpt Plus, send me an email:

TranOpt Plus ver 1.0
User manual


1. About TranOpt Plus

TranOpt Plus (or TranOpt+) is the software supporting mainly for transportation & traffic optimization. TranOpt+ was programmed in C++ version 2011 (using the Qt library for GUIs and Graphics) by Tuan Nam Nguyen since early 2014. The first version was released in January 2015 containing the feature of traffic assignment modeling. More features about traffic optimization will be included in the near future, e.g., traffic network design, facility location, traffic signal light optimization, etc.
Author: Tuan Nam Nguyen
Institude of Computer Science, University of Heidelberg, Germany
Email: or
Copyright: Tuan Nam Nguyen 2015.

1.1 What is TranOpt Plus?

TranOpt stands for Transportation Optimization, but it has the other meaning, that is TRAffic ‘N'(and) OPTimization. The main features of TranOpt+ is to solve traffic problems such as:

  • Traffic assignment modeling;
  • Traffic network design;
  • Urban Traffic controling;
  • Facility locations.

In particularly, it supports for urban mixed traffic assignment modeling in developing countries where the traffic system is a mixture of many tyles of vehicles. However, it can be used to model standard traffic systems in developed countries.
The current version (by March 2015) is TranOpt Plus 1.0-demo, build 20150308 which including 3 main features: Graph editor, Dynamic Routing and Traffic assignment modeling.

1.2 Copyright

TranOpt Plus is licensed partly under GNU General Public Lisense, i.e. only the copyright of developed library TNGA  belongs to Tuan Nam Nguyen, the other source-code is under the GNU General Public License. All modification and redistribution are not allowed without the agreement of the author.

Author’s email: or

1.3 Over view

1.3.1 How to use this manual

TranOpt+ version 1.0 supports 3 main tasks: Graph editor, Dynamic routing, and Traffic assignment modeling. Depending on what you want to do with TranOpt+, you can choose a particular section on this manual to read withour caring other sections.

  • For people interested in map, graph, or GIS objects: go to the Section 2. Graph Editor.
  • For people interested in routing algorithms, navigation: go to the Section 3. Dynamic routing. This section provides some routing algorithms, and visualize the results on the scene.
  • For people interested in Traffic optimization: go to the Section 4. Traffic assignment modeling. This section is for traffic assignment modeling. If you don’t really want to know deeply about how the models work, you can go directly to the Subsection 4.4. Modeling step by step and read the instruction.
  • For developers who want to develop TranOpt+: go to Section 6. Support for developers. This section provides the book of classes in TranOpts, and also the file formats, etc.

1.3.2 Main sections on TranOpt+

This section provides an overview of the main features on TranOpt+, and the location of them.
Fig. 1: The main window with locations of main parts.

  • 1: The context menu bar includeing File operations, tools, view, windows, and help.
  • 2: The File tool bar and the Graph view tool bar control file and graph actions.
  • 3,4,5: The vertical tasks tool bar containing mains tasks such as Graph Editor, Smart routing, and Traffic modeling.
  • 6+8: File Infor holds the file information. User can also edit the information and save it.
  • 7: Dynamic assignment displayerDisplay the dynamic assignment flow.
  • 9: The central view display the map.
  • 10: Dynamic routing or smart routing provides routing feature with some dynamic condition such as the dissimilar paths, k dissimilar paths, etc.
  • 11: Graph tools provides tools for editing the graph.
  • 12: Filter tools provides tools for filter objects on the graph such as nodes,links, zones…
  • 13: Properties box is the box for displaying and editing the properties of selected object
  • 14: Tile sources manager manage the map image sources such as OpenStreetMap pictures…
  • 15: Latitude information display the latitude information of the current mouse’s point
  • 16: Longtitude information display the longtitude information of the current mosue’s point

2. Graph editor

2.1 Main features

This feature consists of creating new graph (map), importing available map and editing map.

Creating new map:
User can press button new in File menu or press shortcut key: CTRL + O to create new map. The existing objects on the scene will be delete and a empty scene is ready to add new objects. Note that after editing, people should save the result.
Importing map:
User can import a file in *.osm or *.tra or *.xml format. The supported format is described here.
Editing map:
User can edit the current graph on the scene with the GraphTool bar.

2.2 File formats

TranOpt uses xml language to store data. It suportes openstreetmap (*.osm) file. Users can download the map of a certain area on the .
After traffic modeling, users can sasve the results as *TRA file. Basically, this is a xml file with the structure as osm but it hold the EdgeObjects with its flow and capacity.
More information about file formats can be found in section 6.2 File structures.

2.3 Editing map on TranOpt

To open graph editing tools, users can click on the Graph button located on the leftside bar or go to Window menu and then choose Graph Editor.
Fig. Graph editing tools.

ADD NODE: click to button “Add node” on the graph editor, then left mouse click on the scene (central widget).
ADD ZONE: click to button “Add Zone” on the graph tools bar and then click on the scene to locate the zone.
ADD WAY: click on the tool button “Add way”, and then click on the scene to located the nodes on the way. To finish adding nodes press key “ESC”.
ADD AREA: click on the tool button “Add area” do the same as adding way. An area is a polygon representing an population zone.
ADD LINKING LINE a linking line is a connector between zone and a node in network. This is the link we the traffic from each zone go to the network and from network go into zone. To add a linking line, first, select an zone, and then select an node.
COMBINE WAY to combine two ways. This function is not yet supported in the version 1.0.

2.4 Editing properties of an objects

Each map object, e.g., node, zone, way, area, etc, has its properties. For example, a way has a property named “highway” to difine the class of highway, such as primary, trunk, secondary, etc. To add or modify properties of an object, first select the object on the scene by left mouse click on it. Open the object properties box by click on the “object properties” tab on left toolbar, or goto menu “Windows”->”Object properties” or just prest “Alt+P”. The figure bellow shows how to change the properties of a zone.

Fig. Dynamic routing tools.

3. Dynamic routing

3.1 Main features

This feature is to find a path between two points on the map satisfying some conditions such as dissimilar condition or upper bound condition. To open the routing tools, click on the Routing button on the left tool bar or go to Windows in menu and then choose “Dynamic routing”.

Fig. Dynamic routing tools.

In the parameters box, users can enter parameters for dynamic routing:

  • K : number of desired paths
  • Min diffirence : Minimum diffirence of two paths (%);
  • Max diffirence : Maximum length of paths compare to the shortest path’s length(%);
  • Increase factor : The factor using in penalty methods;
  • Source id : The id of the source node. Click to the node on the scene and see the id on the status bar or in Object Properties box;
  • Destination id : The id of the destination node;

3.2 How to find potential paths

In the ComborBox Shortest algs, there are 4 algorithms: Dijkstra, Dijkstra biDirections, A* and A* biDirections.
Note that: A* and A* biDirections use the Euclid distance as the lower bound length of path. In the ComborBox K shortest algs, there are 4 algorithms: Penalty A*, Penalty dijkstra, Eppstein and Yen.
To use k shortest paths algorithms, user must enter the parameters:k, min diffirence, maxdiffirence, source id, destination id.
If algorithms Penalty A* or Penalty Dijkstra are selected, users muss enter the parameter Increase factor.
Decriptions of function buttons:

  • K dissimilar: finding k dissimilar paths satisfying min diffirence and max diffirence conditions
  • Shortest path: finding a shortest path
  • Original graph: show only the graph without any marked edges, i.e., clear the previous result
  • Shortest tree: show the shortest tree of the graph.
    If only Source id is entered. The shortest tree is the shortest tree from source node.
    If only Destination id is entered. The shortest tree is the shortest tree from all nodes to the destination node.
    If both source and destination nodes are entered, the shortest tree is the shortest tree from source node to others.
  • Create graph: Update the graph after changing on the scene
  • Efficient area: Mark nodes in efficient area. An unefficient node is a node that d(source, node)+d(node,destination)>upper bound

3.3 Algorithms insides

  • Dijkstra: finding shortest path. It is a specific version of A* algorithm
  • Dijkstra biDirections: Dijkstra search in both source and destination nodes until the visited ball meet each others
  • A* (or A star): find a shortest path.
  • A* biDirections: find a shortest path using A* in both directions
  • Eppstein: finding k shortest paths (may be loop paths). O(mlog(n)+k) where m is number of edge, n is number of vertices and k is number of paths
  • Yen: finding k loopless paths. The complexity O(k.m.log(n)). It utilizes k times shortest path algorithm

3.4 Future works

Develop a new algorithm or improve existing algorithms to find k dissimilar paths from many to many nodes.

4. Traffic assignment modeling

4.1 Main features

To deal with traffic assignment modeling problem, the Traffic section supports some main features to do the task.

  • Modeling traffic assignment problem: forcast the traffic flow on each link (road);
  • Analyzing results: analyze the flows on the traffic system and make statistic about roads with ratio of flow/capacity in a given range;
  • Comparing two results: compare flows of two assignments.

4.2 Traffic assignment models

This section provides definition of each kind of traffic assignment model.
More details can be found in

4.2.1 All or Nothing (AON) model

Definition: Drivers choose the shortest path (responed to the distance).
The model is normally not suitable for a real traffic situation, however, this model is used to evaluate other models and to test some particular traffic situations.

4.2.2 Incremental (INC) model

Definition: Incremental model actually do the same with All-or-Nothing model, but it devide the traffic demand into smaller time intervals and to AON model for each time interval after updating the travel time on each link (road). So, the Incremental model can be called as dynamic All-or-Nothing model.

4.2.3 Original User Equilibrium (UE) model

Definition: Based on the first principle of Wandrop (1952) which states that: The journey times in all routes actually used are equal and less than those which would be experienced by a single vehicle on any unused route.

Each user non-cooperatively seeks to minimize his cost of transportation. The traffic flows that satisfy this principle are usually referred to as “user equilibrium” (UE) flows, since each user chooses the route that is the best. Specifically, a user-optimized equilibrium is reached when no user may lower his transportation cost through unilateral action.
More details can be found in

4.2.4 Mixed User Equilibrium (MUE) model

Definition: new user equilibrium model for mixed traffic system where the traffic containing mostly motorcycles and cars.

The new model is proposed by Tuan Nam Nguyen, applying for mixed traffic system dominated by motorcycles.

4.2.5 Dynamic Mixed User Equilibrium (DMUE) model

Definition: By deviding the travel demand within smaller time intervals and doing MUE modeling for each interval. We got Dynamic Mixed User Equilibrium Model.

4.3 Travel cost functions

Travel time function is the relationship betwwen the driving time and the flow on a road (or link). This is very important for traffic modeling. This sections provides some popular travel time functions which are used nowaday on traffic planning software.

4.3.1 BPR function

Definition: f(x)=T_0*(1+a*(x/C)^b)
where T_0: the travel time on free flow;
C: the capacity of the road;
a,b: the parameters.

More information can be found here

Fig. The BPR function and conical travel time delay function.

4.3.2 Travel time delay conical function

Definition: is proposed by Spiess 1990.

Fig. the conical travel time delay function.

4.4 Modeling step by step

Traffic assignment modeling has main steps as following:

  • Preparing map: Create new or load map file (*.osm), and then Prepare the map with Graph Tool. The map, which is suitable for modeling, should contain at least 2 zones. Users can add zones by Add zone tool in Graph Tools.
  • Switch to Traffic mode by press “Traffic” button on the left tool bar.
  • Loading zones on the map for modeling: one the groupBox Traffic data click on “Zones on Graph” button to get zone list from the graph showed.
  • Entering traffic demand : Press Motor demands button to open the matrix of motor demands. Users can enter the demand manualy or creat randomly with the tools below, or open existing data from file.
  • Selecting model: select a assignment model from the comborBox T.A models.
  • Running model: After selecting a model, enter parameters for the model. Normally, the model parameters box will appear on the right side. Some models don’t need any further parameters, so they don’t have any parameters box.
  • Saving the result: Click button Save results to save the assigned flow on roads to a *.TRA file.

The detail of each step will be described in coming sub sections.

4.4.1 Preparing graph containing zones and connectors

Zone of population (or zone in short) is displayed as a filled circle. In traffic assignment modeling, a zone represents for the center of an population area. The traffic demands are collected from each pair of population areas or pair of zones.

IMPORTANT: each zone must be defined by its order. Orders of all zones must be continuous and start from “1”.
This order is the same with the order when users collect the data. So, after adding a new zone, users must select that zone and go to tab “Object properties”. In the object properties box, user must add an properties name “order” and then give the value. The section 2.4 Editing properties of an object gives the introduction how to edit object’s properties.

To connect each zone to the map network, TranOpt provides an object named connector (or linking line). Each connector is drawed as an blue dot-line (by default), but users can change the color of the connector in display options.
To add, edit, delete zones, connectors, users can follow the instruction in Editing map.


Fig. A map with zones and connectors.
Fig. The displaying zones table.

4.4.2 Entering traffic demand matrices

The traffic demand matrices consisting of car demand matrix and motorcycle demand matrix. To enter demand matrices, press to button “Motor demands” or “Car demands”. The table widget will be showed for enter the matrix as figure bellow:

Fig. traffic demand matrix.

Users can enter directly in this table, or they can open the matrix file (*.tmd). The file format is described in 6.2.3 Traffic demand file(*.tmd).

4.4.3 Selecting models

TranOpt+ version 1.0-demo supports 3 kinds of Traffic assignment models: All or nothing, Incremental and User Equilibrium. Some other models are in construction and will be available in later version. More details about these models can be found in section 4.2 Traffic assignment models .
To select a model, users click on the combobox as following figure.

Fig. Selecting a traffic assignment model.

Right after selecting a model, the parameter box for the model will be displayed in the right side.

Fig. Parameter box for User Equilibrium model.

After entering parameters for the selected model, users press button “Modeling” to run the model.

Fig. Modeling information.

4.4.4 Saving results to file

To save the assigned result, users press button “Save results” beside the button “modeling”. The assigned flow on each road will be saved into a (*.tra) file, see Traffic assigned flows file.

Tips: users can edit the modeling information on the textedit (the default information contains only the information about modeling process). User should add more information bout the map, date, etc.

4.5 Flows statistic

Open the compareing assigned flows tool by select Tools -> Assigned flows statistic….

Fig. Statistic of assigned flows.

This tool provides a statistic of assigned flow on the network. User will know how many roads with the flow/capacity in a given range.

4.6 Comparing results

Open the compareing assigned flows tool by select Tools -> T.A Analyzer.

Fig. Traffic assignment comparing flow tool.

On the top bar bar_Comparing, there are 5 buttons:

  • 1: open the first assigned flows results. The flow will be displayed on the left scene;
  • 2: open the second assigned flows results. The flow will be displayed on the right scene;
  • 3: zoom in both scenes;
  • 4: zoom out both scenes;
  • 5: adjust the view on the right scene to the same with the view on the left scene.

User can also use the statistic tool to compare two results as figure bellow:w_statisticTool2
Fig. Compare statistics of two results.

4.7 Future works

Investigate more traffic assignment models for mixed traffic systems.

5. Other features

5.1 File infor manager

TranOpt+ also provide a simple tool to manage the file information. When users click to button “File Infor” in the task bar (left tool bar), a widget to view or modify file information is showed.

Fig. The widget to view and edit file information.

The file information normally contains the information about kind of graph, the name of graph and the modeling information (if the file is the traffic assignment result (*.tra)). The file information is saved on the file after the tag , see file structure here.

5.2 Shortcuts keys

  • “File” menu :
    • New graph: Ctrl+N
    • Open file: Ctrl+O
    • Save file: Ctrl+S
    • Save as : Ctrl+Shift+S
    • Save view as : Ctrl+Alt+V
    • Save map as : Ctrl+Shift+S
    • Exit : Ctrl+Q
  • “Tools” menu :
    • Matrix tools : F2
    • Comparing assigned flows: F3
    • Assigned flows statistic: F4
  • “Windows” menu :
    • Filter tools : Alt+F
    • Object properties : Alt+P
    • Tiles source manager : Alt+T
    • Graph mode : Shift+G
    • Dynamic routing mode : Shift+R
    • Traffic modeling mode : Shift+T
  • “Options” menu :
    • TranOpt options : Alt+D
  • “Help” menu :
    • TranOpt manual: F1
    • Help developers : Shift+F1
    • About TranOpt : Ctrl+I

5.3 TranOpt+ manual

The manual of TranOpt+ can be found on the menu “Help->TranOpt Manual…” or press “F1”. It is writen in html and user can be open in external html readers, such as, Google Chrome, Internet Explorer, Fire Fox, etc.

5.4 TranOpt setting

To change the diplay of objects in TranOpt or change properties of traffic objects, Users can go to menu “Options->TranOpt options”. The widget for editing options will be showed as fingure bellow:

Fig. TranOpt options tools.

There are two main sections: Display setting and Traffic setting. In Display setting, users can edit the color and width of objects like highways, zones, background, etc. In the Traffic setting, user can edit traffic object’s properties. For example, to change the default width, velocity, preference, oneway ratio of a highway. These properties are used to estimate the parameters for road in travel time funtions as well as in dynamic routing. After change one of properties, users press button “Apply” to apply change and save change to the current setting file.
Users can also save the current setting to a xml file, and load a existing setting file. The setting file is stored in the file “config.xml” and load at the beginning of the application. If the setting file is not found, the default parameters will be setted. Users can also set default all parameters by go to “Options” and choose “Reset setting”.

6 Support for developers

This section provides information for developers who want to know deeply about the structure of TranOpt+ projects. At the first subsection, a book of classes is given, the next subsection will talk about the structure of file data using in TranOpt+. Next subsection is about the GPS system and the last one is for developers who want to build plug-in for TranOPt+.

6.1 Book of classes in TranOpt

TranOpt provide a “book of classes” for developers to understand the classes structure of the software. To open the “book of classes” press Help -> Help developers .

Fig. The book of classes for developers.

The book of classes contains all classes in TranOpt GUI programming. It don’t provide information about rendering visualization tools and mathematics optimization code.

6.2 File structure

This section describes the structure of file format used in TranOpt+.

6.2.1 Open street map file (*.osm)

This is an example of a *.osm file:

Fig. An example of osm file.

6.2.2 Traffic assigned flows file (*.tra)

Traffic assigned flows file is the file format to store the assigned result after running traffic assignment modeling. Basically, the file structure is the same with openstreetmap file, but all ways in the file are tn_edge which includes current flow, flow_history and capacity. This is an example of a traffic assigned (*.tra) file:

Fig. The way in “tra” file contains additional tag for its flow and capacity.

6.2.3 Traffic demands file (*.tmd)

Traffic demand file is the file format to store the traffic demand matrix. User can create the traffic demand file by any text editor programe such as Notepad, Wordpad, etc. The file structure is as the figure below:

Fig. An example of traffic demand file.

The first lines are information about the file, e.g., name of file, file information, number of zones (dimension), etc.
The real data is given after the stoken “START_DATA”.
The first real data line is: the size of matrix (number of columns =number of rows=size).
The next rows are the demand from zone ‘i’ to others zones (includes ‘i’). For example, the demand from zone ‘i’ to zone ‘j’ will be enter on the row ‘i’ and column ‘j’.
The data ends with the stoken “EOF”.

6.2.4 Setting file (*.xml)

This is an example of a setting file:

Fig. An example of a setting file.

6.3 GPS system

In TranOpt, the GPS coordinator is used to locate the object’s location. Each Object on the scene has a position point P(x,y) where x is the longtitude, and y is the latitude.

6.4 Building plug-in for TranOpt+

Version 1.0, TranOpt+ don’t support for building plug-in. This feature will be added in the later version. Developers who want to develop TranOpt+ can contact to author directly.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s