From f589b106923ed7fe5236d73487a838bd7f3da6ae Mon Sep 17 00:00:00 2001 From: sp Date: Thu, 14 Mar 2024 21:45:38 +0100 Subject: [PATCH] more debugging --- examples/shields/rl/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/shields/rl/utils.py b/examples/shields/rl/utils.py index 448f8d1..39992db 100644 --- a/examples/shields/rl/utils.py +++ b/examples/shields/rl/utils.py @@ -127,11 +127,14 @@ class MiniGridShieldHandler(ShieldHandler): ints = dict(re.findall(r'([a-zA-Z][_a-zA-Z0-9]+)=(-?[a-zA-Z0-9]+)', state_valuation)) booleans = re.findall(r'(\!?)([a-zA-Z][_a-zA-Z0-9]+)[\s\t]+', state_valuation) booleans = {b[1]: False if b[0] == "!" else True for b in booleans} + print(ints, booleans) if int(ints.get("previousActionAgent", 3)) != 3: continue if int(ints.get("clock", 0)) != 0: continue state = to_state(ints, booleans) + print(f"{state} got added with actions:") + print(get_allowed_actions_mask([choice_labeling.get_labels_of_choice(model.get_choice_index(stateID, choice[1])) for choice in choices])) action_dictionary[state] = get_allowed_actions_mask([choice_labeling.get_labels_of_choice(model.get_choice_index(stateID, choice[1])) for choice in choices]) toc()