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","]"]
code: def update_best(self, e, x, context):
      self.ebest = e
      self.xbest = np.copy(x)
      if self.callback is not None:
          val = self.callback(x, e, context)
          if val is not None:
              if val:
                  return (
                      "Callback function requested to stop early by "
                      "returning True"
                  )
  
imports: import numpy
  from scipy.optimize import OptimizeResult
  from scipy.optimize import minimize, Bounds
  from scipy.special import gammaln
  from scipy._lib._util import check_random_state
  from scipy.optimize._constraints import new_bounds_to_old
label_desc: Use image node_id 3 for calling the EnergyState obj's underlying member method code with example usage: obj.update_best(e, x, context) and returns: str