code: def optimize(cost, lb, ub):
      from mystic.solvers import DifferentialEvolutionSolver2
      from mystic.termination import CandidateRelativeTolerance as CRT
      from mystic.strategy import Best1Exp
      from mystic.monitors import VerboseMonitor, Monitor
      from mystic.tools import random_seed
  
      random_seed(123)
  
      # stepmon = VerboseMonitor(100)
      stepmon = Monitor()
      evalmon = Monitor()
  
      ndim = len(lb)  # [(1 + RVend) - RVstart] + 1
  
      solver = DifferentialEvolutionSolver2(ndim, npop)
      solver.SetRandomInitialPoints(min=lb, max=ub)
      solver.SetStrictRanges(min=lb, max=ub)
      solver.SetEvaluationLimits(maxiter, maxfun)
      solver.SetEvaluationMonitor(evalmon)
      solver.SetGenerationMonitor(stepmon)
  
      tol = convergence_tol
      solver.Solve(
          cost,
          termination=CRT(tol, tol),
          strategy=Best1Exp,
          CrossProbability=crossover,
          ScalingFactor=percent_change,
      )
  
      print("solved: %s" % solver.bestSolution)
      diameter_squared = -solver.bestEnergy / scale  # XXX: scale != 0
      func_evals = solver.evaluations
      return diameter_squared, func_evals
  
imports: from surrogate import marc_surr
  from mystic.math.stats import volume, prob_mass, mean, mcdiarmid_bound
  from mystic.math.integrate import integrate
label_desc: Use image node_id 2 for calling a global function with example usage: optimize(cost, lb, ub) and returns: diameter_squared,  func_evals