Skip to content

Commit

Permalink
round action
Browse files Browse the repository at this point in the history
  • Loading branch information
PVirie committed Jan 3, 2025
1 parent b681796 commit ed2747c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tasks/rl_hopper.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,11 @@ def prepare_data_tuples(states, actions, rewards, num_layers, skip_steps):
for j in range(1000):
if random.random() <= epsilon or course == 0:
selected_action = env.action_space.sample()
# quantize to -1 0 1
selected_action = np.round(selected_action)
else:
a = model.react(alg.State(observation.data), stable_state)
# selected_action = np.clip(np.asarray(a.data), -1, 1)
selected_action = np.where(np.asarray(a.data) > 0, 1, -1)
selected_action = np.clip(np.asarray(a.data), -1, 1)

next_observation, reward, terminated, truncated, info = env.step(selected_action)
# check for nan
Expand Down

0 comments on commit ed2747c

Please sign in to comment.