flatland.envs.graph.graph_simplification module

flatland.envs.graph.graph_simplification module#

class flatland.envs.graph.graph_simplification.DecisionPointGraph(g: MultiDiGraph)[source]#

Bases: object

Overlay on top of Flatland 3 grid where consecutive cells where agents cannot choose between alternative paths are collapsed into a single edge. A reference to the underlying grid nodes is maintained. The edge length is the number of cells “collapsed” into this edge. See DecisionPointGraphEdgeData.

Attributes#

g: nx.MultiDiGraph

The decision point graph. Nodes have type GridNode and edge data has an attributed d of type DecisionPointGraphEdgeData.

static fromGraphTransitionMap(gtm: GraphTransitionMap) DecisionPointGraph[source]#

Factory method to derive DecisionPointGraph from GraphTransitionMap.

Parameters#

gtm: GraphTransitionMap

The Flatland 3 graph transition map.

Returns#

The overlaid decision point graph.

class flatland.envs.graph.graph_simplification.DecisionPointGraphEdgeData(path: List[Tuple[int, int, int]], len: int)[source]#

Bases: object

The edge data of a decision point overlay graph.

Attributes#

path: List[GridNode]

The list of collapsed cells, starting on a facing switch (e.g. where a decision has been taken upon entering).

len: int

Number of collapsed cells.