class_docstr: Differential Evolution optimization, using Storn and Price's algorithm.
  
  Alternate implementation: 
      - utilizes a map-reduce interface, extensible to parallel computing
      - both a current and a next generation are kept, while the current
        generation is invariant during the main DE logic
      
class_docstr_tok: ["Differential","Evolution","optimization",",","using","Storn","and","Price","'s","algorithm",".","Alternate","implementation",":","-","utilizes","a","map-reduce","interface",",","extensible","to","parallel","computing","-","both","a","current","and","a","next","generation","are","kept",",","while","the","current","generation","is","invariant","during","the","main","DE","logic"]
docstr: decorate the cost function with bounds, penalties, monitors, etc
  
  Args:
      cost (func): objective, of form ``y = cost(x, *ExtraArgs)``, where ``x``
        is a candidate solution vector
      ExtraArgs (tuple, default=None): tuple of positional arguments required to
        evaluate the objective
  
  Returns:
      decorated objective function
          
docstr_tok: ["decorate","the","cost","function","with","bounds",",","penalties",",","monitors",",","etc","Args",":","cost","(","func",")",":","objective",",","of","form","``","y","=","cost","(","x",",","*","ExtraArgs",")","``",",","where","``","x","``","is","a","candidate","solution","vector","ExtraArgs","(","tuple",",","default=None",")",":","tuple","of","positional","arguments","required","to","evaluate","the","objective","Returns",":","decorated","objective","function"]
code: def _decorate_objective(self, cost, ExtraArgs=None):
      """decorate the cost function with bounds, penalties, monitors, etc
  
      Args:
          cost (func): objective, of form ``y = cost(x, *ExtraArgs)``, where ``x``
            is a candidate solution vector
          ExtraArgs (tuple, default=None): tuple of positional arguments required to
            evaluate the objective
  
      Returns:
          decorated objective function
      """
      # print("@%r %r %r" % (cost, ExtraArgs, max))
      raw = cost
      if ExtraArgs is None:
          ExtraArgs = ()
      from mystic.python_map import python_map
  
      if self._map != python_map:
          # FIXME: EvaluationMonitor fails for MPI, throws error for 'pp'
          from mystic.monitors import Null
  
          evalmon = Null()
      else:
          evalmon = self._evalmon
      fcalls, cost = wrap_function(cost, ExtraArgs, evalmon)
      if self._useStrictRange:
          indx = list(self.popEnergy).index(self.bestEnergy)
          ngen = self.generations  # XXX: no random if generations=0 ?
          for i in range(self.nPop):
              self.population[i] = self._clipGuessWithinRangeBoundary(
                  self.population[i], (not ngen) or (i is indx)
              )
          cost = wrap_bounds(
              cost, self._strictMin, self._strictMax
          )  # XXX: remove?
      cost = wrap_penalty(cost, self._penalty)
      if self._reducer:
          # cost = reduced(*self._reducer)(cost) # was self._reducer = (f,bool)
          cost = reduced(self._reducer, arraylike=True)(cost)
      # hold on to the 'wrapped' and 'raw' cost function
      self._cost = (cost, raw, ExtraArgs)
      self._live = True
      return cost
  
imports: from mystic.tools import wrap_function, unpair, isiterable
  from mystic.tools import wrap_bounds, wrap_penalty, reduced
  from mystic.abstract_solver import AbstractSolver
  from mystic.abstract_map_solver import AbstractMapSolver
  from numpy import asfarray, ravel
  from collections.abc import Callable
label_desc: Use image node_id 4 for calling the DifferentialEvolutionSolver2 obj's underlying member method code with example usage: obj._decorate_objective(cost, ExtraArgs) and returns: cost