1 from teamwork.agent.AgentClasses import *
2 from teamwork.dynamics.pwlDynamics import *
3
4 from ratDynamics import *
5
6
7 classHierarchy['usr'] = {
8 'parent': ['Entity'],
9 'horizon':0,
10 'depth':0,
11 'state':{\
12 'ThespianType':1,
13 'money':1.0,
14
15 'being-requested-to-match':0,
16
17 'resp-norm':0,
18 'init-norm':1,
19 'actAliveNorm':1,
20 'specialRule':1,
21
22 },
23 'actions':{'type':'OR',
24 'values':[{'type':'decision',
25 'value':{'type':'XOR',
26 'key':'type',
27 'values':[\
28 {'type':'literal','value':'request-exercise'},
29 {'type':'literal','value':'request-match'},
30 {'type':'literal','value':'feedV'},
31 {'type':'literal','value':'eshock'},
32 {'type':'literal','value':'accept'},
33 {'type':'literal','value':'reject'},
34 ],
35 'base': {'type':'XOR',
36 'key':'object',
37 'values':[{'type':'literal','value':'labrat1'},
38 {'type':'literal','value':'labrat2'},
39 {'type':'literal','value':'streetrat'},
40 ],
41 },
42 },
43 },
44 {'type':'decision',
45 'value':{'type':'XOR',
46 'key':'type',
47 'values':[\
48 {'type':'literal','value':'buyLR'},
49 ],
50 'base': {'type':'XOR',
51 'key':'object',
52 'values':[{'type':'literal','value':'labrat1'},
53 {'type':'literal','value':'labrat2'},
54 ],
55 },
56 },
57 },
58 {'type':'decision',
59 'value':{'type':'XOR',
60 'key':'type',
61 'values':[\
62 {'type':'literal','value':'catchSR'},
63 ],
64 'base': {'type':'XOR',
65 'key':'object',
66 'values':[{'type':'literal','value':'streetrat'},
67 ],
68 },
69 },
70 },
71 {'type':'decision',
72 'value':{'type':'XOR',
73 'key':'type',
74 'values':[\
75
76 {'type':'literal','value':'wait'},
77 ],
78 },
79 },]
80 },
81
82 'dynamics':[DynFun['basicDyn'],DynFun['usrDyn']],
83 'goals':[{'entity': ['self'],
84 'direction': 'max',
85 'type': 'state',
86 'key': 'resp-norm',
87 'weight': 1000},
88
89 {'entity': ['self'],
90 'direction': 'max',
91 'type': 'state',
92 'key': 'init-norm',
93 'weight': 10},
94
95 {'entity': ['self'],
96 'direction': 'max',
97 'type': 'state',
98 'key': 'specialRule',
99 'weight': 1000},
100
101 {'entity': ['self'],
102 'direction': 'max',
103 'type': 'state',
104 'key': 'actAliveNorm',
105 'weight': 1000},
106
107 {'entity': ['self'],
108 'direction': 'max',
109 'type': 'state',
110 'key': 'money',
111 'weight': .01},
112
113 {'entity': ['labrat1'],
114 'direction': 'max',
115 'type': 'state',
116 'key': 'health',
117 'weight': 1},
118
119 {'entity': ['labrat2'],
120 'direction': 'max',
121 'type': 'state',
122 'key': 'health',
123 'weight': 1},
124
125 {'entity': ['streetrat'],
126 'direction': 'max',
127 'type': 'state',
128 'key': 'health',
129 'weight': 1},
130
131 {'entity': ['labrat1'],
132 'direction': 'max',
133 'type': 'state',
134 'key': 'SD',
135 'weight': 1},
136
137 {'entity': ['labrat2'],
138 'direction': 'max',
139 'type': 'state',
140 'key': 'SD',
141 'weight': 1},
142
143 {'entity': ['streetrat'],
144 'direction': 'max',
145 'type': 'state',
146 'key': 'SD',
147 'weight': 1},
148
149 {'entity': ['labrat1'],
150 'direction': 'max',
151 'type': 'state',
152 'key': 'ThespianType',
153 'weight': 1},
154
155 {'entity': ['labrat2'],
156 'direction': 'max',
157 'type': 'state',
158 'key': 'ThespianType',
159 'weight': 1},
160
161 {'entity': ['streetrat'],
162 'direction': 'max',
163 'type': 'state',
164 'key': 'ThespianType',
165 'weight': 1},
166
167
168 ]
169 }
170
171
172 classHierarchy['rat'] = {
173 'parent': ['Entity'],
174 'horizon':2,
175 'depth':2,
176 'state':{\
177 'resp-norm':0,
178 'init-norm':1,
179 'commitNorm':1,
180 'actAliveNorm':1,
181 'avoidShock':1,
182
183 'health':.2,
184 'smart':.4,
185 'SD':0,
186 'being-requested-to-exercise':0,
187 'being-requested-to-match':0,
188 'requested-to-match':0,
189 'commit-to-exercise':0,
190 'commit-to-match':0,
191 'force-to-commit':0,
192
193 'like-to-exercise':0,
194 'like-to-match':0,
195
196 'just-matched':0,
197
198 'ThespianType':0,
199 },
200 'goals':[\
201 {'entity': ['self'],
202 'direction': 'max',
203 'type': 'state',
204 'key': 'resp-norm',
205 'weight': 1000},
206
207 {'entity': ['self'],
208 'direction': 'max',
209 'type': 'state',
210 'key': 'init-norm',
211 'weight': 10},
212
213 {'entity': ['self'],
214 'direction': 'max',
215 'type': 'state',
216 'key': 'commitNorm',
217 'weight': 1000},
218
219 {'entity': ['self'],
220 'direction': 'max',
221 'type': 'state',
222 'key': 'avoidShock',
223 'weight': 10},
224
225 {'entity': ['self'],
226 'direction': 'max',
227 'type': 'state',
228 'key': 'actAliveNorm',
229 'weight': 1000},
230
231
232 {'entity': ['self'],
233 'direction': 'max',
234 'type': 'state',
235 'key': 'health',
236 'weight': 1},
237
238 {'entity': ['self'],
239 'direction': 'max',
240 'type': 'state',
241 'key': 'SD',
242 'weight': 1},
243
244 {'entity': ['self'],
245 'direction': 'max',
246 'type': 'state',
247 'key': 'like-to-exercise',
248 'weight': 1},
249
250 {'entity': ['self'],
251 'direction': 'max',
252 'type': 'state',
253 'key': 'like-to-match',
254 'weight': 1},
255
256 ],
257
258 }
259
260
261 classHierarchy['labrat'] = {
262 'parent': ['rat'],
263 'horizon':2,
264 'depth':2,
265 'dynamics':[DynFun['basicDyn'],DynFun['ratDyn'],DynFun['labratDyn']],
266 'actions':{'type':'OR',
267 'values':[{'type':'decision',
268 'value':{'type':'XOR',
269 'key':'type',
270 'values':[\
271 {'type':'literal','value':'accept'},
272 {'type':'literal','value':'reject'},
273 {'type':'literal','value':'request-match'},
274 ],
275 'base': {'type':'XOR',
276 'key':'object',
277 'values':[{'type':'literal','value':'usr'},
278 ],
279 },
280 },
281 },
282 {'type':'decision',
283 'value':{'type':'XOR',
284 'key':'type',
285 'values':[\
286 {'type':'literal','value':'match'},
287 {'type':'literal','value':'exercise'},
288 {'type':'literal','value':'wait'},
289 ],
290 },
291 },]
292 },
293
294 }
295
296
297 classHierarchy['streetrat'] = {
298 'parent': ['rat'],
299 'horizon':2,
300 'depth':2,
301 'dynamics':[DynFun['basicDyn'],DynFun['ratDyn'],DynFun['streetratDyn']],
302 'actions':{'type':'OR',
303 'values':[{'type':'decision',
304 'value':{'type':'XOR',
305 'key':'type',
306 'values':[\
307 {'type':'literal','value':'accept'},
308 {'type':'literal','value':'reject'},
309 {'type':'literal','value':'request-match'},
310 ],
311 'base': {'type':'XOR',
312 'key':'object',
313 'values':[{'type':'literal','value':'usr'},
314 ],
315 },
316 },
317 },
318 {'type':'decision',
319 'value':{'type':'XOR',
320 'key':'type',
321 'values':[\
322 {'type':'literal','value':'bad-mouth'},
323 ],
324 'base': {'type':'XOR',
325 'key':'object',
326 'values':[{'type':'literal','value':'labrat1'},
327 {'type':'literal','value':'labrat2'},
328 ],
329 },
330 },
331 },
332 {'type':'decision',
333 'value':{'type':'XOR',
334 'key':'type',
335 'values':[\
336 {'type':'literal','value':'exercise'},
337 {'type':'literal','value':'match'},
338 {'type':'literal','value':'escape'},
339 {'type':'literal','value':'wait'},
340 ],
341 },
342 },]
343 },
344
345 }
346
347
348 classHierarchy['otherTeam'] = {
349 'parent': ['Entity'],
350 'horizon':0,
351 'depth':1,
352 'state':{\
353 'ThespianType':1,
354 'preferWait':0,
355 'winChance':0,
356
357 'being-requested-for-match-result':0,
358 'resp-norm':0,
359 },
360 'actions':{
361 'type':'XOR',
362 'key':'type',
363 'values':[\
364 {'type':'literal','value':'wait'},
365 {'type':'literal','value':'increasewinChance'},
366 {'type':'literal','value':'decreasewinChance'},
367 {'type':'literal','value':'win'},
368 {'type':'literal','value':'lose'},
369 ],
370
371 },
372
373 'dynamics':[DynFun['basicDyn'],],
374 'goals':[\
375 {'entity': ['self'],
376 'direction': 'max',
377 'type': 'state',
378 'key': 'preferWait',
379 'weight': 1},
380 {'entity': ['self'],
381 'direction': 'max',
382 'type': 'state',
383 'key': 'resp-norm',
384 'weight': 1000},
385 ]
386 }
387
388
389 classHierarchy['timer'] = {
390 'parent': ['Entity'],
391 'horizon':1,
392 'depth':1,
393 'state':{\
394 'ThespianType':1,
395 'specialRule':1,
396 'time':4,
397 'day':0,
398 },
399 'actions':{'type':'XOR',
400 'key':'type',
401 'values':[\
402 {'type':'literal','value':'wait'},
403 {'type':'literal','value':'daypass'},
404 ],
405 },
406 'dynamics':[DynFun['timerDyn'],],
407 'goals':[\
408 {'entity': ['self'],
409 'direction': 'max',
410 'type': 'state',
411 'key': 'specialRule',
412 'weight': 1},
413 ]
414 }
415