Skip to content

Commit

Permalink
Fix MPE SimpleEnv continuous actions to move in the same direction as…
Browse files Browse the repository at this point in the history
… discrete case (Farama-Foundation#1144)
  • Loading branch information
elliottower authored Dec 7, 2023
1 parent 2cb7596 commit f7a9ef1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pettingzoo/mpe/_mpe_utils/simple_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,9 @@ def _set_action(self, action, agent, action_space, time=None):
agent.action.u = np.zeros(self.world.dim_p)
if self.continuous_actions:
# Process continuous action as in OpenAI MPE
agent.action.u[0] += action[0][1] - action[0][2]
agent.action.u[1] += action[0][3] - action[0][4]
# Note: this ordering preserves the same movement direction as in the discrete case
agent.action.u[0] += action[0][2] - action[0][1]
agent.action.u[1] += action[0][4] - action[0][3]
else:
# process discrete action
if action[0] == 1:
Expand Down

0 comments on commit f7a9ef1

Please sign in to comment.