aima.search.framework
Class GraphSearch

java.lang.Object
  extended by aima.search.framework.NodeExpander
      extended by aima.search.framework.QueueSearch
          extended by aima.search.framework.GraphSearch

public class GraphSearch
extends QueueSearch

Artificial Intelligence A Modern Approach (2nd Edition): Figure 3.19, page 83. function GRAPH-SEARCH(problem, fringe) returns a solution, or failure closed <- an empty set fringe <- INSERT(MAKE-NODE(INITIAL-STATE[problem]), fringe) loop do if EMPTY?(fringe) then return failure node <- REMOVE-FIRST(fringe) if (GOAL-TEST[problem](STATE[node]) then return SOLUTION(node) if STATE[node] is not in closed then add STATE[node] to closed fringe <- INSERT-ALL(EXPAND(node, problem), fringe) Figure 3.19 The general graph-search algorithm, The set closed can be implemented with a hash table to allow efficient checking for repeated states. This algorithm assumes that the first path to a state s is the cheapest (see text).


Field Summary
 
Fields inherited from class aima.search.framework.NodeExpander
metrics, NODES_EXPANDED
 
Constructor Summary
GraphSearch()
           
 
Method Summary
 void addExpandedNodesToFringe(NodeStore fringe, Node node, Problem problem)
           
 java.util.List<java.lang.String> search(Problem problem, NodeStore fringe)
           
 
Methods inherited from class aima.search.framework.QueueSearch
clearInstrumentation, getMaxQueueSize, getPathCost, getQueueSize, setPathCost, setQueueSize
 
Methods inherited from class aima.search.framework.NodeExpander
expandNode, getMetrics, getNodesExpanded, getSearchMetric, setNodesExpanded
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphSearch

public GraphSearch()
Method Detail

search

public java.util.List<java.lang.String> search(Problem problem,
                                               NodeStore fringe)
Overrides:
search in class QueueSearch

addExpandedNodesToFringe

public void addExpandedNodesToFringe(NodeStore fringe,
                                     Node node,
                                     Problem problem)
Specified by:
addExpandedNodesToFringe in class QueueSearch