class_docstr: This class implements the core of the basinhopping algorithm.
  
  x0 : ndarray
      The starting coordinates.
  minimizer : callable
      The local minimizer, with signature ``result = minimizer(x)``.
      The return value is an `optimize.OptimizeResult` object.
  step_taking : callable
      This function displaces the coordinates randomly. Signature should
      be ``x_new = step_taking(x)``. Note that `x` may be modified in-place.
  accept_tests : list of callables
      Each test is passed the kwargs `f_new`, `x_new`, `f_old` and
      `x_old`. These tests will be used to judge whether or not to accept
      the step. The acceptable return values are True, False, or ``"force
      accept"``. If any of the tests return False then the step is rejected.
      If ``"force accept"``, then this will override any other tests in
      order to accept the step. This can be used, for example, to forcefully
      escape from a local minimum that ``basinhopping`` is trapped in.
  disp : bool, optional
      Display status messages.
class_docstr_tok: ["This","class","implements","the","core","of","the","basinhopping","algorithm",".","x0",":","ndarray","The","starting","coordinates",".","minimizer",":","callable","The","local","minimizer",",","with","signature","``","result","=","minimizer","(","x",")","``",".","The","return","value","is","an","`","optimize.OptimizeResult","`","object",".","step_taking",":","callable","This","function","displaces","the","coordinates","randomly",".","Signature","should","be","``","x_new","=","step_taking","(","x",")","``",".","Note","that","`","x","`","may","be","modified","in-place",".","accept_tests",":","list","of","callables","Each","test","is","passed","the","kwargs","`","f_new","`",",","`","x_new","`",",","`","f_old","`","and","`","x_old","`",".","These","tests","will","be","used","to","judge","whether","or","not","to","accept","the","step",".","The","acceptable","return","values","are","True",",","False",",","or","``","``","force","accept","''","``",".","If","any","of","the","tests","return","False","then","the","step","is","rejected",".","If","``","``","force","accept","''","``",",","then","this","will","override","any","other","tests","in","order","to","accept","the","step",".","This","can","be","used",",","for","example",",","to","forcefully","escape","from","a","local","minimum","that","``","basinhopping","``","is","trapped","in",".","disp",":","bool",",","optional","Display","status","messages","."]
code: def __init__(
      self, x0, minimizer, step_taking, accept_tests, disp=False
  ):
      self.x = np.copy(x0)
      self.minimizer = minimizer
      self.step_taking = step_taking
      self.accept_tests = accept_tests
      self.disp = disp
  
      self.nstep = 0
  
      # initialize return object
      self.res = scipy.optimize.OptimizeResult()
      self.res.minimization_failures = 0
  
      # do initial minimization
      minres = minimizer(self.x)
      if not minres.success:
          self.res.minimization_failures += 1
          if self.disp:
              print("warning: basinhopping: local minimization failure")
      self.x = np.copy(minres.x)
      self.energy = minres.fun
      if self.disp:
          print(
              "basinhopping step %d: f %g" % (self.nstep, self.energy)
          )
  
      # initialize storage class
      self.storage = Storage(minres)
  
      if hasattr(minres, "nfev"):
          self.res.nfev = minres.nfev
      if hasattr(minres, "njev"):
          self.res.njev = minres.njev
      if hasattr(minres, "nhev"):
          self.res.nhev = minres.nhev
  
imports: import numpy
  import math
  from numpy import cos, sin
  import scipy.optimize
  from scipy._lib._util import check_random_state
label_desc: Use image node_id 1 to create a new BasinHoppingRunner object  with example: obj = BasinHoppingRunner(x0, minimizer, step_taking, accept_tests, disp)