Package teamwork :: Package examples :: Package Thespian :: Module ThespianAgent :: Class ThespianAgent
[hide private]
[frames] | no frames]

Class ThespianAgent

source code

              agent.Agent.Agent --+                    
                                  |                    
agent.RecursiveAgent.RecursiveAgent --+                
                                      |                
         agent.GoalBased.GoalBasedAgent --+            
                                          |            
              agent.stereotypes.Stereotyper --+        
                                              |        
               agent.DefaultBased.GenericEntity --+    
                                                  |    
                  agent.Agent.Agent --+           |    
                                      |           |    
    agent.RecursiveAgent.RecursiveAgent --+       |    
                                          |       |    
             agent.GoalBased.GoalBasedAgent --+   |    
                                              |   |    
                        agent.support.Supporter --+    
                                                  |    
                  agent.Agent.Agent --+           |    
                                      |           |    
    agent.RecursiveAgent.RecursiveAgent --+       |    
                                          |       |    
              agent.MemoryAgent.MemoryAgent --+   |    
                                              |   |    
              agent.consistency.ConsistentAgent --+    
                                                  |    
                         agent.Entities.PsychEntity --+
                                                      |
                                                     ThespianAgent

Nested Classes [hide private]

Inherited from agent.Agent.Agent: actionClass

Instance Methods [hide private]
dict
observe(self, actionDict={})
Returns: observations this entity would make of the given actions, in the same format as the provided action dictionary
source code
(Action[],Element)
applyPolicy(self, state=None, actions=[], history=None, debug=None, explain=False)
Generates a decision chosen according to the agent's current policy
source code
 
updateActionChoices(self, choices, state=None, includeLocation=False) source code
 
updateActionChoices7(self, choices, state=None, includeLocation=False) source code
 
forceinitState(self)
Instantiates all of the state defaults relevant to this entity
source code
dict[]
fitAllAction(self, horizon=-1, state=None)
Computes a set of constraints on possible goal weights for this agent that, if satisfied, will cause the agent to prefer the desired action in the given state.
source code
Distribution over float
applyRealGoals(self, entity=None, world=None, debug=Debugger (0), fixedgoals=['sameLocation', 'actAlive', 'specialRule'])
Returns: expected reward of the entity in current world
source code
 
getDefault(self, feature)
Finds the most specific class defaults for the specified feature; raises KeyError exception if no default exists
source code
 
initGoals(self, entities=[])
Sets the goal weights of this entity based on class defaults.
source code
 
initEntities(self, entityList, depth=1, maxDepth=-1)
Sets the entities known to be the list provided, and makes the appropriate updates to goals, policy depth, etc.
source code
PWLDynamics
getDynamics(self, act, feature=None)
Returns this entity's dynamics model for the given action
source code
 
hypotheticalPostCom(self, beliefs, msgs, epoch=-1, debug=Debugger (0))
Returns: the potential change in the agent's beliefs based on received messages
source code

Inherited from agent.Entities.PsychEntity: __cmp__, __copy__, __getstate__, __init__, __setstate__, __xml__, acceptMessage, acceptability, extendPolicy, getPolicyDepth, parse, postComStateEstimator, preComStateEstimator, setPolicyDepth, stateEstimator

Inherited from agent.DefaultBased.GenericEntity: addActions, applyBeliefs, applyDefaults, initActions, initBeliefs, initDynamics, initModels, initObservations, initRelationships, initState, instanceof, instantiateGoal, instantiateList, instantiateName, setHierarchy

Inherited from agent.stereotypes.Stereotyper: __str__, clusterSpace, freezeModels, generateSpace, hypotheticalPreCom, reachable, setModel, updateModel, updateModels, weightEqual

Inherited from agent.GoalBased.GoalBasedAgent: actionValue, applyGoals, expectedValue, fit, generateConstraints, getGoalTree, getGoalVector, getGoalWeight, getGoals, getNormalization, normalizeGoals, setGoalWeight, setGoals

Inherited from agent.RecursiveAgent.RecursiveAgent: __deepcopy__, __eq__, __getitem__, __ne__, ancestry, applyChanges, beliefDepth, findObservation, freeze, getActionKeys, getAllBeliefs, getBelief, getBeliefKeys, getEntities, getEntity, getEntityBeliefs, getNestedBelief, getObservation, getObservations, getSelfBelief, getState, getStateFeatures, hasBelief, incorporateMessage, initialStateEstimator, invalidateCache, multistep, resetHistory, saveObservations, setBelief, setEntity, setName, setObservation, setRecursiveBelief, setSelfBelief, setState, step, toHTML, updateStateDict

Inherited from agent.Agent.Agent: generateAllObservations, generateHistories, legalActions, legalMessages, observable

