Skip to content

Commit

Permalink
Merge 4b19aff into 681d200
Browse files Browse the repository at this point in the history
  • Loading branch information
ashkan-software committed Aug 2, 2019
2 parents 681d200 + 4b19aff commit 45b3952
Show file tree
Hide file tree
Showing 3 changed files with 318 additions and 134 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -21,7 +21,7 @@ See [our website](https://flow-project.github.io/) for more information on the a

# Technical questions

Please direct your techincal questions to [Stack Overflow](https://stackoverflow.com) using the [flow-project](https://stackoverflow.com/questions/tagged/flow-project) tag.
Please direct your technical questions to [Stack Overflow](https://stackoverflow.com) using the [flow-project](https://stackoverflow.com/questions/tagged/flow-project) tag.

# Getting involved

Expand Down
10 changes: 6 additions & 4 deletions flow/envs/green_wave_env.py
Expand Up @@ -245,8 +245,9 @@ def _apply_rl_actions(self, rl_actions):
rl_mask = [int(x) for x in list('{0:0b}'.format(rl_actions))]
rl_mask = [0] * (self.num_traffic_lights - len(rl_mask)) + rl_mask
else:
# convert values less than 0.0 to zero and above to 1. 0's indicate
# that we should not switch the direction
# convert values less than 0 to zero and above 0 to 1. 0 indicates
# that should not switch the direction, and 1 indicates that switch
# should happen
rl_mask = rl_actions > 0.0

for i, action in enumerate(rl_mask):
Expand Down Expand Up @@ -690,8 +691,9 @@ def get_state(self):
for edge in self.k.scenario.get_edge_list():
ids = self.k.vehicle.get_ids_by_edge(edge)
if len(ids) > 0:
# TODO(cathywu) Why is there a 5 here?
density += [5 * len(ids) / self.k.scenario.edge_length(edge)]
vehicle_length = 5
density += [vehicle_length * len(ids) /
self.k.scenario.edge_length(edge)]
velocity_avg += [np.mean(
[self.k.vehicle.get_speed(veh_id) for veh_id in
ids]) / max_speed]
Expand Down

0 comments on commit 45b3952

Please sign in to comment.