class_docstr: Differential Evolution optimization.
      
class_docstr_tok: ["Differential","Evolution","optimization","."]
docstr: apply a constraints function to the optimization
  
  Args:
      constraints (function): function of the form: ``xk' = constraints(xk)``,
        where ``xk`` is the current parameter vector. Ideally, this function
        is constructed so the parameter vector it passes to the cost function
        will satisfy the desired (i.e. encoded) constraints.
          
docstr_tok: ["apply","a","constraints","function","to","the","optimization","Args",":","constraints","(","function",")",":","function","of","the","form",":","``","xk","'","=","constraints","(","xk",")","``",",","where","``","xk","``","is","the","current","parameter","vector",".","Ideally",",","this","function","is","constructed","so","the","parameter","vector","it","passes","to","the","cost","function","will","satisfy","the","desired","(","i.e",".","encoded",")","constraints","."]
code: def SetConstraints(self, constraints):
      """apply a constraints function to the optimization
  
      Args:
          constraints (function): function of the form: ``xk' = constraints(xk)``,
            where ``xk`` is the current parameter vector. Ideally, this function
            is constructed so the parameter vector it passes to the cost function
            will satisfy the desired (i.e. encoded) constraints.
      """
      if not constraints:
          self._constraints = lambda x: x
      elif not isinstance(constraints, _Callable):
          raise TypeError(
              "'%s' is not a callable function" % constraints
          )
      else:  # XXX: check for format: x' = constraints(x) ?
          self._constraints = constraints
      return
  
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 3 for calling the DifferentialEvolutionSolver obj's underlying member method code with example usage: obj.SetConstraints(constraints) without return types