Skip to content

Repository files navigation

SUMO RL Project Setup

This guide provides step-by-step instructions to set up the SUMO RL environment, create a Conda environment, install the required Python modules, and run experiments. It also includes details on generating and analyzing plots from experiment outputs.


Prerequisites

Before starting, ensure you have the following installed on your system:


Step 1: Clone the Repository

First, clone the repository to your local machine:

git clone https://github.com/Transyltooniaa/RL-Project.git
cd RL-Project

Step 2: Create a Conda Environment

  1. Create a new Conda environment for the project:

    conda create -n sumo_rl_env python=3.8 -y
  2. Activate the environment:

    conda activate sumo_rl_env

Step 3: Install Necessary Python Modules

Install the required Python modules listed in the requirements.txt file:

pip install -r requirements.txt

For PettingZoo, install a specific version:

pip uninstall pettingzoo -y
pip install pettingzoo==1.23.1

To ensure all dependencies are installed, you can also run:

pip install argparse pandas numpy tqdm gymnasium traci supersuit pyvirtualdisplay sumo_rl stable-baselines3 ray[rllib] tensorflow-probability torch

Step 4: Setting Up SUMO RL Environment

Ensure that SUMO is correctly installed and accessible from your terminal. You can verify this by running the following command:

sumo --version

If SUMO is not installed or not in your PATH, refer to the SUMO documentation for installation guidance.

Configure SUMO_HOME and SUMO_PATH on Windows

  1. Locate the installation directory for SUMO, typically:
    C:\Program Files (x86)\Eclipse\Sumo
    
  2. Set the environment variables:
    • SUMO_HOME: Point to the main directory, e.g., C:\Program Files (x86)\Eclipse\Sumo
    • SUMO_PATH: Add the bin sub-directory to your system's PATH, e.g., C:\Program Files (x86)\Eclipse\Sumo\bin
  3. Steps to configure:
    • Open System Properties > Advanced > Environment Variables.
    • Under System Variables, select New.
    • Add:
      • Variable name: SUMO_HOME
      • Variable value: C:\Program Files (x86)\Eclipse\Sumo
    • Find the Path variable, click Edit, and add: C:\Program Files (x86)\Eclipse\Sumo\bin.

Step 5: Running Experiments

To run an experiment, navigate to the experiment directory and use the following command:

python experiment/<file_name>

Replace <file_name> with the name of the Python script you want to execute.

Example:

python experiment/train_agent.py

The experiment outputs are saved as CSV files in the specified outputs directory within the repository.


Step 6: Generating and Analyzing Plots

After running experiments, you can visualize and analyze the results using the plot.py script.

About plot.py

  • This script generates plots based on the CSV outputs generated by experiments.
  • It looks for CSV files stored in the outputs folder, which is created automatically after you run experiments.
  • The script allows you to compare one column of a CSV file with another, providing a clear visualization of the data.

Generate a Plot

To generate a plot, run the following command:

python outputs/plot.py

Example Usage

  • Use this script to analyze and compare metrics such as rewards, waiting times, or other key performance indicators stored in the CSV files.
  • Visualizations can be saved for later use.

Additional Dependencies

In addition to the dependencies listed in requirements.txt, the following modules are used across the project:

  • argparse
  • os, sys, shutil, subprocess
  • pandas
  • numpy
  • tqdm
  • gymnasium
  • traci
  • supersuit
  • pyvirtualdisplay.smartdisplay
  • sumo_rl
  • stable_baselines3
  • ray[rllib]
  • tensorflow-probability
  • torch

Ensure all these dependencies are installed for the project to run smoothly.


Additional Notes

  • If you encounter any issues, ensure that all required modules are installed and that SUMO is properly set up.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages