【发布时间】:2026-02-07 08:10:01
【问题描述】:
我正在查看* (wikipedia:A*_search_algorithm) 上的 A 星伪代码,我对这段代码的 sn-p 有疑问:
for each neighbor in neighbor_nodes(current)
tentative_g_score := g_score[current] + dist_between(current,neighbor)
tentative_f_score := tentative_g_score + heuristic_cost_estimate(neighbor, goal)
if neighbor in closedset and tentative_f_score >= f_score[neighbor]
continue
在 if 语句的第二部分 - tentative_f_score >= f_score[neighbor] - 我想知道计算 f_score[neighbor] 与计算 tentative_f_score 有何不同。
基本上,我将如何计算f_score[neighbor]?谢谢。
【问题讨论】: