예제 #1
0
 def _check_domain_additional(cls, domain: Domain) -> bool:
     if isinstance(domain, SingleAgent):
         return isinstance(domain.get_action_space(), GymSpace) and \
                isinstance(domain.get_observation_space(), GymSpace)
     else:
         return all(isinstance(a, GymSpace) for a in domain.get_action_space().values()) \
                and all(isinstance(o, GymSpace) for o in domain.get_observation_space().values())
예제 #2
0
    def __init__(self, domain: Domain, unwrap_spaces: bool = True) -> None:
        """Initialize AsGymEnv.

        # Parameters
        domain: The scikit-decide domain to wrap as an OpenAI Gym environment.
        unwrap_spaces: Boolean specifying whether the action & observation spaces should be unwrapped.
        """
        self._domain = domain
        self._unwrap_spaces = unwrap_spaces
        if unwrap_spaces:
            self.observation_space = domain.get_observation_space().unwrapped()
            self.action_space = (domain.get_action_space().unwrapped()
                                 )  # assumes all actions are always applicable
        else:
            self.observation_space = domain.get_observation_space()
            self.action_space = (domain.get_action_space()
                                 )  # assumes all actions are always applicable
예제 #3
0
 def _check_domain_additional(cls, domain: Domain) -> bool:
     return isinstance(domain.get_action_space(), GymSpace) and isinstance(
         domain.get_observation_space(), GymSpace)