class_docstr: Runner of Bayesian optimization loop. This class wraps the optimization loop around the different handlers.
  :param model: GPyOpt model class.
  :param space: GPyOpt space class.
  :param objective: GPyOpt objective class.
  :param acquisition: GPyOpt acquisition class.
  :param evaluator: GPyOpt evaluator class.
  :param X_init: 2d numpy array containing the initial inputs (one per row) of the model.
  :param Y_init: 2d numpy array containing the initial outputs (one per row) of the model.
  :param cost: GPyOpt cost class (default, none).
  :param normalize_Y: whether to normalize the outputs before performing any optimization (default, True).
  :param model_update_interval: interval of collected observations after which the model is updated (default, 1).
  :param de_duplication: GPyOpt DuplicateManager class. Avoids re-evaluating the objective at previous, pending or infeasible locations (default, False).
class_docstr_tok: ["Runner","of","Bayesian","optimization","loop",".","This","class","wraps","the","optimization","loop","around","the","different","handlers",".",":","param","model",":","GPyOpt","model","class",".",":","param","space",":","GPyOpt","space","class",".",":","param","objective",":","GPyOpt","objective","class",".",":","param","acquisition",":","GPyOpt","acquisition","class",".",":","param","evaluator",":","GPyOpt","evaluator","class",".",":","param","X_init",":","2d","numpy","array","containing","the","initial","inputs","(","one","per","row",")","of","the","model",".",":","param","Y_init",":","2d","numpy","array","containing","the","initial","outputs","(","one","per","row",")","of","the","model",".",":","param","cost",":","GPyOpt","cost","class","(","default",",","none",")",".",":","param","normalize_Y",":","whether","to","normalize","the","outputs","before","performing","any","optimization","(","default",",","True",")",".",":","param","model_update_interval",":","interval","of","collected","observations","after","which","the","model","is","updated","(","default",",","1",")",".",":","param","de_duplication",":","GPyOpt","DuplicateManager","class",".","Avoids","re-evaluating","the","objective","at","previous",",","pending","or","infeasible","locations","(","default",",","False",")","."]
docstr: Runs Bayesian Optimization for a number 'max_iter' of iterations (after the initial exploration data)
  
  :param max_iter: exploration horizon, or number of acquisitions. If nothing is provided optimizes the current acquisition.
  :param max_time: maximum exploration horizon in seconds.
  :param eps: minimum distance between two consecutive x's to keep running the model.
  :param context: fixes specified variables to a particular context (values) for the optimization run (default, None).
  :param verbosity: flag to print the optimization results after each iteration (default, False).
  :param report_file: file to which the results of the optimization are saved (default, None).
  :param evaluations_file: file to which the evalations are saved (default, None).
  :param models_file: file to which the model parameters are saved (default, None).
