class_docstr: Metropolis acceptance criterion.
  
  Parameters
  ----------
  T : float
      The "temperature" parameter for the accept or reject criterion.
  random_gen : {None, int, `numpy.random.Generator`,
                `numpy.random.RandomState`}, optional
  
      If `seed` is None (or `np.random`), the `numpy.random.RandomState`
      singleton is used.
      If `seed` is an int, a new ``RandomState`` instance is used,
      seeded with `seed`.
      If `seed` is already a ``Generator`` or ``RandomState`` instance then
      that instance is used.
      Random number generator used for acceptance test.
class_docstr_tok: ["Metropolis","acceptance","criterion",".","Parameters","--","--","--","--","--","T",":","float","The","``","temperature","''","parameter","for","the","accept","or","reject","criterion",".","random_gen",":","{","None",",","int",",","`","numpy.random.Generator","`",",","`","numpy.random.RandomState","`","}",",","optional","If","`","seed","`","is","None","(","or","`","np.random","`",")",",","the","`","numpy.random.RandomState","`","singleton","is","used",".","If","`","seed","`","is","an","int",",","a","new","``","RandomState","``","instance","is","used",",","seeded","with","`","seed","`",".","If","`","seed","`","is","already","a","``","Generator","``","or","``","RandomState","``","instance","then","that","instance","is","used",".","Random","number","generator","used","for","acceptance","test","."]
code: def __init__(self, T, random_gen=None):
      # Avoid ZeroDivisionError since "MBH can be regarded as a special case
      # of the BH framework with the Metropolis criterion, where temperature
      # T = 0." (Reject all steps that increase energy.)
      self.beta = 1.0 / T if T != 0 else float("inf")
      self.random_gen = check_random_state(random_gen)
  
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 Metropolis object  with example: obj = Metropolis(T, random_gen)