Package teamwork :: Package multiagent :: Module pwlSimulation :: Class PWLSimulation
[hide private]
[frames] | no frames]

Class PWLSimulation

source code

             object --+        
                      |        
                   dict --+    
                          |    
Multiagent.MultiagentSystem --+
                              |
                             PWLSimulation

Instance Methods [hide private]
new empty dictionary

__init__(self, agents=None, observable=False)
Initializes a collection to contain the given list of agents
source code
 
initialize(self)
Do any necessary preparation before doing whatever
source code
Element
microstep(self, turns, hypothetical=False, explain=False, state=None, suggest=False)
Step forward by the action of the given entities
source code
dict
hypotheticalAct(self, actions, exp=None, state=None)
Computes the scenario changes that would result from a given action
source code
dict
getState(self)
Returns: a dictionary of 'state' and relationships of the current simulation state
source code
 
getDelta(self, actions, state, exp=None)
Computes the changes to the given state distribution that would result from a given action
source code
dict
applyDynamics(self, actions, state, exp=None)
Compute the effect of the given actions on the given state vector
source code
 
getEffect(self, action, key, vector, instantiate=True, debug=False)
Computes the effect of the given action on the given StateKey
source code
 
applyChanges(self, delta, current=None)
Applies the differential changes to this set of entities
source code
 
explainAction(self, actions) source code
 
__xml__(self, dynamics=False) source code
bool
parse(self, element, agentClass=<class teamwork.agent.lightweight.PWLAgent at 0x17f5e40>, societyClass=None)
Returns: False iff unable to load a specified society file
source code

Inherited from Multiagent.MultiagentSystem: __str__, addMember, getMember, members, save

Inherited from dict: __cmp__, __contains__, __delitem__, __eq__, __ge__, __getattribute__, __getitem__, __gt__, __hash__, __iter__, __le__, __len__, __lt__, __ne__, __new__, __repr__, __setitem__, clear, copy, fromkeys, get, has_key, items, iteritems, iterkeys, itervalues, keys, pop, popitem, setdefault, update, values

Inherited from object: __delattr__, __reduce__, __reduce_ex__, __setattr__

Instance Variables [hide private]
str societyFile
the location of the GenericSociety
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, agents=None, observable=False)
(Constructor)

source code 

Initializes a collection to contain the given list of agents

Parameters:
  • agents - the fully-specified agents
  • observable (bool) - iff True, agents always maintain correct beliefs about the world
  • effects (ActionStateKey[]) - a table of features that actions affect, indexed by action, with each value being a list of keys
Returns:
new empty dictionary

Overrides: object.__init__

initialize(self)

source code 

Do any necessary preparation before doing whatever

Overrides: Multiagent.MultiagentSystem.initialize
(inherited documentation)

microstep(self, turns, hypothetical=False, explain=False, state=None, suggest=False)

source code 

Step forward by the action of the given entities

Parameters:
  • turns (dict[]) - the agents to act next, each entry in the list should be a dictionary:
    • name: the name of the agent to act
    • choices: the list of possible options this agent can consider in this turn (defaults to the list of all possible actions if omitted, or if the list is empty)
    • history: a dictionary of actions already performed (defaults to the built-in history of this simulation instance)
  • hypothetical (bool) - if True, then this is only a hypothetical microstep; otherwise, it is real (default is False)
  • explain (bool) - if True, then add an explanation to the result (default is False)
  • suggest (bool) - this is ignored
Returns: Element
XML results

hypotheticalAct(self, actions, exp=None, state=None)

source code 

Computes the scenario changes that would result from a given action

Parameters:
  • actions (dict:str->Action[]) - dictionary of actions, where each entry is a list of Action instances, indexed by the name of the actor
  • exp (Document) - an optional partial explanation to expand upon
Returns: dict
the changes that would result from actions

getState(self)

source code 
Returns: dict
a dictionary of 'state' and relationships of the current simulation state

getDelta(self, actions, state, exp=None)

source code 

Computes the changes to the given state distribution that would result from a given action

Parameters:
  • actions (dict:str->Action[]) - dictionary of actions, where each entry is a list of Action instances, indexed by the name of the actor
  • state (Distribution(KeyedMatrix)) - the initial state
  • exp (Document) - an optional partial explanation to expand upon

applyDynamics(self, actions, state, exp=None)

source code 

Compute the effect of the given actions on the given state vector

Parameters:
Returns: dict

getEffect(self, action, key, vector, instantiate=True, debug=False)

source code 

Computes the effect of the given action on the given StateKey

Returns:
the dynamics object, and possible a computed delta

__xml__(self, dynamics=False)

source code 
Parameters:
  • dynamcis - if True, instantiated dynamics are stored as well (default is False
  • dynamics (bool)
Overrides: Multiagent.MultiagentSystem.__xml__

parse(self, element, agentClass=<class teamwork.agent.lightweight.PWLAgent at 0x17f5e40>, societyClass=None)

source code 
Returns: bool
False iff unable to load a specified society file
Overrides: Multiagent.MultiagentSystem.parse