1 import copy
2 import sys
3 from teamwork.multiagent.Multiagent import *
4
5 -class Team(MultiagentSystem):
6 """Base class for representing a team of entities"""
7
9 """Generates all possible combined team actions consistent
10 with the specified seed action (generates all possible
11 combined team actions if seed action is left unspecified)"""
12 agentList = []
13 for agent in self.members():
14 if not seedAction.has_key(agent.name):
15 agentList.append(agent)
16 return self.__generateAllActions([seedAction],agentList)
17
29
38
40 """Translates a string into a dictionary of agent:action
41 pairs"""
42 actionList = string.split(actionString)
43 actions = {}
44 for agent in range(len(self.keys())):
45 actions[self.keys()[agent]] = actionList[agent]
46 return actions
47
48
50 """Default method for returning the probability distribution
51 over observations for an individual agent. Returns a uniform
52 distribution. Should be overwritten."""
53 raise NotImplementedError
54
55
57 """Handles the observation function for features that are
58 completely observable. If the observation does not match the
59 true state on the completely observable features, then this
60 function returns 0.0; otherwise, it returns 1.0"""
61 for key in observation.keys():
62 if key[0] != '_' and \
63 self[agent].observations[key] == 'observable':
64 if state[key] != observation[key]:
65 return 0.0
66 else:
67 return 1.0
68