Skip to content
This repository has been archived by the owner on May 6, 2021. It is now read-only.

Commit

Permalink
Fix ppo pendulum example (#165)
Browse files Browse the repository at this point in the history
* fix action_space name conflict problem

* add ppo pendulum to tests
  • Loading branch information
albheim authored Apr 7, 2021
1 parent 8668f3c commit bc64e42
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/experiments/rl_envs/JuliaRL_PPO_Pendulum.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ function RLCore.Experiment(
lg = TBLogger(joinpath(save_dir, "tb_log"), min_level = Logging.Info)
rng = StableRNG(seed)
inner_env = PendulumEnv(T = Float32, rng = rng)
action_space = action_space(inner_env)
low = action_space.low
high = action_space.high
A = action_space(inner_env)
low = A.left
high = A.right
ns = length(state(inner_env))

N_ENV = 8
UPDATE_FREQ = 2048
env = MultiThreadEnv([
PendulumEnv(T = Float32, rng = StableRNG(hash(seed + i))) |>
ActionTransformedEnv(x -> clamp(x * 2, low, high)) for i in 1:N_ENV
env -> ActionTransformedEnv(env, action_mapping = x -> clamp(x * 2, low, high)) for i in 1:N_ENV
])

init = glorot_uniform(rng)
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ end
mean(Iterators.flatten(res.hook[1].rewards))
end

for method in (:DDPG, :SAC, :TD3)
for method in (:DDPG, :SAC, :TD3, :PPO)
res = run(
Experiment(
Val(:JuliaRL),
Expand Down

0 comments on commit bc64e42

Please sign in to comment.