Package teamwork :: Package action :: Module DecisionSpace
[hide private]
[frames] | no frames]

Module DecisionSpace

source code

Class for using AND-(X)OR trees to define the space of possible actions that an agent has available

Classes [hide private]
  DecisionSpace
Space of possible options that an agent may have Each option is assumed to be a dictionary-type object.
  ORSpace
Space of possible options expressed as a disjunction of all possible values
  XORSpace
Space of possible options expressed as XOR tree
  AndSpace
Space of possible options expressed as AND tree
Functions [hide private]
 
parseSpace(element)
Extracts a DecisionSpace instance from an XML specification.
source code
DecisionSpace
extractSpace(spec)
Returns a DecisionSpace object from the given dictionary specification
source code
Variables [hide private]
  _spacesByType = {None: DecisionSpace, 'XOR': XORSpace, 'AND': ...
  EMPTY_NAMESPACE = None
  EMPTY_PREFIX = None
  StringTypes = (<type 'str'>, <type 'unicode'>)
  XMLNS_NAMESPACE = 'http://www.w3.org/2000/xmlns/'
Function Details [hide private]

parseSpace(element)

source code 

Extracts a DecisionSpace instance from an XML specification. In reality, this just identifies the correct DecisionSpace subclass and then invokes the appropriate parse method

Parameters:
  • element - XML element (i.e., <decisions ...>...)
Returns:
DecisionSpace

extractSpace(spec)

source code 

Returns a DecisionSpace object from the given dictionary specification

Parameters:
  • spec - The dictionary should be structured as follows:
    • type: either None, 'XOR', 'OR', or 'AND',
    • base: a dictionary specification of a DecisionSpace object (optional)
    • key: key argument used for constructor (defaults to None)
    • values: values argument use for constructor (optional)
Returns: DecisionSpace
The DecisionSpace object represented by the spec

Variables Details [hide private]

_spacesByType

Value:
{None: DecisionSpace, 'XOR': XORSpace, 'AND': AndSpace, 'OR': ORSpace,\
}