Consider the function,
$f(n) = g(n) + w * h(n)$
where $w$ determines how much weight we give to the heuristic function.
$h(n)$ → manhattan distance
At one end of the spectrum is $w = 0$
with the pull of the source
and only the shortest path in mind
At the other end of the spectrum $w \rightarrow \infty$
with the push towards the goal
and only speedy termination in mind
Weight | Algorithm |
---|---|
0 | Branch and Bound |
1 | A* |
2 | Weighted A* |
$\infty$ (the weight of g(n) is zero, that is, negligible) | Best First Search |
The search spaces for A1 and A2 when h2(n) > h1(n).
Here h2 was more informed than h1
In weighted A* we can shrink this further but lose admissibility.