让我们举一个涉及起始位置和其他位置列表的问题。目标是到达所有这些地点。
所有其他地点均可访问所有地点。
搜索启发式:
total_distance
while locations.has_next():
find distance to nearest location
new_location = location_chosen
total_distance += distance
这是不可接受的吗?只是检查我对这个术语的理解。
例如:
start = (0,0)
nodeA = (0,2)
nodeB = (0,4)
nodeC = (0,-3)
所以这会导致
start > nodeA > nodeB > nodeC = 2 + 2 + 7 = 11,
而不是
start > nodeC > nodeA > nodeB = 3 + 5 + 2 = 10