Inherited from agent.support.Supporter: getLink, getLinkKey, getLinkTypes, getLinkees, getSupport, getTrust, removeLink, setLink, setSupport, setTrust, updateLinks, updateTrust

Inherited from agent.consistency.ConsistentAgent: __getMessageContentKey__, __getStateIntegratedWithMessage__, __propagateBeliefsBackInTime__, __propagateBeliefsForwardInTime__, __solveForUniqueTreePath__, calculateMessageConsistency, getMemoryConsistency

Inherited from agent.MemoryAgent.MemoryAgent: updateMemory

Class Variables [hide private]

Inherited from agent.Entities.PsychEntity: beliefWeights, consistencyWeights

Inherited from agent.DefaultBased.GenericEntity: copyCount, factors

Inherited from agent.stereotypes.Stereotyper: defaultModelChange

Inherited from agent.GoalBased.GoalBasedAgent: valueType

Inherited from agent.support.Supporter: supportLimit, supportWeights

Instance Variables [hide private]

Inherited from agent.stereotypes.Stereotyper: model, modelChange, models

Inherited from agent.GoalBased.GoalBasedAgent: constraints, goals, horizon

Inherited from agent.RecursiveAgent.RecursiveAgent: dynamics, parent, relationships, state

Inherited from agent.Agent.Agent: actions, name, omega

Inherited from agent.support.Supporter: linkDynamics, linkTypes, links

Method Details [hide private]

observe(self, actionDict={})

source code 
Parameters:
  • actionDict (dict:str→Action[]) - the performed actions, indexed by actor name
Returns: dict
observations this entity would make of the given actions, in the same format as the provided action dictionary
Overrides: agent.RecursiveAgent.RecursiveAgent.observe

applyPolicy(self, state=None, actions=[], history=None, debug=None, explain=False)

source code 

Generates a decision chosen according to the agent's current policy

Parameters:
  • state (Distribution(KeyedVector)) - the current state vector
  • actions (Action[]) - the possible actions the agent can consider (defaults to all available actions)
  • history (Action[]:bool) - a dictionary of actions that have already been performed (and which should not be performed again if they are labeled as not repeatable)
  • explain (bool) - flag indicating whether an explanation should be generated
Returns: (Action[],Element)
a list of actions and an explanation, the latter provided by execute
Overrides: agent.RecursiveAgent.RecursiveAgent.applyPolicy

fitAllAction(self, horizon=-1, state=None)

source code 

Computes a set of constraints on possible goal weights for this agent that, if satisfied, will cause the agent to prefer the desired action in the given state. Each constraint is dictionary with the following elements:

  • delta: the total difference that must be made up
  • slope: dictionary of coefficients for each goal weight in the sum that must make up that difference
  • plane: the vector of weights, such that the product of this vector and the goal weight vector must exceed 0 for the desired action to be preferred
Parameters:
  • desired (Action[]) - the action that the agent should prefer
  • horizon (int) - the horizon of lookahead to use (if not provided, the agent's default horizon is used)
  • state (dict) - the current state of this agent's beliefs (if not provided, defaults to the result of getAllBeliefs
Returns: dict[]
a list of constraints

applyRealGoals(self, entity=None, world=None, debug=Debugger (0), fixedgoals=['sameLocation', 'actAlive', 'specialRule'])

source code 
Parameters:
Returns: Distribution over float
expected reward of the entity in current world

getDefault(self, feature)

source code 

Finds the most specific class defaults for the specified feature; raises KeyError exception if no default exists

Overrides: agent.DefaultBased.GenericEntity.getDefault

initGoals(self, entities=[])

source code 

Sets the goal weights of this entity based on class defaults. The resulting goals depend on the group of entities passed in as the optional argument.

Overrides: agent.DefaultBased.GenericEntity.initGoals

initEntities(self, entityList, depth=1, maxDepth=-1)

source code 

Sets the entities known to be the list provided, and makes the appropriate updates to goals, policy depth, etc.

Parameters:
  • maxDepth - the maximum depth of this agent's recursive models
Overrides: agent.support.Supporter.initEntities

getDynamics(self, act, feature=None)

source code 

Returns this entity's dynamics model for the given action

Parameters:
  • act (Action) - the action whose effect we are interested in
  • feature (str) - if the optional feature argument is provided, then this method returns the dynamics for only the given feature; otherwise, returns the effect over all state features (but this latter capability is now deprecated)
Returns: PWLDynamics
this entity's dynamics model for the given action
Overrides: agent.RecursiveAgent.RecursiveAgent.getDynamics

hypotheticalPostCom(self, beliefs, msgs, epoch=-1, debug=Debugger (0))

source code 
Returns:
the potential change in the agent's beliefs based on received messages
Overrides: agent.Entities.PsychEntity.hypotheticalPostCom