def _convert_space(space):
    '''Converts a rl-gym space to our own space representation'''
    if isinstance(space, spaces.Box):
        assert space.low.ndim == 1 and space.low.shape >= 1
        return policyopt.ContinuousSpace(dim=space.low.shape[0])
    elif isinstance(space, spaces.Discrete):
        return policyopt.FiniteSpace(size=space.n)
    raise NotImplementedError(space)
Beispiel #2
0
def _convert_space(space):
    '''Converts a rl-gym space to our own space representation'''
    if isinstance(space, spaces.Box):
        #        print("Debug: rlgymenv")
        #        print(type(space.low.ndim), space.low.ndim)
        #        print(type(space.low.shape), space.low.shape)
        assert space.low.ndim == 1 and space.low.shape >= 1
        #        assert space.low.ndim == 1
        #        if type(space.low.shape) == type(tuple()):
        #            assert space.low.shape[0] >= 1
        #        else:
        #            assert space.low.shape >= 1
        return policyopt.ContinuousSpace(dim=space.low.shape[0])
    elif isinstance(space, spaces.Discrete):
        return policyopt.FiniteSpace(size=space.n)
    raise NotImplementedError(space)