diff options
| author | Gustav Sörnäs <gusso230@student.liu.se> | 2020-11-09 14:43:45 +0100 |
|---|---|---|
| committer | Gustav Sörnäs <gusso230@student.liu.se> | 2020-11-20 13:39:57 +0100 |
| commit | 1527c553eaafa8c813834495cf74f8c3332a739a (patch) | |
| tree | cb3ec5ae3f23718d67c977cb70660ee23c47ffc3 | |
| parent | 10e3d6874745283b545d3b8029a3e5e184932c5d (diff) | |
| download | tdde25-1527c553eaafa8c813834495cf74f8c3332a739a.tar.gz | |
unweighted a-star
| -rw-r--r-- | algorithms.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/algorithms.py b/algorithms.py index 6e01287..ba06641 100644 --- a/algorithms.py +++ b/algorithms.py @@ -58,7 +58,7 @@ def find_shortest_path(nodes, source_id, target_id): continue # otherwise this MIGHT be the shortest walk to neighbour # so put it in the queue - new_dist = walk_dist + length_haversine(nodes[walk_end], neighbour) + new_dist = walk_dist + length_haversine(nodes[walk_end], neighbour) + length_haversine(neighbour, nodes[target_id]) new_walk = walk + (neighbour.id,) heapq.heappush(queue, (new_dist, new_walk)) # no path found |
