-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBestFirstSearch.java
More file actions
25 lines (21 loc) · 839 Bytes
/
BestFirstSearch.java
File metadata and controls
25 lines (21 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package searchAlgorithms;
import heuristic.DistanceHeuristic;
import pathEvaluation.ConstantPathEvaluator;
import searchStrategy.Alphabetical;
import searchStrategy.SearchStrategy;
import searchStrategy.Uniform;
import stateSpace.StateSpace;
import util.Position;
/**
* chooses the node with the closest distance to a goal node
* @param <Node> the node type that the StateSpace uses
*/
public class BestFirstSearch<Node extends Position> extends GeneralSearch<Node> {
/**
* uses a SearchStrategy with Uniform PathSorter, a ConstantPathEvaluator and a DistanceHeuristic
* @param space the StateSpace that the algorithm searches in
*/
public BestFirstSearch(StateSpace<Node> space) {
super(space, new SearchStrategy<>(new Uniform<>(), new Alphabetical<>()), new ConstantPathEvaluator<>(), new DistanceHeuristic<>());
}
}