All three uninformed search strategies in Robotaxi Zoox share a single entry point —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.
busqueda_no_informada — and differ only in how they manage the frontier. Pass "bfs" to get a FIFO queue, "dfs" to get a LIFO stack, or "ucs" to get a min-heap ordered by accumulated cost. Every other piece of logic — the visited set, goal test, and result dictionary — is identical across all three modes.
Function signature
| Parameter | Type | Description |
|---|---|---|
grid | Grid | The map object that generates neighbour nodes and movement costs |
nodo_inicial | Node | Starting state with position and an empty pasajeros_recogidos set |
pasajeros_totales | frozenset[tuple[int, int]] | All passenger positions that must be collected before reaching the destination |
modo | str | Frontier strategy: "bfs", "dfs", or "ucs" |
Breadth-First Search (BFS / "amplitud")
BFS explores all nodes at the current depth before moving deeper. The frontier is a deque and nodes are enqueued at the back and dequeued from the front, guaranteeing that shallower nodes are always processed first.
- Frontier:
collections.deque— FIFO queue - Strategy: expand the shallowest node first
- Complete: yes
- Optimal: yes for uniform-cost graphs (all edges cost 1)
BFS optimality holds when every step costs the same. On maps with
FLUJO_ALTO cells (cost 7), BFS may return a path with fewer steps that is more expensive than a longer route that avoids traffic. Use UCS when movement costs vary.Uniform-Cost Search (UCS / "costo")
UCS generalises BFS to weighted graphs. The frontier is a min-heap ordered by g — the accumulated cost from the start. The node with the lowest g is always expanded next, ensuring the cheapest path is found regardless of depth.
- Frontier:
heapqmin-heap ordered byg - Strategy: expand the lowest-cost node first
- Complete: yes
- Optimal: yes
contador tie-breaker prevents Python from comparing Node objects directly when two nodes share the same g value.
When to use: you want the cheapest total route, especially on maps where FLUJO_ALTO cells (cost 7) significantly inflate some paths.
Depth-First Search (DFS / "profundidad")
DFS always expands the most recently added node. The frontier is a plain Python list used as a LIFO stack: append pushes to the top and pop removes from it.
- Frontier:
list— LIFO stack - Strategy: expand the deepest node first
- Complete: yes (with a visited set to avoid cycles)
- Optimal: no — may return a longer or more expensive path
Without cycle avoidance DFS can loop indefinitely. The shared
visitados set (see below) prevents this by tracking (posicion, pasajeros_recogidos) state pairs that have already been expanded.Visited set and cycle avoidance
All three modes share the samevisitados set. A state is the pair (posicion, pasajeros_recogidos):
Return value
On success, the function returns a plain dictionary:None is returned when the frontier empties without reaching the goal — either because the map has no valid route or a required passenger is blocked by walls.
Full usage example
'bfs' for 'ucs' or 'dfs' to use a different strategy — the rest of the code stays the same.