@@ -41,7 +41,10 @@ def __init_logger(self, log_level):
4141 format = "%(levelname)s:%(message)s" ,
4242 filemode = "w" ,
4343 level = log_level ,
44- ) # Creates the log file
44+ )
45+
46+ def display_available_heuristics (self ):
47+ print (list (self .available_heuristics .keys ()))
4548
4649 def transition (self , state , action ):
4750 return self .pddl .transition (self .domain , state , action , check = False )
@@ -92,34 +95,30 @@ def get_state_def_from_path(self, path):
9295 trimmed_path .append (node .state )
9396 return trimmed_path
9497
95- def breadth_first_search (self , time_it = False ):
98+ def breadth_first_search (self ):
9699 bfs = BreadthFirstSearch (self )
97- last_node , total_time = bfs .search ()
100+ last_node , total_time , opened_nodes = bfs .search ()
98101 path = self .__retrace_path (last_node )
99- if time_it :
100- return path , total_time
101- return path , None
102102
103- def depth_first_search (self , time_it = False ):
103+ return path , total_time , opened_nodes
104+
105+ def depth_first_search (self ):
104106 dfs = DepthFirstSearch (self )
105- last_node , total_time = dfs .search ()
107+ last_node , total_time , opened_nodes = dfs .search ()
106108 path = self .__retrace_path (last_node )
107- if time_it :
108- return path , total_time
109- return path , None
110109
111- def dijktra_best_first_search (self , time_it = False ):
110+ return path , total_time , opened_nodes
111+
112+ def dijktra_best_first_search (self ):
112113 dijkstra = DijkstraBestFirstSearch (self )
113- last_node , total_time = dijkstra .search ()
114+ last_node , total_time , opened_nodes = dijkstra .search ()
114115 path = self .__retrace_path (last_node )
115- if time_it :
116- return path , total_time
117- return path , None
118116
119- def astar_best_first_search (self , time_it = False , heuristic = goal_count_heuristic ):
117+ return path , total_time , opened_nodes
118+
119+ def astar_best_first_search (self , heuristic = goal_count_heuristic ):
120120 astar = AStarBestFirstSearch (self , heuristic )
121- last_node , total_time = astar .search ()
121+ last_node , total_time , opened_nodes = astar .search ()
122122 path = self .__retrace_path (last_node )
123- if time_it :
124- return path , total_time
125- return path , None
123+
124+ return path , total_time , opened_nodes
0 commit comments