code: def compute_budgets(
      min_resources: int,
      max_resources: int,
      reduction_factor: int,
      nums_population: int,
      pairs: int,
  ) -> list[list[BudgetTuple]]:
      """Compute the budgets used for each execution of hyperband"""
      budgets_eves = []
      if reduction_factor == 1:
          for i in range(min_resources, max_resources + 1):
              if i == min_resources:
                  budgets_eves.append([BudgetTuple(nums_population, i)])
              else:
                  budgets_eves[0].append(BudgetTuple(pairs * 2, i))
      else:
          num_brackets = int(
              np.log(max_resources) / np.log(reduction_factor)
          )
          budgets: list[list[BudgetTuple]] = []
          budgets_tab: dict[
              int, list[BudgetTuple]
          ] = {}  # just for display consideration
          for bracket_id in range(0, num_brackets + 1):
              bracket_budgets: list[BudgetTuple] = []
              num_trials = int(
                  np.ceil(
                      int(
                          (num_brackets + 1)
                          / (num_brackets - bracket_id + 1)
                      )
                      * (
                          reduction_factor
                          ** (num_brackets - bracket_id)
                      )
                  )
              )
  
              min_resources = max_resources / reduction_factor ** (
                  num_brackets - bracket_id
              )
              for i in range(0, num_brackets - bracket_id + 1):
                  n_i = int(num_trials / reduction_factor**i)
                  min_i = int(min_resources * reduction_factor**i)
                  bracket_budgets.append(BudgetTuple(n_i, min_i))
  
                  budget = BudgetTuple(n_i, min_i)
                  if budgets_tab.get(i):
                      budgets_tab[i].append(budget)
                  else:
                      budgets_tab[i] = [budget]
  
              budgets.append(bracket_budgets)
  
          for i in range(len(budgets[0])):
              if i == 0:
                  budgets_eves.append(
                      [BudgetTuple(nums_population, budgets[0][i][1])]
                  )
              else:
                  budgets_eves[0].append(
                      BudgetTuple(pairs * 2, budgets[0][i][1])
                  )
  
      return budgets_eves
  
imports: from __future__ import annotations
  import copy
  import importlib
  import logging
  from typing import Callable, ClassVar, Sequence, TypeVar
  import numpy
  from orion.algo.hyperband import BudgetTuple, Hyperband, HyperbandBracket
  from orion.algo.space import Space
  from orion.core.utils import format_trials
  from orion.core.utils.flatten import flatten
  from orion.core.worker.trial import Trial
label_desc: Use image node_id 1 for calling a global function with example usage: compute_budgets(min_resources, max_resources, reduction_factor, nums_population, pairs) and returns: budgets_eves