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-11 18:00:41 +00:00
|
|
|
|
2022-01-25 23:20:53 +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,
|
2022-01-25 23:20:53 +00:00
|
|
|
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}
|
|
|
|
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-25 23:20:53 +00:00
|
|
|
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
|