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

Class PWLPolicy

source code

             generic.Policy --+    
                              |    
LookaheadPolicy.LookaheadPolicy --+
                                  |
                                 PWLPolicy

Policy that uses PWLTables to store action rules

Instance Methods [hide private]
 
__init__(self, entity, actions=None, horizon=None)
Same arguments used by constructor for LookupAheadPolicy superclass
source code
 
reset(self)
Removes any cached policy tables
source code
 
__getitem__(self, index) source code
 
execute(self, state=None, choices=[], debug=None, horizon=-1, explain=False)
Execute the policy in the given state
source code
 
project(self, R, depth=-1, debug=False)
Project the value function and policy one step further at the given depth
source code
PWLTable
getTable(self, depth=-1, horizon=-1)
Returns: a given policy table
source code

Inherited from LookaheadPolicy.LookaheadPolicy: __contains__, __copy__, __str__, __xml__, actionValue, evaluateChoices, findBest, parse, setHorizon

Instance Variables [hide private]

Inherited from LookaheadPolicy.LookaheadPolicy: consistentTieBreaking, horizon

Method Details [hide private]

__init__(self, entity, actions=None, horizon=None)
(Constructor)

source code 

Same arguments used by constructor for LookupAheadPolicy superclass

Parameters:
  • entity - the entity whose policy this is (not sure whether this is necessary)
  • actions - the options considered by this policy (used by superclass)
  • horizon - the lookahead horizon
Overrides: generic.Policy.__init__

execute(self, state=None, choices=[], debug=None, horizon=-1, explain=False)

source code 

Execute the policy in the given state

Parameters:
  • horizon (int) - the horizon to consider (by default, use the entity's given horizon)
  • choices (Action[][]) - the legal actions to consider (default is all available actions)
Overrides: generic.Policy.execute

project(self, R, depth=-1, debug=False)

source code 

Project the value function and policy one step further at the given depth

Parameters:
  • R (PWLTable) - the reward function in tabular form
  • depth (int) - the recursive belief depth to compute the value function for (default is deepest level already computed)

getTable(self, depth=-1, horizon=-1)

source code 
Parameters:
  • depth - the recursive depth for the desired policy (default is maximum depth solved)
  • horizon - the horizon for the desired policy (default is maximum horizon solved)
Returns: PWLTable
a given policy table

Warning: Will raise IndexError if no policy has been solved for the given horizon and depth settings