Package search

Class PriorityQueueSearcher<State,​Node extends SearchTreeNode<Node,​State>,​Frontier extends Frontiers.PriorityQueue<Node>>

java.lang.Object
search.GraphSearcher<State,​Node,​Frontier>
search.PriorityQueueSearcher<State,​Node,​Frontier>
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.
Frontier - Type representing the (entire) search frontier (open set).
Direct Known Subclasses:
AStarFrontierSearcher

public class PriorityQueueSearcher<State,​Node extends SearchTreeNode<Node,​State>,​Frontier extends Frontiers.PriorityQueue<Node>>
extends GraphSearcher<State,​Node,​Frontier>
Specialization of the generic GraphSearcher to use a priority queue structure for its frontier.
  • Constructor Details

    • PriorityQueueSearcher

      public PriorityQueueSearcher​(Supplier<GoalChecker<Node>> goalCheckerFactory, Comparator<Node> prioritizer, Function<Comparator<Node>,​Supplier<? extends Frontier>> frontierMetafactory, Function<Frontier,​ExploredSet<Node>> exploredSetFactory, Function<State,​Node> initializer)
      This constructor allows the comparison function to be specified separately from the frontier-creation process.
      Parameters:
      goalCheckerFactory - The get method of this object must return a predicate on tree nodes used to tell if they are goal nodes. Passed as-is to the primary constructor for this class, and thence to the parent constructor.
      prioritizer - The method by which the priority queue ranks tree nodes. In Java's PriorityQueue implementation, the next element to be removed is the one ranked least by the Comparator.
      frontierMetafactory - This function maps a Comparator for tree nodes to a Supplier of new, empty Frontier instances.
      exploredSetFactory - Structure used to manage adding elements to the frontier, in particular for avoiing duplication. Passed as-is to the primary constructor for this class, and thence to the parent constructor.
      initializer - Creates an initial tree node from a search space element. Passed as-is to the primary constructor for this class, and thence to the parent constructor.
    • PriorityQueueSearcher

      public PriorityQueueSearcher​(Supplier<GoalChecker<Node>> goalCheckerFactory, Supplier<? extends Frontier> frontierFactory, Function<Frontier,​ExploredSet<Node>> exploredSetFactory, Function<State,​Node> initializer)
      Primary constructor for this class. Since the use of a priority queue is specified by the bounds on Frontier, this constructor simply passes its arguments to the superclass constructor. 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.
      frontierFactory - The get method of this object returns a new, empty Frontier instance. Note that the type bound on Factory requires that the generated objects conform to Frontiers.PriorityQueue.
      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.