1
0
Fork 0
mirror of https://gitlab.rlp.net/mobitar/ReCo.jl.git synced 2024-12-21 00:51:21 +00:00
ReCo.jl/src/RL/EnvHelper.jl

56 lines
1.4 KiB
Julia
Raw Normal View History

2022-01-11 18:00:41 +00:00
abstract type EnvHelper end
struct EnvHelperSharedProps{H<:AbstractHook}
env::Env
agent::Agent
hook::H
n_steps_before_actions_update::Int64
2022-01-30 02:20:45 +00:00
n_actions_updates_per_episode::Int64
2022-01-30 02:32:47 +00:00
reward_normalization::Float64
2022-01-11 18:00:41 +00:00
elliptical_a_b_ratio::Float64
2022-01-11 18:00:41 +00:00
n_particles::Int64
2022-01-15 20:27:15 +00:00
old_states_id::Vector{Int64}
states_id::Vector{Int64}
2022-01-11 18:00:41 +00:00
actions::Vector{SVector{2,Float64}}
2022-01-15 20:27:15 +00:00
actions_id::Vector{Int64}
2022-01-11 18:00:41 +00:00
function EnvHelperSharedProps(
env::Env,
agent::Agent,
2022-01-18 01:25:28 +00:00
hook::H,
2022-01-11 18:00:41 +00:00
n_steps_before_actions_update::Int64,
2022-01-30 02:20:45 +00:00
n_actions_updates_per_episode::Int64,
elliptical_a_b_ratio::Float64,
2022-01-11 18:00:41 +00:00
n_particles::Int64,
2022-01-18 01:25:28 +00:00
) where {H<:AbstractHook}
2022-01-30 02:32:47 +00:00
reward_normalization = n_particles * n_actions_updates_per_episode
2022-01-18 01:25:28 +00:00
return new{H}(
2022-01-11 18:00:41 +00:00
env,
agent,
hook,
n_steps_before_actions_update,
2022-01-30 02:20:45 +00:00
n_actions_updates_per_episode,
2022-01-30 02:32:47 +00:00
reward_normalization,
elliptical_a_b_ratio,
2022-01-11 18:00:41 +00:00
n_particles,
fill(0, n_particles),
fill(0, n_particles),
fill(SVector(0.0, 0.0), n_particles),
fill(0, n_particles),
)
end
end
2022-01-14 11:28:47 +00:00
function gen_env_helper(::Env, env_helper_params::EnvHelperSharedProps; args)
2022-01-14 12:01:14 +00:00
return ReCo.method_not_implemented()
2022-01-11 18:00:41 +00:00
end
function get_env_agent_hook(env_helper::EnvHelper)
return (env_helper.shared.env, env_helper.shared.agent, env_helper.shared.hook)
end