summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDobbertin, Niclas <niclas.dobbertin@mailbox.org>2024-06-21 19:59:07 +0200
committerDobbertin, Niclas <niclas.dobbertin@mailbox.org>2024-06-21 19:59:07 +0200
commiteb2e5ca2ffa74e3dd2579dcb70a347e6cd481545 (patch)
treead35fe47a230069b4f33f63c928e007011aceaf8
parentff52130ae894942d8d1006eb5894015300512eed (diff)
visual search
-rw-r--r--modeling/prod_comp.py1
-rw-r--r--modeling/prod_procedure.py46
-rw-r--r--modeling/prod_vis.py372
-rw-r--r--modeling/productions_math.py14
4 files changed, 407 insertions, 26 deletions
diff --git a/modeling/prod_comp.py b/modeling/prod_comp.py
index 8bf53ce..5d3ceff 100644
--- a/modeling/prod_comp.py
+++ b/modeling/prod_comp.py
@@ -127,7 +127,6 @@ def greater_than(Model):
tens1 =ten1
tens2 =ten1
ones1 =one1
- ones2 ~=one1
ones2 =one2
?retrieval>
state free
diff --git a/modeling/prod_procedure.py b/modeling/prod_procedure.py
index a40326d..1a7628b 100644
--- a/modeling/prod_procedure.py
+++ b/modeling/prod_procedure.py
@@ -50,7 +50,8 @@ def procedures(Model):
isa math_goal
proc =proc
task 1
- op =op
+ op check_if_number_arg1_start
+ nextop =op
arg1 =arg1
arg2 =arg2
arg1_idx =arg1_idx
@@ -80,8 +81,7 @@ def procedures(Model):
isa math_goal
arg1 ~None
arg1 =arg1
- op =op
- nextop None
+ op check_if_number_arg1_start
==>
+retrieval>
isa number
@@ -89,7 +89,6 @@ def procedures(Model):
=g>
isa math_goal
op check_if_number_arg1
- nextop =op
"""
)
@@ -100,15 +99,14 @@ def procedures(Model):
isa math_goal
arg1 =arg1
op check_if_number_arg1
- nextop =op
=retrieval>
isa number
number =arg1
==>
=g>
isa math_goal
- op =op
- nextop None
+ op check_if_number_arg2_start
+ ~retrieval>
"""
)
@@ -129,15 +127,15 @@ def procedures(Model):
"""
)
- proc_check_substitute_var2 = Model.productionstring(
- name="proc_substitute_var2",
+ # direct cont from chech var1
+ proc_check_substitute_var2_alt = Model.productionstring(
+ name="proc_substitute_var2_alt",
string="""
=g>
isa math_goal
arg2 ~None
arg2 =arg2
- op =op
- nextop None
+ op check_if_number_arg2_start
==>
+retrieval>
isa number
@@ -145,10 +143,29 @@ def procedures(Model):
=g>
isa math_goal
op check_if_number_arg2
- nextop =op
"""
)
+ # proc_check_substitute_var2 = Model.productionstring(
+ # name="proc_substitute_var2",
+ # string="""
+ # =g>
+ # isa math_goal
+ # arg2 ~None
+ # arg2 =arg2
+ # op =op
+ # nextop None
+ # ==>
+ # +retrieval>
+ # isa number
+ # number =arg2
+ # =g>
+ # isa math_goal
+ # op check_if_number_arg2
+ # nextop =op
+ # """
+ # )
+
proc_check_substitute_var2_number = Model.productionstring(
name="proc_substitute_var2_number",
string="""
@@ -165,6 +182,7 @@ def procedures(Model):
isa math_goal
op =op
nextop None
+ ~retrieval>
"""
)
@@ -182,6 +200,7 @@ def procedures(Model):
=g>
isa math_goal
op vis_find_arg2
+ ~retrieval>
"""
)
@@ -291,7 +310,8 @@ def procedures(Model):
isa math_goal
proc =proc
task 2
- op =op
+ nextop =op
+ op check_if_number_arg2_start
arg1 =arg1
arg2 =arg2
arg1_idx =arg1_idx
diff --git a/modeling/prod_vis.py b/modeling/prod_vis.py
index 2bcbcc8..4fc1883 100644
--- a/modeling/prod_vis.py
+++ b/modeling/prod_vis.py
@@ -22,6 +22,7 @@ def procedures(Model):
"""
)
+ # start value index search
vis_find_arg1_header_done = Model.productionstring(
name = "vis_find_arg1_header_done",
string="""
@@ -30,6 +31,8 @@ def procedures(Model):
op find_arg1_header
arg1 =var
arg1_idx =idx
+ vis_counter ~=idx
+ vis_counter =vis_counter
=visual_location>
isa _visuallocation
screen_x =screen_x
@@ -40,17 +43,374 @@ def procedures(Model):
=g>
isa math_goal
op search_arg1_idx
+ vis_counter 1
+visual_location>
isa _visuallocation
screen_x =screen_x
- >screen_y =screen_y
+ screen_y closest
+ +retrieval>
+ isa number
+ number 1
"""
)
+ vis_find_arg1_search_step1 = Model.productionstring(
+ name = "vis_find_arg1_search_step1",
+ string="""
+ =g>
+ isa math_goal
+ op search_arg1_idx
+ arg1 =var
+ arg1_idx =idx
+ vis_counter ~=idx
+ vis_counter =vis_counter
+ =visual_location>
+ isa _visuallocation
+ screen_x =screen_x
+ screen_y =screen_y
+ ?visual>
+ state free
+ =retrieval>
+ isa number
+ number =vis_counter
+ next =next
+ ==>
+ =g>
+ isa math_goal
+ op search_arg1_idx
+ vis_counter =next
+ +visual_location>
+ isa _visuallocation
+ screen_x =screen_x
+ screen_y closest
+ +retrieval>
+ isa number
+ number =next
+ """
+ )
+
+ vis_find_arg1_search_step2 = Model.productionstring(
+ name = "vis_find_arg1_search_step2",
+ string="""
+ =g>
+ isa math_goal
+ op search_arg1_idx
+ arg1 =var
+ arg1_idx =idx
+ vis_counter ~=idx
+ vis_counter =vis_counter
+ =visual_location>
+ isa _visuallocation
+ screen_x =screen_x
+ screen_y =screen_y
+ ?visual>
+ state free
+ =retrieval>
+ isa number
+ number =vis_counter
+ next =next
+ ==>
+ =g>
+ isa math_goal
+ op search_arg1_idx
+ vis_counter =next
+ +visual_location>
+ isa _visuallocation
+ screen_x =screen_x
+ screen_y 400
+ +retrieval>
+ isa number
+ number =next
+ """
+ )
+
+ vis_find_arg1_search_step3 = Model.productionstring(
+ name = "vis_find_arg1_search_step3",
+ string="""
+ =g>
+ isa math_goal
+ op search_arg1_idx
+ arg1 =var
+ arg1_idx =idx
+ vis_counter ~=idx
+ vis_counter =vis_counter
+ =visual_location>
+ isa _visuallocation
+ screen_x =screen_x
+ screen_y =screen_y
+ ?visual>
+ state free
+ =retrieval>
+ isa number
+ number =vis_counter
+ next =next
+ ==>
+ =g>
+ isa math_goal
+ op search_arg1_idx
+ vis_counter =next
+ +visual_location>
+ isa _visuallocation
+ screen_x =screen_x
+ screen_y 500
+ +retrieval>
+ isa number
+ number =next
+ """
+ )
+
+ vis_find_arg1_search_done = Model.productionstring(
+ name="vis_find_arg1_search_done",
+ string="""
+ =g>
+ isa math_goal
+ arg1_idx =idx
+ vis_counter =idx
+ =visual_location>
+ isa _visuallocation
+ screen_x =screen_x
+ screen_y =screen_y
+ ?visual>
+ state free
+ ==>
+ =g>
+ isa math_goal
+ op search_arg1_done
+ +visual>
+ isa _visual
+ cmd move_attention
+ screen_pos =visual_location
+ ~visual_location>
+ """
+ )
+
+ vis_find_arg1_replace = Model.productionstring(
+ name="vis_find_arg1_replace",
+ string="""
+ =g>
+ isa math_goal
+ op search_arg1_done
+ arg1_idx =idx
+ vis_counter =idx
+ =visual>
+ isa _visual
+ value =arg1
+ ==>
+ =g>
+ isa math_goal
+ op check_if_number_arg2_start
+ arg1 =arg1
+ vis_counter None
+ ~visual>
+ """
+ )
+
+
+ vis_find_arg2_header = Model.productionstring(
+ name = "vis_find_arg2_header",
+ string="""
+ =g>
+ isa math_goal
+ op vis_find_arg2
+ arg2 =var
+ ==>
+ =g>
+ isa math_goal
+ op find_arg2_header
+ ?visual_location>
+ attended False
+ +visual_location>
+ isa _visuallocation
+ value =var
+ """
+ )
+
+ # start value index search
+ vis_find_arg2_header_done = Model.productionstring(
+ name = "vis_find_arg2_header_done",
+ string="""
+ =g>
+ isa math_goal
+ op find_arg2_header
+ arg2 =var
+ arg2_idx =idx
+ vis_counter ~=idx
+ vis_counter =vis_counter
+ =visual_location>
+ isa _visuallocation
+ screen_x =screen_x
+ screen_y =screen_y
+ ?visual>
+ state free
+ ==>
+ =g>
+ isa math_goal
+ op search_arg2_idx
+ vis_counter 1
+ +visual_location>
+ isa _visuallocation
+ screen_x =screen_x
+ screen_y ~=screen_y
+ screen_y closest
+ +retrieval>
+ isa number
+ number 1
+ """
+ )
+
+ vis_find_arg2_search_step1 = Model.productionstring(
+ name = "vis_find_arg2_search_step1",
+ string="""
+ =g>
+ isa math_goal
+ op search_arg2_idx
+ arg2 =var
+ arg2_idx =idx
+ vis_counter ~=idx
+ vis_counter =vis_counter
+ =visual_location>
+ isa _visuallocation
+ screen_x =screen_x
+ screen_y =screen_y
+ ?visual>
+ state free
+ =retrieval>
+ isa number
+ number =vis_counter
+ next =next
+ ==>
+ =g>
+ isa math_goal
+ op search_arg2_idx
+ vis_counter =next
+ +visual_location>
+ isa _visuallocation
+ screen_x =screen_x
+ screen_y 300
+ +retrieval>
+ isa number
+ number =next
+ """
+ )
+
+ vis_find_arg2_search_step2 = Model.productionstring(
+ name = "vis_find_arg2_search_step2",
+ string="""
+ =g>
+ isa math_goal
+ op search_arg2_idx
+ arg2 =var
+ arg2_idx =idx
+ vis_counter ~=idx
+ vis_counter =vis_counter
+ =visual_location>
+ isa _visuallocation
+ screen_x =screen_x
+ screen_y =screen_y
+ ?visual>
+ state free
+ =retrieval>
+ isa number
+ number =vis_counter
+ next =next
+ ==>
+ =g>
+ isa math_goal
+ op search_arg2_idx
+ vis_counter =next
+ +visual_location>
+ isa _visuallocation
+ screen_x =screen_x
+ screen_y 400
+ +retrieval>
+ isa number
+ number =next
+ """
+ )
+
+ vis_find_arg2_search_step3 = Model.productionstring(
+ name = "vis_find_arg2_search_step3",
+ string="""
+ =g>
+ isa math_goal
+ op search_arg2_idx
+ arg2 =var
+ arg2_idx =idx
+ vis_counter ~=idx
+ vis_counter =vis_counter
+ =visual_location>
+ isa _visuallocation
+ screen_x =screen_x
+ screen_y =screen_y
+ ?visual>
+ state free
+ =retrieval>
+ isa number
+ number =vis_counter
+ next =next
+ ==>
+ =g>
+ isa math_goal
+ op search_arg2_idx
+ vis_counter =next
+ +visual_location>
+ isa _visuallocation
+ screen_x =screen_x
+ screen_y 500
+ +retrieval>
+ isa number
+ number =next
+ """
+ )
+
+
+ vis_find_arg2_search_done = Model.productionstring(
+ name="vis_find_arg2_search_done",
+ string="""
+ =g>
+ isa math_goal
+ arg2_idx =idx
+ vis_counter =idx
+ =visual_location>
+ isa _visuallocation
+ screen_x =screen_x
+ screen_y =screen_y
+ ?visual>
+ state free
+ ==>
+ =g>
+ isa math_goal
+ op search_arg2_done
+ +visual>
+ isa _visual
+ cmd move_attention
+ screen_pos =visual_location
+ ~visual_location>
+ """
+ )
+
+ vis_find_arg2_replace = Model.productionstring(
+ name="vis_find_arg2_replace",
+ string="""
+ =g>
+ isa math_goal
+ op search_arg2_done
+ arg2_idx =idx
+ vis_counter =idx
+ =visual>
+ isa _visual
+ value =arg2
+ ==>
+ =g>
+ isa math_goal
+ op done
+ arg2 =arg2
+ vis_counter None
+ ~visual>
+ ~retrieval>
+ """
+ )
+
+
return prods
- # +visual>
- # isa _visual
- # cmd move_attention
- # screen_pos =visual_location
- # ~visual_location>
diff --git a/modeling/productions_math.py b/modeling/productions_math.py
index 57a655a..90dcffb 100644
--- a/modeling/productions_math.py
+++ b/modeling/productions_math.py
@@ -68,6 +68,7 @@ def init():
"mul_counter",
"ones_carry",
"tens_carry",
+ "vis_counter",
),
)
actr.chunktype(
@@ -89,13 +90,13 @@ def init():
op1="add",
arg1_1="Algen",
arg1_1_idx=1,
- arg1_2="Mineralien",
- arg1_2_idx=1,
- op2="greater",
+ arg1_2="Sandstein",
+ arg1_2_idx=4,
+ op2="mul",
arg2_1="result1",
arg2_1_idx=0,
- arg2_2="Algen",
- arg2_2_idx=1,
+ arg2_2="Gifte",
+ arg2_2_idx=3,
)
)
@@ -163,6 +164,7 @@ def general_prod(Model):
=g>
isa math_goal
op =nextop
+ nextop None
""",
)
@@ -213,7 +215,7 @@ def start():
# sim.step()
# if sim.current_event.action == "KEY PRESSED: SPACE":
# break
- sim.run(max_time=8)
+ sim.run(max_time=4)
print("Simulation time: ", sim.show_time())
print("goal: ", goal)
# print(list(env))