简体   繁体   中英

Why do you need to pick a heuristic close to the actual path costs?

I'm a computing science student and I currently have a subject about artificial intelligence. This subject covers various best-first search pathfinding algorithms, such as A* search.

My study material claims that it is usual to pick a heuristic following the next rule:

0 ≤ h(n) ≤ h(n)*

I understand this bit, but after that the material claims your heuristic should be optimistic or close to f(n). According to the material this should result in less nodes being expanded.

Why (and should you) you pick a heuristic as close as possible to f(n) and why does this result in (a lot) less nodes being expanded?

Thanks in advance for replying, you'll be helping me out so much for my next exam!

Example:

Find the shortest way to a specific field on a chess-board like field with obsticles. Lets say you only have the possibility to go left right up or down. A heuristic gives you a guess how many steps to the goal you will need for every one of the four possible fields you can go at every iteration.

Now your heuristic can be:

allways optimal: if thats the case you will allways go to the correct next field and initially find your best path.

allways lower or optimal: here it might occur that you go to the wrong field some time but if you reached your goal (or a view fields later) your algorithm will see that the path you found (or the actual heuristic) is greater than the heuristic of the field you should have gone before.

In other words: your heuristic gives you allways a lower or equal number than the actual steps you have to make. Hence if you find a path shorter or equal to all heuristics of fileds you didn't visit you can be sure your path is optimal.

"sometimes higher" if your heuristic gives you sometimes more steps than you would actually need you never can be sure that the path you have found is an optimal path!

So the worst thing to happen is an overestimation of the way by your heuristic because you might not find the optimal path. Therfore you have the condition 0 ≤ h(n) ≤ h(n)* And the closer you hare to your optimal heuristic, the less "wrong fields" you visit in your search. And the less wrong fields you visit, the faster you are.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM