code: def _add_hybrid_formulation_to_block(
      block, model_definition, input_vars, output_vars
  ):
      """
      This function adds the Hybrid BigM representation to the OmltBlock
  
      Arguments:
          block -- OmltBlock
          model_definition -- LinearTreeDefinition Object
          input_vars -- input variables to the linear tree model
          output_vars -- output variable of the linear tree model
      """
      leaves = model_definition.leaves
      input_bounds = model_definition.scaled_input_bounds
      n_inputs = model_definition.n_inputs
  
      # The set of trees
      tree_ids = list(leaves.keys())
      # Create a list of tuples that contains the tree and leaf indices. Note that
      # the leaf indices depend on the tree in the ensemble.
      t_l = []
      for tree in tree_ids:
          for leaf in leaves[tree].keys():
              t_l.append((tree, leaf))
  
      features = np.arange(0, n_inputs)
  
      # Use the input_bounds and the linear models in the leaves to calculate
      # the lower and upper bounds on the output variable. Required for Pyomo.GDP
      output_bounds = _build_output_bounds(
          model_definition, input_bounds
      )
  
      # Ouptuts are automatically scaled based on whether inputs are scaled
      block.outputs.setub(output_bounds[1])
      block.outputs.setlb(output_bounds[0])
      block.scaled_outputs.setub(output_bounds[1])
      block.scaled_outputs.setlb(output_bounds[0])
  
      # Create the intermeditate variables. z is binary that indicates which leaf
      # in tree t is returned. intermediate_output is the output of tree t and
      # the total output of the model is the sum of the intermediate_output vars
      block.z = pe.Var(t_l, within=pe.Binary)
      block.intermediate_output = pe.Var(tree_ids)
  
      @block.Constraint(features, tree_ids)
      def lower_bound_constraints(mdl, feat, tree):
          leaf_ids = list(leaves[tree].keys())
          return (
              sum(
                  leaves[tree][leaf]["bounds"][feat][0]
                  * mdl.z[tree, leaf]
                  for leaf in leaf_ids
              )
              <= input_vars[feat]
          )
  
      @block.Constraint(features, tree_ids)
      def upper_bound_constraints(mdl, feat, tree):
          leaf_ids = list(leaves[tree].keys())
          return (
              sum(
                  leaves[tree][leaf]["bounds"][feat][1]
                  * mdl.z[tree, leaf]
                  for leaf in leaf_ids
              )
              >= input_vars[feat]
          )
  
      @block.Constraint(tree_ids)
      def linear_constraint(mdl, tree):
          leaf_ids = list(leaves[tree].keys())
          return block.intermediate_output[tree] == sum(
              (
                  sum(
                      leaves[tree][leaf]["slope"][feat]
                      * input_vars[feat]
                      for feat in features
                  )
                  + leaves[tree][leaf]["intercept"]
              )
              * block.z[tree, leaf]
              for leaf in leaf_ids
          )
  
      @block.Constraint(tree_ids)
      def only_one_leaf_per_tree(b, tree):
          leaf_ids = list(leaves[tree].keys())
          return sum(block.z[tree, leaf] for leaf in leaf_ids) == 1
  
      @block.Constraint()
      def output_sum_of_trees(b):
          return output_vars[0] == sum(
              block.intermediate_output[tree] for tree in tree_ids
          )
  
file_path: OMLT/src/omlt/linear_tree/lt_formulation.py
imports: import numpy
  import pyomo.environ
  from pyomo.gdp import Disjunct
  from omlt.formulation import _PyomoFormulation, _setup_scaled_inputs_outputs
label_desc: Use image node_id 3 for calling a global function with example usage: _add_hybrid_formulation_to_block(block, model_definition, input_vars, output_vars) and returns: unknown, unknown, unknown, unknown, unknown