Setup
- Make sure you have Python 3 installed (we recommend using the Anaconda Python distribution).
- Install Jupyter with
pip install jupyter. Verify that you can start a Jupyter notebook with the commandjupyter-notebook. - Install Flow by executing the following installation instructions.
Tutorials
Each file tutorials/tutorial*.ipynb is a separate tutorial. They can be
opened in a Jupyter notebook by running the following commands:
source activate flow cd <flow-path>/tutorials jupyter-notebook
Instructions are written in each file. To do each tutorial, first run all of the cells in the Jupyter notebook. Then modify the ones that need to be modified in order to prevent any exceptions from being raised. Throughout these tutorials, you may find the Flow documentation helpful.
Common error: if, when running a notebook, you run into an error of the form
ImportError: No module named flow.something, this probably means that theflowConda environment is not active in your notebook. Go into the Conda tab and make sure thatflowis selected. In case you don't have this Conda tab, try runningconda install nb_condajust aftersource activate flow, then open the notebook again. If this doesn't work either, you can try other solutions here , or you can launch a Jupyter notebook using theflowenvironment directly from the Anaconda Navigator. If you have the conda tab but you still get the error, open a new terminal and execute the following commands:cd / source activate flow python(
cd /is to make sure thatflowis not in the folder you runpythonfrom). Then, in the Python interface that opens, runimport flow. If you get anImportError, this means you haven't installed Flow in your environment. Go back to the installation instructions, especially the part where you dopip install -e .after having donesource activate flow.
The content of each tutorial is as follows:
Tutorial 0: High-level introduction to Flow.
Tutorial 1: Running SUMO simulations in Flow.
Tutorial 2: Running Aimsun simulations in Flow.
Tutorial 3: Running RLlib experiments for mixed-autonomy traffic.
Tutorial 4: Saving and visualizing resuls from non-RL simulations and testing simulations in the presence of an RLlib agent.
Tutorial 5: Creating custom networks.
Tutorial 6: Importing networks from OpenStreetMap.
Tutorial 7: Importing networks from simulator-specific template files.
Tutorial 8: Creating custom environments.
Tutorial 9: Creating custom controllers.
Tutorial 10: Traffic lights.
Tutorial 11: Running simulations with inflows of vehicles.
Tutorial 12: Running the bottleneck environment.
Tutorial 13: Running rllib experiments on Amazon EC2 instances