Package search

Class BreadthFirstSearcher<State,​Node extends SearchTreeNode<Node,​State>>

java.lang.Object
search.GraphSearcher<State,​Node,​Frontiers.Queue<Node>>
search.BreadthFirstSearcher<State,​Node>
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 Details

    • BreadthFirstSearcher

      public BreadthFirstSearcher​(Predicate<State> stateChecker, Function<State,​Node> initializer)
      Constructor which uses a predicate on goals for checking success of a tree node, and which defaults to a HashSet on 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 a HashSet on state elements for detecting previously-explored nodes.
      Parameters:
      goalCheckerFactory - The get method 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 - The get method 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