class_docstr: Based on OpenAI Gym version
  (https://github.com/openai/gym/blob/master/gym/envs/classic_control/cartpole.py)
code: def __init__(
      self,
      # Physics parameters
      pole_mass=(0.05, 0.5),  # 0.1
      pole_length=(0.1, 1.0),  # 0.5, actually half the pole's length
      cart_mass=(0.5, 1.5),
      relative_force=(0.75, 1.5),  # 1.0, relative to gravity
      gravity=9.8,
      # State space
      state_velocities=True,
      state_location=False,  # true
      state_initial_max_angle=0.05,
      state_initial_max_angle_velocity=0.05,
      state_initial_max_velocity=0.05,
      # Action space
      action_timedelta=0.02,
      action_continuous=False,
      action_noop=True,  # false
  ):
      super().__init__()
  
      # Physics parameters
      if isinstance(pole_mass, tuple):
          assert (
              len(pole_mass) == 2 and 0.0 < pole_mass[0] < pole_mass[1]
          )
          self._pole_mass_range = (
              float(pole_mass[0]),
              float(pole_mass[1]),
          )
      else:
          assert pole_mass > 0.0
          self._pole_mass_range = (float(pole_mass), float(pole_mass))
      if isinstance(pole_length, tuple):
          assert (
              len(pole_length) == 2
              and 0.0 < pole_length[0] < pole_length[1]
          )
          self._pole_length_range = (
              float(pole_length[0]),
              float(pole_length[1]),
          )
      else:
          assert pole_length > 0.0
          self._pole_length_range = (
              float(pole_length),
              float(pole_length),
          )
      if isinstance(cart_mass, tuple):
          assert (
              len(cart_mass) == 2 and 0.0 < cart_mass[0] < cart_mass[1]
          )
          self._cart_mass_range = (
              float(cart_mass[0]),
              float(cart_mass[1]),
          )
      else:
          assert cart_mass > 0.0
          self._cart_mass_range = (float(cart_mass), float(cart_mass))
      if isinstance(relative_force, tuple):
          assert (
              len(relative_force) == 2
              and 0.0 < relative_force[0] < relative_force[1]
          )
          self._relative_force_range = (
              float(relative_force[0]),
              float(relative_force[1]),
          )
      else:
          assert relative_force > 0.0
          self._relative_force_range = (
              float(relative_force),
              float(relative_force),
          )
      assert gravity > 0.0
      self._gravity = float(gravity)
  
      # State space
      state_indices = [2]
      self._state_velocities = bool(state_velocities)
      if self._state_velocities:
          state_indices.append(3)
          state_indices.append(1)
      self._state_location = bool(state_location)
      if self._state_location:
          state_indices.append(0)
      self._state_indices = np.array(state_indices, np.int32)
      self._state_initials = np.array(
          [
              [
                  0.0,
                  float(state_initial_max_velocity),
                  float(state_initial_max_angle),
                  float(state_initial_max_angle_velocity),
              ]
          ],
          dtype=np.float32,
      )
  
      # Action space
      self._action_timedelta = float(action_timedelta)  # in seconds
      assert not action_continuous or action_noop
      self._action_continuous = bool(action_continuous)
      self._action_noop = bool(action_noop)
  
      # State bounds
      angle_bound = float(np.pi) / 4.0
      max_angle_acc_in_zero = (
          self._relative_force_range[1]
          * self._gravity
          / (self._cart_mass_range[0] + self._pole_mass_range[0])
          / self._pole_length_range[0]
          / (
              4.0 / 3.0
              - self._pole_mass_range[1]
              / (self._cart_mass_range[0] + self._pole_mass_range[0])
          )
      )
      min_angle_acc_in_zero = (
          self._relative_force_range[0]
          * self._gravity
          / (self._cart_mass_range[1] + self._pole_mass_range[1])
          / self._pole_length_range[1]
          / (
              4.0 / 3.0
              - self._pole_mass_range[0]
              / (self._cart_mass_range[1] + self._pole_mass_range[1])
          )
      )
      max_loc_acc_in_zero = (
          self._relative_force_range[1] * self._gravity
          - self._pole_mass_range[0]
          * self._pole_length_range[0]
          * min_angle_acc_in_zero
      ) / (self._cart_mass_range[0] + self._pole_mass_range[0])
      angle_vel_bound = (
          max_angle_acc_in_zero * self._action_timedelta * 10.0
      )
      loc_vel_bound = (
          max_loc_acc_in_zero * self._action_timedelta * 10.0
      )
      if self._state_location:
          loc_bound = loc_vel_bound
      else:
          loc_bound = np.inf
      self._state_bounds = np.array(
          [[loc_bound, loc_vel_bound, angle_bound, angle_vel_bound]],
          dtype=np.float32,
      )
      assert (self._state_bounds > 0.0).all()
  
file_path: tensorforce/tensorforce/environments/cartpole.py
imports: import numpy
  from tensorforce.environments import Environment
label_desc: Use image node_id 1 to create a new CartPole object from inherited base classes: Environment with example: obj = CartPole(pole_mass, pole_length, cart_mass, relative_force, gravity, state_velocities, state_location, state_initial_max_angle, state_initial_max_angle_velocity, state_initial_max_velocity, action_timedelta, action_continuous, action_noop)