Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revert maze reward function #158

Merged
merged 3 commits into from
Jun 23, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions gymnasium_robotics/envs/maze/maze.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,11 @@ def add_xy_position_noise(self, xy_pos: np.ndarray) -> np.ndarray:
def compute_reward(
self, achieved_goal: np.ndarray, desired_goal: np.ndarray, info
) -> float:
d = np.linalg.norm(achieved_goal - desired_goal, axis=-1)
distance = np.linalg.norm(achieved_goal - desired_goal, axis=-1)
if self.reward_type == "dense":
return np.exp(-d)
return np.exp(-distance)
elif self.reward_type == "sparse":
return -(d > 0.45).astype(np.float32)
return (distance <= 0.45).astype(np.float64)

def compute_terminated(
self, achieved_goal: np.ndarray, desired_goal: np.ndarray, info
Expand Down