class_docstr: Nelder Mead Simplex optimization adapted from scipy.optimize.fmin.
      
class_docstr_tok: ["Nelder","Mead","Simplex","optimization","adapted","from","scipy.optimize.fmin","."]
docstr: ensure that initial simplex is set within bounds
  
  Args:
      radius (float, default=0.05): size of the initial simplex
          
docstr_tok: ["ensure","that","initial","simplex","is","set","within","bounds","Args",":","radius","(","float",",","default=0.05",")",":","size","of","the","initial","simplex"]
code: def _setSimplexWithinRangeBoundary(self, radius=None):
      """ensure that initial simplex is set within bounds
  
      Args:
          radius (float, default=0.05): size of the initial simplex
      """
      x0 = self.population[0]
      # code modified from park-1.2/park/simplex.py (version 1257)
      if self._useStrictRange:
          x0 = self._clipGuessWithinRangeBoundary(x0)
  
      if radius is None:
          radius = 0.05  # nonzdelt=0.05 from scipy-0.9
      val = x0 * (1 + radius)
      val[val == 0] = (
          radius**2
      ) * 0.1  # zdelt=0.00025 update from scipy-0.9
      if not self._useStrictRange:
          self.population[0] = x0
          return val
  
      lo = self._strictMin
      hi = self._strictMax
      radius = clip(radius, 0, 0.5)
      # rescale val by bounded range...
      # (increases fit for tight bounds; makes worse[?] for large bounds)
      bounded = ~numpy.isinf(lo) & ~numpy.isinf(hi)
      val[bounded] = x0[bounded] + (hi[bounded] - lo[bounded]) * radius
      # crop val at bounds
      settings = numpy.seterr(all="ignore")
      val[val < lo] = lo[val < lo]
      val[val > hi] = hi[val > hi]
      numpy.seterr(**settings)
      # handle collisions (when val[i] == x0[i])
      collision = val == x0
      if numpy.any(collision):
          rval = x0 * (1 - radius)
          rval[rval == 0] = -radius
          rval[bounded] = (
              x0[bounded] - (hi[bounded] - lo[bounded]) * radius
          )
          val[collision] = rval[collision]
      # make tolerance relative for bounded parameters
      #  tol = numpy.ones(x0.shape)*xtol
      #  tol[bounded] = (hi[bounded]-lo[bounded])*xtol
      #  xtol = tol
      self.population[0] = x0
      return val
  
imports: from mystic.tools import wrap_function, unpair, wrap_nested
  from mystic.tools import wrap_bounds, wrap_penalty, reduced
  import numpy
  from numpy import eye, zeros, shape, asarray, absolute, asfarray
  from numpy import clip, squeeze
  from mystic._scipy060optimize import brent
  from mystic.abstract_solver import AbstractSolver
label_desc: Use image node_id 2 for calling the NelderMeadSimplexSolver obj's underlying member method code with example usage: obj._setSimplexWithinRangeBoundary(radius) and returns: val, val