src/seals/base_envs.py
def step(self, action: Action) -> Tuple[Observation, float, bool, dict]:
        """Transition state using given action."""
        if self.cur_state is None or self._n_actions_taken is None:
            raise ValueError("Need to call reset() before first step()")
        if action not in self.action_space:
            raise ValueError(f"{action} not in {self.action_space}")

        old_state = self.cur_state
        self.cur_state = self.transition(self.cur_state, action)
        assert self.cur_state in self.state_space, f"unexpected state {self.cur_state}"
        obs = self.obs_from_state(self.cur_state)
        assert obs in self.observation_space, f"{obs} not in {self.observation_space}"
        rew = self.reward(old_state, action, self.cur_state)
        done = self.terminal(self.cur_state, self._n_actions_taken)
        self._n_actions_taken += 1

        infos = {"old_state": old_state, "new_state": self.cur_state}
        return obs, rew, done, infos
Transition state using given action.
Transition state using given action.
Transition state using given action .
def step(self, action: Action) -> Tuple[Observation, float, bool, dict]:
        if self.cur_state is None or self._n_actions_taken is None:
            raise ValueError("Need to call reset() before first step()")
        if action not in self.action_space:
            raise ValueError(f"{action} not in {self.action_space}")
        old_state = self.cur_state
        self.cur_state = self.transition(self.cur_state, action)
        assert self.cur_state in self.state_space, f"unexpected state {self.cur_state}"
        obs = self.obs_from_state(self.cur_state)
        assert obs in self.observation_space, f"{obs} not in {self.observation_space}"
        rew = self.reward(old_state, action, self.cur_state)
        done = self.terminal(self.cur_state, self._n_actions_taken)
        self._n_actions_taken += 1
        infos = {"old_state": old_state, "new_state": self.cur_state}
        return obs, rew, done, infos
def step ( self , action : Action ) -> Tuple [ Observation , float , bool , dict ] : if self . cur_state is None or self . _n_actions_taken is None : raise ValueError ( "Need to call reset() before first step()" ) if action not in self . action_space : raise ValueError ( f"{action} not in {self.action_space}" ) old_state = self . cur_state self . cur_state = self . transition ( self . cur_state , action ) assert self . cur_state in self . state_space , f"unexpected state {self.cur_state}" obs = self . obs_from_state ( self . cur_state ) assert obs in self . observation_space , f"{obs} not in {self.observation_space}" rew = self . reward ( old_state , action , self . cur_state ) done = self . terminal ( self . cur_state , self . _n_actions_taken ) self . _n_actions_taken += 1 infos = { "old_state" : old_state , "new_state" : self . cur_state } return obs , rew , done , infos
Transition state using given action.
Transition state using given action .
"""Transition state using given action."""
self
action
Action