1 __author__ = 'David V. Pynadath <pynadath@isi.edu>'
2 from xml.dom.minidom import *
3
4 from teamwork.agent.Generic import GenericModel
5 from teamwork.agent.Entities import *
6 from teamwork.multiagent.Multiagent import *
7 from teamwork.multiagent.GenericSociety import *
8
9 from ThespianGeneric import *
10 from ThespianAgents import *
11
13
15 """Copies top-level generic values onto nested belief models"""
16 for other in generic.getEntities():
17 entity = generic.getEntity(other)
18 if self.has_key(other):
19
20 toExplore = [other]
21 while len(toExplore) > 0:
22 cls = toExplore.pop()
23 if len(self[cls].models) > 0:
24 entity.models = self[cls].models
25 break
26 toExplore += self[cls].getParents()
27 entity.dynamics = self[other].dynamics
28
29
30 self.__copyGeneric(entity)
31
47
48
49
51 """Returns a new instantiated agent model
52
53 className: The string name of the relevant generic model
54 instanceName: The string name for the new instance
55 objClass: (Optional) Class to create agent object from"""
56 entity = objClass(instanceName)
57 entity.applyDefaults(className,self)
58 return entity
59