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
11
12
13
15 tree1 = ProbabilityTree(IdentityMatrix('init-norm'))
16
17 tree4 = ProbabilityTree(IncrementMatrix('init-norm',keyConstant,-.1))
18
19
20
21 weights = {}
22 for feature in [\
23 'being-enquired',
24 ]:
25 key = makeStateKey('self',feature)
26 weights[key] = 1
27
28 plane = KeyedPlane(KeyedVector(weights),.001)
29
30 tree5 = createBranchTree(plane,tree1,tree4)
31
32 plane = KeyedPlane(IdentityRow(keys=[{'entity':'actor',
33 'relationship':'equals'}]),0.5)
34 tree0 = createBranchTree(plane,tree1,tree5)
35
36 return {'tree':tree0}
37
38
40 tree0 = ProbabilityTree(IdentityMatrix('resp-norm'))
41
42 tree4 = ProbabilityTree(IncrementMatrix('resp-norm',keyConstant,-.1))
43 tree3 = ProbabilityTree(IdentityMatrix('resp-norm'))
44
45 varname = 'being-enquired'
46
47 weights = {makeStateKey('self',varname):1.}
48 plane = KeyedPlane(KeyedVector(weights),.001)
49 tree2 = createBranchTree(plane,tree4,tree3)
50
51 plane = KeyedPlane(IdentityRow(keys=[{'entity':'actor',
52 'relationship':'equals'}]),0.5)
53 tree1 = createBranchTree(plane,tree0,tree2)
54
55 return {'tree':tree1}
56
57
70
71
73 varname = 'being-enquired'
74 tree0 = ProbabilityTree(IdentityMatrix(varname))
75 tree3 = ProbabilityTree(IncrementMatrix(varname,keyConstant,-1))
76
77 weights = {makeStateKey('self',varname):1.}
78 plane = KeyedPlane(KeyedVector(weights),.1)
79 tree2 = createBranchTree(plane,tree0,tree3)
80
81 plane = KeyedPlane(IdentityRow(keys=[{'entity':'actor',
82 'relationship':'equals'}]),0.5)
83
84 tree1 = createBranchTree(plane,tree0,tree2)
85 return {'tree':tree1}
86
87
88 DynFun = {
89 'noneDyn': {},
90 'basicDyn': {
91 'init-norm':{\
92 'enquiry':{'class':PWLDynamics,
93 'args':InitNorm()},
94 },
95 'resp-norm':{\
96 'pos-inform':{'class':PWLDynamics,
97 'args':RespNorm('inform')},
98 'neu-inform':{'class':PWLDynamics,
99 'args':RespNorm('inform')},
100 'neg-inform':{'class':PWLDynamics,
101 'args':RespNorm('inform')},
102
103 },
104
105 'being-enquired':{'enquiry':{'class':PWLDynamics,
106 'args':IntendImposeNorm('enquiry')},
107 'pos-inform':{'class':PWLDynamics,
108 'args':IntendFinishNorm('inform')},
109 'neu-inform':{'class':PWLDynamics,
110 'args':IntendFinishNorm('inform')},
111 'neg-inform':{'class':PWLDynamics,
112 'args':IntendFinishNorm('inform')},
113 },
114
115 }
116 }
117