aima.search.framework
Class Node
java.lang.Object
aima.search.framework.Node
public class Node
- extends java.lang.Object
Artificial Intelligence A Modern Approach (2nd Edition): page 69.
There are many ways to represent nodes, but we will assume that a node is a
data structure with five components:
STATE: the state in the state space to which the node corresponds;
PARENT-NODE: the node in the search tree that generated this node; ACTION:
the action that was applied to the parent to generate the node; PATH-COST:
the cost, traditionally denoted by g(n), of the path from the initial state
to the node, as indicated by the parent pointers; and DEPTH: the number of
steps along the path from the initial state.
Constructor Summary |
Node(Node parent,
java.lang.Object state)
|
Node(java.lang.Object state)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Node
public Node(java.lang.Object state)
Node
public Node(Node parent,
java.lang.Object state)
getDepth
public int getDepth()
isRootNode
public boolean isRootNode()
getParent
public Node getParent()
getPathFromRoot
public java.util.List<Node> getPathFromRoot()
getState
public java.lang.Object getState()
setAction
public void setAction(java.lang.String action)
getAction
public java.lang.String getAction()
setStepCost
public void setStepCost(java.lang.Double stepCost)
addToPathCost
public void addToPathCost(java.lang.Double stepCost)
getPathCost
public double getPathCost()
- Returns:
- Returns the pathCost.
getStepCost
public double getStepCost()
- Returns:
- Returns the stepCost.
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object