Package teamwork :: Package reward :: Module MinMaxGoal :: Class MinMaxGoal
[hide private]
[frames] | no frames]

Class MinMaxGoal

source code

A reward subfunction that is linear in a single feature/action

0) Creating a new goal (i.e., __init__()): goal = MinMaxGoal(entity,direction,type,key)

1) Accessing elements of this goal goal.isMax()

Instance Methods [hide private]
 
__init__(self, entity=None, direction=None, goalType=None, key=None, value={})
Constructs a goal object with the specified field values
source code
 
__copy__(self) source code
 
generateName(self)
Returns a canonical string representation
source code
boolean
isMax(self)
Returns: true if maximization goal, false if minimization
source code
Key
toKey(self)
Returns: the vector key corresponding to this goal
source code
 
reward(self, context)
Applies this goal in the specified context
source code
(str,Distribution)
maxElement(self)
Finds the element that has the highest value
source code
 
__getitem__(self, index)
Accessor: supports access in the form `self[index]'
source code
 
__setitem__(self, index, value)
Accessor: supports access in the form `self[index]=x'
source code
 
keys(self)
Returns: all of the element names in this goal
source code
 
evaluate(self, context)
Returns a new goal instance in the given context by computing the reward and storing it in its value attribute
source code
 
__add__(self, goal) source code
 
__neg__(self) source code
 
__sub__(self, goal) source code
 
__mul__(self, factor) source code
 
__div__(self, factor) source code
 
total(self)
Returns sum over the individual elements in an instantiated goal
source code
 
__str__(self) source code
 
__hash__(self) source code
 
__xml__(self) source code
 
parse(self, element) source code
Method Details [hide private]

__init__(self, entity=None, direction=None, goalType=None, key=None, value={})
(Constructor)

source code 

Constructs a goal object with the specified field values

The named arguments are stored as corresponding attributes:

Parameters:
  • entity (str[]) - list of names (for recursive belief access if a state goal, or for relevant actor/object if action goal)
  • direction - either 'min' or 'max'
  • goalType - either 'state' (value of a state feature), 'act' (number of occurences of action of given type), 'actActor' (number of occurrences of action of given type by given actor), 'actObject' (number of occurences of action of given type to given object)
  • key - for a 'state' goal, is the state feature to be min/maximized for an 'act', goal, is the act type to be min/maximized
  • direction,goalType,key (str)

isMax(self)

source code 
Returns: boolean
true if maximization goal, false if minimization

toKey(self)

source code 
Returns: Key
the vector key corresponding to this goal

Warning: There is no Key subclass for beliefs

maxElement(self)

source code 

Finds the element that has the highest value

Returns: (str,Distribution)
a tuple of the key and value

keys(self)

source code 
Returns:
all of the element names in this goal