-
Notifications
You must be signed in to change notification settings - Fork 0
Home
The source code in this repository is written in combination of Python (>2.7) and Java (> 8). We will work with pip, maven and virtualenv (optional). On Ubuntu 16.04, those can be installed, e.g., through the package manager as follows:
sudo apt-get install default-jdk python maven python-pip python-virtualenv npm
Note: On Ubuntu 14.04, Java 8 is not in standard software repository and must be installed separately.
Clone the contents of this repository to your local machine:
git clone https://github.com/aicenter/agentpolis-demo.git
The source code will be in directory called agentpolis-demo. The subsequent commands must be executed in this directory. We will change the working directory:
cd agentpolis-demo
Virtualenv is a tool that allows to create Python environments that are isolated from the rest of the system. We will need to install several third party libraries, it is a good idea to do it in an isolated environment to avoid possible incompatibilities with the packages already installed in the system. To create a new virtual environment, whose configuration will be stored in ademo_virtenv directory, run:
virtualenv -p python2.7 ademo_virtenv
To activate the newly created virtual environment, run:
source ademo_virtenv/bin/activate
On most Windows computeres NumPy package cannot be installed via pip. Instead, download its wheel packages for your python version and 32/64 bit Windows into your current directory. For example, for python 3.7 runned on Windows 64bit, select numpy‑1.16.0rc1+mkl‑cp37‑cp37m‑win_amd64.whl. You can download wheel here: https://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy After downloading install it via pip from the folder where the wheel is:
pip install (file name of wheel)
Then install the rest of the dependencies required using pip:
pip install -r requirements.txt
Next, we will need to process the OSM data to obtain a collection of geoJSON files that are used to specify the structure of road network in Agentpolis. The steps needed to obtain the geoJSON input files for Agentpolis from OSM data file are implemented in in process_map.py script. The following command will use OSM data from map file and generates geoJSON input files in data directory:
python process_map.py map data
Finally, we prepared a simple urban traffic scenario that will be executed in the given road network. The scenario is implemented in Java and can be compiled through Maven:
mvn clean compile -U
A single simulation run can be executed using Maven as
mvn exec:java -Dexec.mainClass="cz.cvut.fel.aic.apdemo.DemoSimulation"
A visualization window will pop-up. You will see a map of Prague with a number of vehicles driving between randomly generated points.

When the visualization window appears, you can control the visualization and the progress of simulation as follows:
- Move the viewport: Drag with right mouse button pressed
- Zoom in/out: Rotate mouse wheel
- Pause/unpause simulation: Press SPACE
- Speed-up simulation: Press "+"
- Slow-down simulation: Press "-"
- Simulate in real-time: Press "*"
- Simulate as fast as possible: Press Ctrl+"*"
- Show/hide roadmap: Press "h"