Commit ca8dcd65 authored by u214892's avatar u214892
Browse files

Trainrun and Waypoint instead of WayPoint and TrainRun for readability

parent 8cd0cf6d
Pipeline #2836 passed with stages
in 46 minutes and 43 seconds
......@@ -6,7 +6,7 @@ import numpy as np
from flatland.core.grid.grid_utils import Vec2dOperations as Vec2d
from flatland.envs.rail_env import RailEnv, RailEnvActions
from flatland.envs.rail_env_shortest_paths import get_action_for_move
from flatland.envs.rail_train_run_data_structures import WayPoint, TrainRun, TrainRunWayPoint
from flatland.envs.rail_train_run_data_structures import Wayoint, Trainrun, TrainrunWaypoint
from flatland.utils.rendertools import RenderTool, AgentRenderVariant
# ---- ActionPlan ---------------
......@@ -22,20 +22,20 @@ ActionPlan = List[ActionPlanElement]
ActionPlanDict = Dict[int, ActionPlan]
class ControllerFromTrainRuns():
class ControllerFromTrainruns():
"""Takes train runs, derives the actions from it and re-acts them."""
pp = pprint.PrettyPrinter(indent=4)
def __init__(self,
env: RailEnv,
train_run_dict: Dict[int, TrainRun]):
train_run_dict: Dict[int, Trainrun]):
self.env: RailEnv = env
self.train_run_dict: Dict[int, TrainRun] = train_run_dict
self.train_run_dict: Dict[int, Trainrun] = train_run_dict
self.action_plan: ActionPlanDict = [self._create_action_plan_for_agent(agent_id, chosen_path)
for agent_id, chosen_path in train_run_dict.items()]
def get_way_point_before_or_at_step(self, agent_id: int, step: int) -> WayPoint:
def get_way_point_before_or_at_step(self, agent_id: int, step: int) -> Wayoint:
"""
Get the way point point from which the current position can be extracted.
......@@ -53,13 +53,13 @@ class ControllerFromTrainRuns():
entry_time_step = train_run[0].scheduled_at
# the agent has no position before and at choosing to enter the grid (one tick elapses before the agent enters the grid)
if step <= entry_time_step:
return WayPoint(position=None, direction=self.env.agents[agent_id].initial_direction)
return Wayoint(position=None, direction=self.env.agents[agent_id].initial_direction)
# the agent has no position as soon as the target is reached
exit_time_step = train_run[-1].scheduled_at
if step >= exit_time_step:
# agent loses position as soon as target cell is reached
return WayPoint(position=None, direction=train_run[-1].way_point.direction)
return Wayoint(position=None, direction=train_run[-1].way_point.direction)
way_point = None
for train_run_way_point in train_run:
......@@ -130,15 +130,15 @@ class ControllerFromTrainRuns():
"len for agent {} should be the same.\n\n expected ({}) = {}\n\n actual ({}) = {}".format(
k,
len(expected_action_plan[k]),
ControllerFromTrainRuns.pp.pformat(expected_action_plan[k]),
ControllerFromTrainruns.pp.pformat(expected_action_plan[k]),
len(actual_action_plan[k]),
ControllerFromTrainRuns.pp.pformat(actual_action_plan[k]))
ControllerFromTrainruns.pp.pformat(actual_action_plan[k]))
for i in range(len(expected_action_plan[k])):
assert expected_action_plan[k][i] == actual_action_plan[k][i], \
"not the same at agent {} at step {}\n\n expected = {}\n\n actual = {}".format(
k, i,
ControllerFromTrainRuns.pp.pformat(expected_action_plan[k][i]),
ControllerFromTrainRuns.pp.pformat(actual_action_plan[k][i]))
ControllerFromTrainruns.pp.pformat(expected_action_plan[k][i]),
ControllerFromTrainruns.pp.pformat(actual_action_plan[k][i]))
assert expected_action_plan == actual_action_plan, \
"expected {}, found {}".format(expected_action_plan, actual_action_plan)
......@@ -147,14 +147,14 @@ class ControllerFromTrainRuns():
agent = self.env.agents[agent_id]
minimum_cell_time = int(np.ceil(1.0 / agent.speed_data['speed']))
for path_loop, train_run_way_point in enumerate(train_run):
train_run_way_point: TrainRunWayPoint = train_run_way_point
train_run_way_point: TrainrunWaypoint = train_run_way_point
position = train_run_way_point.way_point.position
if Vec2d.is_equal(agent.target, position):
break
next_train_run_way_point: TrainRunWayPoint = train_run[path_loop + 1]
next_train_run_way_point: TrainrunWaypoint = train_run[path_loop + 1]
next_position = next_train_run_way_point.way_point.position
if path_loop == 0:
......@@ -186,8 +186,8 @@ class ControllerFromTrainRuns():
def _add_action_plan_elements_for_current_path_element(self,
action_plan: ActionPlan,
minimum_cell_time: int,
train_run_way_point: TrainRunWayPoint,
next_train_run_way_point: TrainRunWayPoint):
train_run_way_point: TrainrunWaypoint,
next_train_run_way_point: TrainrunWaypoint):
scheduled_at = train_run_way_point.scheduled_at
next_entry_value = next_train_run_way_point.scheduled_at
......@@ -217,8 +217,8 @@ class ControllerFromTrainRuns():
def _add_action_plan_elements_for_target_at_path_element_just_before_target(self,
action_plan: ActionPlan,
minimum_cell_time: int,
train_run_way_point: TrainRunWayPoint,
next_train_run_way_point: TrainRunWayPoint):
train_run_way_point: TrainrunWaypoint,
next_train_run_way_point: TrainrunWaypoint):
scheduled_at = train_run_way_point.scheduled_at
action = ActionPlanElement(scheduled_at + minimum_cell_time, RailEnvActions.STOP_MOVING)
......@@ -226,8 +226,8 @@ class ControllerFromTrainRuns():
def _add_action_plan_elements_for_first_path_element_of_agent(self,
action_plan: ActionPlan,
train_run_way_point: TrainRunWayPoint,
next_train_run_way_point: TrainRunWayPoint,
train_run_way_point: TrainrunWaypoint,
next_train_run_way_point: TrainrunWaypoint,
minimum_cell_time: int):
scheduled_at = train_run_way_point.scheduled_at
position = train_run_way_point.way_point.position
......@@ -260,11 +260,11 @@ class ControllerFromTrainRuns():
action_plan.append(action)
class ControllerFromTrainRunsReplayer():
class ControllerFromTrainrunsReplayer():
"""Allows to verify a `DeterministicController` by replaying it against a FLATland env without malfunction."""
@staticmethod
def replay_verify(max_episode_steps: int, ctl: ControllerFromTrainRuns, env: RailEnv, rendering: bool):
def replay_verify(max_episode_steps: int, ctl: ControllerFromTrainruns, env: RailEnv, rendering: bool):
"""Replays this deterministic `ActionPlan` and verifies whether it is feasible."""
if rendering:
renderer = RenderTool(env, gl="PILSVG",
......@@ -277,7 +277,7 @@ class ControllerFromTrainRunsReplayer():
i = 0
while not env.dones['__all__'] and i <= max_episode_steps:
for agent_id, agent in enumerate(env.agents):
way_point: WayPoint = ctl.get_way_point_before_or_at_step(agent_id, i)
way_point: Wayoint = ctl.get_way_point_before_or_at_step(agent_id, i)
assert agent.position == way_point.position, \
"before {}, agent {} at {}, expected {}".format(i, agent_id, agent.position,
way_point.position)
......
......@@ -10,7 +10,7 @@ from flatland.core.transition_map import GridTransitionMap
from flatland.envs.agent_utils import RailAgentStatus
from flatland.envs.distance_map import DistanceMap
from flatland.envs.rail_env import RailEnvNextAction, RailEnvActions, RailEnv
from flatland.envs.rail_train_run_data_structures import WayPoint
from flatland.envs.rail_train_run_data_structures import Wayoint
from flatland.utils.ordered_set import OrderedSet
......@@ -201,7 +201,7 @@ def get_action_for_move(
# N.B. get_shortest_paths is not part of distance_map since it refers to RailEnvActions (would lead to circularity!)
def get_shortest_paths(distance_map: DistanceMap, max_depth: Optional[int] = None, agent_handle: Optional[int] = None) \
-> Dict[int, Optional[List[WayPoint]]]:
-> Dict[int, Optional[List[Wayoint]]]:
"""
Computes the shortest path for each agent to its target and the action to be taken to do so.
The paths are derived from a `DistanceMap`.
......@@ -251,7 +251,7 @@ def get_shortest_paths(distance_map: DistanceMap, max_depth: Optional[int] = Non
best_next_action = next_action
distance = next_action_distance
shortest_paths[agent.handle].append(WayPoint(position, direction))
shortest_paths[agent.handle].append(Wayoint(position, direction))
depth += 1
# if there is no way to continue, the rail must be disconnected!
......@@ -263,7 +263,7 @@ def get_shortest_paths(distance_map: DistanceMap, max_depth: Optional[int] = Non
position = best_next_action.next_position
direction = best_next_action.next_direction
if max_depth is None or depth < max_depth:
shortest_paths[agent.handle].append(WayPoint(position, direction))
shortest_paths[agent.handle].append(Wayoint(position, direction))
if agent_handle is not None:
_shortest_path_for_agent(distance_map.agents[agent_handle])
......@@ -278,7 +278,7 @@ def get_k_shortest_paths(env: RailEnv,
source_position: Tuple[int, int],
source_direction: int,
target_position=Tuple[int, int],
k: int = 1, debug=False) -> List[Tuple[WayPoint]]:
k: int = 1, debug=False) -> List[Tuple[Wayoint]]:
"""
Computes the k shortest paths using modified Dijkstra
following pseudo-code https://en.wikipedia.org/wiki/K_shortest_path_routing
......@@ -304,7 +304,7 @@ def get_k_shortest_paths(env: RailEnv,
# P: set of shortest paths from s to t
# P =empty,
shortest_paths: List[Tuple[WayPoint]] = []
shortest_paths: List[Tuple[Wayoint]] = []
# countu: number of shortest paths found to node u
# countu = 0, for all u in V
......@@ -312,10 +312,10 @@ def get_k_shortest_paths(env: RailEnv,
# B is a heap data structure containing paths
# N.B. use OrderedSet to make result deterministic!
heap: OrderedSet[Tuple[WayPoint]] = OrderedSet()
heap: OrderedSet[Tuple[Wayoint]] = OrderedSet()
# insert path Ps = {s} into B with cost 0
heap.add((WayPoint(source_position, source_direction),))
heap.add((Wayoint(source_position, source_direction),))
# while B is not empty and countt < K:
while len(heap) > 0 and len(shortest_paths) < k:
......@@ -328,7 +328,7 @@ def get_k_shortest_paths(env: RailEnv,
if len(path) < cost:
pu = path
cost = len(path)
u: WayPoint = pu[-1]
u: Wayoint = pu[-1]
if debug:
print(" looking at pu={}".format(pu))
......@@ -360,7 +360,7 @@ def get_k_shortest_paths(env: RailEnv,
if debug:
print(" looking at neighbor v={}".format((*new_position, new_direction)))
v = WayPoint(position=new_position, direction=new_direction)
v = Wayoint(position=new_position, direction=new_direction)
# CAVEAT: do not allow for loopy paths
if v in pu:
continue
......
......@@ -6,13 +6,13 @@ from typing import NamedTuple, Tuple, List
# This induces a graph on top of the FLATland cells:
# - four possible way points per cell
# - edges are the possible transitions in the cell.
WayPoint = NamedTuple('WayPoint', [('position', Tuple[int, int]), ('direction', int)])
Wayoint = NamedTuple('Wayoint', [('position', Tuple[int, int]), ('direction', int)])
# A train run is represented by the waypoints traversed and the times of traversal
# The terminology follows https://github.com/crowdAI/train-schedule-optimisation-challenge-starter-kit/blob/master/documentation/output_data_model.md
TrainRunWayPoint = NamedTuple('TrainRunWayPoint', [
TrainrunWaypoint = NamedTuple('TrainrunWaypoint', [
('scheduled_at', int),
('way_point', WayPoint)
('way_point', Wayoint)
])
# A train run is the list of an agent's way points and their scheduled time
TrainRun = List[TrainRunWayPoint]
Trainrun = List[TrainrunWaypoint]
from flatland.action_plan.action_plan import TrainRunWayPoint, ControllerFromTrainRunsReplayer, ActionPlanElement, \
ControllerFromTrainRuns
from flatland.action_plan.action_plan import TrainrunWaypoint, ControllerFromTrainrunsReplayer, ActionPlanElement, \
ControllerFromTrainruns
from flatland.core.grid.grid4 import Grid4TransitionsEnum
from flatland.envs.observations import GlobalObsForRailEnv
from flatland.envs.rail_env import RailEnv, RailEnvActions
from flatland.envs.rail_generators import rail_from_grid_transition_map
from flatland.envs.rail_train_run_data_structures import WayPoint
from flatland.envs.rail_train_run_data_structures import Wayoint
from flatland.envs.schedule_generators import random_schedule_generator
from flatland.utils.simple_rail import make_simple_rail
......@@ -32,25 +32,25 @@ def test_action_plan(rendering: bool = False):
for handle, agent in enumerate(env.agents):
print("[{}] {} -> {}".format(handle, agent.initial_position, agent.target))
chosen_path_dict = {0: [TrainRunWayPoint(scheduled_at=0, way_point=WayPoint(position=(3, 0), direction=3)),
TrainRunWayPoint(scheduled_at=2, way_point=WayPoint(position=(3, 1), direction=1)),
TrainRunWayPoint(scheduled_at=3, way_point=WayPoint(position=(3, 2), direction=1)),
TrainRunWayPoint(scheduled_at=14, way_point=WayPoint(position=(3, 3), direction=1)),
TrainRunWayPoint(scheduled_at=15, way_point=WayPoint(position=(3, 4), direction=1)),
TrainRunWayPoint(scheduled_at=16, way_point=WayPoint(position=(3, 5), direction=1)),
TrainRunWayPoint(scheduled_at=17, way_point=WayPoint(position=(3, 6), direction=1)),
TrainRunWayPoint(scheduled_at=18, way_point=WayPoint(position=(3, 7), direction=1)),
TrainRunWayPoint(scheduled_at=19, way_point=WayPoint(position=(3, 8), direction=1)),
TrainRunWayPoint(scheduled_at=20, way_point=WayPoint(position=(3, 8), direction=5))],
1: [TrainRunWayPoint(scheduled_at=0, way_point=WayPoint(position=(3, 8), direction=3)),
TrainRunWayPoint(scheduled_at=3, way_point=WayPoint(position=(3, 7), direction=3)),
TrainRunWayPoint(scheduled_at=5, way_point=WayPoint(position=(3, 6), direction=3)),
TrainRunWayPoint(scheduled_at=7, way_point=WayPoint(position=(3, 5), direction=3)),
TrainRunWayPoint(scheduled_at=9, way_point=WayPoint(position=(3, 4), direction=3)),
TrainRunWayPoint(scheduled_at=11, way_point=WayPoint(position=(3, 3), direction=3)),
TrainRunWayPoint(scheduled_at=13, way_point=WayPoint(position=(2, 3), direction=0)),
TrainRunWayPoint(scheduled_at=15, way_point=WayPoint(position=(1, 3), direction=0)),
TrainRunWayPoint(scheduled_at=17, way_point=WayPoint(position=(0, 3), direction=0))]}
chosen_path_dict = {0: [TrainrunWaypoint(scheduled_at=0, way_point=Wayoint(position=(3, 0), direction=3)),
TrainrunWaypoint(scheduled_at=2, way_point=Wayoint(position=(3, 1), direction=1)),
TrainrunWaypoint(scheduled_at=3, way_point=Wayoint(position=(3, 2), direction=1)),
TrainrunWaypoint(scheduled_at=14, way_point=Wayoint(position=(3, 3), direction=1)),
TrainrunWaypoint(scheduled_at=15, way_point=Wayoint(position=(3, 4), direction=1)),
TrainrunWaypoint(scheduled_at=16, way_point=Wayoint(position=(3, 5), direction=1)),
TrainrunWaypoint(scheduled_at=17, way_point=Wayoint(position=(3, 6), direction=1)),
TrainrunWaypoint(scheduled_at=18, way_point=Wayoint(position=(3, 7), direction=1)),
TrainrunWaypoint(scheduled_at=19, way_point=Wayoint(position=(3, 8), direction=1)),
TrainrunWaypoint(scheduled_at=20, way_point=Wayoint(position=(3, 8), direction=5))],
1: [TrainrunWaypoint(scheduled_at=0, way_point=Wayoint(position=(3, 8), direction=3)),
TrainrunWaypoint(scheduled_at=3, way_point=Wayoint(position=(3, 7), direction=3)),
TrainrunWaypoint(scheduled_at=5, way_point=Wayoint(position=(3, 6), direction=3)),
TrainrunWaypoint(scheduled_at=7, way_point=Wayoint(position=(3, 5), direction=3)),
TrainrunWaypoint(scheduled_at=9, way_point=Wayoint(position=(3, 4), direction=3)),
TrainrunWaypoint(scheduled_at=11, way_point=Wayoint(position=(3, 3), direction=3)),
TrainrunWaypoint(scheduled_at=13, way_point=Wayoint(position=(2, 3), direction=0)),
TrainrunWaypoint(scheduled_at=15, way_point=Wayoint(position=(1, 3), direction=0)),
TrainrunWaypoint(scheduled_at=17, way_point=Wayoint(position=(0, 3), direction=0))]}
expected_action_plan = [[
# take action to enter the grid
ActionPlanElement(0, RailEnvActions.MOVE_FORWARD),
......@@ -82,7 +82,7 @@ def test_action_plan(rendering: bool = False):
MAX_EPISODE_STEPS = 50
deterministic_controller = ControllerFromTrainRuns(env, chosen_path_dict)
deterministic_controller = ControllerFromTrainruns(env, chosen_path_dict)
deterministic_controller.print_action_plan()
ControllerFromTrainRuns.assert_actions_plans_equal(expected_action_plan, deterministic_controller.action_plan)
ControllerFromTrainRunsReplayer.replay_verify(MAX_EPISODE_STEPS, deterministic_controller, env, rendering)
ControllerFromTrainruns.assert_actions_plans_equal(expected_action_plan, deterministic_controller.action_plan)
ControllerFromTrainrunsReplayer.replay_verify(MAX_EPISODE_STEPS, deterministic_controller, env, rendering)
......@@ -11,7 +11,7 @@ from flatland.envs.predictions import DummyPredictorForRailEnv, ShortestPathPred
from flatland.envs.rail_env import RailEnv, RailEnvActions
from flatland.envs.rail_env_shortest_paths import get_shortest_paths
from flatland.envs.rail_generators import rail_from_grid_transition_map
from flatland.envs.rail_train_run_data_structures import WayPoint
from flatland.envs.rail_train_run_data_structures import Wayoint
from flatland.envs.schedule_generators import random_schedule_generator
from flatland.utils.rendertools import RenderTool
from flatland.utils.simple_rail import make_simple_rail, make_simple_rail2, make_invalid_simple_rail
......@@ -147,12 +147,12 @@ def test_shortest_path_predictor(rendering=False):
paths = get_shortest_paths(env.distance_map)[0]
assert paths == [
WayPoint((5, 6), 0),
WayPoint((4, 6), 0),
WayPoint((3, 6), 0),
WayPoint((3, 7), 1),
WayPoint((3, 8), 1),
WayPoint((3, 9), 1)
Wayoint((5, 6), 0),
Wayoint((4, 6), 0),
Wayoint((3, 6), 0),
Wayoint((3, 7), 1),
Wayoint((3, 8), 1),
Wayoint((3, 9), 1)
]
# extract the data
......
......@@ -8,7 +8,7 @@ from flatland.envs.rail_env import RailEnv
from flatland.envs.rail_env_shortest_paths import get_shortest_paths, get_k_shortest_paths
from flatland.envs.rail_env_utils import load_flatland_environment_from_file
from flatland.envs.rail_generators import rail_from_grid_transition_map
from flatland.envs.rail_train_run_data_structures import WayPoint
from flatland.envs.rail_train_run_data_structures import Wayoint
from flatland.envs.schedule_generators import random_schedule_generator
from flatland.utils.rendertools import RenderTool
from flatland.utils.simple_rail import make_disconnected_simple_rail, make_simple_rail_with_alternatives
......@@ -47,45 +47,45 @@ def test_get_shortest_paths():
expected = {
0: [
WayPoint(position=(1, 1), direction=1),
WayPoint(position=(1, 2), direction=1),
WayPoint(position=(1, 3), direction=1),
WayPoint(position=(2, 3), direction=2),
WayPoint(position=(2, 4), direction=1),
WayPoint(position=(2, 5), direction=1),
WayPoint(position=(2, 6), direction=1),
WayPoint(position=(2, 7), direction=1),
WayPoint(position=(2, 8), direction=1),
WayPoint(position=(2, 9), direction=1),
WayPoint(position=(2, 10), direction=1),
WayPoint(position=(2, 11), direction=1),
WayPoint(position=(2, 12), direction=1),
WayPoint(position=(2, 13), direction=1),
WayPoint(position=(2, 14), direction=1),
WayPoint(position=(2, 15), direction=1),
WayPoint(position=(2, 16), direction=1),
WayPoint(position=(2, 17), direction=1),
WayPoint(position=(2, 18), direction=1)],
Wayoint(position=(1, 1), direction=1),
Wayoint(position=(1, 2), direction=1),
Wayoint(position=(1, 3), direction=1),
Wayoint(position=(2, 3), direction=2),
Wayoint(position=(2, 4), direction=1),
Wayoint(position=(2, 5), direction=1),
Wayoint(position=(2, 6), direction=1),
Wayoint(position=(2, 7), direction=1),
Wayoint(position=(2, 8), direction=1),
Wayoint(position=(2, 9), direction=1),
Wayoint(position=(2, 10), direction=1),
Wayoint(position=(2, 11), direction=1),
Wayoint(position=(2, 12), direction=1),
Wayoint(position=(2, 13), direction=1),
Wayoint(position=(2, 14), direction=1),
Wayoint(position=(2, 15), direction=1),
Wayoint(position=(2, 16), direction=1),
Wayoint(position=(2, 17), direction=1),
Wayoint(position=(2, 18), direction=1)],
1: [
WayPoint(position=(3, 18), direction=3),
WayPoint(position=(3, 17), direction=3),
WayPoint(position=(3, 16), direction=3),
WayPoint(position=(2, 16), direction=0),
WayPoint(position=(2, 15), direction=3),
WayPoint(position=(2, 14), direction=3),
WayPoint(position=(2, 13), direction=3),
WayPoint(position=(2, 12), direction=3),
WayPoint(position=(2, 11), direction=3),
WayPoint(position=(2, 10), direction=3),
WayPoint(position=(2, 9), direction=3),
WayPoint(position=(2, 8), direction=3),
WayPoint(position=(2, 7), direction=3),
WayPoint(position=(2, 6), direction=3),
WayPoint(position=(2, 5), direction=3),
WayPoint(position=(2, 4), direction=3),
WayPoint(position=(2, 3), direction=3),
WayPoint(position=(2, 2), direction=3),
WayPoint(position=(2, 1), direction=3)]
Wayoint(position=(3, 18), direction=3),
Wayoint(position=(3, 17), direction=3),
Wayoint(position=(3, 16), direction=3),
Wayoint(position=(2, 16), direction=0),
Wayoint(position=(2, 15), direction=3),
Wayoint(position=(2, 14), direction=3),
Wayoint(position=(2, 13), direction=3),
Wayoint(position=(2, 12), direction=3),
Wayoint(position=(2, 11), direction=3),
Wayoint(position=(2, 10), direction=3),
Wayoint(position=(2, 9), direction=3),
Wayoint(position=(2, 8), direction=3),
Wayoint(position=(2, 7), direction=3),
Wayoint(position=(2, 6), direction=3),
Wayoint(position=(2, 5), direction=3),
Wayoint(position=(2, 4), direction=3),
Wayoint(position=(2, 3), direction=3),
Wayoint(position=(2, 2), direction=3),
Wayoint(position=(2, 1), direction=3)]
}
for agent_handle in expected:
......@@ -102,12 +102,12 @@ def test_get_shortest_paths_max_depth():
expected = {
0: [
WayPoint(position=(1, 1), direction=1),
WayPoint(position=(1, 2), direction=1)
Wayoint(position=(1, 1), direction=1),
Wayoint(position=(1, 2), direction=1)
],
1: [
WayPoint(position=(3, 18), direction=3),
WayPoint(position=(3, 17), direction=3),
Wayoint(position=(3, 18), direction=3),
Wayoint(position=(3, 17), direction=3),
]
}
......@@ -126,78 +126,78 @@ def test_get_shortest_paths_agent_handle():
print(actual, file=sys.stderr)
expected = {6:
[WayPoint(position=(5, 5),
[Wayoint(position=(5, 5),
direction=0),
WayPoint(position=(4, 5),
Wayoint(position=(4, 5),
direction=0),
WayPoint(position=(3, 5),
Wayoint(position=(3, 5),
direction=0),
WayPoint(position=(2, 5),
Wayoint(position=(2, 5),
direction=0),
WayPoint(position=(1, 5),
Wayoint(position=(1, 5),
direction=0),
WayPoint(position=(0, 5),
Wayoint(position=(0, 5),
direction=0),
WayPoint(position=(0, 6),
Wayoint(position=(0, 6),
direction=1),
WayPoint(position=(0, 7), direction=1),
WayPoint(position=(0, 8),
Wayoint(position=(0, 7), direction=1),
Wayoint(position=(0, 8),
direction=1),
WayPoint(position=(0, 9),
Wayoint(position=(0, 9),
direction=1),
WayPoint(position=(0, 10),
Wayoint(position=(0, 10),
direction=1),
WayPoint(position=(1, 10),
Wayoint(position=(1, 10),
direction=2),
WayPoint(position=(2, 10),
Wayoint(position=(2, 10),
direction=2),
WayPoint(position=(3, 10),
Wayoint(position=(3, 10),
direction=2),
WayPoint(position=(4, 10),
Wayoint(position=(4, 10),
direction=2),
WayPoint(position=(5, 10),
Wayoint(position=(5, 10),
direction=2),
WayPoint(position=(6, 10),
Wayoint(position=(6, 10),
direction=2),
WayPoint(position=(7, 10),
Wayoint(position=(7, 10),
direction=2),
WayPoint(position=(8, 10),
Wayoint(position=(8, 10),
direction=2),
WayPoint(position=(9, 10),
Wayoint(position=(9, 10),
direction=2),
WayPoint(position=(10, 10),
Wayoint(position=(10, 10),
direction=2),
WayPoint(position=(11, 10),
Wayoint(position=(11, 10),
direction=2),
WayPoint(position=(12, 10),
Wayoint(position=(12, 10),
direction=2),
WayPoint(position=(13, 10),
Wayoint(position=(13, 10),
direction=2),
WayPoint(position=(14, 10),
Wayoint(position=(14, 10),
direction=2),
WayPoint(position=(15, 10),
Wayoint(position=(15, 10),
direction=2),
WayPoint(position=(16, 10),
Wayoint(position=(16, 10),
direction=2),
WayPoint(position=(17, 10),
Wayoint(position=(17, 10),
direction=2),
WayPoint(position=(18, 10),
Wayoint(position=(18, 10),
direction=2),
WayPoint(position=(19, 10),
Wayoint(position=(19, 10),
direction=2),
WayPoint(position=(20, 10),
Wayoint(position=(20, 10),
direction=2),
WayPoint(position=(20, 9),
Wayoint(position=(20, 9),
direction=3),
WayPoint(position=(20, 8),
Wayoint(position=(20, 8),
direction=3),
WayPoint(position=(21, 8),
Wayoint(position=(21, 8),
direction=2),
WayPoint(position=(21, 7),
Wayoint(position=(21, 7),
direction=3),
WayPoint(position=(21, 6),
Wayoint(position=(21, 6),
direction=3),
WayPoint(position=(21, 5),
Wayoint(position=(21, 5),
direction=3)
]}
......@@ -246,41 +246,41 @@ def test_get_k_shortest_paths(rendering=False):
expected = set([