flatland.envs.agent_chains module#
- class flatland.envs.agent_chains.ChainTestEnv(omc: MotionCheck)[source]#
Bases:
object
Just for testing agent chains
- class flatland.envs.agent_chains.MotionCheck[source]#
Bases:
object
Class to find chains of agents which are “colliding” with a stopped agent. This is to allow close-packed chains of agents, ie a train of agents travelling at the same speed with no gaps between them,
- addAgent(iAg, rc1, rc2, xlabel=None)[source]#
add an agent and its motion as row,col tuples of current and next position. The agent’s current position is given an “agent” attribute recording the agent index. If an agent does not want to move this round (rc1 == rc2) then a self-loop edge is created. xlabel is used for test cases to give a label (see graphviz)
- block_preds(svStops, color='red')[source]#
Take a list of stopped agents, and apply a stop color to any chains/trees of agents trying to head toward those cells. Count the number of agents blocked, ignoring those which are already marked. (Otherwise it can double count swaps)
- check_motion(iAgent, rcPos)[source]#
Returns tuple of boolean can the agent move, and the cell it will move into. If agent position is None, we use a dummy position of (-1, iAgent)
- find_same_dest()[source]#
find groups of agents which are trying to land on the same cell. ie there is a gap of one cell between them and they are both landing on it.
- find_stop_preds(svStops=None)[source]#
Find the predecessors to a list of stopped agents (ie the nodes / vertices) Returns the set of predecessors. Includes “chained” predecessors.
- find_stops()[source]#
find all the stopped agents as a set of rc position nodes A stopped agent is a self-loop on a cell node.
- find_stops2()[source]#
alternative method to find stopped agents, using a networkx call to find selfloop edges
- flatland.envs.agent_chains.create_test_agents(omc: MotionCheck)[source]#
- flatland.envs.agent_chains.create_test_agents2(omc: MotionCheck)[source]#
- flatland.envs.agent_chains.render(omc: MotionCheck, horizontal=True)[source]#