Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CityflowGym

Standalone Gym-style wrapper for CityFlow traffic signal control.

This package extracts the CityFlow simulation wrapper from LibSignal and keeps the observation, reward, and info definitions inside the environment rather than inside an agent class.

Quick Test

Run from this folder:

python -m cityflow_gym.env 

Minimal Usage

from cityflow_gym import GymTSCEnv, TSCEnvSpec

env = GymTSCEnv(
    cityflow_config="configs/cityflow1x1.json",
    thread_num=1,
    spec=TSCEnvSpec(
        obs_keys=("lane_count", "phase"),
        reward_key="negative_waiting_count",
        reward_mode="vector",
    ),
)

obs = env.reset()
actions = env.action_space.sample()
next_obs, rewards, done, info = env.step(actions)

Supported Keys

Observation keys:

  • lane_count
  • lane_waiting_count
  • lane_delay
  • pressure
  • phase
  • phase_one_hot

Reward keys:

  • negative_waiting_count
  • negative_queue
  • negative_pressure
  • negative_delay

Reward modes:

  • vector: one reward per controllable intersection
  • mean: scalar mean reward
  • sum: scalar summed reward

About

Standalone Gym-style wrapper for CityFlow traffic signal control.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages