Add NoRewardBilliard

This commit is contained in:
kngwyu 2021-05-18 15:46:59 +09:00
parent fe7e4d5a11
commit f2c5ff9f3c

View File

@ -333,7 +333,7 @@ class NoRewardCorridor(MazeTask):
REWARD_THRESHOLD: float = 0.0 REWARD_THRESHOLD: float = 0.0
MAZE_SIZE_SCALING: Scaling = Scaling(4.0, 4.0, 1.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
@staticmethod @staticmethod
@ -448,6 +448,14 @@ class DistRewardBilliard(GoalRewardBilliard):
return -self.goals[0].euc_dist(obs[3:6]) / self.scale return -self.goals[0].euc_dist(obs[3:6]) / self.scale
class NoRewardBilliard(GoalRewardBilliard):
def __init__(self, scale: float) -> None:
MazeTask.__init__(self, scale)
def reward(self, _obs: np.ndarray) -> float:
return 0.0
class SubGoalBilliard(GoalRewardBilliard): class SubGoalBilliard(GoalRewardBilliard):
def __init__( def __init__(
self, self,
@ -504,10 +512,11 @@ class TaskRegistry:
"BlockMaze": [DistRewardBlockMaze, GoalRewardBlockMaze], "BlockMaze": [DistRewardBlockMaze, GoalRewardBlockMaze],
"Corridor": [DistRewardCorridor, GoalRewardCorridor, NoRewardCorridor], "Corridor": [DistRewardCorridor, GoalRewardCorridor, NoRewardCorridor],
"Billiard": [ "Billiard": [
DistRewardBilliard, DistRewardBilliard, # v0
GoalRewardBilliard, GoalRewardBilliard, # v1
SubGoalBilliard, SubGoalBilliard, # v2
BanditBilliard, BanditBilliard, # v3
NoRewardBilliard, # v4
], ],
} }