本篇文章介绍Greedy Best Fisrt Search算法。实现GBFS算法时使用了上篇文章介绍的优先队列。下篇文章将尝试介绍著名的A star算法。
Greedy Best-First Search
- use heuristic function as evaluation function: f(n) = h(n)
- always expands the node that is closest to the goal node
- eats the largest chunk out of the remaining distance, hence, “greedy”
The following example is “Touring in Romania”, which is an actual problem for making a plan travelling from Arad to Bucharest, the aim that we use the lowest cost.
example
Touring in Romania: Heuristic
- HSLD(n) = straight-line distance to Bucharest straight-line distance: Euclidean distance
- distance to Bucharest because our goal is to be in Bucharest
[table]
- HSLD(Bucharest) = 0
- HSLD(Fagaras) = 176 < 211 driving distance
- HSLD(n) cannot be computed from the problem description, it represents
additional information
What’s wrong with GBFS?
for this problem: search proceeds straight to the goal node:
- minimal search cost
- but not the optimal path
Compare to Uniform-Cost Search
- UCS: numbers start from 0 and increase – tendency to expand earlier nodes –
breadth-first tendency - UCS的介绍
- GBFS: number start from high and decreases – tendency to expand later nodes
– depth-first tendency
参考资料
- 数据结构与算法分析
- 大话数据结构
- AI planning 课程资料