|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--search.SearchGraph
The SearchGraph
class is a container for a set of
SearchNodes
. A SearchGraph
is used by the five
basic search algorithms: depth-first, breadth-first, iterated,
best-first, and genetic.
Field Summary | |
(package private) java.util.Hashtable |
graph
|
(package private) java.lang.String |
name
|
Constructor Summary | |
SearchGraph(java.lang.String name)
Creates a SearchGraph with the given name. |
Method Summary | |
SearchNode |
bestFirstSearch(SearchNode initialNode,
java.lang.Object goalState)
Does a best-first search on graph, starting the the given initial node and continuing until the goal state is reached. |
SearchNode |
breadthFirstSearch(SearchNode initialNode,
java.lang.Object goalState)
Method breadthFirstSearch |
SearchNode |
depthFirstSearch(SearchNode initialNode,
java.lang.Object goalState)
Does a depth-first search on graph, starting the the given initial node and continuing until the goal state is reached. |
SearchNode |
depthLimitedSearch(SearchNode initialNode,
java.lang.Object goalState,
int maxDepth)
Does a depth-first search on graph, starting the the given initial node and continuing until the goal state is reached or the given depth is reached. |
java.util.Hashtable |
getGraph()
Returns the search graph. |
SearchNode |
getNode(java.lang.String nodeName)
Returns the search node associated with the given node name. |
SearchNode |
iterDeepSearch(SearchNode startNode,
java.lang.Object goalState)
Does a iterated deepening search on graph, a series of depth-first searches starting at the given initial node and continuing until the goal state is reached or an arbitrary depth is reached. |
(package private) void |
put(SearchNode node)
Adds a node to the graph, using node label as key. |
(package private) void |
reset()
Resets each search node in the graph. |
Methods inherited from class java.lang.Object |
|
Field Detail |
java.lang.String name
java.util.Hashtable graph
Constructor Detail |
public SearchGraph(java.lang.String name)
SearchGraph
with the given name.name
- the String that identifies the name of the graphMethod Detail |
public java.util.Hashtable getGraph()
public SearchNode getNode(java.lang.String nodeName)
nodeName
- the String that names a node in the graphvoid reset()
void put(SearchNode node)
node
- the SearchNode to be added to the graphpublic SearchNode depthFirstSearch(SearchNode initialNode, java.lang.Object goalState)
initialNode
- the SearchNode at which the search beginsgoalState
- the Object being searched for in the graphSearchNode
containing the goal is returned,
if the goal state is found. Otherwise, null
is returned.public SearchNode breadthFirstSearch(SearchNode initialNode, java.lang.Object goalState)
initialNode
- the SearchNode objectgoalState
- the Object objectpublic SearchNode depthLimitedSearch(SearchNode initialNode, java.lang.Object goalState, int maxDepth)
initialNode
- the SearchNode at which the search beginsgoalState
- the Object being searched for in the graphmaxDepth
- the maximum depth to be searchedSearchNode
containing the goal is returned,
if the goal state is found. Otherwise, null
is returned.public SearchNode iterDeepSearch(SearchNode startNode, java.lang.Object goalState)
initialNode
- the SearchNode at which the search beginsstartNode
- the SearchNode objectgoalState
- the Object being searched for in the graphSearchNode
containing the goal is returned,
if the goal state is found. Otherwise, null
is returned.public SearchNode bestFirstSearch(SearchNode initialNode, java.lang.Object goalState)
SearchNode
.initialNode
- the SearchNode at which the search beginsgoalState
- the Object being searched for in the graphSearchNode
containing the goal is returned,
if the goal state is found. Otherwise, null
is returned.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |