flatland.core.env_observation_builder module

ObservationBuilder objects are objects that can be passed to environments designed for customizability. The ObservationBuilder-derived custom classes implement 2 functions, reset() and get() or get(handle).

  • reset() is called after each environment reset, to allow for pre-computing relevant data.
  • get() is called whenever an observation has to be computed, potentially for each agent independently in case of multi-agent environments.
class flatland.core.env_observation_builder.DummyObservationBuilder[source]

Bases: flatland.core.env_observation_builder.ObservationBuilder

DummyObservationBuilder class which returns dummy observations This is used in the evaluation service

get(self, handle:int=0) → bool[source]

Called whenever an observation has to be computed for the env environment, possibly for each agent independently (agent id handle).

Parameters:
handle : int, optional

Handle of the agent for which to compute the observation vector.

Returns:
function

An observation structure, specific to the corresponding environment.

get_many(self, handles:Union[List[int], NoneType]=None) → bool[source]

Called whenever an observation has to be computed for the env environment, for each agent with handle in the handles list.

Parameters:
handles : list of handles, optional

List with the handles of the agents for which to compute the observation vector.

Returns:
function

A dictionary of observation structures, specific to the corresponding environment, with handles from handles as keys.

reset(self)[source]

Called after each environment reset.

class flatland.core.env_observation_builder.ObservationBuilder[source]

Bases: object

ObservationBuilder base class.

get(self, handle:int=0)[source]

Called whenever an observation has to be computed for the env environment, possibly for each agent independently (agent id handle).

Parameters:
handle : int, optional

Handle of the agent for which to compute the observation vector.

Returns:
function

An observation structure, specific to the corresponding environment.

get_many(self, handles:Union[List[int], NoneType]=None)[source]

Called whenever an observation has to be computed for the env environment, for each agent with handle in the handles list.

Parameters:
handles : list of handles, optional

List with the handles of the agents for which to compute the observation vector.

Returns:
function

A dictionary of observation structures, specific to the corresponding environment, with handles from handles as keys.

reset(self)[source]

Called after each environment reset.

set_env(self, env:flatland.core.env.Environment)[source]