-
Notifications
You must be signed in to change notification settings - Fork 0
Home
This source doce in this repository is written in Python (>2.7) and Java (> 8). We will work with pip, wget, maven and virtualenv (optional). On Ubuntu Linux, those can be installed through e.g. through package manager:
sudo apt-get install maven python-pip python-virtualenv
Clone this contents of this repository to your local machine:
git clone git@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 --no-site-packages ademo_virtenv
To activate the newly created virtual environment, run:
source ademo_virtenv/bin/activate
Now install all the dependencies required in the virtual environment using pip:
pip install -r requirements.txt
To prepare a transport simulation of some specific urban area, we first need to download OSM data for that area. One way to obtain such data is to use one of 200 ready-made Metro Extracts offered by Mapzen. One of the smallest is the extract of Hanoi, Vietnam. The OSM data for Hanoi can be downloaded in compressed OSM XML format through this link:
wget https://s3.amazonaws.com/metro-extracts.mapzen.com/hanoi_vietnam.osm.bz2 -O map.osm.bz2
We will need to decompress the file to obtain the XML data. The following command will create uncompressed file map.osm:
bzip2 -d map.osm.bz2
After the process of decompressing has finished, the OSM data will be in file map.osm.
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.osm file and generates geoJSON input files in data directory:
python process_map.py map.osm 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 compileed through Maven:
mvn compile
A single simulation run can be executed using Maven as
mvn exec:java -Dexec.mainClass="cz.cvut.fel.aic.agentpolis.demo.OnDemandVehiclesSimulation"