class_docstr: A DiscreteSearchCallback class that handles mapping floating-point variables
  to discrete values.
docstr: Performs a callback whenever a task begins.
  
  Args:
      opt_model: An instance of the optimization model.
docstr_tok: ["Performs","a","callback","whenever","a","task","begins",".","Args",":","opt_model",":","An","instance","of","the","optimization","model","."]
code: def on_task_begin(self, opt_model: Opytimizer) -> None:
      """Performs a callback whenever a task begins.
  
      Args:
          opt_model: An instance of the optimization model.
  
      """
  
      n_variables = opt_model.space.n_variables
      lower_bound = opt_model.space.lb
      upper_bound = opt_model.space.ub
  
      assert (
          len(self.allowed_values) == n_variables
      ), f"`allowed_values` should have length equals to {n_variables}."
      assert np.all(
          [
              np.all((av >= lb) == (av <= ub))
              for av, lb, ub in zip(
                  self.allowed_values, lower_bound, upper_bound
              )
          ]
      ), "Every value from `allowed_values` should be between `lower_bound` and `upper_bound`."
  
imports: from typing import List, TypeVar, Union
  import numpy
  import opytimizer.utils.exception
  from opytimizer.core.space import Space
label_desc: Use image node_id 4 for calling the DiscreteSearchCallback obj's underlying member method code with example usage: obj.on_task_begin(opt_model) without return types