Skip to content
Snippets Groups Projects
Commit b7e98ab0 authored by Erik Nygren's avatar Erik Nygren
Browse files

fixed shortest path predictor to handle exception when no path to target is possible.

parent cbd78bf3
No related branches found
No related tags found
No related merge requests found
......@@ -147,6 +147,9 @@ class ShortestPathPredictorForRailEnv(PredictionBuilder):
if target_dist < min_dist:
min_dist = target_dist
new_direction = direction
if new_direction == None:
prediction[index] = [index, *agent.position, agent.direction, RailEnvActions.STOP_MOVING]
continue
new_position = get_new_position(agent.position, new_direction)
else:
raise Exception("No transition possible {}".format(cell_transitions))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment