Fix reward of sparse setting

This commit is contained in:
kngwyu 2020-05-31 18:14:52 +09:00
parent e4d6338a30
commit d4f588cf0c

View File

@ -565,15 +565,15 @@ def _reward_fn(maze_id: str, dense: str) -> callable:
else: else:
if maze_id in ["Maze", "Push", "BlockMaze"]: if maze_id in ["Maze", "Push", "BlockMaze"]:
return ( return (
lambda obs, goal: -0.001 lambda obs, goal: 1.0
if np.linalg.norm(obs[:2] - goal) <= 0.6 if np.linalg.norm(obs[:2] - goal) <= 0.6
else 1.0 else -0.0001
) )
elif maze_id == "Fall": elif maze_id == "Fall":
return ( return (
lambda obs, goal: -0.001 lambda obs, goal: 1.0
if np.linalg.norm(obs[:3] - goal) <= 0.6 if np.linalg.norm(obs[:3] - goal) <= 0.6
else 1.0 else -0.0001
) )
else: else:
raise NotImplementedError(f"Unknown maze id: {maze_id}") raise NotImplementedError(f"Unknown maze id: {maze_id}")