flatland.core.policy module

flatland.core.policy module#

class flatland.core.policy.Policy[source]#

Bases: object

Abstract base class for Flatland policies. Used for evaluation.

Loosely corresponding to ray-project/ray, but much simpler.

act(handle: int, observation: List[Any], **kwargs) Any[source]#

Get action for agent. Called by act_many() for each agent.

Parameters#

handle: int

the agent’s handle

observation: Any

the agent’s observation

kwargs

forward compatibility placeholder

Returns#

Any

the action dict

act_many(handles: List[int], observations: List[Any], **kwargs) Dict[int, Any][source]#

Get action_dict for all agents. Default implementation calls act() for each handle in the list.

Parameters#

handles: List[int]

the agents’ handles

observations: List[Any]

the agents’ observations

kwargs

forward compatibility placeholder

Returns#

Dict[int, Any]

the action dict