很多时候我们需要丢弃重复的状态,如 uniform-cost search 中所述。 .
if n is in frontier with higher cost
replace existing node with n
优先级队列不提供用于搜索项目的优先级然后更新它的接口(interface)。我很惊讶我找不到任何与此相关的资源,任何人都可以提供帮助。
最佳答案
您正在寻找优先搜索队列。
A priority search queue efficiently supports the opperations of both a search tree and a priority queue. A Binding is a product of a key and a priority. Bindings can be inserted, deleted, modified and queried in the queue (usually in logarithmic time), and the binding with the least priority can be retrieved in constant time.
这是一个implementation在 haskell 。
关于algorithm - 统一成本搜索中前沿的理想数据结构是什么(优先级队列似乎不够)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12688364/