mirror of
https://github.com/wassname/DeepRL.git
synced 2026-10-30 12:50:27 +08:00
DDPG
This commit is contained in:
1 parent
0b88546091
commit
5447d64caa
7 files changed
+389
-3
No files matched your search
@@ -27,6 +27,8 @@ class BasicTask:
|
||||
next_state = self.normalize_state(next_state)
|
||||
return next_state, np.sign(reward), done, info
|
||||
|
||||
|
||||
|
||||
class MountainCar(BasicTask):
|
||||
name = 'MountainCar-v0'
|
||||
success_threshold = -110
|
||||
@@ -71,3 +73,29 @@ class PixelAtari(BasicTask):
|
||||
|
||||
def normalize_state(self, state):
|
||||
return np.asarray(state, dtype=np.float32) / 255.0
|
||||
|
||||
|
||||
class ContinuousMountainCar(BasicTask):
|
||||
name = 'MountainCarContinuous-v0'
|
||||
success_threshold = 1000
|
||||
|
||||
def __init__(self):
|
||||
BasicTask.__init__(self)
|
||||
self.env = gym.make(self.name)
|
||||
self.env._max_episode_steps = sys.maxsize
|
||||
|
||||
|
||||
class Pendulum(BasicTask):
|
||||
name = 'Pendulum-v0'
|
||||
success_threshold = 200
|
||||
|
||||
def __init__(self):
|
||||
BasicTask.__init__(self)
|
||||
self.env = gym.make(self.name)
|
||||
self.env._max_episode_steps = sys.maxsize
|
||||
|
||||
def step(self, action):
|
||||
next_state, reward, done, info = self.env.step(action)
|
||||
if self.normalized_state:
|
||||
next_state = self.normalize_state(next_state)
|
||||
return next_state, reward, done, info
|
||||
Reference in new issue
Block a user