πŸš‰ Questions about the Flatland Environment

The purpose of this thread is to gather questions about details of the Flatland environment (RailEnv). Ask here if you have any doubt about what happens at intersections, what is the precise way malfunctions occurs, etc.

Hi, if the agent will have malfunction in next step, and I give him an action to do now, it must do it or not?
I mean does the next malfunction affect the current action? In another words, does the environment try to malfunction the agent before it obeys the actions I give to it or after? I believe logically, it must do the actions with current state of malfunction (before change the state of malfunction), but I have an error in my tests, and I can’t find any suggestion other than this.

By which action can I change the status of an agent from READY_TO_DEPART to ACTIVE. Another thing, is it automatically removed from scene when it arrives to its destination or must I do some action?
Maybe, I can find the answers if I investigate the libraries, but honestly I am not so good in python (and it’s easier if someone knows and tells us the answers).

Hello @MasterScrat, I’ve recently set up the environment and I’m working with manual rail generator. Is there a way in which we can manually fix the sources and destinations of the agents? Or, if we can know the starting and ending positions of the agents from the (manually) generated environment? Many thanks.

Hi Zain

In the RailEnv.step FLATland checks whether there is a mal function for given agent. If so the agent can not move. See the comment in the rail_env.py:

        # Induce malfunction before we do a step, thus a broken agent can't move in this step
        self._break_agent(agent)

When an agent is not yet active (READY_TO_DEPART) and the agent’s apply action MOVE_LEFT,MOVE_RIGHT,MOVE_FORWARD it become active and the agent is set to its initial position but only if the cell is empty

Adrian

2 Likes

Hi
I don’t exactly know what the manual generator is doint - but if you put an agent into the environment you just need to set the agent status: READY_TO_DEPART and as well its position = None. The agent is now located outside of the environment. Thus you have to further set the initial_position to the entry position. Means where the agent will entring the world.

The ending position is the agent’s target. Where the agent can be automatically removed or not. In the challenge setup it will automatically removed. RailEnv(…, remove_agents_at_target = True) -> remove_agents_at_target is set to true thus it reqeust the env to remove agents at target. It will be done as soon as the agent reached its target.

2 Likes

Hello!

I noticed that there the environment has a remove_agents_at_target parameter that defaults to True . Can we assume that this will always be True during evaluation?

@seungjae_ryan_lee yes remove_agents_at_target is True during evaluation!

1 Like

Hi,

I’m confused about the specification of the evaluation environment as specified here https://flatland.aicrowd.com/getting-started/environment-configurations.html. In particular does malfunction_duration = [20,50] specify the min/max of the malfunction_duration? But it contradicts the values for the min_malfunction_interval in the table below. And what is the malfunction_rate?

Could you please clarify? Thanks.

Hey @shining_spring,

Indeed, malfunction_duration = [20,50] specifies the min/max of the malfunction_duration. This value is the same for all Round 1 environments.

min_malfunction_interval is the minimal interval between malfunctions.

The malfunction_rate is the invert of the malfunction interval. So the malfunction rate will be at most 1.0 / min_malfunction_interval.

Hi, I’m trying to parallelise the RL training by running multiple episodes simultaneously. Do you know if other people have successfully tried this out? Something is going wrong for me - the environment does not seem to be creating independent instances of itself. My threads appear to be writing to each other’s memory locations.

That’s weird! How are you parallelising it? We use dozens of environments in parallel in the RLlib baselines: https://flatland.aicrowd.com/research/baselines.html

Thanks for the prompt response! It turned out to be a joblib version issue. I had an older version installed, which was mismanaging the object references.