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

Commit bc64e42

Browse files
authored
Fix ppo pendulum example (#165)
* fix action_space name conflict problem * add ppo pendulum to tests
1 parent 8668f3c commit bc64e42

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/experiments/rl_envs/JuliaRL_PPO_Pendulum.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ function RLCore.Experiment(
1414
lg = TBLogger(joinpath(save_dir, "tb_log"), min_level = Logging.Info)
1515
rng = StableRNG(seed)
1616
inner_env = PendulumEnv(T = Float32, rng = rng)
17-
action_space = action_space(inner_env)
18-
low = action_space.low
19-
high = action_space.high
17+
A = action_space(inner_env)
18+
low = A.left
19+
high = A.right
2020
ns = length(state(inner_env))
2121

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

2929
init = glorot_uniform(rng)

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ end
7575
mean(Iterators.flatten(res.hook[1].rewards))
7676
end
7777

78-
for method in (:DDPG, :SAC, :TD3)
78+
for method in (:DDPG, :SAC, :TD3, :PPO)
7979
res = run(
8080
Experiment(
8181
Val(:JuliaRL),

0 commit comments

Comments
 (0)