def __init__(self, config): if config.get("simplex_actions", False): self.action_space = Simplex((2, )) else: self.action_space = Box(0.0, 1.0, (1, )) self.observation_space = Box(0.0, 1.0, (1, )) self.max_steps = config.get("max_steps", 100) self.state = None self.steps = None
def test_simplex_space(self): space = Simplex(shape=(3, 4), concentration=np.array((1, 2, 1))) d = gym_space_to_dict(space) sp = gym_space_from_dict(d) _assert_array_equal(self.assertEqual, space.shape, sp.shape) _assert_array_equal(self.assertAlmostEqual, space.concentration, sp.concentration) self.assertEqual(space.dtype, sp.dtype)
def _simplex(d: Dict) -> Simplex: return Simplex(**__common(d))