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 92
    • Issues 92
    • 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
  • #346

Closed
Open
Created May 06, 2022 by qimaili@qimaili

[Bug] Initial direction of agents may not be valid.

There is chance that the initial direction of agents is not valid! For example, when agent.initial_position is a east-west rail, the agent.initial_direction may be NORTH sometimes, although the chance is very small.

Following script can reproduce the bug within several hundred of loops.

from flatland.envs.rail_env import RailEnv
from flatland.envs.rail_generators import SparseRailGen
import numpy as np

env = RailEnv(
    width=60,
    height=60,
    number_of_agents=4,
    rail_generator=SparseRailGen(max_num_cities=6, max_rails_between_cities=3),
)


cnt = 0
while True:
    env.reset()
    for agent in env.agents:
        possible_transitions = env.rail.get_transitions(
            *agent.initial_position, agent.initial_direction
        )
        if all(np.array(possible_transitions) == 0):
            print("Wrong initial direction!!!!! No possible transition from it!!!")
    cnt += 1
    print(f"\r{cnt}", end="")

My test environment:

  • OS: Ubuntu 20.04 LTS (GNU/Linux 5.10.16.3-microsoft-standard-WSL2 x86_64)
  • python==3.6.13
  • flatland==3.0.15
Edited May 06, 2022 by qimaili
Assignee
Assign to
Time tracking