docstr_tok: ["Runs","Bayesian","Optimization","for","a","number","'max_iter","'","of","iterations","(","after","the","initial","exploration","data",")",":","param","max_iter",":","exploration","horizon",",","or","number","of","acquisitions",".","If","nothing","is","provided","optimizes","the","current","acquisition",".",":","param","max_time",":","maximum","exploration","horizon","in","seconds",".",":","param","eps",":","minimum","distance","between","two","consecutive","x","'s","to","keep","running","the","model",".",":","param","context",":","fixes","specified","variables","to","a","particular","context","(","values",")","for","the","optimization","run","(","default",",","None",")",".",":","param","verbosity",":","flag","to","print","the","optimization","results","after","each","iteration","(","default",",","False",")",".",":","param","report_file",":","file","to","which","the","results","of","the","optimization","are","saved","(","default",",","None",")",".",":","param","evaluations_file",":","file","to","which","the","evalations","are","saved","(","default",",","None",")",".",":","param","models_file",":","file","to","which","the","model","parameters","are","saved","(","default",",","None",")","."]
code: def run_optimization(
      self,
      max_iter=0,
      max_time=np.inf,
      eps=1e-8,
      context=None,
      verbosity=False,
      save_models_parameters=True,
      report_file=None,
      evaluations_file=None,
      models_file=None,
  ):
      """
      Runs Bayesian Optimization for a number 'max_iter' of iterations (after the initial exploration data)
  
      :param max_iter: exploration horizon, or number of acquisitions. If nothing is provided optimizes the current acquisition.
      :param max_time: maximum exploration horizon in seconds.
      :param eps: minimum distance between two consecutive x's to keep running the model.
      :param context: fixes specified variables to a particular context (values) for the optimization run (default, None).
      :param verbosity: flag to print the optimization results after each iteration (default, False).
      :param report_file: file to which the results of the optimization are saved (default, None).
      :param evaluations_file: file to which the evalations are saved (default, None).
      :param models_file: file to which the model parameters are saved (default, None).
      """
  
      if self.objective is None:
          raise InvalidConfigError(
              "Cannot run the optimization loop without the objective function"
          )
  
      # --- Save the options to print and save the results
      self.verbosity = verbosity
      self.save_models_parameters = save_models_parameters
      self.report_file = report_file
      self.evaluations_file = evaluations_file
      self.models_file = models_file
      self.model_parameters_iterations = None
      self.context = context
  
      # --- Check if we can save the model parameters in each iteration
      if self.save_models_parameters == True:
          if not (
              isinstance(self.model, GPyOpt.models.GPModel)
              or isinstance(self.model, GPyOpt.models.GPModel_MCMC)
          ):
              print(
                  "Models printout after each iteration is only available for GP and GP_MCMC models"
              )
              self.save_models_parameters = False
  
      # --- Setting up stop conditions
      self.eps = eps
      if (max_iter is None) and (max_time is None):
          self.max_iter = 0
          self.max_time = np.inf
      elif (max_iter is None) and (max_time is not None):
          self.max_iter = np.inf
          self.max_time = max_time
      elif (max_iter is not None) and (max_time is None):
          self.max_iter = max_iter
          self.max_time = np.inf
      else:
          self.max_iter = max_iter
          self.max_time = max_time
  
      # --- Initial function evaluation and model fitting
      if self.X is not None and self.Y is None:
          self.Y, cost_values = self.objective.evaluate(self.X)
          if self.cost.cost_type == "evaluation_time":
              self.cost.update_cost_model(self.X, cost_values)
  
      # --- Initialize iterations and running time
      self.time_zero = time.time()
      self.cum_time = 0
      self.num_acquisitions = 0
      self.suggested_sample = self.X
      self.Y_new = self.Y
  
      # --- Initialize time cost of the evaluations
      while self.max_time > self.cum_time:
          # --- Update model
          try:
              self._update_model(self.normalization_type)
          except np.linalg.linalg.LinAlgError:
              break
  
          if self.num_acquisitions >= self.max_iter or (
              len(self.X) > 1
              and self._distance_last_evaluations() <= self.eps
          ):
              break
  
          self.suggested_sample = self._compute_next_evaluations()
  
          # --- Augment X
          self.X = np.vstack((self.X, self.suggested_sample))
  
          # --- Evaluate *f* in X, augment Y and update cost function (if needed)
          self.evaluate_objective()
  
          # --- Update current evaluation time and function evaluations
          self.cum_time = time.time() - self.time_zero
          self.num_acquisitions += 1
  
          if verbosity:
              print(
                  "num acquisition: {}, time elapsed: {:.2f}s".format(
                      self.num_acquisitions, self.cum_time
                  )
              )
  
      # --- Stop messages and execution time
      self._compute_results()
  
      # --- Print the desired result in files
      if self.report_file is not None:
          self.save_report(self.report_file)
      if self.evaluations_file is not None:
          self.save_evaluations(self.evaluations_file)
      if self.models_file is not None:
          self.save_models(self.models_file)
  
imports: import GPyOpt
  import collections
  import numpy
  import time
  import csv
  import logging
  from ..util.general import best_value, normalize
  from ..util.duplicate_manager import DuplicateManager
  from ..core.errors import InvalidConfigError
  from ..core.task.cost import CostModel
  from ..optimization.acquisition_optimizer import ContextManager
label_desc: Use image node_id 3 for calling the BO obj's underlying member method code with example usage: obj.run_optimization(max_iter, max_time, eps, context, verbosity, save_models_parameters, report_file, evaluations_file, models_file) without return types