1
0
Fork 0
mirror of https://gitlab.rlp.net/mobitar/ReCo.jl.git synced 2024-11-08 22:21:08 +00:00

Add rl_dir

This commit is contained in:
Mo8it 2022-02-07 18:41:25 +01:00
parent 0325ee36f9
commit 146b024e19
2 changed files with 6 additions and 5 deletions

View file

@ -11,7 +11,7 @@ function run_rl_prcesses_reward_discount(γs::AbstractVector)
Threads.@threads for γ_ind in 1:n_γs Threads.@threads for γ_ind in 1:n_γs
γ = γs[γ_ind] γ = γs[γ_ind]
env_helper = ReCo.run_rl(; env_helper, rl_dir = ReCo.run_rl(;
EnvType=ReCo.OriginEnv, EnvType=ReCo.OriginEnv,
n_episodes=400, n_episodes=400,
episode_duration=15.0, episode_duration=15.0,

View file

@ -79,7 +79,7 @@ end
""" """
run_rl(EnvType; <keyword arguments>) run_rl(EnvType; <keyword arguments>)
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 # 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. - `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) 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 # Pre experiment
hook(PRE_EXPERIMENT_STAGE, agent, env) hook(PRE_EXPERIMENT_STAGE, agent, env)
@ -208,7 +209,7 @@ function run_rl(
JLD2.save_object(env_helper_path, env_helper) JLD2.save_object(env_helper_path, env_helper)
return env_helper return (env_helper, rl_dir)
end end
function gen_state_space_labels(state_label::String, state_space::Vector{Interval}) function gen_state_space_labels(state_label::String, state_space::Vector{Interval})