Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Juan-Carlos-Cruz/robotaxi-zoox/llms.txt
Use this file to discover all available pages before exploring further.
Node represents a single state in the search tree. It stores the taxi’s current position, the set of passengers already collected, the accumulated path cost from the root, and the heuristic estimate to the goal. Instances are immutable by convention — each move produces a fresh child node rather than modifying an existing one. Node implements __eq__, __hash__, and __lt__ so it can be stored in sets, used as dictionary keys, and placed directly on a priority heap.
Constructor
Node(posicion, pasajeros_recogidos=None, padre=None, g=0, h=0)
Creates a search-tree node and immediately computes the two derived attributes f and profundidad.
The
(row, column) coordinates of the taxi in the grid at this state.Positions of passengers that have already been picked up on the path leading
to this node. Any iterable of coordinate tuples is accepted and stored as a
frozenset. Defaults to an empty frozenset when None is passed.The parent node in the search tree — the state from which this node was
reached. Pass
None for the root node.Accumulated movement cost from the root node to this node.
Heuristic estimate of the remaining cost from this node to the goal. Defaults
to
0, which makes uninformed algorithms (BFS, DFS, UCS) behave correctly
without needing to supply a heuristic.f— priority value equal tog + h, used for heap ordering in informed searches.profundidad— depth in the search tree, equal topadre.profundidad + 1if a parent exists, otherwise0.
Attributes
| Name | Type | Description |
|---|---|---|
posicion | tuple[int, int] | (row, column) coordinates in the grid |
pasajeros_recogidos | frozenset[tuple[int, int]] | Passengers collected on the path to this node |
padre | Node | None | Parent node in the search tree; None for the root |
g | int | float | Accumulated cost from the root node |
h | int | float | Heuristic estimate of remaining cost to the goal |
f | int | float | Priority score — g + h — used for heap ordering |
profundidad | int | Depth from the root node (0-based) |
Methods
obtener_camino()
Reconstructs the full path from the root of the search tree to this node by walking the padre chain backwards and reversing the result.
An ordered list of
(row, column) positions starting at the root node and
ending at this node’s position.__eq__(other)
Two nodes are considered equal when they represent the same search state — that is, the same grid position and the same set of collected passengers. The values of g, h, f, and profundidad are intentionally ignored so that revisit detection works correctly regardless of how a state was reached.
The node to compare against.
True if self.posicion == other.posicion and
self.pasajeros_recogidos == other.pasajeros_recogidos.__hash__()
Returns a hash derived from (posicion, pasajeros_recogidos), matching the equality definition. This makes Node instances safe to use in set collections and as dict keys, which closed-list implementations rely on for O(1) revisit checks.
An integer hash of the tuple
(posicion, pasajeros_recogidos).__lt__(other)
Compares two nodes by their f value. This is required by Python’s heapq module, which calls < when two queue entries have equal priority keys.
The node to compare against.
True when self.f < other.f.__lt__ only compares f values; it does not break ties by depth or
insertion order. For algorithms like A* that need a stable tie-breaking
strategy, wrap nodes in a (f, counter, node) tuple before pushing to
the heap.