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_informada implements two heuristic-guided algorithms — Greedy Best-First (priority by h) and A* (priority by f = g + h) — using the same Manhattan-distance heuristic function to estimate distance to the next uncollected passenger or the final destination. Both algorithms share the same goal condition: every passenger must be collected before the taxi reaches destino. The heuristic is admissible on a grid (it never overestimates), which guarantees that A* returns a cost-optimal solution.
Import
Heuristic helper functions
heuristica_manhattan
abs(r1 - r2) + abs(c1 - c2). Because the taxi can only move in four cardinal directions, this value never overestimates the true path cost, making it an admissible heuristic.
calcular_heuristica
nodo.pasajeros_recogidos == meta_pasajeros), it returns the Manhattan distance to destino. Otherwise it returns the minimum Manhattan distance to any uncollected passenger — the nearest unvisited pickup.
busqueda_informada signature
The map object that provides
get_vecinos for neighbour generation and movement costs.Starting
(row, column) position of the taxi on the grid.Terminal
(row, column) position the taxi must reach after collecting all passengers.All passenger positions that must be collected before the goal is satisfied. Pass
grid.pasajeros directly.Algorithm variant to run. Must be
'avara' (Greedy Best-First) or 'a_estrella' (A*). Any other value raises a ValueError.Return value
Returns adict with the following keys on success, or None when the destination is unreachable.
Ordered list of grid positions from start to destination, inclusive.
Total accumulated movement cost
g of the solution node.Number of nodes popped from the frontier and processed during the search.
Depth of the solution node in the search tree.
The
h value of the solution node at the moment it was identified as the goal. This is 0 for A* when the destination is reached with all passengers collected.Greedy vs A* comparison
| Property | 'avara' (Greedy) | 'a_estrella' (A*) |
|---|---|---|
| Priority key | h only | f = g + h |
| Cost-optimal | No | Yes (with admissible h) |
| Visited tracking | visited set — a state is never re-expanded | best_g dict — re-expands a state if a cheaper path is found later |
| Speed | Often faster in practice | Slower but guarantees optimal cost |
A* uses a
best_g dictionary instead of a plain visited set. When a state is popped from the frontier, the search only skips it if the previously recorded cost is already less than or equal to the current node’s g. This allows A* to re-expand a state via a newly discovered cheaper path — a key difference from Greedy.Heuristic details
| Function | Formula | When used |
|---|---|---|
heuristica_manhattan | abs(r1−r2) + abs(c1−c2) | Base distance calculation between any two cells |
calcular_heuristica | min Manhattan to uncollected passenger | When passengers remain to be picked up |
calcular_heuristica | Manhattan to destino | When all passengers have been collected |
h and f attributes of each Node are always up to date.