From 06bfcfe065c6debef5f8954dde29146da095a075 Mon Sep 17 00:00:00 2001 From: Dominik Roth Date: Sun, 13 Nov 2022 20:00:15 +0100 Subject: [PATCH] Adding the envs from my thesis --- README.md | 3 +- columbus/env.py | 2 +- configs/Env_A_Local_Optima.yaml | 78 +++++++++++++++++++ configs/Env_B_Random_Gen.yaml | 54 +++++++++++++ configs/Env_C_Passage.yaml | 67 ++++++++++++++++ .../example.yaml | 0 6 files changed, 202 insertions(+), 2 deletions(-) create mode 100644 configs/Env_A_Local_Optima.yaml create mode 100644 configs/Env_B_Random_Gen.yaml create mode 100644 configs/Env_C_Passage.yaml rename ColumbusConfigDefinedExample.yaml => configs/example.yaml (100%) diff --git a/README.md b/README.md index 79331ec..389f8a9 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,8 @@ Contains the ColumbusEnv. There exist two ways to implement new envs: - Subclassing ColumbusEnv and expanding _init_ and overriding _setup_. -- Using the ColumbusConfigDefined with a desired configuration. This makes configuring ColumbusEnvs via ClusterWorks2-configs possible. (See ColumbusConfigDefinedExample.yaml for an example of how the parameters are supposed to look like (uses yaml format), I don't have time to write a better documentation right now...) (To test this run 'python humanPlayer.py', select 5, give path to ColumbusConfigDefinedExample.yaml, select 0) +- Using the ColumbusConfigDefined with a desired configuration. This makes configuring ColumbusEnvs via ClusterWorks2-configs possible. (See configs/example.yaml for an example of how the parameters are supposed to look like (uses yaml format) +- The environments used in my thesis can also be found in configs/ ##### Some caveats / infos diff --git a/columbus/env.py b/columbus/env.py index 1b67f76..c76aea1 100644 --- a/columbus/env.py +++ b/columbus/env.py @@ -91,11 +91,11 @@ class ColumbusEnv(gym.Env): self.terminate_on_reward = terminate_on_reward self.agent_draw_path = agent_draw_path self.clear_path_on_reset = clear_path_on_reset + if value_color_mapper == 'atan': def value_color_mapper(x): return th.atan(x*2)/0.786/2 elif value_color_mapper == 'tanh': def value_color_mapper(x): return th.tanh(x*2)/0.762/2 - self.value_color_mapper = value_color_mapper self.max_steps = max_steps diff --git a/configs/Env_A_Local_Optima.yaml b/configs/Env_A_Local_Optima.yaml new file mode 100644 index 0000000..13ecf87 --- /dev/null +++ b/configs/Env_A_Local_Optima.yaml @@ -0,0 +1,78 @@ +name: "DEFAULT" + +params: + task: + task: columbus + env_name: ColumbusConfigDefined-v0 + env_args: + observable: + - type: State + coordsAgent: True + speedAgent: True + coordsRelativeToAgent: False + coordsRewards: True + coordsEnemys: False + enemysNoBarriers: True + rewardsTimeouts: False + include_rand: True + - type: State + coordsAgent: False + speedAgent: False + coordsRelativeToAgent: True + coordsRewards: True + coordsEnemys: False + enemysNoBarriers: True + rewardsTimeouts: False + include_rand: True + - type: Compass + - type: RayCast + num_rays: 6 + chans: [Enemy] + entities: + - type: RectBarrier + damage: 1 #1 + width: 300 + height: 120 # 360 - 5%(720) + pos: [0, 0] + - type: RectBarrier + damage: 1 #1 + width: 300 + height: 1000 + pos: [0, 0.25] + - type: RectBarrier + damage: 1 #1 + width: 250 + height: 30 + pos: [0.55, 0.6] + - type: RectBarrier + damage: 1 #1 + width: 30 + height: 120 + pos: [0.856, 0.475] + - type: RectBarrier + num: 0 + damage: 1 #1 + width: 50 + width_rand: 100 + height: 25 + height_rand: 100 + - type: OnceReward + reward: 100 + radius: 20 + pos: [0.9, 0.8] + start_pos: [0.1, 0.21] + default_collision_elasticity: 0.8 + start_score: 10 + speed_fac: 0.01 + acc_fac: 0.1 + die_on_zero: False #True + agent_drag: 0.1 # 0.05 + controll_type: ACC # SPEED + aux_reward_max: 1 + aux_penalty_max: 0.01 + void_damage: 5 #1 + terminate_on_reward: True + agent_draw_path: True + clear_path_on_reset: False + max_steps: 450 # 1800 +--- \ No newline at end of file diff --git a/configs/Env_B_Random_Gen.yaml b/configs/Env_B_Random_Gen.yaml new file mode 100644 index 0000000..265d486 --- /dev/null +++ b/configs/Env_B_Random_Gen.yaml @@ -0,0 +1,54 @@ +name: "DEFAULT" + +params: + task: + task: columbus + num_envs: 8 + env_args: + observable: + - type: State + coordsAgent: True + speedAgent: True + coordsRelativeToAgent: False + coordsRewards: True + coordsEnemys: False + enemysNoBarriers: True + rewardsTimeouts: False + include_rand: True + - type: State + coordsAgent: False + speedAgent: False + coordsRelativeToAgent: True + coordsRewards: True + coordsEnemys: False + enemysNoBarriers: True + rewardsTimeouts: False + include_rand: True + - type: Compass + - type: RayCast + num_rays: 8 + chans: [Enemy] + entities: + - type: CircleBarrier + num: 8 + num_rand: 6 + damage: 20 #20 + radius: 25 + radius_rand: 75 + - type: TeleportingReward + num: 1 + reward: 100 #100 + radius: 20 + default_collision_elasticity: 0.8 + start_score: 50 + speed_fac: 0.01 + acc_fac: 0.1 + die_on_zero: True + agent_drag: 0.07 # 0.05 + controll_type: ACC # SPEED + aux_reward_max: 1 + aux_penalty_max: 0.1 + void_damage: 5 #1 + #master_seed: 3.14 + max_steps: 900 # 30 sec +--- \ No newline at end of file diff --git a/configs/Env_C_Passage.yaml b/configs/Env_C_Passage.yaml new file mode 100644 index 0000000..3145eed --- /dev/null +++ b/configs/Env_C_Passage.yaml @@ -0,0 +1,67 @@ +name: "DEFAULT" + +params: + task: + task: columbus + env_name: ColumbusConfigDefined-v0 + env_args: + observable: + - type: State + coordsAgent: True + speedAgent: True + coordsRelativeToAgent: False + coordsRewards: True + coordsEnemys: False + enemysNoBarriers: True + rewardsTimeouts: False + include_rand: True + - type: State + coordsAgent: False + speedAgent: False + coordsRelativeToAgent: True + coordsRewards: True + coordsEnemys: False + enemysNoBarriers: True + rewardsTimeouts: False + include_rand: True + - type: RayCast + num_rays: 6 + chans: [Enemy] + entities: + - type: RectBarrier + damage: 10 #1 + width: 25 + height: 120 # 360 - 5%(720) + pos: [0.45, 0] + - type: RectBarrier + damage: 10 #1 + width: 25 + height: 1000 + pos: [0.45, 0.25] + - type: RectBarrier + damage: 10 #1 + width: 25 + height: 520 # 360 - 5%(720) + pos: [0.55, 0] + - type: RectBarrier + damage: 10 #1 + width: 25 + height: 200 + pos: [0.55, 0.80] + - type: LoopReward + num: 1 + reward: 100 #25 + radius: 20 + loop: [[0.125, 0.5, 0.1, 0.5], [0.875, 0.5, 0.1, 0.5]] + default_collision_elasticity: 0.8 + start_score: 10 + speed_fac: 0.01 + acc_fac: 0.1 + die_on_zero: False #True + agent_drag: 0.1 # 0.05 + controll_type: ACC # SPEED + aux_reward_max: 1 + aux_penalty_max: 0.01 + void_damage: 5 #1 + agent_draw_path: True +--- \ No newline at end of file diff --git a/ColumbusConfigDefinedExample.yaml b/configs/example.yaml similarity index 100% rename from ColumbusConfigDefinedExample.yaml rename to configs/example.yaml