From 3eb78a1ddb0ac78c4306f4b6d2f81f62d097179a Mon Sep 17 00:00:00 2001 From: "Dobbertin, Niclas" Date: Mon, 14 Oct 2024 23:19:55 +0200 Subject: bugfixes --- modeling/productions_math.py | 59 +++++++++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 23 deletions(-) (limited to 'modeling/productions_math.py') diff --git a/modeling/productions_math.py b/modeling/productions_math.py index 542f2e3..b6302bd 100644 --- a/modeling/productions_math.py +++ b/modeling/productions_math.py @@ -53,12 +53,12 @@ def start(): Model, DM, goal, imaginal, env = init() # Model.model_parameters["subsymbolic"] = True # Model.model_parameters["partial_matching"] = True - Model.model_parameters["activation_trace"] = True - Model.model_parameters["instantaneous_noise"] = .2 - Model.model_parameters["utility_alpha"] = 0.5 - Model.model_parameters["utility_noise"] = 0.5 - Model.model_parameters["production_compilation"] = True - Model.model_parameters["utility_learning"] = True + # Model.model_parameters["activation_trace"] = True + # Model.model_parameters["instantaneous_noise"] = .2 + # Model.model_parameters["utility_alpha"] = 0.5 + # Model.model_parameters["utility_noise"] = 0.5 + # Model.model_parameters["production_compilation"] = True + # Model.model_parameters["utility_learning"] = True # add_goal(goal, op, arg1, arg2) add_proc(goal, "next_proc") @@ -107,7 +107,11 @@ 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 "number_expand_done and continue_with_next_op" 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:]]) # break @@ -116,26 +120,34 @@ def start(): if sim.current_event.action == "KEY PRESSED: SPACE": sim._Simulation__env.stimulus = stimuli.update_current_stimulus( f"Answer{i}", - int("".join(userinput[phase][stimuli.current_stimulus_id][str(i)][:-1])), + int( + "".join(userinput[phase][stimuli.current_stimulus_id][str(i)][:-1]) + ), ) i += 1 pprint(userinput) pprint("NEW PROC") - if i <= 6: - goal.add( - actr.makechunk("", "math_goal", proc="next_proc", ones_carry="") - ) - elif i >= 7 and j < training_N+test_N: - print("Stimulus Done, next stimulus") + if condition != "blocked": + if i <= 6: + goal.add( + actr.makechunk("", "math_goal", proc="next_proc", ones_carry="") + ) + elif i >= 7 and j < training_N + test_N: + print("Stimulus Done, next stimulus") + sim._Simulation__env.stimulus = stimuli.next_stimulus() + goal.add( + actr.makechunk("", "math_goal", proc="next_proc", ones_carry="") + ) + i = 1 + j += 1 + elif i >= 7 and j >= training_N + test_N: + print("DONE") + break + elif condition == "blocked": + if i >= 6 * (training_N + test_N): + print("DONE") + break sim._Simulation__env.stimulus = stimuli.next_stimulus() - goal.add( - actr.makechunk("", "math_goal", proc="next_proc", ones_carry="") - ) - i = 1 - j += 1 - elif i >= 7 and j >= training_N+test_N: - print("DONE") - break # sim.run(max_time=25) print("training order: ", stimuli.training_order_list) @@ -160,9 +172,10 @@ def start(): # print("\n") # print("#######used prods########") # print(sim.ordered_rulenames) - + # pprint(sim._Simulation__pr.rules) # pprint(sim._Simulation__pr.ordered_rulenames) + if __name__ == "__main__": start() -- cgit v1.2.3