summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDobbertin, Niclas <niclas.dobbertin@mailbox.org>2024-04-16 09:26:03 +0200
committerDobbertin, Niclas <niclas.dobbertin@mailbox.org>2024-04-16 09:26:03 +0200
commit9f5afe40e26ec2995bf19b86efb73a212abab12e (patch)
tree5aede0dd59063426f78399a64fc8733aa184b93e
parent2783b34776c0efc31b2bcaaf66eebd467e4cb3ca (diff)
add greater and lesser
-rw-r--r--modeling/prod_comp.py575
-rw-r--r--modeling/productions_math.py22
2 files changed, 586 insertions, 11 deletions
diff --git a/modeling/prod_comp.py b/modeling/prod_comp.py
new file mode 100644
index 0000000..5bf30c9
--- /dev/null
+++ b/modeling/prod_comp.py
@@ -0,0 +1,575 @@
+#!/usr/bin/env python3
+
+
+def greater_than(Model):
+ prods = []
+
+ arg1_greater = Model.productionstring(
+ name="arg1_greater",
+ string="""
+ =g>
+ isa math_goal
+ task arg1
+ =imaginal>
+ isa math_op
+ op greater
+ hundreds1 =hun1
+ tens1 =ten1
+ ones1 =one1
+ ==>
+ =g>
+ isa math_goal
+ task done
+ =imaginal>
+ isa math_op
+ hundreds_ans =hun1
+ tens_ans =ten1
+ ones_ans =one1
+ """,
+ )
+ prods.append(arg1_greater)
+
+ arg2_greater = Model.productionstring(
+ name="arg2_greater",
+ string="""
+ =g>
+ isa math_goal
+ task arg2
+ =imaginal>
+ isa math_op
+ op greater
+ hundreds2 =hun2
+ tens2 =ten2
+ ones2 =one2
+ ==>
+ =g>
+ isa math_goal
+ task done
+ =imaginal>
+ isa math_op
+ hundreds_ans =hun2
+ tens_ans =ten2
+ ones_ans =one2
+ """,
+ )
+ prods.append(arg2_greater)
+
+ start_greater_hun = Model.productionstring(
+ name="start_greater_hun",
+ string="""
+ =g>
+ isa math_goal
+ task calc
+ =imaginal>
+ isa math_op
+ op greater
+ hundreds1 =hun1
+ hundreds2 ~=hun1
+ hundreds2 =hun2
+ ==>
+ =g>
+ isa math_goal
+ task comp
+ +retrieval>
+ isa math_op
+ op greater
+ arg1 =hun1
+ arg2 =hun2
+ """,
+ )
+ prods.append(start_greater_hun)
+
+ start_greater_ten = Model.productionstring(
+ name="start_greater_ten",
+ string="""
+ =g>
+ isa math_goal
+ task calc
+ =imaginal>
+ isa math_op
+ op greater
+ hundreds1 =hun1
+ hundreds2 =hun1
+ tens1 =ten1
+ tens2 ~=ten1
+ tens2 =ten2
+ ==>
+ =g>
+ isa math_goal
+ task comp
+ +retrieval>
+ isa math_op
+ op greater
+ arg1 =ten1
+ arg2 =ten2
+ """,
+ )
+ prods.append(start_greater_ten)
+
+ start_greater_one = Model.productionstring(
+ name="start_greater_one",
+ string="""
+ =g>
+ isa math_goal
+ task calc
+ =imaginal>
+ isa math_op
+ op greater
+ hundreds1 =hun1
+ hundreds2 =hun1
+ tens1 =ten1
+ tens2 =ten1
+ ones1 =one1
+ ones2 ~=one1
+ ones2 =one2
+ ==>
+ =g>
+ isa math_goal
+ task comp
+ +retrieval>
+ isa math_op
+ op greater
+ arg1 =one1
+ arg2 =one2
+ """,
+ )
+ prods.append(start_greater_one)
+
+ comp_result_hun_greater_arg1 = Model.productionstring(
+ name="comp_result_hun_greater_arg1",
+ string="""
+ =g>
+ isa math_goal
+ task comp
+ =imaginal>
+ isa math_op
+ op greater
+ hundreds1 =hun1
+ hundreds2 =hun2
+ =retrieval>
+ isa math_op
+ op greater
+ arg1 =hun1
+ arg2 =hun2
+ result =hun1
+ ==>
+ =g>
+ isa math_goal
+ task arg1
+ """,
+ )
+ prods.append(comp_result_hun_greater_arg1)
+
+ comp_result_hun_greater_arg2 = Model.productionstring(
+ name="comp_result_hun_greater_arg2",
+ string="""
+ =g>
+ isa math_goal
+ task comp
+ =imaginal>
+ isa math_op
+ op greater
+ hundreds1 =hun1
+ hundreds2 =hun2
+ =retrieval>
+ isa math_op
+ op greater
+ arg1 =hun1
+ arg2 =hun2
+ result =hun2
+ ==>
+ =g>
+ isa math_goal
+ task arg2
+ """,
+ )
+ prods.append(comp_result_hun_greater_arg2)
+
+ comp_result_ten_greater_arg1 = Model.productionstring(
+ name="comp_result_ten_greater_arg1",
+ string="""
+ =g>
+ isa math_goal
+ task comp
+ =imaginal>
+ isa math_op
+ op greater
+ tens1 =ten1
+ tens2 =ten2
+ =retrieval>
+ isa math_op
+ op greater
+ arg1 =ten1
+ arg2 =ten2
+ result =ten1
+ ==>
+ =g>
+ isa math_goal
+ task arg1
+ """,
+ )
+ prods.append(comp_result_ten_greater_arg1)
+
+ comp_result_ten_greater_arg2 = Model.productionstring(
+ name="comp_result_ten_greater_arg2",
+ string="""
+ =g>
+ isa math_goal
+ task comp
+ =imaginal>
+ isa math_op
+ op greater
+ tens1 =ten1
+ tens2 =ten2
+ =retrieval>
+ isa math_op
+ op greater
+ arg1 =ten1
+ arg2 =ten2
+ result =ten2
+ ==>
+ =g>
+ isa math_goal
+ task arg2
+ """,
+ )
+ prods.append(comp_result_ten_greater_arg2)
+
+ comp_result_one_greater_arg1 = Model.productionstring(
+ name="comp_result_one_greater_arg1",
+ string="""
+ =g>
+ isa math_goal
+ task comp
+ =imaginal>
+ isa math_op
+ op greater
+ ones1 =one1
+ ones2 =one2
+ =retrieval>
+ isa math_op
+ op greater
+ arg1 =one1
+ arg2 =one2
+ result =one1
+ ==>
+ =g>
+ isa math_goal
+ task arg1
+ """,
+ )
+ prods.append(comp_result_one_greater_arg1)
+
+ comp_result_one_greater_arg2 = Model.productionstring(
+ name="comp_result_one_greater_arg2",
+ string="""
+ =g>
+ isa math_goal
+ task comp
+ =imaginal>
+ isa math_op
+ op greater
+ ones1 =one1
+ ones2 =one2
+ =retrieval>
+ isa math_op
+ op greater
+ arg1 =one1
+ arg2 =one2
+ result =one2
+ ==>
+ =g>
+ isa math_goal
+ task arg2
+ """,
+ )
+ prods.append(comp_result_one_greater_arg2)
+
+ return prods
+
+
+def less_than(Model):
+ prods = []
+
+ arg1_less = Model.productionstring(
+ name="arg1_less",
+ string="""
+ =g>
+ isa math_goal
+ task arg1
+ =imaginal>
+ isa math_op
+ op less
+ hundreds1 =hun1
+ tens1 =ten1
+ ones1 =one1
+ ==>
+ =g>
+ isa math_goal
+ task done
+ =imaginal>
+ isa math_op
+ hundreds_ans =hun1
+ tens_ans =ten1
+ ones_ans =one1
+ """,
+ )
+ prods.append(arg1_less)
+
+ arg2_less = Model.productionstring(
+ name="arg2_less",
+ string="""
+ =g>
+ isa math_goal
+ task arg2
+ =imaginal>
+ isa math_op
+ op less
+ hundreds2 =hun2
+ tens2 =ten2
+ ones2 =one2
+ ==>
+ =g>
+ isa math_goal
+ task done
+ =imaginal>
+ isa math_op
+ hundreds_ans =hun2
+ tens_ans =ten2
+ ones_ans =one2
+ """,
+ )
+ prods.append(arg2_less)
+
+ start_less_hun = Model.productionstring(
+ name="start_less_hun",
+ string="""
+ =g>
+ isa math_goal
+ task calc
+ =imaginal>
+ isa math_op
+ op less
+ hundreds1 =hun1
+ hundreds2 ~=hun1
+ hundreds2 =hun2
+ ==>
+ =g>
+ isa math_goal
+ task comp
+ +retrieval>
+ isa math_op
+ op greater
+ arg1 =hun1
+ arg2 =hun2
+ """,
+ )
+ prods.append(start_less_hun)
+
+ start_less_ten = Model.productionstring(
+ name="start_less_ten",
+ string="""
+ =g>
+ isa math_goal
+ task calc
+ =imaginal>
+ isa math_op
+ op less
+ hundreds1 =hun1
+ hundreds2 =hun1
+ tens1 =ten1
+ tens2 ~=ten1
+ tens2 =ten2
+ ==>
+ =g>
+ isa math_goal
+ task comp
+ +retrieval>
+ isa math_op
+ op greater
+ arg1 =ten1
+ arg2 =ten2
+ """,
+ )
+ prods.append(start_less_ten)
+
+ start_less_one = Model.productionstring(
+ name="start_less_one",
+ string="""
+ =g>
+ isa math_goal
+ task calc
+ =imaginal>
+ isa math_op
+ op less
+ hundreds1 =hun1
+ hundreds2 =hun1
+ tens1 =ten1
+ tens2 =ten1
+ ones1 =one1
+ ones2 ~=one1
+ ones2 =one2
+ ==>
+ =g>
+ isa math_goal
+ task comp
+ +retrieval>
+ isa math_op
+ op greater
+ arg1 =one1
+ arg2 =one2
+ """,
+ )
+ prods.append(start_less_one)
+
+ comp_result_hun_less_arg2 = Model.productionstring(
+ name="comp_result_hun_less_arg2",
+ string="""
+ =g>
+ isa math_goal
+ task comp
+ =imaginal>
+ isa math_op
+ op less
+ hundreds1 =hun1
+ hundreds2 =hun2
+ =retrieval>
+ isa math_op
+ op greater
+ arg1 =hun1
+ arg2 =hun2
+ result =hun1
+ ==>
+ =g>
+ isa math_goal
+ task arg2
+ """,
+ )
+ prods.append(comp_result_hun_less_arg2)
+
+ comp_result_hun_less_arg1 = Model.productionstring(
+ name="comp_result_hun_less",
+ string="""
+ =g>
+ isa math_goal
+ task comp
+ =imaginal>
+ isa math_op
+ op less
+ hundreds1 =hun1
+ hundreds2 =hun2
+ =retrieval>
+ isa math_op
+ op greater
+ arg1 =hun1
+ arg2 =hun2
+ result =hun2
+ ==>
+ =g>
+ isa math_goal
+ task arg1
+ """,
+ )
+ prods.append(comp_result_hun_less_arg1)
+
+ comp_result_ten_less_arg2 = Model.productionstring(
+ name="comp_result_ten_less_arg2",
+ string="""
+ =g>
+ isa math_goal
+ task comp
+ =imaginal>
+ isa math_op
+ op less
+ tens1 =ten1
+ tens2 =ten2
+ =retrieval>
+ isa math_op
+ op greater
+ arg1 =ten1
+ arg2 =ten2
+ result =ten1
+ ==>
+ =g>
+ isa math_goal
+ task arg2
+ """,
+ )
+ prods.append(comp_result_ten_less_arg2)
+
+ comp_result_ten_lesser_arg1 = Model.productionstring(
+ name="comp_result_ten_lesser_arg1",
+ string="""
+ =g>
+ isa math_goal
+ task comp
+ =imaginal>
+ isa math_op
+ op less
+ tens1 =ten1
+ tens2 =ten2
+ =retrieval>
+ isa math_op
+ op greater
+ arg1 =ten1
+ arg2 =ten2
+ result =ten2
+ ==>
+ =g>
+ isa math_goal
+ task arg1
+ """,
+ )
+ prods.append(comp_result_ten_lesser_arg1)
+
+ comp_result_one_less_arg2 = Model.productionstring(
+ name="comp_result_one_less_arg2",
+ string="""
+ =g>
+ isa math_goal
+ task comp
+ =imaginal>
+ isa math_op
+ op less
+ ones1 =one1
+ ones2 =one2
+ =retrieval>
+ isa math_op
+ op greater
+ arg1 =one1
+ arg2 =one2
+ result =one1
+ ==>
+ =g>
+ isa math_goal
+ task arg2
+ """,
+ )
+ prods.append(comp_result_one_less_arg2)
+
+ comp_result_one_lesser_arg1 = Model.productionstring(
+ name="comp_result_one_lesser_arg1",
+ string="""
+ =g>
+ isa math_goal
+ task comp
+ =imaginal>
+ isa math_op
+ op less
+ ones1 =one1
+ ones2 =one2
+ =retrieval>
+ isa math_op
+ op greater
+ arg1 =one1
+ arg2 =one2
+ result =one2
+ ==>
+ =g>
+ isa math_goal
+ task arg1
+ """,
+ )
+ prods.append(comp_result_one_lesser_arg1)
+
+ return prods
diff --git a/modeling/productions_math.py b/modeling/productions_math.py
index 8a2ebc2..40c400f 100644
--- a/modeling/productions_math.py
+++ b/modeling/productions_math.py
@@ -68,16 +68,16 @@ def init():
result=max(i, j),
)
)
- DM.add(
- actr.makechunk(
- f"lesser{i}{j}",
- "math_op",
- op="lesser",
- arg1=i,
- arg2=j,
- result=min(i, j),
- )
- )
+ # DM.add(
+ # actr.makechunk(
+ # f"lesser{i}{j}",
+ # "math_op",
+ # op="lesser",
+ # arg1=i,
+ # arg2=j,
+ # result=min(i, j),
+ # )
+ # )
DM.add(
actr.makechunk(
f"plus{i}{j}", "math_op", op="add", arg1=i, arg2=j, result=i + j
@@ -153,12 +153,12 @@ def start():
# unwind_prod()
add_prods = prod_addition.addition(Model)
greater_prods = prod_comp.greater_than(Model)
+ less_prods = prod_comp.less_than(Model)
for prod in add_prods:
print(prod)
print("\n")
- # Model.goal.add(actr.makechunk("goal", "math_op", op="greater", arg1=5, arg2=9))
print("goal: ", goal)
print("imaginal: ", imaginal)
x = Model.simulation()