根据这一理论执行A*算法:
create the open list of nodes, initially containing only our starting node
create the closed list of nodes, initially empty
while (we have not reached our goal) {
consider the best node in the open list (the node with the lowest f value)
if (this node is the goal) {
then we re done
}
else {
move the current node to the closed list and consider all of its neighbors
for (each neighbor) {
if (this neighbor is in the closed list and our current g value is lower) {
update the neighbor with the new, lower, g value
change the neighbor s parent to our current node
}
else if (this neighbor is in the open list and our current g value is lower) {
update the neighbor with the new, lower, g value
change the neighbor s parent to our current node
}
else this neighbor is not in either the open or closed list {
add the neighbor to the open list and set its g value
}
}
}
}
现在有两个优先事项 公开名单和封闭名单的询问。
在从开放名单到封闭名单之后,如果邻国也被列入封闭名单并从事上述行动,就必须建立其邻国,相互核对。 问题只能是 pe头,与产生邻国相比。 我也能够接触到 que子的其余部分,以便进行比较。
我的问题是:
how can i compare the neighbours to the nodes in the closed list. Or should i use a different data structure for the closed list?
感谢