From 38f0bd67d1ad98ee169f8c30041c0211ffb93ffc Mon Sep 17 00:00:00 2001 From: u214892 <u214892@sbb.ch> Date: Fri, 5 Jul 2019 17:18:23 +0200 Subject: [PATCH] #67 multiple agents --- flatland/envs/observations.py | 3 ++- tests/test_flatland_envs_predictions.py | 4 ++-- tox.ini | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/flatland/envs/observations.py b/flatland/envs/observations.py index ad5be7c7..a10c58e6 100644 --- a/flatland/envs/observations.py +++ b/flatland/envs/observations.py @@ -20,6 +20,8 @@ class TreeObsForRailEnv(ObservationBuilder): network to simplify the representation of the state of the environment for each agent. """ + observation_dim = 9 + def __init__(self, max_depth, predictor=None): self.max_depth = max_depth @@ -29,7 +31,6 @@ class TreeObsForRailEnv(ObservationBuilder): for i in range(self.max_depth + 1): size += pow4 pow4 *= 4 - self.observation_dim = 9 self.observation_space = [size * self.observation_dim] self.location_has_agent = {} self.location_has_agent_direction = {} diff --git a/tests/test_flatland_envs_predictions.py b/tests/test_flatland_envs_predictions.py index 96a4b958..c90f91a0 100644 --- a/tests/test_flatland_envs_predictions.py +++ b/tests/test_flatland_envs_predictions.py @@ -265,8 +265,8 @@ def test_shortest_path_predictor_conflicts(rendering=False): pp.pprint(tree_0) # check the expectations - expected_conflicts_0 = [('F','R')] - expected_conflicts_1 = [('F','L')] + expected_conflicts_0 = [('F', 'R')] + expected_conflicts_1 = [('F', 'L')] _check_expected_conflicts(expected_conflicts_0, obs_builder, tree_0, "agent[0]: ") _check_expected_conflicts(expected_conflicts_1, obs_builder, tree_1, "agent[1]: ") diff --git a/tox.ini b/tox.ini index 2047166a..644f5253 100644 --- a/tox.ini +++ b/tox.ini @@ -113,6 +113,8 @@ deps = -r{toxinidir}/requirements_dev.txt -r{toxinidir}/requirements_continuous_integration.txt commands = +; install current version of flatland to be used by notebooks + sh -c 'python setup.py' ; run tests from subfolder to ensure that resources are accessed via resources and not via relative paths sh -c 'mkdir -p {envtmpdir}/6f59bc68108c3895b1828abdd04b9a06' sh -c 'jupyter nbextension install --py --sys-prefix widgetsnbextension' -- GitLab