Farama-Foundation / Gymnasium-Robotics

A collection of robotics simulation environments for reinforcement learning
https://robotics.farama.org/
MIT License
529 stars 85 forks source link

[Question] Maze Dense Reward #175

Open llewynS opened 1 year ago

llewynS commented 1 year ago

Question

Looking at the dense reward function for Maze Env:

return np.exp(-np.linalg.norm(desired_goal - achieved_goal))

The agent seems to prefer sitting the ball as close as possible to the goal without touching it after optimisation.

This makes sense given there is no bonus for reaching the reward and the reward is positive for all time steps.

Why is the dense reward formulated this way?

Kallinteris-Andreas commented 9 months ago
  1. Are you using continuing_task=True (which is the default)?
  2. Are you resetting about termination=True?
  3. Have you experimented with other reward functions?
onnoeberhard commented 7 months ago

Somewhat related: the description of the maze environments says the returned reward is the negative Euclidean distance between the achieved goal position and the desired goal. This is wrong (it is the exponential of the negative distance).

Kallinteris-Andreas commented 7 months ago

@onnoeberhard https://github.com/Farama-Foundation/Gymnasium-Robotics/blob/8606192735a9963d1dcc12feade037b77d9349be/gymnasium_robotics/envs/maze/maze_v4.py#L374-L381

You are correct, can you make a PR to fix it? You can use the Gymnasium/MuJoCo as reference https://gymnasium.farama.org/main/environments/mujoco/ant/#rewards