Package mazealgo.model.algorithms.search
Class BestFirstSearch
java.lang.Object
mazealgo.model.algorithms.search.ASearchingAlgorithm
mazealgo.model.algorithms.search.BreadthFirstSearch
mazealgo.model.algorithms.search.BestFirstSearch
- All Implemented Interfaces:
ISearchingAlgorithm
Best First Search algorithm.
It works just like Breadth First Search (BFS), but instead of exploring equally in all directions,
it uses a "smart" queue (a priority queue) to decide where to go next.
It prioritizes states based on their actual cost so far PLUS an estimated cost to the goal,
obtained from the domain's own heuristic. This makes it act like A*, finding the
cheapest path while exploring far fewer nodes than BFS - assuming the domain
provides an admissible heuristic.
-
Field Summary
Fields inherited from class mazealgo.model.algorithms.search.BreadthFirstSearch
openListFields inherited from class mazealgo.model.algorithms.search.ASearchingAlgorithm
numberOfNodesEvaluated -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class mazealgo.model.algorithms.search.BreadthFirstSearch
resetMethods inherited from class mazealgo.model.algorithms.search.ASearchingAlgorithm
buildSolution, getNumberOfNodesEvaluated, onNodeEvaluated, setNodeEvaluatedListener
-
Constructor Details
-
BestFirstSearch
public BestFirstSearch()
-
-
Method Details
-
solve
- Specified by:
solvein interfaceISearchingAlgorithm- Overrides:
solvein classBreadthFirstSearch
-
getName
- Specified by:
getNamein interfaceISearchingAlgorithm- Overrides:
getNamein classBreadthFirstSearch
-