ReservationTable
- class w9_pathfinding.mapf.ReservationTable
Data structure to manage dynamic obstacles.
Can be used to simulate obstacles that move along a known path or agents with precomputed paths.
- Parameters:
env (Environment) – The environment (graph or grid).
- add_edge_constraint(time, n1, n2)
Add a constraint that prevents movement along a specific edge at a given time.
- Parameters:
time (int) – The time step of the movement.
n1 (node) – The starting node of the edge.
n2 (node) – The ending node of the edge.
- Raises:
ValueError – If either n1 or n2 is not a valid node in the environment.
- add_path(path, start_time=0, reserve_destination=False)
Reserve all nodes along a given path starting at a specified time. If edge_collision is enabled in the environment, this method will also reserve edges along the path.
- Parameters:
path (List[node]) – The list of nodes representing the path.
start_time (int, default 0) – The time step at which the path starts.
reserve_destination (bool, default False) – If True, the destination node remains reserved after arrival.
- Raises:
ValueError – If any node in the path is not a valid node in the environment.
- add_vertex_constraint(time, node, permanent=False)
Add a vertex constraint to block access to a node at a specific time.
- Parameters:
time (int) – The time step at which the node should be blocked.
node (node) – The node to constrain.
permanent (bool, default False) – If True, the node is permanently blocked from time onward.
- Raises:
ValueError – If node is not a valid node in the environment.
- is_edge_reserved(time, n1, n2)
Check if moving from node n1 to n2 is reserved at a given time.
- Parameters:
time (int) – The time step of the movement.
n1 (node) – The start node of the edge.
n2 (node) – The end node of the edge.
- Returns:
True if the edge is reserved at the given time.
- Return type:
bool
- Raises:
ValueError – If either n1 or n2 is not a valid node in the environment.
- is_reserved(time, node)
Check if a node is reserved at a given time.
- Parameters:
time (int) – The time step to query.
node (node) – The node to check
- Returns:
True if the node is reserved at the given time.
- Return type:
bool
- Raises:
ValueError – If node is not a valid node in the environment.