Make ORI_IND optional and adjust the size of maze for swimmer

This commit is contained in:
kngwyu 2021-05-07 19:25:57 +09:00
parent 409ee44568
commit d043a35e6c
3 changed files with 2 additions and 3 deletions

View File

@ -11,7 +11,7 @@ from gym.utils import EzPickle
class AgentModel(ABC, MujocoEnv, EzPickle): class AgentModel(ABC, MujocoEnv, EzPickle):
FILE: str FILE: str
MANUAL_COLLISION: bool MANUAL_COLLISION: bool
ORI_IND: int ORI_IND: Optional[int] = None
RADIUS: Optional[float] = None RADIUS: Optional[float] = None
def __init__(self, file_path: str, frame_skip: int) -> None: def __init__(self, file_path: str, frame_skip: int) -> None:

View File

@ -331,7 +331,7 @@ class SubGoalTRoom(GoalRewardTRoom):
class NoRewardRoom(MazeTask): class NoRewardRoom(MazeTask):
REWARD_THRESHOLD: float = 0.0 REWARD_THRESHOLD: float = 0.0
MAZE_SIZE_SCALING: Scaling = Scaling(4.0, 4.0, 4.0) MAZE_SIZE_SCALING: Scaling = Scaling(4.0, 4.0, 1.0)
def reward(self, obs: np.ndarray) -> float: def reward(self, obs: np.ndarray) -> float:
return 0.0 return 0.0

View File

@ -37,7 +37,6 @@ class SwimmerEnv(AgentModel):
def step(self, action: np.ndarray) -> Tuple[np.ndarray, float, bool, dict]: def step(self, action: np.ndarray) -> Tuple[np.ndarray, float, bool, dict]:
xy_pos_before = self.sim.data.qpos[:2].copy() xy_pos_before = self.sim.data.qpos[:2].copy()
self.do_simulation(action, self.frame_skip) self.do_simulation(action, self.frame_skip)
forward_reward = self._forward_reward(xy_pos_before) forward_reward = self._forward_reward(xy_pos_before)
ctrl_cost = self._ctrl_cost_weight * np.sum(np.square(action)) ctrl_cost = self._ctrl_cost_weight * np.sum(np.square(action))
return ( return (