Road Traffic Simulator
Road Traffic Simulator — OpenEnv RL Environment An OpenEnv-compliant RL sandbox for global traffic flow optimization on real road networks.
Core trick
Reward is Shannon entropy over segment vehicle counts minus mean wait time, with deadlock termination, on OpenStreetMap road graphs.
Tags
Description
Road Traffic Simulator — OpenEnv RL Environment
An OpenEnv-compliant RL sandbox for global traffic flow optimization on real road networks. The environment models any city's road graph as a directed graph G=(V,E) from OpenStreetMap, where an agent acts as a Global Traffic Orchestrator redistributing flow to prevent gridlock.
What makes it hard: partial observability via density heatmaps, non-stationarity from live street closures causing schema drift, and long-horizon causal reasoning where local rerouting decisions cascade into downstream gridlock minutes later.
Reward: Shannon entropy maximization (α=2.0) spreads vehicles across segments, penalized by mean wait time (β=0.5) and a hard deadlock termination — preventing degenerate routing solutions.
README excerpt
---
title: Road Traffic Simulator Env Environment Server
emoji: 🖲️
colorFrom: purple
colorTo: green
sdk: docker
pinned: false
app_port: 8000
base_path: /web
tags:
- openenv
---
# Road Traffic Simulator Env Environment
A simple test environment that echoes back messages. Perfect for testing the env APIs as well as demonstrating environment usage patterns.
## Quick Start
The simplest way to use the Road Traffic Simulator Env environment is through the `RoadTrafficSimulatorEnv` class:
```python
from road_traffic_simulator_env import RoadTrafficSimulatorAction, RoadTrafficSimulatorEnv
try:
# Create environment from Docker image
road_traffic_simulator_envenv = RoadTrafficSimulatorEnv.from_docker_image("road_traffic_simulator_env-env:latest")
# Reset
result = road_traffic_simulator_envenv.reset()
print(f"Reset: {result.observation.echoed_message}")
# Send multiple messages
messages = ["Hello, World!", "Testing echo", "Final message"]
for msg in messages:
result = road_traffic_simulator_envenv.step(RoadTrafficSimulatorAction(message=msg))
print(f"Sent: '{msg}'")
print(f" → Echoed: '{result.observation.echoed_message}'")
print(f" → Length: {result.observation.message_length}")
print(f" → Reward: {result.reward}")
finally:
# Always clean up
road_traffic_simulator_envenv.close()
```
That's it! The `RoadTrafficSimulatorEnv.from_docker_image()` method handles:
- Starting the Docker container
-