wingsweihua / colight

CoLight: Learning Network-level Cooperation for Traffic Signal Control
http://personal.psu.edu/hzw77/publications.html
160 stars 58 forks source link

Questions About Intersection/Road Id Settings When Reproducing `CoLight` #5

Closed IvanLLL closed 4 years ago

IvanLLL commented 4 years ago

Hi, I am trying to reproduce the CoLight experiment on Hangzhou_4x4_real dataset and I have some questions about the detailed implementation of index setting in anon_env.py.

An Example of the intersection information in the road net is shown below:

inter_id: (1, 1) inter_name: intersection_1_1 dic_entering_approach_to_edge: {'W': 'road_0_1_0', 'E': 'road_2_1_2', 'N': 'road_1_0_1', 'S': 'road_1_2_3'} dic_exiting_approach_to_edge: {'W': 'road_1_1_2', 'E': 'road_1_1_0', 'N': 'road_1_1_1', 'S': 'road_1_1_3'} list_entering_lanes: ['road_0_1_0_0', 'road_0_1_0_1', 'road_0_1_0_2', 'road_2_1_2_0', 'road_2_1_2_1', 'road_2_1_2_2', 'road_1_0_1_0', 'road_1_0_1_1', 'road_1_0_1_2', 'road_1_2_3_0', 'road_1_2_3_1', 'road_1_2_3_2'] list_exiting_lanes: ['road_1_1_2_0', 'road_1_1_2_1', 'road_1_1_2_2', 'road_1_1_0_0', 'road_1_1_0_1', 'road_1_1_0_2', 'road_1_1_1_0', 'road_1_1_1_1', 'road_1_1_1_2', 'road_1_1_3_0', 'road_1_1_3_1', 'road_1_1_3_2'] neighbor_ENWS: ['intersection_2_1', 'intersection_1_2', None, None]

Question 1: The ids of intersections are identified as Intersection_i_j. Inferred based on the example, i refers to the column index and j refers to the row index. However, in 'anon_env.py', i is defined as row index and j is defined as i index. Check https://github.com/wingsweihua/colight/blob/8772ac151b8435bb5605446c9f10dd3ac98ab4a8/anon_env.py#L827-L830

Question 2: Pairs (i, j) in dic_entering_approach_to_edge and neighbor_ENWS do not match well. That is, N in dic_entering_approach_to_edge is 'road_1_0_1', sent from virtual intersection 'Intersection_1_0' and N in neighbor_ENWS indicates 'intersection_1_2'.

Thank you very much. A quick response will be appreciated a lot.

wingsweihua commented 4 years ago

I think both of your questions is brought up by one issue: the row and column id in the roadnet file defined in Cityflow are inversed.

If you take a look at the ids for Jinan & New York where the row and column ids are not equal, you will have a better idea about the id definition in our roadnet.

wingsweihua commented 4 years ago

For a better understanding of how lane ids are defined, please take a look at this page and this picture.

IvanLLL commented 4 years ago

@wingsweihua thanks for your answer.