Change _apply_rl_actions in green wave and added tests#42
Change _apply_rl_actions in green wave and added tests#42kjang96 wants to merge 3 commits intoberkeleyflow:masterfrom
Conversation
…th min_yellow_time and min_green_time. Also added tests in test_traffic_lights.py
| num_cars_top = 1 | ||
| num_cars_bot = 1 | ||
| ======= | ||
| v_enter = 20 |
There was a problem hiding this comment.
You've got merge conflicts in this file.
| if action: | ||
| else: # currently green | ||
| self.last_change[i, 0] += self.sim_step | ||
| if self.last_change[i, 0] >= self.min_green_time and rl_mask[i]: |
There was a problem hiding this comment.
Why does self.last_change get incremented inside the else when it didn't before? (not too familiar with the green wave stuff though so I might just be missing something obvious)
There was a problem hiding this comment.
self.last_change used to only keep track of last change since a yellow phase began. Now it also keeps track of time since a green phase began. So now, last_change[i, 0] resets when the green phase begins (it didn't use to) and increments during the green phase as well.
|
|
||
|
|
||
| def test_min_switch(self): | ||
| # FOR THE PURPOSES OF THIS TEST, never set min switch to be < 2 |
There was a problem hiding this comment.
Does this test enforce the constraint of min_switch >= 2?
There was a problem hiding this comment.
The setup script it uses has min_switch >=2, is that what you mean?
Removed switch_time from green_wave_env's env params, and replaced with min_yellow_time and min_green_time. Also added tests in test_traffic_lights.py
self.last_change is still 3 columns long, but now records last change for switches to green, not only switches to yellow.