class_docstr: Example vectorized environment, illustrating best-practice implementation pattern.
  
  State space: position in [0, 10].
  Action space: movement in {-1, 0, 1}.
  Random start in [0, 3] or [7, 10].
  Positive reward for moving towards the center 5.
class_docstr_tok: ["Example","vectorized","environment",",","illustrating","best-practice","implementation","pattern",".","State","space",":","position","in","[","0",",","10","]",".","Action","space",":","movement","in","{","-1",",","0",",","1","}",".","Random","start","in","[","0",",","3","]","or","[","7",",","10","]",".","Positive","reward","for","moving","towards","the","center","5","."]
code: def execute(self, actions):
      # Always for vectorized environments: expand actions if non-vectorized
      if not self._is_parallel:
          actions = np.expand_dims(actions, axis=0)
  
      # Vectorized environment logic
      reward = np.select(
          condlist=[self._states < 5, self._states > 5],
          choicelist=[
              (actions == 2).astype(np.float32),
              (actions == 0).astype(np.float32),
          ],
          default=np.ones(
              shape=self._parallel_indices.shape, dtype=np.float32
          ),
      )
      terminal = (
          np.random.random_sample(size=self._parallel_indices.shape)
          < 0.1
      )
      self._states = np.clip(
          self._states + (actions - 1), a_min=0, a_max=10
      )
  
      # Always for vectorized environments: update parallel indices and states,
      #                                     and return un-/vectorized values
      if self._is_parallel:
          self._parallel_indices = self._parallel_indices[~terminal]
          self._states = self._states[~terminal]
          return (
              self._parallel_indices.copy(),
              self._states.copy(),
              terminal,
              reward,
          )
      else:
          return self._states[0], terminal.item(), reward.item()
  
file_path: tensorforce/examples/vectorized_environment.py
imports: import numpy
  from tensorforce import Environment, Runner
label_desc: Use image node_id 6 for calling the VectorizedEnvironment obj's underlying member method code with example usage: obj.execute(actions) and returns: self,  self,  terminal,  reward, self,  terminal,  reward