Class UtilityNode
java.lang.Object
edu.uky.cs.nil.sabre.hg.Node
edu.uky.cs.nil.sabre.hg.FormulaNode
edu.uky.cs.nil.sabre.hg.UtilityNode
- All Implemented Interfaces:
CostSet, Countable, Serializable, Iterable<CostSet.Entry>
A
cost set node that represents a
utility expression. When a utility node's character is
null, it represents the author's
utility; otherwise, it represents that character's utility. Each branch of the conditional utility
expression is represented by a goal node.- Author:
- Stephen G. Ware
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface CostSet
CostSet.Entry -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal CharacterThe character whose utility this node represents, or null for the author's utilityA list ofgoal nodesthat correspond to thebranchesof theconditional utility expressionand which can cause this node to have different valuesfinal Conditional<Disjunction<Clause<Precondition>>> The conditional numeric expression that defines a utility value depending on the situationprotected final RangeThe set of possible values this utility expression can have and their associated costsFields inherited from class FormulaNode
formulas -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedUtilityNode(HeuristicGraph graph, Character character, Conditional<Disjunction<Clause<Precondition>>> label) Constructs a new utility node that belongs to a given graph and represents a given utility. -
Method Summary
Modifier and TypeMethodDescriptionfinal doublegetCost(int index) Returns the cost of the value at a given index in the set.final doublegetCost(Comparison.Operator operator, Value value) Returns the cost of some value in this set satisfying the givencomparison operatorwhen it is on the left and a given value is on the right.final ValuegetValue(int index) Returns thevalueat a given index in the set.final Iterator<CostSet.Entry> iterator()protected voidreset()Returns this node to its default state.protected booleanSets the cost of this node's utility expression having the givenvalue.final intsize()Returns the number of elements in this collectionMethods inherited from class Node
hashCode, markForReset, notify, toStringMethods inherited from class Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Field Details
-
character
The character whose utility this node represents, or null for the author's utility -
label
The conditional numeric expression that defines a utility value depending on the situation -
goals
A list ofgoal nodesthat correspond to thebranchesof theconditional utility expressionand which can cause this node to have different values -
range
The set of possible values this utility expression can have and their associated costs
-
-
Constructor Details
-
UtilityNode
protected UtilityNode(HeuristicGraph graph, Character character, Conditional<Disjunction<Clause<Precondition>>> label) Constructs a new utility node that belongs to a given graph and represents a given utility.- Parameters:
graph- the graph this node belongs tocharacter- the character whose utility this node represents, or null for the authorlabel- the numeric utility expression this node represents
-
-
Method Details
-
size
public final int size()Description copied from interface:CountableReturns the number of elements in this collection- Returns:
- the number of elements in this collection
-
iterator
-
getValue
Description copied from interface:CostSetReturns thevalueat a given index in the set. The cost of value can be accessed viaCostSet.getCost(int).- Parameters:
index- the index of the desired value- Returns:
- the value at that index
-
getCost
public final double getCost(int index) Description copied from interface:CostSetReturns the cost of the value at a given index in the set. The value itself can be accessed viaCostSet.getValue(int).- Parameters:
index- the index of the value whose cost is desired- Returns:
- the cost of the value at that index
-
getCost
Description copied from interface:CostSetReturns the cost of some value in this set satisfying the givencomparison operatorwhen it is on the left and a given value is on the right. For example, if this method is called with thegreater than operatorand the value 0, it means "what is the cost of this set having a value above 0?"- Parameters:
operator- the comparison operator to satisfyvalue- the value on the right hand side of the comparison- Returns:
- the cost of some value in this set that satisfies the comparison when it is on the left hand side of the comparison
-
setCost
Sets the cost of this node's utility expression having the givenvalue. The value's cost will only be updated if the given cost is less than the current cost of that value.- Overrides:
setCostin classFormulaNode- Parameters:
value- a value that the utility expression can now havecost- the cost of the utility expression having that value- Returns:
- true if the cost of that value was updated, or false if this node's state did not change
-
reset
-