class_docstr: Class used to record the energy state. At any time, it knows what is the
  currently used coordinates and the most recent best location.
  
  Parameters
  ----------
  lower : array_like
      A 1-D NumPy ndarray containing lower bounds for generating an initial
      random components in the `reset` method.
  upper : array_like
      A 1-D NumPy ndarray containing upper bounds for generating an initial
      random components in the `reset` method
      components. Neither NaN or inf are allowed.
  callback : callable, ``callback(x, f, context)``, optional
      A callback function which will be called for all minima found.
      ``x`` and ``f`` are the coordinates and function value of the
      latest minimum found, and `context` has value in [0, 1, 2]
class_docstr_tok: ["Class","used","to","record","the","energy","state",".","At","any","time",",","it","knows","what","is","the","currently","used","coordinates","and","the","most","recent","best","location",".","Parameters","--","--","--","--","--","lower",":","array_like","A","1-D","NumPy","ndarray","containing","lower","bounds","for","generating","an","initial","random","components","in","the","`","reset","`","method",".","upper",":","array_like","A","1-D","NumPy","ndarray","containing","upper","bounds","for","generating","an","initial","random","components","in","the","`","reset","`","method","components",".","Neither","NaN","or","inf","are","allowed",".","callback",":","callable",",","``","callback","(","x",",","f",",","context",")","``",",","optional","A","callback","function","which","will","be","called","for","all","minima","found",".","``","x","``","and","``","f","``","are","the","coordinates","and","function","value","of","the","latest","minimum","found",",","and","`","context","`","has","value","in","[","0",",","1",",","2","]"]
docstr: Initialize current location is the search domain. If `x0` is not
  provided, a random location within the bounds is generated.
docstr_tok: ["Initialize","current","location","is","the","search","domain",".","If","`","x0","`","is","not","provided",",","a","random","location","within","the","bounds","is","generated","."]
code: def reset(self, func_wrapper, rand_gen, x0=None):
      """
      Initialize current location is the search domain. If `x0` is not
      provided, a random location within the bounds is generated.
      """
      if x0 is None:
          self.current_location = rand_gen.uniform(
              self.lower, self.upper, size=len(self.lower)
          )
      else:
          self.current_location = np.copy(x0)
      init_error = True
      reinit_counter = 0
      while init_error:
          self.current_energy = func_wrapper.fun(self.current_location)
          if self.current_energy is None:
              raise ValueError("Objective function is returning None")
          if not np.isfinite(self.current_energy) or np.isnan(
              self.current_energy
          ):
              if reinit_counter >= EnergyState.MAX_REINIT_COUNT:
                  init_error = False
                  message = (
                      "Stopping algorithm because function "
                      "create NaN or (+/-) infinity values even with "
                      "trying new random parameters"
                  )
                  raise ValueError(message)
              self.current_location = rand_gen.uniform(
                  self.lower, self.upper, size=self.lower.size
              )
              reinit_counter += 1
          else:
              init_error = False
          # If first time reset, initialize ebest and xbest
          if self.ebest is None and self.xbest is None:
              self.ebest = self.current_energy
              self.xbest = np.copy(self.current_location)
  
imports: import numpy
  from scipy.optimize import OptimizeResult
  from scipy.optimize import minimize
  from scipy.special import gammaln
  from scipy._lib._util import check_random_state
label_desc: Use image node_id 2 for calling the EnergyState obj's underlying member method code with example usage: obj.reset(func_wrapper, rand_gen, x0) without return types