diff --git a/examples/train.py b/examples/train.py index 225ac53ea9..10ac432367 100644 --- a/examples/train.py +++ b/examples/train.py @@ -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) diff --git a/flow/utils/rllib.py b/flow/utils/rllib.py index af8d8a37c2..0206f1b615 100644 --- a/flow/utils/rllib.py +++ b/flow/utils/rllib.py @@ -5,7 +5,6 @@ """ from copy import deepcopy import json -import sys import os import sys diff --git a/tests/fast_tests/test_rewards.py b/tests/fast_tests/test_rewards.py index 3f2e08cdeb..487bda6951 100644 --- a/tests/fast_tests/test_rewards.py +++ b/tests/fast_tests/test_rewards.py @@ -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."""