diff --git a/flatland/envs/rail_env.py b/flatland/envs/rail_env.py index 67131060bb4a8fa8f41d5187f2b70db13b8d17f0..70312ecb31d0acf9e5fea13c022745aa77e52511 100644 --- a/flatland/envs/rail_env.py +++ b/flatland/envs/rail_env.py @@ -319,6 +319,8 @@ class RailEnv(Environment): if optionals and 'distance_map' in optionals: self.distance_map.set(optionals['distance_map']) + # todo change self.agents_static[0] with the refactoring for agents_static -> issue nr. 185 + # https://gitlab.aicrowd.com/flatland/flatland/issues/185 if regenerate_schedule or self.agents_static[0] is None: agents_hints = None if optionals and 'agents_hints' in optionals: diff --git a/tests/test_flatland_envs_rail_env.py b/tests/test_flatland_envs_rail_env.py index bee91c117239358e8b8ef98caccb6329fa834cc1..dc4c78f9a6796d8eef3cfbeb4c54409f14406415 100644 --- a/tests/test_flatland_envs_rail_env.py +++ b/tests/test_flatland_envs_rail_env.py @@ -232,7 +232,7 @@ def test_get_entry_directions(): def test_rail_env_reset(): file_name = "test_rail_env_reset.pkl" - # Test to save and load file with distance map. + # Test to save and load file. rail, rail_map = make_simple_rail() @@ -264,10 +264,6 @@ def test_rail_env_reset(): assert np.all(np.array_equal(rails_initial, rails_loaded)) assert agents_initial == agents_loaded - # Check that distance map was not recomputed - assert np.shape(env2.distance_map.get()) == dist_map_shape - assert env2.distance_map.get() is not None - env3 = RailEnv(width=1, height=1, rail_generator=rail_from_file(file_name), @@ -282,10 +278,6 @@ def test_rail_env_reset(): assert np.all(np.array_equal(rails_initial, rails_loaded)) assert agents_initial == agents_loaded - # Check that distance map was not recomputed - assert np.shape(env3.distance_map.get()) == dist_map_shape - assert env3.distance_map.get() is not None - env4 = RailEnv(width=1, height=1, rail_generator=rail_from_file(file_name), @@ -299,7 +291,3 @@ def test_rail_env_reset(): assert np.all(np.array_equal(rails_initial, rails_loaded)) assert agents_initial == agents_loaded - - # Check that distance map was not recomputed - assert np.shape(env4.distance_map.get()) == dist_map_shape - assert env4.distance_map.get() is not None