Commit 808887c9 authored by u214892's avatar u214892
Browse files

bugfix #141: check_path_exists and tests

parent 6e367dd6
Pipeline #1847 failed with stages
in 5 minutes and 15 seconds
......@@ -312,7 +312,7 @@ class GridTransitionMap(TransitionMap):
tmp = tmp >> 1
return nbits == 1
def _path_exists(self, start, direction, end):
def check_path_exists(self, start, direction, end):
# print("_path_exists({},{},{}".format(start, direction, end))
# BFS - Check if a path exists between the 2 nodes
......
......@@ -183,8 +183,8 @@ def random_schedule_generator(speed_ratio_map: Mapping[float, float] = None) ->
valid_starting_directions = []
for m in valid_movements:
new_position = get_new_position(agents_position[i], m[1])
if m[0] not in valid_starting_directions and rail._path_exists(new_position, m[0],
agents_target[i]):
if m[0] not in valid_starting_directions and rail.check_path_exists(new_position, m[0],
agents_target[i]):
valid_starting_directions.append(m[0])
if len(valid_starting_directions) == 0:
......
......@@ -63,7 +63,7 @@ def check_path(env, rail, position, direction, target, expected, rendering=False
renderer = RenderTool(env, gl="PILSVG")
renderer.render_env(show=True, show_observations=False)
input("Continue?")
assert rail._path_exists(agent.position, agent.direction, agent.target) == expected
assert rail.check_path_exists(agent.position, agent.direction, agent.target) == expected
def test_path_exists(rendering=False):
......
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