diff options
author | Dobbertin, Niclas <niclas.dobbertin@mailbox.org> | 2024-08-07 07:52:12 +0200 |
---|---|---|
committer | Dobbertin, Niclas <niclas.dobbertin@mailbox.org> | 2024-08-07 07:52:12 +0200 |
commit | 347d3c943462a73c35c9d246c4970833d96180bf (patch) | |
tree | f3507e40a3a76b07b507fb294871ad777a3a27d6 /modeling/test_compilation.py | |
parent | d3a81759c311a9ccfc4d17d2cb9347b9367cb7d1 (diff) |
full experiment, fixed and random
Diffstat (limited to 'modeling/test_compilation.py')
-rw-r--r-- | modeling/test_compilation.py | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/modeling/test_compilation.py b/modeling/test_compilation.py new file mode 100644 index 0000000..1312494 --- /dev/null +++ b/modeling/test_compilation.py @@ -0,0 +1,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"]) |