class_docstr: Based on OpenAI Gym version
  (https://github.com/openai/gym/blob/master/gym/envs/classic_control/cartpole.py)
code: def execute(self, actions):
      if not self._is_parallel:
          actions = np.expand_dims(actions, axis=0)
  
      # Split state into components
      loc = self._states[:, 0]
      loc_vel = self._states[:, 1]
      angle = self._states[:, 2]
      angle_vel = self._states[:, 3]
  
      # Make action continuous
      if self._action_continuous:
          force = actions
      else:
          force = np.where(
              actions == 2, 0.0, np.where(actions == 1, 1.0, -1.0)
          )
      force *= self._relative_force * self._gravity
  
      # Compute accelerations (https://coneural.org/florian/papers/05_cart_pole.pdf)
      cos_angle = np.cos(angle)
      sin_angle = np.sin(angle)
      total_mass = self._cart_mass + self._pole_mass
      pole_mass_length = self._pole_mass * self._pole_length
      bracket = (
          force + pole_mass_length * angle_vel * angle_vel * sin_angle
      ) / total_mass
      denom = self._pole_length * (
          4.0 / 3.0
          - (self._pole_mass * cos_angle * cos_angle) / total_mass
      )
      angle_acc = (
          self._gravity * sin_angle - cos_angle * bracket
      ) / denom
      loc_acc = (
          bracket
          - pole_mass_length * angle_acc * cos_angle / total_mass
      )
  
      # Integration
      deriv = np.stack([loc_vel, loc_acc, angle_vel, angle_acc], axis=1)
      self._states += self._action_timedelta * deriv
  
      # Terminal
      terminal = (np.abs(self._states) > self._state_bounds).any(axis=1)
  
      # Reward
      reward = np.ones_like(terminal, dtype=np.float32)
  
      if self._is_parallel:
          self._parallel_indices = self._parallel_indices[~terminal]
          self._states = self._states[~terminal]
          return (
              self._parallel_indices.copy(),
              self._states[:, self._state_indices],
              terminal,
              reward,
          )
      else:
          return (
              self._states[0, self._state_indices],
              terminal.item(),
              reward.item(),
          )
  
file_path: tensorforce/tensorforce/environments/cartpole.py
imports: import numpy
  from tensorforce.environments import Environment
label_desc: Use image node_id 6 for calling the CartPole obj's underlying member method code with example usage: obj.execute(actions) and returns: self,  self,  terminal,  reward, self,  terminal,  reward