Skip to content

Commit

Permalink
Do not treat reward conctact as separate objective in ant-v5
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasAlegre committed Oct 25, 2024
1 parent f4261ba commit 5188672
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions mo_gymnasium/envs/mujoco/ant_v5.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,16 @@ def step(self, action):
x_velocity = info["x_velocity"]
y_velocity = info["y_velocity"]
cost = info["reward_ctrl"]
contact_cost = info["reward_contact"]
healthy_reward = info["reward_survive"]

if self.cost_objetive:
cost /= self._ctrl_cost_weight # Ignore the weight in the original AntEnv
contact_cost /= self._contact_cost_weight
vec_reward = np.array([x_velocity, y_velocity, cost], dtype=np.float32)
else:
vec_reward = np.array([x_velocity, y_velocity], dtype=np.float32)
vec_reward += cost + contact_cost
vec_reward += cost

vec_reward += healthy_reward
vec_reward += info["reward_contact"] # Do not treat contact forces as a separate objective

return observation, vec_reward, terminated, truncated, info

0 comments on commit 5188672

Please sign in to comment.