From 687a14059c0bd1a8b8c10cbdf82155ba57f6c31a Mon Sep 17 00:00:00 2001 From: Niclas Dobbertin Date: Fri, 20 Sep 2024 11:08:29 +0200 Subject: reward for done retrieval to prevent loop wip --- modeling/prod_multi.py | 1 + modeling/prod_numbers.py | 6 ++++++ modeling/productions_math.py | 8 ++++---- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/modeling/prod_multi.py b/modeling/prod_multi.py index d7cf073..e93eda0 100644 --- a/modeling/prod_multi.py +++ b/modeling/prod_multi.py @@ -105,6 +105,7 @@ def multiplication(Model): """ ) + # TODO: why mul_start->mul_step_success?? mul_start = Model.productionstring( name="mul_start", string=""" diff --git a/modeling/prod_numbers.py b/modeling/prod_numbers.py index 3943403..773768d 100644 --- a/modeling/prod_numbers.py +++ b/modeling/prod_numbers.py @@ -28,6 +28,7 @@ def number(Model): number_expand_arg1_done = Model.productionstring( name="number_expand_arg1_done", + reward=100, string=""" =g> isa math_goal @@ -54,6 +55,7 @@ def number(Model): number_expand_arg1_fail = Model.productionstring( name="number_expand_arg1_fail", + # reward=-100, string=""" =g> isa math_goal @@ -97,6 +99,7 @@ def number(Model): number_expand_arg2_fail = Model.productionstring( name="number_expand_arg2_fail", + # reward=-100, string=""" =g> isa math_goal @@ -116,6 +119,7 @@ def number(Model): number_expand_arg2_done = Model.productionstring( name="number_expand_arg2_done", + reward=100, string=""" =g> isa math_goal @@ -142,6 +146,7 @@ def number(Model): number_expand_done = Model.productionstring( name="number_expand_done", + reward=100, string=""" =g> isa math_goal @@ -191,6 +196,7 @@ def number(Model): number_contract_result_done = Model.productionstring( name="number_contract_result_done", + reward=100, string=""" =g> isa math_goal diff --git a/modeling/productions_math.py b/modeling/productions_math.py index 326b9c4..542f2e3 100644 --- a/modeling/productions_math.py +++ b/modeling/productions_math.py @@ -107,9 +107,9 @@ def start(): userinput[phase][stimuli.current_stimulus_id][str(i)].append( sim.current_event.action.split(":")[1].strip() ) - if "RULE FIRED:" in sim.current_event.action and " and " in sim.current_event.action: + if "RULE FIRED:" in sim.current_event.action and "number_expand_done and continue_with_next_op" in sim.current_event.action: print("FIRED COMPILED RULE!!!!") - print(Model.productions[sim.current_event.action[12:]]) + # print(Model.productions[sim.current_event.action[12:]]) # break if sim.current_event.action == "NO RULE FOUND": print(goal) @@ -161,8 +161,8 @@ def start(): # print("#######used prods########") # print(sim.ordered_rulenames) - pprint(sim._Simulation__pr.rules) - pprint(sim._Simulation__pr.ordered_rulenames) + # pprint(sim._Simulation__pr.rules) + # pprint(sim._Simulation__pr.ordered_rulenames) if __name__ == "__main__": start() -- cgit v1.2.3