Package search
Class BreadthFirstSearcher<State,Node extends SearchTreeNode<Node,State>>
- Type Parameters:
State- Type representing elements of the search space.Node- Type representing nodes in the search tree. Each node typically contains a reference to a State element.
- Direct Known Subclasses:
BreadthFirstFinder
public class BreadthFirstSearcher<State,Node extends SearchTreeNode<Node,State>> extends GraphSearcher<State,Node,Frontiers.Queue<Node>>
Specialization of the generic
GraphSearcher to use a queue
for its frontier, and thus erform breadth-first search.-
Constructor Summary
Constructors Constructor Description BreadthFirstSearcher(Predicate<State> stateChecker, Function<State,Node> initializer)BreadthFirstSearcher(Supplier<GoalChecker<Node>> goalCheckerFactory, Function<Frontiers.Queue<Node>,ExploredSet<Node>> exploredSetFactory, Function<State,Node> initializer)Primary constructor for this class.BreadthFirstSearcher(Supplier<GoalChecker<Node>> goalCheckerFactory, Function<State,Node> initializer)Constructor which defaults to aHashSeton state elements for detecting previously-explored nodes. -
Method Summary
Modifier and Type Method Description static <S> BreadthFirstSearcher<S,Nodes.SimpleTreeNode<S>>build(Predicate<S> stateChecker, Function<S,Iterable<S>> expander)Methods inherited from class search.GraphSearcher
debugExpansion, debugFrontier, debugFrontierAddition, debugFrontierExhausted, debugFrontierNonaddition, debugFrontierRemoval, debugGoalFound, debugInitialNode, getDebug, getLastAddedToFrontier, getLastExpandedFromFrontier, getLastNotAddedToFrontier, getLastUnexpandedInFrontier, search, setDebug, solvable
-
Constructor Details
-
BreadthFirstSearcher
Constructor which uses a predicate on goals for checking success of a tree node, and which defaults to aHashSeton state elements for detecting previously-explored nodes.- Parameters:
stateChecker- Success predicate on state elements.initializer- Creates an initial tree node from a search space element.
-
BreadthFirstSearcher
public BreadthFirstSearcher(Supplier<GoalChecker<Node>> goalCheckerFactory, Function<State,Node> initializer)Constructor which defaults to aHashSeton state elements for detecting previously-explored nodes.- Parameters:
goalCheckerFactory- Thegetmethod of this object must return a predicate on tree nodes used to tell if they are goal nodes.initializer- Creates an initial tree node from a search space element.
-
BreadthFirstSearcher
public BreadthFirstSearcher(Supplier<GoalChecker<Node>> goalCheckerFactory, Function<Frontiers.Queue<Node>,ExploredSet<Node>> exploredSetFactory, Function<State,Node> initializer)Primary constructor for this class. Passes its arguments to the superclass constructor, along with a factory for queue-based frontiers. Other constructors for this class invoke this constructor.- Parameters:
goalCheckerFactory- Thegetmethod of this object must return a predicate on tree nodes used to tell if they are goal nodes.exploredSetFactory- Structure used to manage adding elements to the frontier, in particular for avoiing duplication.initializer- Creates an initial tree node from a search space element.
-
-
Method Details
-
build
public static <S> BreadthFirstSearcher<S,Nodes.SimpleTreeNode<S>> build(Predicate<S> stateChecker, Function<S,Iterable<S>> expander)
-