class_docstr: A general minimizer for curve fitting and optimization.
class_docstr_tok: ["A","general","minimizer","for","curve","fitting","and","optimization","."]
docstr: Use the `basinhopping` algorithm to find the global minimum.
  
  This method calls :scipydoc:`optimize.basinhopping` using the
  default arguments. The default minimizer is ``BFGS``, but since
  lmfit supports parameter bounds for all minimizers, the user can
  choose any of the solvers present in :scipydoc:`optimize.minimize`.
  
  Parameters
  ----------
  params : Parameters, optional
      Contains the Parameters for the model. If None, then the
      Parameters used to initialize the Minimizer object are used.
  max_nfev : int or None, optional
      Maximum number of function evaluations (default is None). Defaults
      to ``200000*(nvarys+1)``.
  **kws : dict, optional
      Minimizer options to pass to :scipydoc:`optimize.basinhopping`.
  
  Returns
  -------
  MinimizerResult
      Object containing the optimization results from the
      basinhopping algorithm.
  
  
  .. versionadded:: 0.9.10
docstr_tok: ["Use","the","`","basinhopping","`","algorithm","to","find","the","global","minimum",".","This","method","calls",":","scipydoc",":","`","optimize.basinhopping","`","using","the","default","arguments",".","The","default","minimizer","is","``","BFGS","``",",","but","since","lmfit","supports","parameter","bounds","for","all","minimizers",",","the","user","can","choose","any","of","the","solvers","present","in",":","scipydoc",":","`","optimize.minimize","`",".","Parameters","--","--","--","--","--","params",":","Parameters",",","optional","Contains","the","Parameters","for","the","model",".","If","None",",","then","the","Parameters","used","to","initialize","the","Minimizer","object","are","used",".","max_nfev",":","int","or","None",",","optional","Maximum","number","of","function","evaluations","(","default","is","None",")",".","Defaults","to","``","200000","*","(","nvarys+1",")","``",".","*","*","kws",":","dict",",","optional","Minimizer","options","to","pass","to",":","scipydoc",":","`","optimize.basinhopping","`",".","Returns","--","--","--","-","MinimizerResult","Object","containing","the","optimization","results","from","the","basinhopping","algorithm",".","..","versionadded",":",":","0.9.10"]
code: def basinhopping(self, params=None, max_nfev=None, **kws):
      """Use the `basinhopping` algorithm to find the global minimum.
  
      This method calls :scipydoc:`optimize.basinhopping` using the
      default arguments. The default minimizer is ``BFGS``, but since
      lmfit supports parameter bounds for all minimizers, the user can
      choose any of the solvers present in :scipydoc:`optimize.minimize`.
  
      Parameters
      ----------
      params : Parameters, optional
          Contains the Parameters for the model. If None, then the
          Parameters used to initialize the Minimizer object are used.
      max_nfev : int or None, optional
          Maximum number of function evaluations (default is None). Defaults
          to ``200000*(nvarys+1)``.
      **kws : dict, optional
          Minimizer options to pass to :scipydoc:`optimize.basinhopping`.
  
      Returns
      -------
      MinimizerResult
          Object containing the optimization results from the
          basinhopping algorithm.
  
  
      .. versionadded:: 0.9.10
  
      """
      result = self.prepare_fit(params=params)
      result.method = "basinhopping"
      self.set_max_nfev(max_nfev, 200000 * (result.nvarys + 1))
      basinhopping_kws = dict(
          niter=100,
          T=1.0,
          stepsize=0.5,
          minimizer_kwargs=None,
          take_step=None,
          accept_test=None,
          callback=None,
          interval=50,
          disp=False,
          niter_success=None,
          seed=None,
          target_accept_rate=0.5,
          stepwise_factor=0.9,
      )
  
      basinhopping_kws.update(self.kws)
      basinhopping_kws.update(kws)
  
      x0 = result._init_vals_internal
      result.call_kws = basinhopping_kws
      try:
          ret = scipy_basinhopping(self.penalty, x0, **basinhopping_kws)
      except AbortFitException:
          pass
  
      if not result.aborted:
          result.message = ret.message
          result.residual = self.__residual(ret.x)
          result.nfev -= 1
      elif result.nfev > self.max_nfev - 5:
          result.nfev -= 2
          _best = result.last_internal_values
          result.residual = self.__residual(_best, False)
  
      result._calculate_statistics()
  
      # calculate the cov_x and estimate uncertainties/correlations
      if (
          not result.aborted
          and self.calc_covar
          and HAS_NUMDIFFTOOLS
          and len(result.residual) > len(result.var_names)
      ):
          _covar_ndt = self._calculate_covariance_matrix(ret.x)
          if _covar_ndt is not None:
              result.covar = self._int2ext_cov_x(_covar_ndt, ret.x)
              self._calculate_uncertainties_correlations()
  
      return result
  
imports: from collections import namedtuple
  from copy import deepcopy
  import inspect
  import multiprocessing
  import numbers
  import warnings
  import numpy
  from scipy.linalg import LinAlgError, inv
  from scipy.optimize import basinhopping
  from scipy.optimize import brute
  from scipy.optimize import differential_evolution
  from scipy.optimize import dual_annealing
  from scipy.optimize import least_squares
  from scipy.optimize import leastsq
  from scipy.optimize import minimize
  from scipy.optimize import shgo
  from scipy.sparse import issparse
  from scipy.sparse.linalg import LinearOperator
  from scipy.stats import cauchy
  from scipy.stats import norm
  from ._ampgo import ampgo
  from .parameter import Parameter, Parameters
  from .printfuncs import fitreport_html_table
label_desc: Use image node_id 17 for calling the Minimizer obj's underlying member method code with example usage: obj.basinhopping(params, max_nfev) and returns: result