1 from teamwork.math.ProbabilityTree import *
2 from teamwork.math.KeyedMatrix import *
3 from teamwork.dynamics.pwlDynamics import *
4 from teamwork.dynamics.arbitraryDynamics import *
5
6
15
30
31
32
36
38 tree0 = ProbabilityTree(IdentityMatrix(feature))
39 tree1 = ProbabilityTree(IncrementMatrix(feature,keyConstant,delta))
40
41 plane = KeyedPlane(IdentityRow(keys=[{'entity':'actor',
42 'relationship':'equals'}]),0.5)
43
44 tree2 = createBranchTree(plane,tree0,tree1)
45
46 plane = KeyedPlane(IdentityRow(keys=[{'entity':'object',
47 'relationship':'equals'}]),0.5)
48
49 tree3 = createBranchTree(plane,tree2,tree1)
50
51 return {'tree':tree3}
52
53
65
66
71
82
83
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
151 tree1 = ProbabilityTree(IdentityMatrix('conversation-flow-norm'))
152 tree4 = ProbabilityTree(IncrementMatrix('conversation-flow-norm',keyConstant,-.1))
153
154
155
156 if not act in ['greet-init','bye-resp']:
157 weights = {makeStateKey('self','conversation'): 1.}
158 plane = KeyedPlane(KeyedVector(weights),.001)
159 tree2 = createBranchTree(plane,tree4,tree1)
160 else:
161 weights = {makeStateKey('self','conversation'): 1.}
162 plane = KeyedPlane(KeyedVector(weights),.001)
163 tree2 = createBranchTree(plane,tree1,tree4)
164
165
166 plane = KeyedPlane(IdentityRow(keys=[{'entity':'actor',
167 'relationship':'equals'}]),0.5)
168 tree0 = createBranchTree(plane,tree1,tree2)
169
170 return {'tree':tree0}
171
172
174 tree1 = ProbabilityTree(IdentityMatrix('init-norm'))
175
176 tree4 = ProbabilityTree(IncrementMatrix('init-norm',keyConstant,-.1))
177
178
179
180 weights = {}
181 for feature in [\
182 'being-greeted',
183 'being-byed',
184 'being-enquired',
185 'being-informed',
186 'being-enquired-about-granny',
187 ]:
188 key = makeStateKey('self',feature)
189 weights[key] = 1
190
191 plane = KeyedPlane(KeyedVector(weights),.001)
192
193 tree5 = createBranchTree(plane,tree1,tree4)
194
195 plane = KeyedPlane(IdentityRow(keys=[{'entity':'actor',
196 'relationship':'equals'}]),0.5)
197 tree0 = createBranchTree(plane,tree1,tree5)
198
199 return {'tree':tree0}
200
201
203 tree0 = ProbabilityTree(IdentityMatrix('resp-norm'))
204
205 tree4 = ProbabilityTree(IncrementMatrix('resp-norm',keyConstant,-.1))
206 tree3 = ProbabilityTree(IdentityMatrix('resp-norm'))
207
208
209
210 if act == 'inform':
211 varname = 'being-enquired'
212 elif act in ['accept','reject']:
213 varname = 'being-requested'
214 elif act in ['OK']:
215 varname = 'being-informed'
216 elif act == 'enquiry-about-granny':
217 varname = 'being-enquired-about-granny'
218 else:
219 varname = 'being-'+act
220 if act[len(act)-1] == 'e':
221 varname += 'd'
222 else:
223 varname += 'ed'
224
225 weights = {makeStateKey('self',varname):1.}
226 plane = KeyedPlane(KeyedVector(weights),.001)
227 tree2 = createBranchTree(plane,tree4,tree3)
228
229 plane = KeyedPlane(IdentityRow(keys=[{'entity':'actor',
230 'relationship':'equals'}]),0.5)
231 tree1 = createBranchTree(plane,tree0,tree2)
232
233 return {'tree':tree1}
234
236 tree0 = ProbabilityTree(IdentityMatrix('makeResp-norm'))
237
238 tree4 = ProbabilityTree(IdentityMatrix('makeResp-norm'))
239 tree3 = ProbabilityTree(IncrementMatrix('makeResp-norm',keyConstant,.1))
240
241
242
243 if act == 'inform':
244 varname = 'being-enquired'
245 elif act in ['accept','reject']:
246 varname = 'being-requested'
247 elif act in ['OK']:
248 varname = 'being-informed'
249 elif act == 'enquiry-about-granny':
250 varname = 'being-enquired-about-granny'
251 else:
252 varname = 'being-'+act
253 if act[len(act)-1] == 'e':
254 varname += 'd'
255 else:
256 varname += 'ed'
257
258 weights = {makeStateKey('self',varname):1.}
259 plane = KeyedPlane(KeyedVector(weights),.001)
260 tree2 = createBranchTree(plane,tree4,tree3)
261
262 plane = KeyedPlane(IdentityRow(keys=[{'entity':'actor',
263 'relationship':'equals'}]),0.5)
264 tree1 = createBranchTree(plane,tree0,tree2)
265
266
267 return {'tree':tree1}
268
269
271
272 if act == 'enquiry':
273 varname = 'being-enquired'
274 elif act == 'inform-info':
275 varname = 'being-informed'
276 elif act == 'enquiry-about-granny':
277 varname = 'being-enquired-about-granny'
278 else:
279 varname = 'being-'+act
280 if act[len(act)-1] == 'e':
281 varname += 'd'
282 else:
283 varname += 'ed'
284 tree0 = ProbabilityTree(IdentityMatrix(varname))
285 tree3 = ProbabilityTree(SetToConstantMatrix(source=varname,value=1))
286
287 plane = KeyedPlane(IdentityRow(keys=[{'entity':'object',
288 'relationship':'equals'}]),0.5)
289
290 tree1 = createBranchTree(plane,tree0,tree3)
291
292 return {'tree':tree1}
293
294
296
297 if act == 'inform':
298 varname = 'being-enquired'
299 elif act in ['accept','reject']:
300 varname = 'being-requested'
301 elif act in ['OK']:
302 varname = 'being-informed'
303 elif act == 'enquiry-about-granny':
304 varname = 'being-enquired-about-granny'
305 else:
306 varname = 'being-'+act
307 if act[len(act)-1] == 'e':
308 varname += 'd'
309 else:
310 varname += 'ed'
311 tree0 = ProbabilityTree(IdentityMatrix(varname))
312 tree3 = ProbabilityTree(IncrementMatrix(varname,keyConstant,-1))
313
314 weights = {makeStateKey('self',varname):1.}
315 plane = KeyedPlane(KeyedVector(weights),.1)
316 tree2 = createBranchTree(plane,tree0,tree3)
317
318 plane = KeyedPlane(IdentityRow(keys=[{'entity':'actor',
319 'relationship':'equals'}]),0.5)
320
321 tree1 = createBranchTree(plane,tree0,tree2)
322 return {'tree':tree1}
323
325 tree0 = ProbabilityTree(IdentityMatrix('conversation'))
326 if intend == 'greet':
327 tree1 = ProbabilityTree(SetToConstantMatrix(source='conversation',value=1))
328 elif intend == 'bye':
329 tree1 = ProbabilityTree(SetToConstantMatrix(source='conversation',value=0))
330
331 plane = KeyedPlane(IdentityRow(keys=[{'entity':'actor',
332 'relationship':'equals'}]),0.5)
333
334 tree2 = createBranchTree(plane,tree0,tree1)
335
336 plane = KeyedPlane(IdentityRow(keys=[{'entity':'object',
337 'relationship':'equals'}]),0.5)
338
339 tree3 = createBranchTree(plane,tree2,tree1)
340
341 return {'tree':tree3}
342
353
367
368
369
370
371
372
373
374
375
376
377
378
379
380
391
393 tree0 = ProbabilityTree(IdentityMatrix('full'))
394 tree1 = ProbabilityTree(IncrementMatrix('full',keyConstant,.5))
395
396 weights = {makeStateKey('actor','full'):1.}
397 plane = KeyedPlane(KeyedVector(weights),.9)
398 tree2 = createBranchTree(plane,tree1,tree0)
399
400 plane = KeyedPlane(IdentityRow(keys=[{'entity':'actor',
401 'relationship':'equals'}]),0.5)
402
403 tree3 = createBranchTree(plane,tree0,tree2)
404
405 return {'tree':tree3}
406
408 tree0 = ProbabilityTree(IdentityMatrix('full'))
409 tree1 = ProbabilityTree(IncrementMatrix('full',keyConstant,.2))
410
411 weights = {makeStateKey('object','full'):1.}
412 plane = KeyedPlane(KeyedVector(weights),.9)
413 tree2 = createBranchTree(plane,tree1,tree0)
414
415 plane = KeyedPlane(IdentityRow(keys=[{'entity':'object',
416 'relationship':'equals'}]),0.5)
417
418 tree3 = createBranchTree(plane,tree0,tree2)
419
420 return {'tree':tree3}
421
422
424 tree0 = ProbabilityTree(IdentityMatrix('has-cake'))
425 tree1 = ProbabilityTree(SetToConstantMatrix(source='has-cake',value=1))
426 tree2 = ProbabilityTree(SetToConstantMatrix(source='has-cake',value=0))
427
428 plane = KeyedPlane(IdentityRow(keys=[{'entity':'object',
429 'relationship':'equals'}]),0.5)
430
431 tree3 = createBranchTree(plane,tree0,tree1)
432
433 plane = KeyedPlane(IdentityRow(keys=[{'entity':'actor',
434 'relationship':'equals'}]),0.5)
435
436 tree4 = createBranchTree(plane,tree3,tree2)
437
438 return {'tree':tree4}
439
440
451
452
454 if dis == 1:
455 val1=.1
456 val2=-.1
457 else:
458 val1=.2
459 val2=-.2
460
461 tree0 = ProbabilityTree(IdentityMatrix('location'))
462 tree1 = ProbabilityTree(IncrementMatrix('location',keyConstant,val1))
463 tree2 = ProbabilityTree(IncrementMatrix('location',keyConstant,val2))
464
465 weights = {makeStateKey('actor','location'):1.}
466 plane = KeyedPlane(KeyedVector(weights),.9)
467 tree3 = createBranchTree(plane,tree1,tree2)
468
469 plane = KeyedPlane(IdentityRow(keys=[{'entity':'actor',
470 'relationship':'equals'}]),0.5)
471
472 tree4 = createBranchTree(plane,tree0,tree3)
473 return {'tree':tree4}
474
475
487
488
490
491 tree0 = ProbabilityTree(IdentityMatrix('sameLocation'))
492 tree1 = ProbabilityTree(IncrementMatrix('sameLocation',keyConstant,-.1))
493
494
495 plane = KeyedPlane(DifferenceRow(keys=[makeStateKey('actor','location'),makeStateKey('object','location')]),0.001)
496
497 tree2 = createBranchTree(plane,tree0,tree1)
498
499 plane = KeyedPlane(DifferenceRow(keys=[makeStateKey('object','location'),makeStateKey('actor','location')]),0.001)
500
501 tree3 = createBranchTree(plane,tree2,tree1)
502
503
504 plane = KeyedPlane(IdentityRow(keys=[{'entity':'actor',
505 'relationship':'equals'}]),0.5)
506
507 tree4 = createBranchTree(plane,tree0,tree3)
508
509 return {'tree':tree4}
510
512
513 tree0 = ProbabilityTree(IdentityMatrix('actAlive'))
514 tree1 = ProbabilityTree(IncrementMatrix('actAlive',keyConstant,-.1))
515
516 weights = {makeStateKey('actor','alive'):1.}
517 plane = KeyedPlane(KeyedVector(weights),.001)
518
519 tree2 = createBranchTree(plane,tree1,tree0)
520
521 weights = {makeStateKey('object','alive'):1.}
522 plane = KeyedPlane(KeyedVector(weights),.001)
523
524 tree3 = createBranchTree(plane,tree1,tree2)
525
526
527 plane = KeyedPlane(IdentityRow(keys=[{'entity':'actor',
528 'relationship':'equals'}]),0.5)
529
530 tree4 = createBranchTree(plane,tree0,tree3)
531
532 return {'tree':tree4}
533
534
536
537 tree0 = ProbabilityTree(IdentityMatrix('actAlive'))
538 tree1 = ProbabilityTree(IncrementMatrix('actAlive',keyConstant,-.1))
539
540 weights = {makeStateKey('actor','alive'):1.}
541 plane = KeyedPlane(KeyedVector(weights),.001)
542
543 tree2 = createBranchTree(plane,tree1,tree0)
544
545 plane = KeyedPlane(IdentityRow(keys=[{'entity':'actor',
546 'relationship':'equals'}]),0.5)
547
548 tree4 = createBranchTree(plane,tree0,tree2)
549
550 return {'tree':tree4}
551
553
554 tree0 = ProbabilityTree(IdentityMatrix('actAlive'))
555 tree1 = ProbabilityTree(IncrementMatrix('actAlive',keyConstant,-.1))
556
557 weights = {makeStateKey('actor','alive'):1.}
558 plane = KeyedPlane(KeyedVector(weights),.001)
559
560 tree2 = createBranchTree(plane,tree1,tree0)
561
562 weights = {makeStateKey('object','alive'):1.}
563 plane = KeyedPlane(KeyedVector(weights),.001)
564
565 tree3 = createBranchTree(plane,tree2,tree1)
566
567
568 plane = KeyedPlane(IdentityRow(keys=[{'entity':'actor',
569 'relationship':'equals'}]),0.5)
570
571 tree4 = createBranchTree(plane,tree0,tree3)
572
573 return {'tree':tree4}
574
575
577
578 tree0 = ProbabilityTree(IdentityMatrix('actAlive'))
579 tree1 = ProbabilityTree(IncrementMatrix('actAlive',keyConstant,-.1))
580
581 weights = {makeStateKey('actor','alive'):1.}
582 plane = KeyedPlane(KeyedVector(weights),.001)
583
584 tree2 = createBranchTree(plane,tree0,tree1)
585
586 weights = {makeStateKey('object','alive'):1.}
587 plane = KeyedPlane(KeyedVector(weights),.001)
588
589 tree3 = createBranchTree(plane,tree2,tree1)
590
591
592 plane = KeyedPlane(IdentityRow(keys=[{'entity':'actor',
593 'relationship':'equals'}]),0.5)
594
595 tree4 = createBranchTree(plane,tree0,tree3)
596
597 return {'tree':tree4}
598
600 tree0 = ProbabilityTree(IdentityMatrix('specialRule'))
601 tree1 = ProbabilityTree(IncrementMatrix('specialRule',keyConstant,-.1))
602
603
604 weights = {makeStateKey('actor','know-granny'):1.}
605 plane = KeyedPlane(KeyedVector(weights),0)
606
607 tree5 = createBranchTree(plane,tree1,tree0)
608
609 plane = KeyedPlane(ClassRow(keys=[{'entity':'object','value':'granny'}]),0)
610
611 tree6 = createBranchTree(plane,tree0,tree5)
612
613
614
615 weights = {makeStateKey('actor','location'):1.}
616 plane = KeyedPlane(KeyedVector(weights),0)
617
618 tree2 = createBranchTree(plane,tree1,tree6)
619
620 weights = {makeStateKey('actor','location'):1.}
621 plane = KeyedPlane(KeyedVector(weights),-.9)
622
623 tree3 = createBranchTree(plane,tree0,tree2)
624
625
626
627 weights = {makeStateKey('actor','identity'):1.}
628 plane = KeyedPlane(KeyedVector(weights),0)
629
630 tree7 = createBranchTree(plane,tree3,tree1)
631
632
633
634 weights = {makeStateKey('actor','full'):1.}
635 plane = KeyedPlane(KeyedVector(weights),0.9)
636
637 tree8 = createBranchTree(plane,tree7,tree1)
638
639
640 plane = KeyedPlane(IdentityRow(keys=[{'entity':'actor',
641 'relationship':'equals'}]),0.5)
642
643 tree4 = createBranchTree(plane,tree0,tree8)
644
645 return {'tree':tree4}
646
647
649 tree0 = ProbabilityTree(IdentityMatrix('preferWait'))
650 tree2 = ProbabilityTree(IncrementMatrix('preferWait',keyConstant,.1))
651
652 weights = {makeStateKey('self','full'):1.}
653 plane = KeyedPlane(KeyedVector(weights),.8)
654
655 tree4 = createBranchTree(plane,tree0,tree2)
656
657 plane = KeyedPlane(IdentityRow(keys=[{'entity':'actor',
658 'relationship':'equals'}]),0.5)
659
660 tree3 = createBranchTree(plane,tree0,tree4)
661
662 return {'tree':tree3}
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
691
692 tree0 = ProbabilityTree(IdentityMatrix('noRepeat-norm'))
693 tree1 = ProbabilityTree(IncrementMatrix('noRepeat-norm',keyConstant,-.1))
694
695
696 weights = {makeStateKey('actor',feature):1.}
697 plane = KeyedPlane(KeyedVector(weights),0)
698 tree3 = createBranchTree(plane,tree0,tree1)
699
700 plane = KeyedPlane(IdentityRow(keys=[{'entity':'actor',
701 'relationship':'equals'}]),0.5)
702
703 tree4 = createBranchTree(plane,tree0,tree3)
704 return {'tree':tree4}
705
706
708
709 tree0 = ProbabilityTree(IdentityMatrix('specialRule'))
710 tree1 = ProbabilityTree(IncrementMatrix('specialRule',keyConstant,-.1))
711
712
713 weights = {makeStateKey('actor','know-granny'):1.}
714 plane = KeyedPlane(KeyedVector(weights),0)
715 tree3 = createBranchTree(plane,tree0,tree1)
716
717 plane = KeyedPlane(IdentityRow(keys=[{'entity':'actor',
718 'relationship':'equals'}]),0.5)
719
720 tree4 = createBranchTree(plane,tree0,tree3)
721 return {'tree':tree4}
722
723
725
726 tree0 = ProbabilityTree(IdentityMatrix('specialRule'))
727 tree1 = ProbabilityTree(IncrementMatrix('specialRule',keyConstant,-.1))
728
729
730 weights = {makeStateKey('actor','has-cake'):1.}
731 plane = KeyedPlane(KeyedVector(weights),.5)
732 tree3 = createBranchTree(plane,tree1,tree0)
733
734 plane = KeyedPlane(IdentityRow(keys=[{'entity':'actor',
735 'relationship':'equals'}]),0.5)
736
737 tree4 = createBranchTree(plane,tree0,tree3)
738 return {'tree':tree4}
739
740
742 tree0 = ProbabilityTree(IdentityMatrix(feature))
743 tree1 = ProbabilityTree(IncrementMatrix(feature,keyConstant,.05))
744
745 name = feature.strip('SDwith')
746 if name == 'Wolf':
747 name = 'wolf'
748
749 plane = KeyedPlane(ClassRow(keys=[{'entity':'object','value':name}]),0)
750
751 tree3 = createBranchTree(plane,tree0,tree1)
752
753 plane = KeyedPlane(ClassRow(keys=[{'entity':'actor','value':name}]),0)
754
755 tree2 = createBranchTree(plane,tree0,tree1)
756
757 plane = KeyedPlane(IdentityRow(keys=[{'entity':'object',
758 'relationship':'equals'}]),0.5)
759
760 tree5 = createBranchTree(plane,tree0,tree2)
761
762 plane = KeyedPlane(IdentityRow(keys=[{'entity':'actor',
763 'relationship':'equals'}]),0.5)
764
765 tree4 = createBranchTree(plane,tree5,tree3)
766 return {'tree':tree4}
767
768
770 tree0 = ProbabilityTree(IdentityMatrix('SDnorm'))
771 tree1 = ProbabilityTree(IncrementMatrix('SDnorm',keyConstant,-.1))
772
773
774 weights = {makeStateKey('object','SDwithWolf'):1.}
775 plane = KeyedPlane(KeyedVector(weights),0)
776 tree3 = createBranchTree(plane,tree1,tree0)
777
778 plane = KeyedPlane(IdentityRow(keys=[{'entity':'actor',
779 'relationship':'equals'}]),0.5)
780
781 tree4 = createBranchTree(plane,tree0,tree3)
782 return {'tree':tree4}
783
784
785 DynFun = {
786 'noneDyn': {},
787 'basicDyn': {
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810 'resp-norm':{\
811 'greet-resp':{'class':PWLDynamics,
812 'args':RespNorm('greet')},
813
814 'bye-resp':{'class':PWLDynamics,
815 'args':RespNorm('bye')},
816
817 'inform':{'class':PWLDynamics,
818 'args':RespNorm('inform')},
819
820 'inform-about-granny':{'class':PWLDynamics,
821 'args':RespNorm('enquiry-about-granny')},
822
823 },
824 'makeResp-norm':{\
825 'greet-resp':{'class':PWLDynamics,
826 'args':MakeRespNorm('greet')},
827
828 'bye-resp':{'class':PWLDynamics,
829 'args':MakeRespNorm('bye')},
830
831 'inform':{'class':PWLDynamics,
832 'args':MakeRespNorm('inform')},
833
834 'inform-about-granny':{'class':PWLDynamics,
835 'args':MakeRespNorm('enquiry-about-granny')},
836
837 },
838 'init-norm':{'greet-init':{'class':PWLDynamics,
839 'args':InitNorm()},
840
841 'bye-init':{'class':PWLDynamics,
842 'args':InitNorm()},
843
844 'enquiry':{'class':PWLDynamics,
845 'args':InitNorm()},
846
847 'enquiry-about-granny':{'class':PWLDynamics,
848 'args':InitNorm()},
849
850 'tell-about-granny':{'class':PWLDynamics,
851 'args':InitNorm()},
852 'move1':{'class':PWLDynamics,
853 'args':InitNorm()},
854 'move2':{'class':PWLDynamics,
855 'args':InitNorm()},
856 'wait':{'class':PWLDynamics,
857 'args':InitNorm()},
858
859 },
860
861 'conversation-flow-norm':{'greet-init':{'class':PWLDynamics,
862 'args':conversationFlowNorm('greet-init')},
863 'greet-resp':{'class':PWLDynamics,
864 'args':conversationFlowNorm('greet')},
865 'bye-init':{'class':PWLDynamics,
866 'args':conversationFlowNorm('bye-init')},
867 'bye-resp':{'class':PWLDynamics,
868 'args':conversationFlowNorm('bye-resp')},
869 'enquiry':{'class':PWLDynamics,
870 'args':conversationFlowNorm('enquiry')},
871 'inform':{'class':PWLDynamics,
872 'args':conversationFlowNorm('inform')},
873 'inform-info':{'class':PWLDynamics,
874 'args':conversationFlowNorm('inform-info')},
875 'OK':{'class':PWLDynamics,
876 'args':conversationFlowNorm('OK')},
877 'enquiry-about-granny':{'class':PWLDynamics,
878 'args':conversationFlowNorm('enquiry-about-granny')},
879 'inform-about-granny':{'class':PWLDynamics,
880 'args':conversationFlowNorm('enquiry-about-granny')},
881 'tell-about-granny':{'class':PWLDynamics,
882 'args':conversationFlowNorm('enquiry-about-granny')},
883
884 },
885
886 'noRepeat-norm':{\
887
888
889 'tell-about-granny':{'class':PWLDynamics,
890 'args':noRepeatDyn('told-about-granny')},
891 'give-cake':{'class':PWLDynamics,
892 'args':noRepeatDyn('given-cake')},
893 'greet-init':{'class':PWLDynamics,
894 'args':noRepeatDyn('greeted')},
895 'bye-init':{'class':PWLDynamics,
896 'args':noRepeatDyn('byed')},
897 },
898
899
900
901 'greeted':{'greet-init':{'class':PWLDynamics,
902 'args':deltaActorOrObjectDyn('greeted', 1)},
903 'greet-resp':{'class':PWLDynamics,
904 'args':deltaActorOrObjectDyn('greeted', 1)},
905 'bye-init':{'class':PWLDynamics,
906 'args':deltaActorOrObjectDyn('greeted', 1)},
907 'bye-resp':{'class':PWLDynamics,
908 'args':deltaActorOrObjectDyn('greeted', 1)},
909 'enquiry':{'class':PWLDynamics,
910 'args':deltaActorOrObjectDyn('greeted', 1)},
911 'inform':{'class':PWLDynamics,
912 'args':deltaActorOrObjectDyn('greeted', 1)},
913 'enquiry-about-granny':{'class':PWLDynamics,
914 'args':deltaActorOrObjectDyn('greeted', 1)},
915 'inform-about-granny':{'class':PWLDynamics,
916 'args':deltaActorOrObjectDyn('greeted', 1)},
917 'tell-about-granny':{'class':PWLDynamics,
918 'args':deltaActorOrObjectDyn('greeted', 1)},
919 },
920
921 'byed':{'bye-init':{'class':PWLDynamics,
922 'args':deltaActorOrObjectDyn('byed', 1)},
923 'bye-resp':{'class':PWLDynamics,
924 'args':deltaActorOrObjectDyn('byed', 1)},
925 },
926
927 'enquired':{'enquiry':{'class':PWLDynamics,
928 'args':deltaActorDyn('enquired', 1)},
929 },
930
931 'given-cake':{'give-cake':{'class':PWLDynamics,
932 'args':deltaActorDyn('given-cake', 1)},
933 },
934 'told-about-granny':{'tell-about-granny':{'class':PWLDynamics,
935 'args':deltaActorDyn('told-about-granny', 1)},
936 'inform-about-granny':{'class':PWLDynamics,
937 'args':deltaActorDyn('told-about-granny', 1)},
938 },
939
940 'being-greeted':{'greet-init':{'class':PWLDynamics,
941 'args':IntendImposeNorm('greet')},
942 'greet-resp':{'class':PWLDynamics,
943 'args':IntendFinishNorm('greet')},
944 },
945 'being-byed':{'bye-init':{'class':PWLDynamics,
946 'args':IntendImposeNorm('bye')},
947 'bye-resp':{'class':PWLDynamics,
948 'args':IntendFinishNorm('bye')},
949 },
950
951 'being-enquired':{'enquiry':{'class':PWLDynamics,
952 'args':IntendImposeNorm('enquiry')},
953 'inform':{'class':PWLDynamics,
954 'args':IntendFinishNorm('inform')},
955 },
956 'being-informed':{'inform-info':{'class':PWLDynamics,
957 'args':IntendImposeNorm('inform-info')},
958 'OK':{'class':PWLDynamics,
959 'args':IntendFinishNorm('OK')},
960 },
961
962 'conversation':{\
963 'eat':{'class':PWLDynamics,
964 'args':conversationDyn('bye')},
965
966 'kill':{'class':PWLDynamics,
967 'args':conversationDyn('bye')},
968
969 'escape':{'class':PWLDynamics,
970 'args':dummyDyn('conversation')},
971
972 'resurrect':{'class':PWLDynamics,
973 'args':dummyDyn('conversation')},
974
975 'wait':{'class':PWLDynamics,
976 'args':dummyDyn('conversation')},
977 'move1':{'class':PWLDynamics,
978 'args':conversationDyn('bye')},
979 'move2':{'class':PWLDynamics,
980 'args':conversationDyn('bye')},
981
982 'bye-resp':{'class':PWLDynamics,
983 'args':dummyDyn('conversation')},
984 'give-cake':{'class':PWLDynamics,
985 'args':dummyDyn('conversation')},
986
987 None:{'class':PWLDynamics,
988 'args':conversationDyn('greet')},
989 'bye-init':{'class':PWLDynamics,
990 'args':conversationDyn('bye')},
991 },
992
993 },
994 'RedDyn': {
995 'alive':{\
996 'hunter-kill-wolf':{'class':PWLDynamics,
997 'args':aliveDyn()},
998 'fairy-kill-wolf':{'class':PWLDynamics,
999 'args':aliveDyn()},
1000 'red-kill-wolf':{'class':PWLDynamics,
1001 'args':aliveProbDyn()},
1002 'eat':{'class':PWLDynamics,
1003 'args':aliveDyn()},
1004 'escape':{'class':PWLDynamics,
1005 'args':escapeDyn()},
1006 'resurrect':{'class':PWLDynamics,
1007 'args':ObjectSetDyn('alive',1.0)},
1008 },
1009 'full':{'eat':{'class':PWLDynamics,
1010 'args':eatFullDyn()},
1011 'give-cake':{'class':PWLDynamics,
1012 'args':eatCakeFullDyn()},
1013 },
1014
1015
1016
1017 'has-cake':{'give-cake':{'class':PWLDynamics,
1018 'args':cakeDyn()},
1019 },
1020 'location':{\
1021 'move1':{'class':PWLDynamics,
1022 'args':moveDyn(1)},
1023 'move2':{'class':PWLDynamics,
1024 'args':moveDyn(2)},
1025 },
1026 'know-granny':{\
1027 'tell-about-granny':{'class':PWLDynamics,
1028 'args':knowPersonDyn('know-granny')},
1029 'inform-about-granny':{'class':PWLDynamics,
1030 'args':knowPersonDyn('know-granny')},
1031 },
1032 'likeMove':{'move1':{'class':PWLDynamics,
1033 'args':likeActDyn('likeMove')},
1034 'move2':{'class':PWLDynamics,
1035 'args':likeActDyn('likeMove')},
1036
1037 },
1038 'likeTalk':{'greet-init':{'class':PWLDynamics,
1039 'args':likeActDyn('likeTalk')},
1040 'greet-resp':{'class':PWLDynamics,
1041 'args':likeActDyn('likeTalk')},
1042 'bye-init':{'class':PWLDynamics,
1043 'args':likeActDyn('likeTalk')},
1044 'bye-resp':{'class':PWLDynamics,
1045 'args':likeActDyn('likeTalk')},
1046 'tell-about-granny':{'class':PWLDynamics,
1047 'args':likeActDyn('likeTalk')},
1048 'inform-about-granny':{'class':PWLDynamics,
1049 'args':likeActDyn('likeTalk')},
1050 'inform':{'class':PWLDynamics,
1051 'args':likeActDyn('likeTalk')},
1052 'enquiry':{'class':PWLDynamics,
1053 'args':likeActDyn('likeTalk')},
1054 'inform-about-granny':{'class':PWLDynamics,
1055 'args':likeActDyn('likeTalk')},
1056 'enquiry-about-granny':{'class':PWLDynamics,
1057 'args':likeActDyn('likeTalk')},
1058 },
1059 'sameLocation':{'wait':{'class':PWLDynamics,
1060 'args':dummyDyn('sameLocation')},
1061 'move1':{'class':PWLDynamics,
1062 'args':dummyDyn('sameLocation')},
1063 'move2':{'class':PWLDynamics,
1064 'args':dummyDyn('sameLocation')},
1065 'changeIdentity':{'class':PWLDynamics,
1066 'args':dummyDyn('sameLocation')},
1067 None:{'class':PWLDynamics,
1068 'args':locationDyn()},
1069 },
1070 'actAlive':{'wait':{'class':PWLDynamics,
1071 'args':dummyDyn('actAlive')},
1072 'move1':{'class':PWLDynamics,
1073 'args':actActorAliveDyn()},
1074 'move2':{'class':PWLDynamics,
1075 'args':actActorAliveDyn()},
1076 'changeIdentity':{'class':PWLDynamics,
1077 'args':actActorAliveDyn()},
1078 'escape':{'class':PWLDynamics,
1079 'args':actBothNotAliveDyn()},
1080 None:{'class':PWLDynamics,
1081 'args':actBothAliveDyn()},
1082 },
1083 'specialRule':{'eat':{'class':PWLDynamics,
1084 'args':specialRuleEatDyn(),},
1085 'enquiry-about-granny':{'class':PWLDynamics,
1086 'args':specialRuleEnquiryDyn()},
1087 'enquiry':{'class':PWLDynamics,
1088 'args':specialRuleEnquiryDyn()},
1089 'give-cake':{'class':PWLDynamics,
1090 'args':specialRuleCakeDyn()},
1091 },
1092
1093 'preferWait':{'wait':{'class':PWLDynamics,
1094 'args':preferWaitWolfDyn()},
1095 },
1096 'being-enquired-about-granny':{\
1097 'enquiry-about-granny':{'class':PWLDynamics,
1098 'args':thresholdObjectSetDyn('SDwithWolf','being-enquired-about-granny',1)},
1099 'inform-about-granny':{'class':PWLDynamics,
1100 'args':ActorSetDyn('being-enquired-about-granny',0)},
1101 },
1102 'SDwithWolf':{None:{'class':PWLDynamics,
1103 'args':SDDyn('SDwithWolf')},
1104 'wait':{'class':PWLDynamics,
1105 'args':dummyDyn('SDwithWolf')},
1106 'move1':{'class':PWLDynamics,
1107 'args':dummyDyn('SDwithWolf')},
1108 'move2':{'class':PWLDynamics,
1109 'args':dummyDyn('SDwithWolf')},
1110 'escape':{'class':PWLDynamics,
1111 'args':dummyDyn('SDwithWolf')},
1112 'enquiry-about-granny':{'class':PWLDynamics,
1113 'args':thresholdDecrease('SDwithWolf')},
1114 },
1115 'SDnorm':{'enquiry-about-granny':{'class':PWLDynamics,
1116 'args':SDnormDyn('enquiry-about-granny')},
1117 },
1118 'identity':{'changeIdentity':{'class':PWLDynamics,
1119 'args':deltaActorDyn('identity',2.0)},
1120 },
1121
1122 }
1123 }
1124