code: def min_budget_calculation(
      search_space_ins: SpaceWrapper,
      dataset: str,
      N_K_ratio: int,
      sh: BudgetAwareControllerSH,
      t1_: float,
  ):
      # Calculate the minimum budget requirements for both phases
      K_max = int(len(search_space_ins) / N_K_ratio)
  
      if search_space_ins.name == Config.NB101:
          U_options = [4, 12, 16, 108]
      elif search_space_ins.name == Config.NB201:
          U_options = list(range(1, 200))
      elif search_space_ins.name == Config.MLPSP:
          # TODO: This is for benchmark only
          if dataset == Config.Frappe:
              MaxEpochTrained = 20
          elif dataset == Config.Criteo:
              MaxEpochTrained = 10
          elif dataset == Config.UCIDataset:
              MaxEpochTrained = 40
          else:
              raise NotImplementedError
          U_options = list(range(1, MaxEpochTrained))
      else:
          raise NotImplementedError
  
      U_min = U_options[0]
      min_budget_required_both_phase = (
          sh.pre_calculate_time_required(K=1, U=U_min)[1]
          + N_K_ratio * t1_
      )
  
      return K_max, U_options, U_min, min_budget_required_both_phase
  
imports: from src.common.constant import Config
  from src.eva_engine.phase2.run_sh import BudgetAwareControllerSH
  from src.logger import logger
  from src.search_space.core.space import SpaceWrapper
label_desc: Use image node_id 1 for calling a global function with example usage: min_budget_calculation(search_space_ins, dataset, N_K_ratio, sh, t1_) and returns: K_max,  U_options,  U_min,  min_budget_required_both_phase