Commit 414eb632 authored by Jonas Boysen's avatar Jonas Boysen
Browse files

fix to also update "cost" of frontier after last bug fix

parent a1ea535e
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -160,12 +160,15 @@ class Simulation:
                )

                if self.search_method == "UCS":
                    cost = path_cost
                    if self.frontier_history["cost"][hist_idx] <= path_cost:
                        continue
                if self.search_method == "GreedyBestFirst":
                    cost = heuristic
                    if self.frontier_history["cost"][hist_idx] <= heuristic:
                        continue
                if self.search_method == "A*":
                    cost = heuristic + path_cost
                    if self.frontier_history["cost"][hist_idx] <= path_cost + heuristic:
                        continue

@@ -186,6 +189,9 @@ class Simulation:
                self.frontier_history_unsorted["heuristic"][
                    hist_unsorted_idx
                ] = heuristic

                self.frontier_history["cost"][hist_idx] = cost
                self.frontier_history_unsorted["cost"][hist_unsorted_idx] = cost
            else:
                # create entry in frontier
                self.frontier.append((self.current_node, child))