Package teamwork :: Package policy :: Module LookupPolicy :: Class LookupPolicy
[hide private]
[frames] | no frames]

Class LookupPolicy

source code

generic.Policy --+
                 |
                LookupPolicy
Known Subclasses:

Class for representing a strictly reactive policy

Each entry is represented as a dictionary: >>> {'class':<cls>, 'action':<action>, ... } The action can be passed in as a dictionary, which is then converted into the appropriate Action subclass. The remaining structure of the entry depends on the value of <cls>, as follows:

Instance Methods [hide private]
 
__init__(self, entity, actions=[], span=1) source code
 
matchAnswer(self, state, action) source code
 
execute(self, state, choices=[], history=None, debug=Debugger (0), explain=None) source code
 
actionValue(self, state, actStruct, debug=Debugger (0))
Return some quantified value of performing action
source code
 
testCondition(self, state, entry, debug=<class teamwork.utils.Debugger.Debugger at 0x172bdb0>) source code
 
extend(self, entry, actionClass=None, entity=None)
Extends the current policy table to include the given entry
source code
 
parseEntry(self, entry, actionClass=None)
Takes a string representation of a lookup entry and returns the corresponding policy entry structure
source code
 
parseLHS(self, keys, entryType) source code
 
instantiateKeys(self, keys)
Takes a list of strings and substitutes any specific entities into generic relation labels
source code
 
__str__(self) source code
 
__contains__(self, value)
Returns true if the specified value matches an entry in this policy
source code
Method Details [hide private]

__init__(self, entity, actions=[], span=1)
(Constructor)

source code 
Overrides: generic.Policy.__init__

execute(self, state, choices=[], history=None, debug=Debugger (0), explain=None)

source code 
Overrides: generic.Policy.execute

extend(self, entry, actionClass=None, entity=None)

source code 

Extends the current policy table to include the given entry

The entry can be either a string or a list of policy entry dictionaries or a single policy entry dictionary. The optional actionClass argument (default: Action) specifies the base class for the RHS