class_docstr: Defines a global optimization benchmark problem.
  
  This abstract class defines the basic structure of a global
  optimization problem. Subclasses should implement the ``fun`` method
  for a particular optimization problem.
  
  Attributes
  ----------
  N : int
      The dimensionality of the problem.
  bounds : sequence
      The lower/upper bounds to be used for minimizing the problem.
      This a list of (lower, upper) tuples that contain the lower and upper
      bounds for the problem.  The problem should not be asked for evaluation
      outside these bounds. ``len(bounds) == N``.
  xmin : sequence
      The lower bounds for the problem
  xmax : sequence
      The upper bounds for the problem
  fglob : float
      The global minimum of the evaluated function.
  global_optimum : sequence
      A list of vectors that provide the locations of the global minimum.
      Note that some problems have multiple global minima, not all of which
      may be listed.
  nfev : int
      the number of function evaluations that the object has been asked to
      calculate.
  change_dimensionality : bool
      Whether we can change the benchmark function `x` variable length (i.e.,
      the dimensionality of the problem)
  custom_bounds : sequence
      a list of tuples that contain lower/upper bounds for use in plotting.
docstr: Tests if a candidate solution at the global minimum.
  The default test is
  
  Parameters
  ----------
  x : sequence
      The candidate vector for testing if the global minimum has been
      reached. Must have ``len(x) == self.N``
  tol : float
      The evaluated function and known global minimum must differ by less
      than this amount to be at a global minimum.
  
  Returns
  -------
  bool : is the candidate vector at the global minimum?
docstr_tok: ["Tests","if","a","candidate","solution","at","the","global","minimum",".","The","default","test","is","Parameters","--","--","--","--","--","x",":","sequence","The","candidate","vector","for","testing","if","the","global","minimum","has","been","reached",".","Must","have","``","len","(","x",")","==","self.N","``","tol",":","float","The","evaluated","function","and","known","global","minimum","must","differ","by","less","than","this","amount","to","be","at","a","global","minimum",".","Returns","--","--","--","-","bool",":","is","the","candidate","vector","at","the","global","minimum","?"]
code: def success(self, x, tol=1.0e-5):
      """
      Tests if a candidate solution at the global minimum.
      The default test is
  
      Parameters
      ----------
      x : sequence
          The candidate vector for testing if the global minimum has been
          reached. Must have ``len(x) == self.N``
      tol : float
          The evaluated function and known global minimum must differ by less
          than this amount to be at a global minimum.
  
      Returns
      -------
      bool : is the candidate vector at the global minimum?
      """
      val = self.fun(asarray(x))
      if abs(val - self.fglob) < tol:
          return True
  
      # the solution should still be in bounds, otherwise immediate fail.
      bounds = np.asarray(self.bounds, dtype=np.float64)
      if np.any(x > bounds[:, 1]):
          return False
      if np.any(x < bounds[:, 0]):
          return False
  
      # you found a lower global minimum.  This shouldn't happen.
      if val < self.fglob:
          raise ValueError(
              "Found a lower global minimum", x, val, self.fglob
          )
  
      return False
  
file_path: scipy/benchmarks/benchmarks/go_benchmark_functions/go_benchmark.py
imports: import numpy
  from numpy import abs, asarray
  from ..common import safe_import
label_desc: Use image node_id 5 for calling the Benchmark obj's underlying member method code with example usage: obj.success(x, tol) and returns: False, True, False, False