public class NodeExpander
extends java.lang.Object
expand(Node, Problem)
calls.Modifier and Type | Class and Description |
---|---|
static interface |
NodeExpander.NodeListener
Interface for progress Tracers
|
Modifier and Type | Field and Description |
---|---|
protected int |
counter
Counts the number of
expand(Node, Problem) calls. |
protected boolean |
useParentLinks |
Constructor and Description |
---|
NodeExpander() |
Modifier and Type | Method and Description |
---|---|
void |
addNodeListener(NodeExpander.NodeListener listener)
Adds a listener to the list of node listeners.
|
Node |
createNode(java.lang.Object state,
Node parent,
Action action,
double stepCost)
Computes the path cost for getting from the root node state via the
parent node state to the specified state, creates a new node for the
specified state, adds it as child of the provided parent (if
useParentLinks is true), and returns it. |
Node |
createRootNode(java.lang.Object state)
Factory method, which creates a root node for the specified state.
|
java.util.List<Node> |
expand(Node node,
Problem problem)
Returns the children obtained from expanding the specified node in the
specified problem.
|
int |
getNumOfExpandCalls()
Returns the number of
expand(Node, Problem) calls since the last
counter reset. |
protected void |
notifyNodeListeners(Node node) |
void |
resetCounter()
Resets the counter for
expand(Node, Problem) calls. |
NodeExpander |
useParentLinks(boolean state)
Modifies
useParentLinks and returns this node expander. |
protected boolean useParentLinks
protected int counter
expand(Node, Problem)
calls.public NodeExpander useParentLinks(boolean state)
useParentLinks
and returns this node expander. When
using local search to search for states, parent links are not needed and
lead to unnecessary memory consumption.public Node createRootNode(java.lang.Object state)
public Node createNode(java.lang.Object state, Node parent, Action action, double stepCost)
useParentLinks
is true), and returns it.public java.util.List<Node> expand(Node node, Problem problem)
node
- the node to expandproblem
- the problem the specified node is within.public void addNodeListener(NodeExpander.NodeListener listener)
protected void notifyNodeListeners(Node node)
public void resetCounter()
expand(Node, Problem)
calls.public int getNumOfExpandCalls()
expand(Node, Problem)
calls since the last
counter reset.