code: def test_griewangk(verbose=False):
      """Test Griewangk's function, which has many local minima.
  
      Testing Griewangk:
      Expected: x=[0.]*10 and f=0
  
      Using DifferentialEvolutionSolver:
      Solution:  [  8.87516194e-09   7.26058147e-09   1.02076001e-08   1.54219038e-08
        -1.54328461e-08   2.34589663e-08   2.02809360e-08  -1.36385836e-08
         1.38670373e-08   1.59668900e-08]
      f value:  0.0
      Iterations:  4120
      Function evaluations:  205669
      Time elapsed:  34.4936850071  seconds
  
      Using DifferentialEvolutionSolver2:
      Solution:  [ -2.02709316e-09   3.22017968e-09   1.55275472e-08   5.26739541e-09
        -2.18490470e-08   3.73725584e-09  -1.02315312e-09   1.24680355e-08
        -9.47898116e-09   2.22243557e-08]
      f value:  0.0
      Iterations:  4011
      Function evaluations:  200215
      Time elapsed:  32.8412370682  seconds"""
  
      if verbose:
          print("Testing Griewangk:")
          print("Expected: x=[0.]*10 and f=0")
      from mystic.models import griewangk as costfunc
  
      ndim = 10
      lb = [-400.0] * ndim
      ub = [400.0] * ndim
      maxiter = 10000
      seed = 123  # Re-seed for each solver to have them all start at same x0
  
      # DifferentialEvolutionSolver
      if verbose:
          print("\nUsing DifferentialEvolutionSolver:")
      npop = 50
      random_seed(seed)
      from mystic.solvers import DifferentialEvolutionSolver
      from mystic.termination import ChangeOverGeneration as COG
      from mystic.termination import CandidateRelativeTolerance as CRT
      from mystic.termination import VTR
      from mystic.strategy import Rand1Bin, Best1Bin, Rand1Exp
  
      esow = Monitor()
      ssow = Monitor()
      solver = DifferentialEvolutionSolver(ndim, npop)
      solver.SetRandomInitialPoints(lb, ub)
      solver.SetStrictRanges(lb, ub)
      solver.SetEvaluationLimits(generations=maxiter)
      solver.SetEvaluationMonitor(esow)
      solver.SetGenerationMonitor(ssow)
      solver.enable_signal_handler()
      # term = COG(1e-10)
      # term = CRT()
      term = VTR(0.0)
      time1 = time.time()  # Is this an ok way of timing?
      solver.Solve(
          costfunc,
          term,
          strategy=Rand1Exp,
          CrossProbability=0.3,
          ScalingFactor=1.0,
      )
      sol = solver.Solution()
      time_elapsed = time.time() - time1
      fx = solver.bestEnergy
      if verbose:
          print("Solution: %s" % sol)
          print("f value: %s" % fx)
          print("Iterations: %s" % solver.generations)
          print("Function evaluations: %s" % len(esow.x))
          print("Time elapsed: %s seconds" % time_elapsed)
      assert almostEqual(fx, 0.0, tol=3e-3)
  
      # DifferentialEvolutionSolver2
      if verbose:
          print("\nUsing DifferentialEvolutionSolver2:")
      npop = 50
      random_seed(seed)
      from mystic.solvers import DifferentialEvolutionSolver2
      from mystic.termination import ChangeOverGeneration as COG
      from mystic.termination import CandidateRelativeTolerance as CRT
      from mystic.termination import VTR
      from mystic.strategy import Rand1Bin, Best1Bin, Rand1Exp
  
      esow = Monitor()
      ssow = Monitor()
      solver = DifferentialEvolutionSolver2(ndim, npop)
      solver.SetRandomInitialPoints(lb, ub)
      solver.SetStrictRanges(lb, ub)
      solver.SetEvaluationLimits(generations=maxiter)
      solver.SetEvaluationMonitor(esow)
      solver.SetGenerationMonitor(ssow)
      # term = COG(1e-10)
      # term = CRT()
      term = VTR(0.0)
      time1 = time.time()  # Is this an ok way of timing?
      solver.Solve(
          costfunc,
          term,
          strategy=Rand1Exp,
          CrossProbability=0.3,
          ScalingFactor=1.0,
      )
      sol = solver.Solution()
      time_elapsed = time.time() - time1
      fx = solver.bestEnergy
      if verbose:
          print("Solution: %s" % sol)
          print("f value: %s" % fx)
          print("Iterations: %s" % solver.generations)
          print("Function evaluations: %s" % len(esow.x))
          print("Time elapsed: %s seconds" % time_elapsed)
      assert almostEqual(fx, 0.0, tol=3e-3)
  
imports: from mystic.monitors import Monitor
  from mystic.math import almostEqual
  from mystic.tools import random_seed
  import time
label_desc: Use image node_id 2 for calling a global function with example usage: test_griewangk(verbose) without return types