Choosing a heuristic
Choosing a heuristic
\astar and \idastar do not specify which heuristic we should use. Indeed, we can plug in any suitable heuristic and off we go.
How do we decide on which heuristic to use, or whether a suitable heuristic exists?
A heuristic is an estimate
Never lose sight of the fact that a heuristic is an estimate. A heuristic is not a calculation of actual cost. If we had a cheap and easy way to compute actual cost we wouldn’t need heuristic search at all.
Some estimates are better than others
Some estimates are better than others.
The most extreme example is the zero heuristic. Is it an estimate? Well, yeah, I suppose. Is it a good estimate? Nah.
Ideally, we’d like our estimate to be as close as possible to the true value, but
- we don’t know true values in advance, and
- it’s often the case that better estimates involve more computation.
So we should look for a means of estimating that’s good enough to guide our search, but not so expensive to compute that it’s not worth the effort.
Heuristics should be admissible
If at all possible, our heuristics should be admissible. Without admissibility, we lose the guarantee of optimality.
Certain problems are difficult enough that we cannot devise a heuristic that’s computationally efficient, reasonably accurate, and admissible. Nevertheless, there are a great many problems for which we have good, admissible heuristics, and this should always be a primary goal.
Consistency is a very desirable property
With consistency, we have a guarantee that once a node is expanded, we never need to revisit and re-expand the node. Once we reach a node, we know we’ve done so by a lowest-cost path.
Keep in mind that consistency implies admissibility, but the converse is not true—a heuristic may be admissible but not consistent.
Copyright © 2023–2026 Clayton Cafiero
No generative AI was used in producing drafts of this material. This was written the old-fashioned way. AI was used to rewrite existing pseudocode in LaTeX to produce standalone *.tex files for rendering, and for revisions toward satisfying WCAG 2.1 AA-level accessibility standards as required by UVM policy. It may also have been used to proofread selected human-written prose. Claude 2.1.150 with model Sonnet 4.6. Revisions, if any, were performed by the author. AI was not used in generating any code whatsoever. All code samples and starter code are by the author only.