Class Node
java.lang.Object
fr.uga.pddl4j.util.BitSet
fr.uga.pddl4j.util.BitVector
fr.uga.pddl4j.problem.State
fr.uga.pddl4j.planners.statespace.search.Node
- All Implemented Interfaces:
Serializable
,Cloneable
This class implements a node of the tree search.
- See Also:
- Serialized Form
-
Field Summary
-
Constructor Summary
ConstructorDescriptionCreates a new node from a specified state.Creates a new node with a specified state, parent node, operator, cost and heuristic value.Creates a new node with a specified state, parent node, operator, cost, depth and heuristic value. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns if a node is equal to an other object.int
Returns the action applied to reach the node.double
getCost()
Returns the cost to reach the node from the root node.int
getDepth()
Returns the depth of this node.double
Returns the estimated distance to the goal from the node.Returns the parent node of the node.double
getValueF(double weight)
Returns the value of the heuristic function, i.e.,this.node.getCost() + this.node.getHeuristic()
.int
hashCode()
Returns the hash code value of the node.void
setAction(int action)
Sets the action applied to reach the node.void
setCost(double cost)
Sets the cost needed to reach the node from the root node.void
setDepth(int depth)
Set the depth of this node.void
setHeuristic(double estimates)
Sets the estimated distance to the goal from the node.void
Sets the parent node of the node.Methods inherited from class fr.uga.pddl4j.util.BitVector
exclude, getIntersection, include, shiftLeft, shiftRight
Methods inherited from class fr.uga.pddl4j.util.BitSet
and, andNot, cardinality, clear, clear, clear, clone, ensureCapacity, flip, flip, get, get, intersects, isEmpty, length, nextClearBit, nextSetBit, or, previousClearBit, previousSetBit, recalculateWordsInUse, set, set, set, set, size, stream, toByteArray, toLongArray, toString, valueOf, valueOf, valueOf, valueOf, xor
-
Constructor Details
-
Node
Creates a new node from a specified state.- Parameters:
state
- the state.
-
Node
Creates a new node with a specified state, parent node, operator, cost and heuristic value.- Parameters:
state
- the logical state of the node.parent
- the parent node of the node.action
- the action applied to reached the node from its parent.cost
- the cost to reach the node from the root node.heuristic
- the estimated distance to reach the goal from the node.
-
Node
Creates a new node with a specified state, parent node, operator, cost, depth and heuristic value.- Parameters:
state
- the logical state of the node.parent
- the parent node of the node.action
- the action applied to reached the node from its parent.cost
- the cost to reach the node from the root node.depth
- the depth of the node.heuristic
- the estimated distance to reach the goal from the node.
-
-
Method Details
-
getAction
public final int getAction()Returns the action applied to reach the node.- Returns:
- the action applied to reach the node.
-
setAction
public final void setAction(int action)Sets the action applied to reach the node.- Parameters:
action
- the action to set.
-
getParent
Returns the parent node of the node.- Returns:
- the parent node.
-
setParent
Sets the parent node of the node.- Parameters:
parent
- the parent to set.
-
getCost
public final double getCost()Returns the cost to reach the node from the root node.- Returns:
- the cost to reach the node from the root node.
-
setCost
public final void setCost(double cost)Sets the cost needed to reach the node from the root node.- Parameters:
cost
- the cost needed to reach the node from the root nod to set.
-
getHeuristic
public final double getHeuristic()Returns the estimated distance to the goal from the node.- Returns:
- the estimated distance to the goal from the node.
-
setHeuristic
public final void setHeuristic(double estimates)Sets the estimated distance to the goal from the node.- Parameters:
estimates
- the estimated distance to the goal from the node to set.
-
getDepth
public int getDepth()Returns the depth of this node.- Returns:
- the depth of this node.
-
setDepth
public void setDepth(int depth)Set the depth of this node.- Parameters:
depth
- the depth of this node.
-
getValueF
public final double getValueF(double weight)Returns the value of the heuristic function, i.e.,this.node.getCost() + this.node.getHeuristic()
.- Parameters:
weight
- the weight of the heuristic.- Returns:
- the value of the heuristic function, i.e.,
this.node.getCost() + this.node.getHeuristic()
.
-
equals
Returns if a node is equal to an other object. The equals method has the same behaviour as the equals method of the class BitState.- Overrides:
equals
in classBitSet
- Parameters:
obj
- the other oject.- Returns:
true
if the node is equal to the other specified object;false
otherwise.- See Also:
BitSet.equals(Object)
-
hashCode
public int hashCode()Returns the hash code value of the node. The hashcode method has the same behaviour as the hashcode method of the class BitState.- Overrides:
hashCode
in classBitSet
- Returns:
- the hashcode value for this node.
- See Also:
BitSet.hashCode()
-