blob: 13124945b5960278667c206d6a87a94c3543b543 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#!/usr/bin/env python3
"""
Testing a simple case of production compilation. The compilation also allows for utility learning, shown in the model below, as well.
"""
import warnings
import pyactr as actr
class Compilation1:
"""
Model testing compilation -- basic cases.
"""
def __init__(self, **kwargs):
actr.chunktype("state", "starting ending")
self.m = actr.ACTRModel(**kwargs)
self.m.goal.add(actr.makechunk(nameofchunk="start", typename="state", starting=1))
self.m.productionstring(name="one", string="""
=g>
isa state
starting =x
ending ~=x
==>
=g>
isa state
ending =x""", utility=2)
self.m.productionstring(name="two", string="""
=g>
isa state
starting =x
ending =x
==>
=g>
isa state
starting =x
ending 4""")
if __name__ == "__main__":
warnings.simplefilter("ignore")
mm = Compilation1(production_compilation=True, utility_learning=True)
model = mm.m
sim = model.simulation(realtime=True)
sim.run(0.5)
print(model.productions["one and two"])
|