def main_generator(self):
    objective = self.objective
    driver = self.driver

    # test the entire initial simplex
    self.simplex_points = list(map(driver.get_configuration,
                                   self.initial_simplex()))

    if len(self.simplex_points) <= 1:
      log.warning("only 1 point in simplex, will not use %s", self.name)
      return

    log.debug("initial points")
    for p in self.simplex_points:
      self.yield_nonblocking(p)
    yield None  # wait until results are ready

    while not self.convergence_criterea():
      # next steps assume this ordering
      self.simplex_points.sort(cmp=objective.compare)
      # set limit from worst point
      self.limit = objective.limit_from_config(self.simplex_points[-1])
      self.centroid = self.calculate_centroid()
      if log.isEnabledFor(logging.DEBUG):
        self.debug_log()

      reflection = self.reflection_point()
      yield reflection

      if objective.lt(reflection, self.simplex_points[0]):
        #expansion case
        expansion = self.expansion_point(reflection)
        yield expansion

        if objective.lt(expansion, reflection):
          log.debug("using expansion point")
          self.simplex_points[-1] = expansion
        else:
          log.debug("using reflection point (considered expansion)")
          self.simplex_points[-1] = reflection

      elif objective.lt(reflection, self.simplex_points[1]):
        #reflection case
        log.debug("using reflection point")
        self.simplex_points[-1] = reflection
      else:
        # contraction case
        if objective.lte(reflection, self.simplex_points[-1]):
          # outside contraction
          contract_base = reflection
        else:
          # inside contraction
          contract_base = self.simplex_points[-1]

        contraction = self.contraction_point(contract_base)
        yield contraction

        if objective.lte(contraction, contract_base):
          log.debug("using contraction point")
          self.simplex_points[-1] = contraction
        else:
          #reduction case
          log.debug("performing shrink reduction")
          self.perform_shrink_reduction()
          for p in self.simplex_points:
            self.yield_nonblocking(p)
          yield None  # wait until results are ready
dataset/ETHPy150Open jansel/opentuner/opentuner/search/simplextechniques.py/NelderMead.main_generator/original