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()