Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Flatland Flatland
  • Project information
    • Project information
    • Activity
    • Labels
    • Planning hierarchy
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 96
    • Issues 96
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 3
    • Merge requests 3
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Flatland
  • FlatlandFlatland
  • Issues
  • #327

Closed
Open
Created Sep 16, 2020 by akopacz@akopacz

Invalid agent directions while visiting cells with ShortestPathPredictorForRailEnv

Sometimes, the agent's direction of the last visited cell generated by the ShortestPathPredictorForRailEnv marks an invalid direction - the cell does not permit that transition.

Possible source of the problem that the initial agent direction is appended to the list of visited cells when reaching the agent.target position (link: https://gitlab.aicrowd.com/flatland/flatland/blob/master/flatland/envs/predictions.py#L163).

for index in range(1, self.max_depth + 1):
    # if we're at the target, stop moving until max_depth is reached
    if new_position == agent.target or not shortest_path:
        prediction[index] = [index, *new_position, new_direction, RailEnvActions.STOP_MOVING]
        visited.add((*new_position, agent.direction))
        continue

Suggestion: Change agent.direction to the new_direction variable, so the list of the visited cells would contain the directions of the agent's path.

Version: flatland-rl==2.2.1

Assignee
Assign to
Time tracking