diff --git a/analysis/reward_discount_analysis.jl b/analysis/reward_discount_analysis.jl index a7d6f1a..d6e2b25 100644 --- a/analysis/reward_discount_analysis.jl +++ b/analysis/reward_discount_analysis.jl @@ -11,7 +11,7 @@ function run_rl_prcesses_reward_discount(γs::AbstractVector) Threads.@threads for γ_ind in 1:n_γs γ = γs[γ_ind] - env_helper = ReCo.run_rl(; + env_helper, rl_dir = ReCo.run_rl(; EnvType=ReCo.OriginEnv, n_episodes=400, episode_duration=15.0, diff --git a/src/RL/RL.jl b/src/RL/RL.jl index 4bd7479..5490488 100644 --- a/src/RL/RL.jl +++ b/src/RL/RL.jl @@ -79,7 +79,7 @@ end """ run_rl(EnvType; ) -Run a reinforcement learning process and return the environment helper. +Run a reinforcement learning process and return the tuple (`env_helper`, `rl_dir`). `env_helper` is the environment helper and `rl_dir` is the path of the process directory relative to the directory `ReCo.jl`. # Arguments - `EnvType::Type{<:Env}`: Environment type. It has to be one of the environments named after the file names in the directory `ReCo.jl/RL/Envs`, for example: `LocalCOMEnv`. A description of an environment is included at the beginning of the corresponding file. @@ -161,9 +161,10 @@ function run_rl( env_helper = gen_env_helper(env, env_helper_shared; args=env_helper_args) - parent_dir = "RL/" * process_dir + parent_dir = "RL/$process_dir" + rl_dir = "$(ReCo.DEFAULT_EXPORTS_DIR)/$parent_dir" - env_helper_path = ReCo.DEFAULT_EXPORTS_DIR * "/$parent_dir/env_helper.jld2" + env_helper_path = "$rl_dir/env_helper.jld2" # Pre experiment hook(PRE_EXPERIMENT_STAGE, agent, env) @@ -208,7 +209,7 @@ function run_rl( JLD2.save_object(env_helper_path, env_helper) - return env_helper + return (env_helper, rl_dir) end function gen_state_space_labels(state_label::String, state_space::Vector{Interval})