Official code for article DynamicLight: Two-Stage Dynamic Traffic Signal Timing.
python3.6
,tensorflow=2.4
, cityflow
, pandas
, numpy
cityflow
needs a linux environment, and we run the code on Manjaro Linux.
- For
DynamicLight
, run:
python run_dynamiclight.py
- For tranfer, configure and run
run_test.py
- For
DynamicLight-Rand
, run:
python run_dynamic_rand.py
- For
DynamicLight-FT
, run:
python run_dynamic_ft.py
For DynamicLight-MP
, run:
python run_dynamic_mp.py
For DynamicLight-MQL
, run:
python run_dynamic_mql.py
- For
DynamicLight-Lite
, run:
python run_dynamic_lite.py
- w/o duration control: Before run the model, change the duration action as fixed
1
accroding to the duration action space at./models/dynamiclight.py
line 123.
First, well train the model;
Then, test the model with changing the phase control policy as FixedTime
.
For example, run run_dynamiclight.py
with the model name as "dynamiclight", then run run_test.py
with the model name as "dynamiclightft".
- run
run_dynamiclgiht.py
with the synthetic datasets - run
run_test.py
for model transfer envaluation
Cconfigure the action space in run_dynamic_mql.py
and run it.
Configure the model name as <Dyn01
, Dyn02
,Dyn03
,Dyn05
> in run_dynamic_mql.py
and run it.
Refer to the ./models
for more model details.
-
with parameter sharing, configure the model name as
Dyn01
and runrun_dynamic_mql.py
-
w/o parameter sharing, configure the model name as
DynM
and runrun_dynamic_mql.py
- For
Clear Memory
, change./utils/updater.py
at line 56 - For
fix part network
, change./models/dynamiclight.py
at line 210 - For
change lr
, change./utils/config.py
at line 101 - For
train seperately
, change./models/dynamiclight.py
at line 193 - configure on
fine-tuning
, change./models/dynamiclight.py
at line 193
Configure line 123
at ./models/dynamiclight.py
:
- fixed duration action=10s: set the duration action as
0
- fixed duration action=15s: set the duration action as
1
- fixed duration action=20s: set the duration action as
2
For the baseline methods, refer to Advanced-XLight and AttentionLight.
This project is licensed under the GNU General Public License version 3 (GPLv3) - see the LICENSE file for details.