docstr: solve (in measure space) for bound on given objective
  
  Input:
      objective: cost function of the form y = objective(x)
  
  Additional Input:
      solver: mystic.solver instance [default: DifferentialEvolutionSolver2]
      npop: population size [default: None]
      id: a unique identifier for the solver [default: None]
      nested: mystic.solver instance [default: None], for ensemble solvers
      x0: initial parameter guess [default: use RandomInitialPoints]
      maxiter: max number of iterations [default: defined in solver]
      maxfun: max number of objective evaluations [default: defined in solver]
      evalmon: mystic.monitor instance [default: Monitor], for evaluations
      stepmon: mystic.monitor instance [default: Monitor], for iterations
      map: pathos map instance for solver.SetMapper [default: None]
      save: iteration frequency to save solver [default: None]
      opts: dict of configuration options for solver.Solve [default: {}]
  
  Returns:
      solver instance, after Solve has been called
      
docstr_tok: ["solve","(","in","measure","space",")","for","bound","on","given","objective","Input",":","objective",":","cost","function","of","the","form","y","=","objective","(","x",")","Additional","Input",":","solver",":","mystic.solver","instance","[","default",":","DifferentialEvolutionSolver2","]","npop",":","population","size","[","default",":","None","]","id",":","a","unique","identifier","for","the","solver","[","default",":","None","]","nested",":","mystic.solver","instance","[","default",":","None","]",",","for","ensemble","solvers","x0",":","initial","parameter","guess","[","default",":","use","RandomInitialPoints","]","maxiter",":","max","number","of","iterations","[","default",":","defined","in","solver","]","maxfun",":","max","number","of","objective","evaluations","[","default",":","defined","in","solver","]","evalmon",":","mystic.monitor","instance","[","default",":","Monitor","]",",","for","evaluations","stepmon",":","mystic.monitor","instance","[","default",":","Monitor","]",",","for","iterations","map",":","pathos","map","instance","for","solver.SetMapper","[","default",":","None","]","save",":","iteration","frequency","to","save","solver","[","default",":","None","]","opts",":","dict","of","configuration","options","for","solver.Solve","[","default",":","{","}","]","Returns",":","solver","instance",",","after","Solve","has","been","called"]
code: def solve(self, objective, **kwds):  # NOTE: single axis only
      """solve (in measure space) for bound on given objective
  
      Input:
          objective: cost function of the form y = objective(x)
  
      Additional Input:
          solver: mystic.solver instance [default: DifferentialEvolutionSolver2]
          npop: population size [default: None]
          id: a unique identifier for the solver [default: None]
          nested: mystic.solver instance [default: None], for ensemble solvers
          x0: initial parameter guess [default: use RandomInitialPoints]
          maxiter: max number of iterations [default: defined in solver]
          maxfun: max number of objective evaluations [default: defined in solver]
          evalmon: mystic.monitor instance [default: Monitor], for evaluations
          stepmon: mystic.monitor instance [default: Monitor], for iterations
          map: pathos map instance for solver.SetMapper [default: None]
          save: iteration frequency to save solver [default: None]
          opts: dict of configuration options for solver.Solve [default: {}]
  
      Returns:
          solver instance, after Solve has been called
      """
      # NOTE: kwds(penalty, stop) undocumented
      penalty = kwds.pop("penalty", None)  # special case 'and(penalty)'
      stop = kwds.pop("stop", None)  # special case 'Or(stop)'
      k = self.kwds.copy()
      k.update(kwds)  # overrides self.kwds
      kwds.update(k)  # FIXME: good idea??? [bad in parallel???]
      lb, ub = self.lb, self.ub
      solver = kwds.get("solver", DifferentialEvolutionSolver2)
      npop = kwds.get("npop", None)
      if npop is not None:
          solver = solver(len(lb), npop)
      else:
          solver = solver(len(lb))
      solver.id = kwds.pop("id", None)
      nested = kwds.get("nested", None)
      x0 = kwds.get("x0", None)
      if nested is not None:  # Buckshot/Sparsity
          solver.SetNestedSolver(nested)
      else:  # DiffEv/Nelder/Powell
          if x0 is None:
              solver.SetRandomInitialPoints(min=lb, max=ub)
          else:
              solver.SetInitialPoints(x0)
      save = kwds.get("save", None)
      if save is not None:
          solver.SetSaveFrequency(save, "Solver.pkl")  # FIXME: set name
      mapper = kwds.get("map", None)
      if mapper is not None:
          solver.SetMapper(mapper)  # NOTE: not Nelder/Powell
      maxiter = kwds.get("maxiter", None)
      maxfun = kwds.get("maxfun", None)
      solver.SetEvaluationLimits(maxiter, maxfun)
      evalmon = kwds.get("evalmon", None)
      evalmon = Monitor() if evalmon is None else evalmon
      solver.SetEvaluationMonitor(evalmon[:0])
      stepmon = kwds.get("stepmon", None)
      stepmon = Monitor() if stepmon is None else stepmon[:0]
      solver.SetGenerationMonitor(stepmon)
      solver.SetStrictRanges(
          min=lb, max=ub
      )  # ,tight=True) #XXX: tight?
      solver.SetConstraints(self.constraint)
      if penalty is not None:  # add the special-case penalty
          from mystic.coupler import and_
  
          penalty = and_(self.penalty, penalty)
      else:
          penalty = self.penalty
      solver.SetPenalty(penalty)
      opts = kwds.get("opts", {})  # XXX: copy is necessary?
      if stop is not None:  # add the special-case termination
          term = opts.get("termination", solver._termination)
          from mystic.termination import Or
  
          opts["termination"] = Or(stop, term)
      # solve
      solver.Solve(objective, **opts)
      if mapper is not None:
          mapper.close()
          mapper.join()
          mapper.clear()  # NOTE: if used, then shut down pool
      # NOTE: debugging code
      # print("solved: %s" % solver.Solution())
      # func_bound = solver.bestEnergy
      # func_evals = solver.evaluations
      # from mystic.munge import write_support_file
      # write_support_file(solver._stepmon)
      # print("func_bound: %s" % func_bound) #NOTE: may be inverted
      # print("func_evals: %s" % func_evals)
      return solver
  
imports: import mystic.cache
  from mystic.cache import cached
  from mystic.cache.archive import dict_archive, file_archive, read
  from mystic.math import almostEqual
  from mystic.math.discrete import product_measure
  from mystic.math.samples import random_samples
  from mystic.solvers import DifferentialEvolutionSolver2
  from mystic.monitors import Monitor
  from ouq_models import WrapModel
label_desc: Use image node_id 10 for calling the BaseOUQ obj's underlying member method code with example usage: obj.solve(objective) and returns: solver