Exemplo n.º 1
0
 def test_states_dict(self):
     gym_spaces = Dict({
         'history':
         Box(low=0.0, high=1.0, shape=(6, 50, 3), dtype=np.float32),
         'weights':
         Box(low=1.0, high=1.0, shape=(6, ), dtype=np.float32),
         'weights2':
         Box(low=1.0, high=1.0, shape=(6, ), dtype=np.float32)
     })
     tensorforce_spaces = {
         'history': {
             'shape': (6, 50, 3),
             'type': 'float'
         },
         'weights': {
             'shape': (6, ),
             'type': 'float'
         },
         'weights2': {
             'shape': (6, ),
             'type': 'float'
         }
     }
     env = OpenAIGymCustom(gym_id="CartPole-v0")
     self.assertEqual(env.state_from_space(gym_spaces), tensorforce_spaces,
                      "conversion of states is not correct")
Exemplo n.º 2
0
 def test_actions_dict(self):
     gym_spaces = Dict({
         'history':
         Box(low=0.0, high=1.0, shape=(6, 50, 3), dtype=np.float32),
         'weights':
         Box(low=1.0, high=1.0, shape=(6, ), dtype=np.float32),
         'weights2':
         Box(low=1.0, high=1.0, shape=(6, ), dtype=np.float32)
     })
     tensorforce_spaces = {
         'history': {
             'shape': (6, 50, 3),
             'type': 'float'
         },
         'weights': {
             'shape': (6, ),
             'type': 'float'
         },
         'weights2': {
             'shape': (6, ),
             'type': 'float'
         }
     }
     env = OpenAIGymCustom(gym_id="CartPole-v0")
     env.action_from_space(gym_spaces)
Exemplo n.º 3
0
 def test_actions_box(self):
     gym_spaces = Box(low=-10.0, high=10.0, shape=(1, ), dtype=np.float32)
     tensorforce_spaces = {
         'type': 'float',
         'shape': (1, ),
         'min_value': -10.0,
         'max_value': 10.0
     }
     env = OpenAIGymCustom(gym_id="CartPole-v0")
     self.assertEqual(env.action_from_space(gym_spaces), tensorforce_spaces,
                      "conversion of actions is not correct")
Exemplo n.º 4
0
 def test_actions_discrete(self):
     gym_spaces = Discrete(10)
     tensorforce_spaces = {'type': 'int', 'num_actions': 10}
     env = OpenAIGymCustom(gym_id="CartPole-v0")
     self.assertEqual(env.action_from_space(gym_spaces), tensorforce_spaces,
                      "conversion of actions is not correct")
Exemplo n.º 5
0
 def test_states_box(self):
     gym_spaces = Box(low=-10.0, high=10.0, shape=(1, ), dtype=np.float32)
     tensorforce_spaces = {'shape': (1, ), 'type': 'float'}
     env = OpenAIGymCustom(gym_id="CartPole-v0")
     self.assertEqual(env.state_from_space(gym_spaces), tensorforce_spaces,
                      "conversion of states is not correct")
Exemplo n.º 6
0
 def test_states_discrete(self):
     gym_spaces = Discrete(10)
     tensorforce_spaces = {'shape': (), 'type': 'int'}
     env = OpenAIGymCustom(gym_id="CartPole-v0")
     self.assertEqual(env.state_from_space(gym_spaces), tensorforce_spaces,
                      "conversion of states is not correct")