class_docstr: Extends HyperBand early stopping algorithm for BOHB.
  
  This implementation removes the ``HyperBandScheduler`` pipelining. This
  class introduces key changes:
  
  1. Trials are now placed so that the bracket with the largest size is
  filled first.
  
  2. Trials will be paused even if the bracket is not filled. This allows
  BOHB to insert new trials into the training.
  
  See ray.tune.schedulers.HyperBandScheduler for parameter docstring.
docstr: Adds new trial.
  
  On a new trial add, if current bracket is not filled, add to current
  bracket. Else, if current band is not filled, create new bracket, add
  to current bracket. Else, create new iteration, create new bracket,
  add to bracket.
code: def on_trial_add(
      self, tune_controller: "TuneController", trial: Trial
  ):
      """Adds new trial.
  
      On a new trial add, if current bracket is not filled, add to current
      bracket. Else, if current band is not filled, create new bracket, add
      to current bracket. Else, create new iteration, create new bracket,
      add to bracket.
      """
      if not self._metric or not self._metric_op:
          raise ValueError(
              "{} has been instantiated without a valid `metric` ({}) or "
              "`mode` ({}) parameter. Either pass these parameters when "
              "instantiating the scheduler, or pass them as parameters "
              "to `tune.TuneConfig()`".format(
                  self.__class__.__name__, self._metric, self._mode
              )
          )
  
      cur_bracket = self._state["bracket"]
      cur_band = self._hyperbands[self._state["band_idx"]]
      if cur_bracket is None or cur_bracket.filled():
          retry = True
          while retry:
              # if current iteration is filled, create new iteration
              if self._cur_band_filled():
                  cur_band = []
                  self._hyperbands.append(cur_band)
                  self._state["band_idx"] += 1
  
              # MAIN CHANGE HERE - largest bracket first!
              # cur_band will always be less than s_max_1 or else filled
              s = self._s_max_1 - len(cur_band) - 1
              assert s >= 0, "Current band is filled!"
              if self._get_r0(s) == 0:
                  logger.debug("BOHB: Bracket too small - Retrying...")
                  cur_bracket = None
              else:
                  retry = False
                  cur_bracket = self._create_bracket(s)
              cur_band.append(cur_bracket)
              self._state["bracket"] = cur_bracket
  
      self._state["bracket"].add_trial(trial)
      self._trial_info[trial] = cur_bracket, self._state["band_idx"]
  
file_path: ray/python/ray/tune/schedulers/hb_bohb.py
imports: import logging
  from typing import Dict, Optional, TYPE_CHECKING
  from ray.tune.schedulers.trial_scheduler import TrialScheduler
  from ray.tune.schedulers.hyperband import HyperBandScheduler
  from ray.tune.experiment import Trial
  from ray.util import PublicAPI
label_desc: Use image node_id 1 for calling the HyperBandForBOHB obj's underlying member method code with example usage: obj.on_trial_add(tune_controller, trial) without return types