Package teamwork :: Package agent :: Module support :: Class Supporter
[hide private]
[frames] | no frames]

Class Supporter

source code

              Agent.Agent --+        
                            |        
RecursiveAgent.RecursiveAgent --+    
                                |    
         GoalBased.GoalBasedAgent --+
                                    |
                                   Supporter
Known Subclasses:

Mix-in class that enables and updates support relationships

Nested Classes [hide private]

Inherited from Agent.Agent: actionClass

Instance Methods [hide private]
 
__init__(self, name='') source code
 
__xml__(self, doc=None) source code
dict
getAllBeliefs(self)
Packages up all of this agent's beliefs into a handy dictionary
source code
float
getLink(self, relationship, entity)
Returns: the current value of the link
source code
LinkKey
getLinkKey(self, relation, entity)
Returns: the vector index for this entity's relation to the given entity
source code
str[]
getLinkTypes(self)
Returns: all of the available dynamics relationship types that his entity has
source code
str[]
getLinkees(self, relationship)
Returns: the others to which this entity has explicit relationships of the specified type
source code
teamwork.math.probability.Distribution
getSupport(self, entity)
Returns: the support/liking that I have in the given entity
source code
float
getTrust(self, entity)
Returns: the trust that I have in the given entity
source code
 
initEntities(self, entityList)
Sets the entities linked to
source code
 
parse(self, element)
Extracts this agent's recursive belief structure from the given XML Element
source code
dict
preComStateEstimator(self, beliefs, actions, epoch=-1, debug=None)
Computes the hypothetical changes to the given beliefs in response to the given actions
source code
 
removeLink(self, relationship, entity)
Removes the given relationship from this entity to the given one
source code
 
setLink(self, relationship, entity, value) source code
 
setSupport(self, entity, value)
Sets the support/liking that I have in the given entity
source code
 
setTrust(self, entity, value)
Sets the trust that I have in the given entity
source code
 
updateLinks(self, delta)
Takes changes to relationships and modifies them accordingly
source code
dict
updateTrust(self, sender, delta, accept)
Updates the given delta based on any changes due to the acceptance/reject of a message
source code

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

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

Inherited from Agent.Agent: __cmp__, generateAllObservations, generateHistories, legalActions, legalMessages, observable, postComStateEstimator

Class Variables [hide private]
  _supportFeature = 'likes'
  _trustFeature = 'trusts'
float supportLimit = 0.5
the maximum distance allowed between the goals as stated in another entity's messages and one's own beliefs, when determining whether that entity's messages are in support of one's current beliefs
  supportWeights = {'future': 0.3, 'legitimacy': 0.1, 'past': 0....

Inherited from GoalBased.GoalBasedAgent: valueType

Instance Variables [hide private]
  linkDynamics
the decision tree defining the effects on the dynamic relationship values, indexed by link type, then by action type
str[] linkTypes
list of current dynamic relationship types
KeyedVector links
the current dynamic relationship values

Inherited from GoalBased.GoalBasedAgent: constraints, goals, horizon

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

Inherited from Agent.Agent: actions, name, omega

Method Details [hide private]

__init__(self, name='')
(Constructor)

source code 
Parameters:
  • name - label for this instance
Overrides: Agent.Agent.__init__
(inherited documentation)

__xml__(self, doc=None)

source code 
Overrides: Agent.Agent.__xml__

getAllBeliefs(self)

source code 

Packages up all of this agent's beliefs into a handy dictionary

Returns: dict
the dictionary has the following indices:
  • state: what this agent believes about the state of the world
  • name: what this agent think agent, name, believes (i.e., a recursive call to getAllBeliefs)
Overrides: RecursiveAgent.RecursiveAgent.getAllBeliefs

getLink(self, relationship, entity)

source code 
Parameters:
  • relationship - the dynamic relationship (e.g., 'likes', 'trusts') to evaluate
  • entity - the entity who is the object of the relationship (e.g., the entity being liked or trusted)
  • relationship,entity (str)
Returns: float
the current value of the link

getLinkKey(self, relation, entity)

source code 
Returns: LinkKey
the vector index for this entity's relation to the given entity

getLinkTypes(self)

source code 
Returns: str[]
all of the available dynamics relationship types that his entity has

getLinkees(self, relationship)

source code 
Parameters:
  • relationship (str) - the dynamic relationship (e.g., 'likes', 'trusts') to evaluate
Returns: str[]
the others to which this entity has explicit relationships of the specified type

getSupport(self, entity)

source code 
Returns: teamwork.math.probability.Distribution
the support/liking that I have in the given entity

getTrust(self, entity)

source code 
Returns: float
the trust that I have in the given entity

parse(self, element)

source code 

Extracts this agent's recursive belief structure from the given XML Element

Overrides: Agent.Agent.parse

preComStateEstimator(self, beliefs, actions, epoch=-1, debug=None)

source code 

Computes the hypothetical changes to the given beliefs in response to the given actions

Parameters:
  • beliefs (dict) - the beliefs to be updated (traditionally, the result from getAllBeliefs)
  • actions (dict:str→Action) - the actions observed by this agent
  • epoch (int) - the current epoch in which these observations occurred (currently ignored, but potentially important)
  • debug (Debugger)
Returns: dict
the belief changes that would result from the specified observed actions, in dictionary form:
  • beliefs: results as returned by hypotheticalAct
  • observations: the given actions
Overrides: Agent.Agent.preComStateEstimator

removeLink(self, relationship, entity)

source code 

Removes the given relationship from this entity to the given one

Parameters:
  • relationship - the dynamic relationship (e.g., 'likes', 'trusts') to evaluate
  • entity - the entity who is the object of the relationship (e.g., the entity being liked or trusted)
  • relationship,entity (str)

setLink(self, relationship, entity, value)

source code 
Parameters:
  • relationship - the dynamic relationship (e.g., 'likes', 'trusts') to evaluate
  • entity - the entity who is the object of the relationship (e.g., the entity being liked or trusted)
  • value (float) - the new value for my trust level
  • relationship,entity (str)

setSupport(self, entity, value)

source code 

Sets the support/liking that I have in the given entity

Parameters:
  • entity (str) - the entity I (dis)like
  • value - the new value for my support/liking level

setTrust(self, entity, value)

source code 

Sets the trust that I have in the given entity

Parameters:
  • entity (str) - the entity I (dis)trust
  • value - the new value for my trust level

updateTrust(self, sender, delta, accept)

source code 

Updates the given delta based on any changes due to the acceptance/reject of a message

Parameters:
  • sender (str) - the agent sending the message
  • delta (dict) - the current effect dictionary
  • accept (bool) - flat indicating whether the message has been accepted (True means accepted)
Returns: dict
the updated effect dictionary (original dictionary is changed as a side effect)

Class Variable Details [hide private]

supportWeights

Value:
{'future': 0.3, 'legitimacy': 0.1, 'past': 0.5, 'support': 0.1}