Skip to content

Commit

Permalink
Flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
eugenevinitsky committed Mar 19, 2020
1 parent 2183ca5 commit ccd5d01
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 5 deletions.
2 changes: 0 additions & 2 deletions examples/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,10 @@ def on_episode_end(info):
episode.custom_metrics["avg_energy"] = avg_energy
episode.custom_metrics["outflow"] = env.k.vehicle.get_outflow_rate()


config["callbacks"] = {"on_episode_start": tune.function(on_episode_start),
"on_episode_step": tune.function(on_episode_step),
"on_episode_end": tune.function(on_episode_end)}


# save the flow params for replay
flow_json = json.dumps(
flow_params, cls=FlowParamsEncoder, sort_keys=True, indent=4)
Expand Down
1 change: 0 additions & 1 deletion flow/utils/rllib.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"""
from copy import deepcopy
import json
import sys
import os
import sys

Expand Down
4 changes: 2 additions & 2 deletions tests/fast_tests/test_rewards.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,13 @@ def test_energy_consumption(self):

# change the speed of one vehicle
env.k.vehicle.test_set_speed("test_0", 1)
self.assertEqual(energy_consumption(env), -12.059337750000001)
self.assertEqual(energy_consumption(env), -1.205933775)

# check that stepping change the previous speeds and increases the energy consumption
env.step(rl_actions=None)
env.step(rl_actions=None)
self.assertGreater(env.k.vehicle.get_previous_speed("test_0"), 0.0)
self.assertLess(energy_consumption(env), -12.059337750000001)
self.assertLess(energy_consumption(env), -1.205933775)

def test_boolean_action_penalty(self):
"""Test the boolean_action_penalty method."""
Expand Down

0 comments on commit ccd5d01

Please sign in to comment.