TRAPP framework for Traffic Reconfiguration via Adaptive Participatory Planning
- Pre-print of TRAPP publication at the 14th Symposium on Software Engineering for Adaptive and Self-Managing Systems 2019
-
Download and install the latest version SUMO (v1.2.0).
-
On debian or ubuntu, SUMO can be installed simply via:
sudo add-apt-repository ppa:sumo/stable sudo apt-get update sudo apt-get install sumo sumo-tools sumo-doc
-
On Mac OSX we recommend using Homebrew:
brew tap dlr-ts/sumo brew install sumo
-
If you have to build SUMO from source using these commands:
sudo apt-get install -y build-essential git libxerces-c-dev sudo mkdir -p /opt && sudo cd /opt sudo git clone https://github.com/radiganm/sumo.git sudo cd /opt/sumo && sudo ./configure sudo cd /opt/sumo && sudo make sudo cd /opt/sumo && sudo make install
-
-
Set
SUMO_HOME
environment variable the folder of your SUMO intallation.- Hint: If SUMO is installed via the regular distribution in debian/ubuntu, it is installed at
/usr/share/sumo
. - Hint 2: On Mac OSX look at
/usr/local/opt/sumo@X.X
- Hint: If SUMO is installed via the regular distribution in debian/ubuntu, it is installed at
-
Clone the latest TRAPP version from github via
git clone https://github.com/iliasger/TRAPP.git
-
Navigate to the newly created TRAPP folder.
-
If
setuptools
are not installed in your system, install them. -
Install the python dependencies of TRAPP by issuing (inside the newly created TRAPP folder):
python setup.py install
-
Download the 0.0.1 release of EPOS and unzip it. Note the path to the path in the unzipped folder.
-
Open the file
app/Config.py
inside the TRAPP project in an editor of your choice and set the value of theepos_jar_path
variable to the above path.
-
Download and install Virtualbox.
-
Download the OVA file available from this Zenodo artifact and import it in Virtualbox. Give the VM at least 2GB of RAM to run.
-
Login to the VM by using the
seams19
password. (Disconnect any external monitors or keyboard/mouse if you face problems with the display in Virtualbox.) -
Open the Terminal and navigate to the
/home/seams19/TRAPP
folder. -
Make sure that you have the latest code by issuing
git pull
. -
Perform a sample run by issuing python
run.py
. Upon startup the following lines should be printed:and the SUMO Graphical User Interface (GUI) should open with the map of Eichstaett:
-
Inspect the cars moving in the simulation. You can zoom in and out with mouse scrolling.
-
After a few seconds, the following should be printed to the console, indicating that an adaptation run starts:
-
Shortly after, the following should be printed to the console, indicating that an EPOS run has started:
An EPOS run prints out a wealth of information, including the configuration of the run:
When an EPOS run finishes, a corresponding message is printed:
An EPOS run can comprise multiple simulations. We have configured EPOS to run a single simulation per run. This can be changed via the
numSimulations
parameter inconfig/epos.properties
. -
After that, inspect the rest of the outputs until the termination of the simulation.
Note: Error messages similar to may be printed after an EPOS run. This is an indicator that a certain cars couldn't be rerouted (since that would necessitate that they do a U-turn, which is not possible to perform in SUMO). We plan to deal with this special case in a future release--for now, such messages can safely be ignored.
These step-by-step instructions are a mini-tutorial to get someone familiar with TRAPP. The instructions assume that the VM is started, the user is logged in and has navigated to the /home/seams19/TRAPP
folder. To edit files, you can either use vim/gedit or PyCharm (pinned in Favorites bar on the left). We recommend to use PyCharm to inspect the code and project structure.
We will first run the LoadBalancing strategy available at app/adaptation/strategy/LoadBalancing.py
with different thresholds and inspect and compare the results.
-
Open
app/Config.py
and inspect the configurations. Verify thatadaptation_strategy
is set to"load_balancing"
and (optionally, for performance reasons) setsumoUseGUI
toFalse
. -
Open
app/adaptation/strategy/LoadBalancing.py
and verify that the implementation of theplan
method includes:if mean_overhead > 3.5: print "Mean overhead threshold reached!" return 0.9
-
Navigate to
/home/seams19/TRAPP
and issuepython run.py
.The program starts by adding 600 cars to the simulation.
Every 100 ticks, an adaptation run is invoked (
adaptation_period
var. inConfig.py
).Every 100 ticks, a planning run is invoked (
planning_period
variable inConfig.py
).Wait until the simulation finishes. The simulation should take ~5 mins or less with the simulation horizon of 300 ticks (
simulation_horizon variable
inConfig.py
). -
Navigate to the data folder and rename the files "overheads.csv" and "streets.scv" to "overheads-1.csv" and "streets-1.scv" respectively.
We will use these files in the analysis later on and renaming ensures that they are not lost in the next simulation run.
-
The execute phase of the adaptation runs was not triggered in the previous run since the average overhead was not more than 3.5.
Now, we will perform a simulation where the execute plase is triggered and the beta parameter of planning decreases.
This corresponds to increasing the altrouism of the agents, that hopefully also reduces the trip overheads via achieving load balancing in the traffic network.
To do this, open
app/adaptation/strategy/LoadBalancing.py
and change the lineif mean_overhead > 3.5:
to
if mean_overhead > 1.2:
-
Navigate to the
/home/seams19/TRAPP
and issuepython run.py
.Inspect that the "beta" is set to 0.9 already in the first adaptation run. Wait until the simulation finishes.
-
This simulation has generated two more files ("overheads.csv" and "streets.scv") in the data folder of the project.
-
We will now analyze the results from the two simulation we performed.
To do this, being at the parent folder of the project (
/home/seams19/TRAPP
) and issuejupyter notebook
. This opens a new tab in the browser. -
Click on the "SEAMS example.ipynb". This will open a new tab. If asked which kernel to use, pick either of the two.
-
Click anywhere in the first cell and issue Shift+Enter. This will run the Python script of the first shell and plot graphs which, together with the printed statistics, can be used to determine the difference in trip overheads between the 2 simulation runs.
The graphs (boxplots) should look similar to:
-
Do the same for the second cell of the notebook and inspect the statistics and the graphs on street utilizations.
The value of variance of street utilization for the 90% selfish case (2nd simulation performed) should be lower than the 100% selfish case (1st simulation performed).
-
Congratulations! You have successfully run two different variants of an adaptation strategy and compared their results. In real settings, the simulation time would be larger in order to collect more data and increase the validity of the comparison. Also, the plan phase of this strategy can be much more complex than simply comparing to a threshold.
Let's now run the AvoidOverLoadedStreets strategy. In this strategy, street utilization is monitored. Streets that are considered overloaded (based on a comparison to a threhold value) are included in an EPOS signal so that they are avoided in the next planning step.
-
Open
app/Config.py
and set the adaptation_strategy parameter to "avoid_overloaded_streets". -
Navigate to the
/home/seams19/TRAPP
and issuepython run.py
. Inspect the messages about overloaded streets printed in the console. -
Open
app/adaptation/strategy/AvoidOverLoadedStreets.py
and inspect its logic.
Finally, let's now run the TunePlanningResolution strategy, which is also the most complicated one. In this strategy, the actual average utilization of each street in each step is compared to the value predicted by EPOS. Large differences (errors) there indicate that there is a big drift between these values, which the strategy tries to rectify by planning more often.
-
Open
app/Config.py
and set the adaptation_strategy parameter to "tune_planning_resolution". -
Navigate to the
/home/seams19/TRAPP
and issuepython run.py
. Inspect the message about mean errors and changing of planning parameters printed in the console at simulation tick 200. -
When the simulation ends, navigate to the root of the project and open "TunePlanningResolution-200.png". This shows the errors between the actual street utilizations and the EPOS-predicted ones, for each street and for each planning step, at simulation tick 200.
-
Open
app/adaptation/strategy/TunePlanningResolution.py
and inspect its logic.
If you need help in using or extending TRAPP, feel free to contact us: