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
|
|
|
|
2022-02-01 21:57:56 +00:00
|
|
|
elliptical_b_a_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,
|
2022-02-01 21:57:56 +00:00
|
|
|
elliptical_b_a_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,
|
2022-02-01 21:57:56 +00:00
|
|
|
elliptical_b_a_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-05-01 16:13:35 +00:00
|
|
|
function gen_env_helper(::Env, env_helper_params::EnvHelperSharedProps; kwargs...)
|
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)
|
2022-03-19 22:11:03 +00:00
|
|
|
end
|