Beispiel #1
0
    def __init__(
        self,
        goal=(1, 1),
        random_start=False,
        show_traces=True,
        completion_bonus=0.,
        never_done=False,
        action_scale=1.,
    ):
        Serializable.quick_init(self, locals())
        Parameterized.__init__(self)

        self._goal = np.array(goal, dtype=np.float32)
        self._point = np.zeros(2)
        self._completion_bonus = completion_bonus
        self._never_done = never_done
        self._action_scale = action_scale

        self.screen = None
        self.screen_width = 500
        self.screen_height = 500
        self.zoom = 50.
        self.show_traces = show_traces
        self.random_start = random_start

        self._traces = deque(maxlen=MAX_SHOWN_TRACES)
Beispiel #2
0
 def __init__(self, env=None, env_name=""):
     if env_name:
         super().__init__(gym.make(env_name))
     else:
         super().__init__(env)
     Parameterized.__init__(self)
     Serializable.quick_init(self, locals())
Beispiel #3
0
    def __init__(self, wrapped_env=None, wrapped_policy=None):
        assert isinstance(wrapped_policy, MultitaskPolicy)
        Serializable.quick_init(self, locals())
        Parameterized.__init__(self)

        self._wrapped_env = wrapped_env
        self._wrapped_policy = wrapped_policy
        self._last_obs = None
Beispiel #4
0
    def __init__(self, env=None, env_name=""):
        if env_name:
            super().__init__(gym.make(env_name))
        else:
            super().__init__(env)

        self.action_space = self._to_akro_space(self.env.action_space)
        self.observation_space = self._to_akro_space(
            self.env.observation_space)

        Parameterized.__init__(self)
        Serializable.quick_init(self, locals())
Beispiel #5
0
    def __init__(self,
                 wrapped_env=None,
                 wrapped_policy=None,
                 latents=None,
                 normalize=False):
        assert isinstance(wrapped_policy, MultitaskPolicy)
        Serializable.quick_init(self, locals())
        Parameterized.__init__(self)

        self._wrapped_env = wrapped_env
        self._wrapped_policy = wrapped_policy
        self._latents = np.array(latents)
        self._last_obs = None
        self._normalize = normalize
    def __init__(self,
                 task_selection_strategy=round_robin,
                 task_env_cls=None,
                 task_args=None,
                 task_kwargs=None):
        Serializable.quick_init(self, locals())
        Parameterized.__init__(self)

        self._task_envs = [
            task_env_cls(*t_args, **t_kwargs)
            for t_args, t_kwargs in zip(task_args, task_kwargs)
        ]
        self._task_selection_strategy = task_selection_strategy
        self._active_task = None
    def __init__(self,
                 wrapped_env=None,
                 wrapped_policy=None,
                 latents=None,
                 skip_steps=1,
                 deterministic=True):
        assert isinstance(wrapped_policy, MultitaskPolicy)
        assert isinstance(latents, list)
        Serializable.quick_init(self, locals())
        Parameterized.__init__(self)

        self._wrapped_env = wrapped_env
        self._wrapped_policy = wrapped_policy
        self._latents = latents
        self._last_obs = None
        self._skip_steps = skip_steps
        self._deterministic = deterministic
Beispiel #8
0
    def __init__(self, wrapped_env=None, wrapped_policy=None):
        assert isinstance(wrapped_policy, MultitaskPolicy)
        Serializable.quick_init(self, locals())
        Parameterized.__init__(self)

        self._wrapped_env = wrapped_env
        self._wrapped_policy = wrapped_policy
        self._last_obs = None

        n_task = self._wrapped_policy.task_space.flat_dim
        one_hots = np.identity(n_task)
        latents, infos = self._wrapped_policy._embedding.get_latents(one_hots)
        latents_means = infos["mean"]
        self._latents_combination_hash = list()
        for i in range(n_task):
            for j in range(i + 1, n_task):
                self._latents_combination_hash.append(
                    (latents_means[i, ...], latents_means[j, ...]))

        self._latents_combination_hash = tuple(self._latents_combination_hash)
        self._n_skills = n_task
Beispiel #9
0
 def __init__(self, env_spec):
     Parameterized.__init__(self)
     self._env_spec = env_spec
Beispiel #10
0
 def __init__(self, env):
     Serializable.quick_init(self, locals())
     Parameterized.__init__(self)
     super().__init__(env)
Beispiel #11
0
 def __init__(self, *args, **kwargs):
     Serializable.quick_init(self, locals())
     Parameterized.__init__(self)
     super().__init__(SawyerReachXYZEnv(*args, **kwargs))
 def __init__(self, env):
     Serializable.quick_init(self, locals())
     Parameterized.__init__(self)
     NormalizedEnv.__init__(self, env)