From 8cbbef4006848c3f2d8ec6546f854eb7e32b16b1 Mon Sep 17 00:00:00 2001 From: sp Date: Mon, 15 Jan 2024 17:03:04 +0100 Subject: [PATCH] ensure that exp log directory exists --- examples/shields/rl/utils.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/shields/rl/utils.py b/examples/shields/rl/utils.py index dd851a0..5339063 100644 --- a/examples/shields/rl/utils.py +++ b/examples/shields/rl/utils.py @@ -133,11 +133,12 @@ class MiniGridShieldHandler(ShieldHandler): return self.__create_shield_dict() +def expname(args): + return f"{args.env}_{args.shielding}_{args.shield_comparison}_{args.shield_value}" def create_log_dir(args): - return f"{args.log_dir}/{args.env}_{args.shielding}_{args.shield_comparison}_{args.shield_value}" - -def test_name(args): - return f"{args.expname}" + log_dir = f"{args.log_dir}/{datetime.datetime.now().strftime('%Y%m%dT%H%M%S')}_{expname(args)}" + os.makedirs(log_dir, exist_ok=True) + return log_dir def get_allowed_actions_mask(actions): action_mask = [0.0] * 3 + [1.0] * 4 @@ -155,7 +156,7 @@ def common_parser(): parser = argparse.ArgumentParser() parser.add_argument("--env", help="gym environment to load", - default="MiniGrid-LavaSlipperyCliff-16x12-v0") + default="MiniGrid-LavaSlipperyCliff-16x13-v0") parser.add_argument("--grid_file", default="grid.txt") parser.add_argument("--prism_output_file", default="grid.prism")