Commit 314dda88 authored by u214892's avatar u214892
Browse files

#67 multiple agents

parent 4b5e3b18
Pipeline #1343 failed with stage
in 5 minutes and 15 seconds
......@@ -230,7 +230,7 @@ class TreeObsForRailEnv(ObservationBuilder):
(possible future use: number of other agents in the same direction in this branch)
0 = no agent present same direction
#9: agent in the opposite drection
#9: agent in the opposite direction
n = number of agents present other direction than myself (so conflict)
(possible future use: number of other agents in other direction in this branch, ie. number of conflicts)
0 = no agent present other direction than myself
......
......@@ -265,18 +265,17 @@ def test_shortest_path_predictor_conflicts(rendering=False):
pp.pprint(tree_0)
# check the expectations
# TODO check with Erik, this should be symmetric, should it not?
expected_conflicts_0 = [('F', 'R'), ('F', 'L')]
expected_conflicts_1 = [('F'), ('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]: ")
def _check_expected_conflicts(expected_conflicts, obs_builder, tree_0, prompt=''):
assert (tree_0[''][7] > 0) == (() in expected_conflicts), "{}[]".format(prompt)
assert (tree_0[''][8] > 0) == (() in expected_conflicts), "{}[]".format(prompt)
for a_1 in obs_builder.tree_explorted_actions_char:
conflict = tree_0[a_1][''][7]
conflict = tree_0[a_1][''][8]
assert (conflict > 0) == ((a_1) in expected_conflicts), "{}[{}]".format(prompt, a_1)
for a_2 in obs_builder.tree_explorted_actions_char:
conflict = tree_0[a_1][a_2][''][7]
conflict = tree_0[a_1][a_2][''][8]
assert (conflict > 0) == ((a_1, a_2) in expected_conflicts), "{}[{}][{}]".format(prompt, a_1, a_2)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment