class_docstr: A simple HRL graph manager creates a deep hierarchy with a single composite agent per hierarchy level, and a single
  environment which is interacted with.
class_docstr_tok: ["A","simple","HRL","graph","manager","creates","a","deep","hierarchy","with","a","single","composite","agent","per","hierarchy","level",",","and","a","single","environment","which","is","interacted","with","."]
docstr: :param agents_params: the parameters of all the agents in the hierarchy starting from the top level of the
                        hierarchy to the bottom level
  :param env_params: the parameters of the environment
  :param schedule_params: the parameters for scheduling the graph
  :param vis_params: the visualization parameters
  :param consecutive_steps_to_run_each_level: the number of time steps that each level is ran.
      for example, when the top level gives the bottom level a goal, the bottom level can act for
      consecutive_steps_to_run_each_level steps and try to reach that goal. This is expected to be either
      an EnvironmentSteps which will be used for all levels, or an EnvironmentSteps for each level as a list.
docstr_tok: [":","param","agents_params",":","the","parameters","of","all","the","agents","in","the","hierarchy","starting","from","the","top","level","of","the","hierarchy","to","the","bottom","level",":","param","env_params",":","the","parameters","of","the","environment",":","param","schedule_params",":","the","parameters","for","scheduling","the","graph",":","param","vis_params",":","the","visualization","parameters",":","param","consecutive_steps_to_run_each_level",":","the","number","of","time","steps","that","each","level","is","ran",".","for","example",",","when","the","top","level","gives","the","bottom","level","a","goal",",","the","bottom","level","can","act","for","consecutive_steps_to_run_each_level","steps","and","try","to","reach","that","goal",".","This","is","expected","to","be","either","an","EnvironmentSteps","which","will","be","used","for","all","levels",",","or","an","EnvironmentSteps","for","each","level","as","a","list","."]
code: def __init__(
      self,
      agents_params: List[AgentParameters],
      env_params: EnvironmentParameters,
      schedule_params: ScheduleParameters,
      vis_params: VisualizationParameters,
      consecutive_steps_to_run_each_level: Union[
          EnvironmentSteps, List[EnvironmentSteps]
      ],
      preset_validation_params: PresetValidationParameters = PresetValidationParameters(),
  ):
      """
      :param agents_params: the parameters of all the agents in the hierarchy starting from the top level of the
                            hierarchy to the bottom level
      :param env_params: the parameters of the environment
      :param schedule_params: the parameters for scheduling the graph
      :param vis_params: the visualization parameters
      :param consecutive_steps_to_run_each_level: the number of time steps that each level is ran.
          for example, when the top level gives the bottom level a goal, the bottom level can act for
          consecutive_steps_to_run_each_level steps and try to reach that goal. This is expected to be either
          an EnvironmentSteps which will be used for all levels, or an EnvironmentSteps for each level as a list.
      """
      super().__init__("hrl_graph", schedule_params, vis_params)
      self.agents_params = agents_params
      self.env_params = env_params
      self.preset_validation_params = preset_validation_params
      if isinstance(consecutive_steps_to_run_each_level, list):
          if len(consecutive_steps_to_run_each_level) != len(
              self.agents_params
          ):
              raise ValueError(
                  "If the consecutive_steps_to_run_each_level is given as a list, it should match "
                  "the number of levels in the hierarchy. Alternatively, it is possible to use a single "
                  "value for all the levels, by passing an EnvironmentSteps"
              )
      elif isinstance(
          consecutive_steps_to_run_each_level, EnvironmentSteps
      ):
          self.consecutive_steps_to_run_each_level = [
              consecutive_steps_to_run_each_level
          ] * len(self.agents_params)
  
      for agent_params in agents_params:
          agent_params.visualization = self.visualization_parameters
          if agent_params.input_filter is None:
              agent_params.input_filter = (
                  self.env_params.default_input_filter()
              )
          if agent_params.output_filter is None:
              agent_params.output_filter = (
                  self.env_params.default_output_filter()
              )
  
      if len(self.agents_params) < 2:
          raise ValueError(
              "The HRL graph manager must receive the agent parameters for at least two levels of the "
              "hierarchy. Otherwise, use the basic RL graph manager."
          )
  
file_path: coach/rl_coach/graph_managers/hrl_graph_manager.py
imports: from typing import List, Union, Tuple
  from rl_coach.base_parameters import AgentParameters, VisualizationParameters, TaskParameters, PresetValidationParameters
  from rl_coach.core_types import EnvironmentSteps
  from rl_coach.environments.environment import EnvironmentParameters, Environment
  from rl_coach.graph_managers.graph_manager import GraphManager, ScheduleParameters
  from rl_coach.level_manager import LevelManager
  from rl_coach.utils import short_dynamic_import
label_desc: Use image node_id 1 to create a new HRLGraphManager object from inherited base classes: GraphManager with example: obj = HRLGraphManager(agents_params, env_params, schedule_params, vis_params, consecutive_steps_to_run_each_level, preset_validation_params)