MacLight
홈페이지 · 논문 1편
If you plan to test your method on our road network, you can find road network files in env\map.
- ff.net.xml is road network. It is unchanging, and the difference between the different environments is the traffic flow file.
- ff_normal.rou.xml is traffic flow file under normal pressure (Normal&Block).
- ff_hard.rou.xml is traffic flow file under high pressure (Peak).
It should be noted that the normal pressure we set is also relatively high.
| | Normal&Block | Peak | arterial4x4 | grid4x4 |
|----------|--------------|------|-------------|---------|
| Vehicles | 8000 | 10286| 2485 | 1472 |
Examples to create an enviroment
Our environment interface inherits from gymnasium and sumo-rl, so you can easily migrate your algorithms.
1. Static environment:
The direction of the vehicle is completely fixed and the route will not be changed.
``python
env = sumo_rl.parallel_env(
net_file='env/map/ff.net.xml',
route_file=f'env/map/ff_normal.rou.xml', # Could be ff_hard.rou.xml
num_seconds=args.seconds,
use_gui=False,
sumo_warnings=False,
additional_sumo_cmd='--no-step-log'
)
`
2. Dynamic environment
We define the BlockStreet class, which can randomly block certain roads, so that vehicles reselect the best route, which will cause sudden changes in traffic flow on certain roads.
`python
from env.wrap.random_block import BlockStreet
# block_num: Number of blocked roads, like 8
# seconds: Simulation seconds, up to 3600
env = BlockStreet(env, block_num, seconds)
`
Additionally, we strongly recommend that you set the following environment variables to get the fastest possible simulation (although it may still be slower):
`python
import os
os.environ['LIBSUMO_AS_TRACI'] = '1'
``