class_docstr: High-level API class for running hyperparameter optimisation.
  This class encapsulates optimiser querying, job building, scheduling and
  results collection as well as checkpointing and report generation.
docstr: Run the optimisation and objective function evaluation.
  
  Args:
      n_steps: :obj:`int`. The total number of optimisation steps.
      n_parallel: (optional) :obj:`int`. The number of jobs that can be
          scheduled at once.
      **kwargs: additional keyword arguments for the optimisation,
          supplied to the :py:meth:`run_step` method of the
          :class:`Optimiser` instance.
  
  Keyword Args:
      batch_size: (optional) :obj:`int`. The number of samples that are
          suggested at once. Default is 1.
      minimise: (optional) :obj:`bool`. If the optimiser is
          :class:`BayesianOptimisation` then this flag tells whether the
          objective function is being minimised or maximised. Otherwise
          it has no effect. Default is `False`.
docstr_tok: ["Run","the","optimisation","and","objective","function","evaluation",".","Args",":","n_steps",":",":","obj",":","`","int","`",".","The","total","number","of","optimisation","steps",".","n_parallel",":","(","optional",")",":","obj",":","`","int","`",".","The","number","of","jobs","that","can","be","scheduled","at","once",".","*","*","kwargs",":","additional","keyword","arguments","for","the","optimisation",",","supplied","to","the",":","py",":","meth",":","`","run_step","`","method","of","the",":","class",":","`","Optimiser","`","instance",".","Keyword","Args",":","batch_size",":","(","optional",")",":","obj",":","`","int","`",".","The","number","of","samples","that","are","suggested","at","once",".","Default","is","1.","minimise",":","(","optional",")",":","obj",":","`","bool","`",".","If","the","optimiser","is",":","class",":","`","BayesianOptimisation","`","then","this","flag","tells","whether","the","objective","function","is","being","minimised","or","maximised",".","Otherwise","it","has","no","effect",".","Default","is","`","False","`","."]
code: def run(self, n_steps: int, n_parallel: int = 1, **kwargs):
      """Run the optimisation and objective function evaluation.
  
      Args:
          n_steps: :obj:`int`. The total number of optimisation steps.
          n_parallel: (optional) :obj:`int`. The number of jobs that can be
              scheduled at once.
          **kwargs: additional keyword arguments for the optimisation,
              supplied to the :py:meth:`run_step` method of the
              :class:`Optimiser` instance.
  
      Keyword Args:
          batch_size: (optional) :obj:`int`. The number of samples that are
              suggested at once. Default is 1.
          minimise: (optional) :obj:`bool`. If the optimiser is
              :class:`BayesianOptimisation` then this flag tells whether the
              objective function is being minimised or maximised. Otherwise
              it has no effect. Default is `False`.
      """
      batch_size = kwargs.get("batch_size", 1)
      n_parallel = min(n_parallel, batch_size)
      with self.scheduler(n_parallel=n_parallel) as scheduler:
          for i in range(n_steps):
              samples = self.optimiser.run_step(
                  batch_size=batch_size,
                  minimise=kwargs.get("minimise", False),
              )
              jobs = [
                  self._job(task=self.objective, args=s.as_dict())
                  for s in samples
              ]
              scheduler.dispatch(jobs)
              evaluations = [
                  r.data
                  for r in scheduler.collect(
                      n_results=batch_size, timeout=self._timeout
                  )
              ]
              self.optimiser.update(samples, evaluations)
              for s, e, j in zip(samples, evaluations, jobs):
                  self.reporter.log((s, e), meta={"job_id": j.id})
  
file_path: hypertunity/hypertunity/trial.py
imports: from typing import Callable, Type, Union
  from hypertunity import optimisation, reports, utils
  from hypertunity.domain import Domain
  from hypertunity.optimisation import Optimiser
  from hypertunity.reports import Reporter
  from hypertunity.scheduling import Job, Scheduler, SlurmJob
label_desc: Use image node_id 5 for calling the Trial obj's underlying member method code with example usage: obj.run(n_steps, n_parallel) without return types