From 83f0bd8fa2b6fea7a24b5e5b45f96adf0f83b051 Mon Sep 17 00:00:00 2001 From: Giulio Dioguardi Date: Wed, 13 Oct 2021 23:22:20 +0200 Subject: [PATCH 1/3] Fix TypeError < between Nodes --- mazes.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mazes.py b/mazes.py index adf72fb..6076fc6 100644 --- a/mazes.py +++ b/mazes.py @@ -5,6 +5,9 @@ def __init__(self, position): self.Neighbours = [None, None, None, None] #self.Weights = [0, 0, 0, 0] + def __lt__(self, other): + return True + def __init__(self, im): width = im.size[0] From 0bb1b0e2d57a976e9072860537ea38dc06e0547d Mon Sep 17 00:00:00 2001 From: Giulio Dioguardi Date: Wed, 13 Oct 2021 23:22:40 +0200 Subject: [PATCH 2/3] Fix queue import error --- priority_queue.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/priority_queue.py b/priority_queue.py index 763edbb..01818c6 100644 --- a/priority_queue.py +++ b/priority_queue.py @@ -4,7 +4,7 @@ from FibonacciHeap import FibHeap import heapq -import Queue +import queue class PriorityQueue(): __metaclass__ = ABCMeta @@ -88,7 +88,7 @@ def decreasekey(self, node, new_priority): class QueuePQ(PriorityQueue): def __init__(self): - self.pq = Queue.PriorityQueue() + self.pq = queue.PriorityQueue() self.removed = set() self.count = 0 From a9752f5b6e9c8028b1a7d918e557111741bd1600 Mon Sep 17 00:00:00 2001 From: Giulio Dioguardi Date: Wed, 13 Oct 2021 23:38:44 +0200 Subject: [PATCH 3/3] profile.py got an import loop, renaming it, fixes that. tempfile.NamedTemporaryFile will also open the file for you, so passing it to solve instead of its name fixes a PermissionDenied error. --- profile.py => profile_all.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename profile.py => profile_all.py (98%) diff --git a/profile.py b/profile_all.py similarity index 98% rename from profile.py rename to profile_all.py index 62cf7a1..b91f2a6 100644 --- a/profile.py +++ b/profile_all.py @@ -32,7 +32,7 @@ def profile(): for m in methods: for i in inputs: with tempfile.NamedTemporaryFile(suffix='.png') as tmp: - solve(SolverFactory(), m, "examples/%s.png" % i, tmp.name) + solve(SolverFactory(), m, "examples/%s.png" % i, tmp) profiler = BProfile('profiler.png') with profiler: