From c2c475d0274b3103a31748a7f8bc498925ffe728 Mon Sep 17 00:00:00 2001 From: Mo8it Date: Sun, 1 May 2022 17:10:15 +0200 Subject: [PATCH] Adjust triggers --- src/RL/Envs/LocalCOMWithAdditionalShapeRewardEnv.jl | 7 ++++++- src/RL/Envs/LocalCOMWithAdditionalShapeRewardEnv2.jl | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/RL/Envs/LocalCOMWithAdditionalShapeRewardEnv.jl b/src/RL/Envs/LocalCOMWithAdditionalShapeRewardEnv.jl index c6f8b3a..83a0338 100644 --- a/src/RL/Envs/LocalCOMWithAdditionalShapeRewardEnv.jl +++ b/src/RL/Envs/LocalCOMWithAdditionalShapeRewardEnv.jl @@ -5,6 +5,8 @@ The minimization variable of the additional reward term is the individual ellipt using ..ReCo: ReCo +const TRIGGER = 0.6 + struct LocalCOMWithAdditionalShapeRewardEnv <: Env shared::EnvSharedProps @@ -158,7 +160,10 @@ function state_update_hook!( distance_to_local_center_of_mass_sum / n_particles env_helper.add_shape_reward_term = mean_distance_to_local_center_of_mass / - env_helper.max_distance_to_local_center_of_mass < 0.32 + env_helper.max_distance_to_local_center_of_mass < TRIGGER + if env_helper.add_shape_reward_term + print("*") + end env_helper.center_of_mass = ReCo.center_of_mass(particles, env_helper.half_box_len) diff --git a/src/RL/Envs/LocalCOMWithAdditionalShapeRewardEnv2.jl b/src/RL/Envs/LocalCOMWithAdditionalShapeRewardEnv2.jl index 05724ff..c5a8613 100644 --- a/src/RL/Envs/LocalCOMWithAdditionalShapeRewardEnv2.jl +++ b/src/RL/Envs/LocalCOMWithAdditionalShapeRewardEnv2.jl @@ -5,6 +5,8 @@ The minimization variable of the additional reward term is the absolute differen using ..ReCo: ReCo +const TRIGGER = 0.6 + struct LocalCOMWithAdditionalShapeRewardEnv2 <: Env shared::EnvSharedProps @@ -156,7 +158,7 @@ function state_update_hook!( distance_to_local_center_of_mass_sum / n_particles env_helper.add_shape_reward_term = mean_distance_to_local_center_of_mass / - env_helper.max_distance_to_local_center_of_mass < 0.32 + env_helper.max_distance_to_local_center_of_mass < TRIGGER return nothing end