@@ -12,6 +12,7 @@ def zero_heuristic():
1212
1313class DijkstraBestFirstSearch :
1414 def __init__ (self , automated_planner ):
15+ self .time_start = now ()
1516 self .automated_planner = automated_planner
1617 self .metrics = Metrics ()
1718 self .init = Node (
@@ -35,7 +36,6 @@ def search(self, node_bound=float("inf")):
3536 self .automated_planner .logger .debug (
3637 "Search started at: " + str (timestamp .now ())
3738 )
38- time_start = now ()
3939 while self .open_nodes_n > 0 :
4040 current_key = min (
4141 [n for n in self .nodes if self .nodes [n ].is_open ],
@@ -46,7 +46,7 @@ def search(self, node_bound=float("inf")):
4646 if self .automated_planner .satisfies (
4747 self .automated_planner .problem .goal , current_node .state
4848 ):
49- self .metrics .runtime = now () - time_start
49+ self .metrics .runtime = now () - self . time_start
5050 self .automated_planner .logger .debug (
5151 "Search finished at: " + str (timestamp .now ())
5252 )
@@ -96,6 +96,6 @@ def search(self, node_bound=float("inf")):
9696 self .nodes [child_hash ] = child
9797 self .metrics .n_opened += 1
9898 self .open_nodes_n += 1
99- self .metrics .runtime = now () - time_start
99+ self .metrics .runtime = now () - self . time_start
100100 self .automated_planner .logger .warning ("!!! No path found !!!" )
101101 return None , self .metrics
0 commit comments