Skip to content

Commit d059090

Browse files
committed
fix visualization for IDA*
1 parent 3651f66 commit d059090

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
# 1.0.16
2+
## Bugfix
3+
- fix for ida_star: visualize all visited nodes, not just the last one.
4+
15
# 1.0.15
26
## Bugfix
3-
- fix for ida_star: return list of nodes instad of x-y-tuples
7+
- fix for ida_star: return list of nodes instead of x-y-tuples
48

59
# 1.0.14
610
## Bugfix

pathfinding/finder/ida_star.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def __init__(self, heuristic=None, weight=1,
3232
weighted=False,
3333
time_limit=time_limit,
3434
max_runs=max_runs)
35+
self.nodes_visited = 0
3536
self.track_recursion = track_recursion
3637
if not heuristic:
3738
if diagonal_movement == DiagonalMovement.never:
@@ -70,8 +71,10 @@ def search(self, node, g, cutoff, path, depth, end, grid):
7071
# sorted(neighbors, sort_neighbors)
7172
min_t = float('inf')
7273
for neighbor in neighbors:
74+
neighbor.opened = True
75+
7376
if self.track_recursion:
74-
# Retain a copy for visualisation. Due to recursion, this
77+
# Retain a copy for visualization. Due to recursion, this
7578
# node may be part of other paths too.
7679
neighbor.retain_count += 1
7780
neighbor.tested = True
@@ -85,12 +88,6 @@ def search(self, node, g, cutoff, path, depth, end, grid):
8588
path[depth] = node
8689
return t
8790

88-
# Decrement count, then determine whether it's actually closed.
89-
if self.track_recursion:
90-
neighbor.retain_count -= 1
91-
if neighbor.retain_count == 0:
92-
neighbor.tested = False
93-
9491
if t < min_t:
9592
min_t = t
9693

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
long_description=long_description,
1212
long_description_content_type="text/markdown",
1313
url="https://github.com/brean/python-pathfinding",
14-
version="1.0.15",
14+
version="1.0.16",
1515
license="MIT",
1616
author="Andreas Bresser",
1717
packages=find_packages(),

0 commit comments

Comments
 (0)