def __init__(self,
               batch_size=None,
               discrete_rewards=True,
               parallelism=1,
               **env_kwargs):
    """Initializes this class by creating the envs and managing trajectories.

    Args:
      batch_size: (int or None) How many envs to make in the non natively
        batched mode.
      discrete_rewards: (bool) whether to round the rewards to the nearest
        integer.
      parallelism: (int) If this is greater than one then we run the envs in
        parallel using multi-threading.
      **env_kwargs: (dict) Additional kwargs to pass to the environments.
    """

    # Call the super's ctor.
    problem.Problem.__init__(self, was_reversed=False, was_copy=False)

    # An env generates data when it is given actions by an agent which is either
    # a policy or a human -- this is supposed to be the `id` of the agent.
    #
    # In practice, this is used only to store (and possibly retrieve) history
    # to an appropriate directory.
    self._agent_id = "default"

    # If set, we discretize the rewards and treat them as integers.
    self._discrete_rewards = discrete_rewards

    # A data structure to hold the `batch_size` currently active trajectories
    # and also the ones that are completed, i.e. done.
    self._trajectories = None

    self._batch_size = None

    self._parallelism = None
    # The parallelism is passes in via env_kwargs because it will be used by
    # `GymEnvProblem` to paralellize env actions across a batch.
    env_kwargs["parallelism"] = parallelism

    if batch_size is not None:
      self.initialize(batch_size=batch_size, **env_kwargs)
Initializes this class by creating the envs and managing trajectories.

    Args:
      batch_size: (int or None) How many envs to make in the non natively
        batched mode.
      discrete_rewards: (bool) whether to round the rewards to the nearest
        integer.
      parallelism: (int) If this is greater than one then we run the envs in
        parallel using multi-threading.
      **env_kwargs: (dict) Additional kwargs to pass to the environments.
    
tensor2tensor/envs/env_problem.py