forked from COMP579TA/COMP579-Project-Template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenvironments.py
43 lines (32 loc) · 994 Bytes
/
environments.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import gym
import numpy as np
class JellyBeanEnv(gym.Wrapper):
'''The JellyBean Environment Wrapper.'''
def __init__(self, env):
super().__init__(env)
self.env = env
def reset(self):
return self.env.reset()
def step(self, action):
next_obs, reward, done, info = self.env.step(action)
return next_obs, reward, done, info
def seed(self, seed):
self.env.seed(seed)
self.env.action_space.seed(seed)
self.env.scent_space.seed(seed)
self.env.vision_space.seed(seed)
self.env.feature_space.seed(seed)
class MujocoEnv(gym.Wrapper):
'''The Mujoco Environment Wrapper.'''
def __init__(self, env):
super().__init__(env)
self.env = env
def reset(self):
return self.env.reset()
def step(self, action):
next_obs, reward, done, info = self.env.step(action)
return next_obs, reward, done, info
def seed(self, seed):
self.env.seed(seed)
self.env.action_space.seed(seed)
self.env.observation_space.seed(seed)