SUMO simulator¶
- class routerl.environment.SumoSimulator(params: dict, path_gen_params: dict, seed: int = 23423)[source]
Sumo simulator class
A class responsible for managing the communication between our learning agents and the SUMO traffic simulator. SUMO provides the traffic environment where vehicles travel between designated origins and destinations, and it returns the corresponding travel times for these vehicles.
- Parameters:
- Variables:
network_name – Network name.
simulation_length – Simulation length.
sumo_id – SUMO connection id.
sumo_connection – Traci-SUMO connection object.
timestep – Time step being simulated within the day.
- add_vehicle(act_dict: dict) None [source]
Adds a vehicle to the SUMO simulation environment with the specified route and parameters.
- Parameters:
act_dict (dict) – A dictionary containing key vehicle attributes.
- Returns:
None
- reset() dict [source]
Resets the SUMO simulation to its initial state.
Reads detector data.
- Returns:
det_dict (dict[str, float]) – dictionary with detector data.
- start() None [source]
Starts the SUMO simulation with the specified configuration.
- Returns:
None
- step() tuple [source]
Advances the SUMO simulation by one timestep and retrieves information about vehicle arrivals and detector data.
- Returns:
self.timestep (int) – The current simulation timestep.
arrivals (list) – List of vehicle IDs that arrived at their destinations during the current timestep.
- stop() None [source]
Stops and closes the SUMO simulation.
- Returns:
None