This method iteratively applies a {@link SelectionOperator} to the population to fill the mating pool population.

@param population
@return The mating pool population
550020
@Override
  protected List<S> selection(List<S> population) {
    List<S> matingPopulation = new ArrayList<>(population.size());
    for (int i = 0; i < matingPoolSize; i++) {
      S solution = selectionOperator.execute(population);
      matingPopulation.add(solution);
    }

    return matingPopulation;
  }
924348
private void notifyPopulationChange(PopulationData<T> data)
    {
        for (EvolutionObserver<? super T> observer : observers)
        {
            observer.populationUpdate(data);
        }
    }
882687
@SuppressWarnings("unchecked")
	public E poll () {
		if (size == 0) return null;
		int s = --size;
		E result = (E)queue[0];
		E x = (E)queue[s];
		queue[s] = null;
		if (s != 0) siftDown(0, x);
		if (uniqueness) set.remove(result);
		return result;
	}
773520
public void initializeInstance(PopulationModel populationModel) {
        this.population = populationModel.getPopulation();
        culledSize = (int) (populationModel.getPopulationSize() * (1.0 - cullRatio) + 0.5);
    }
588076
public void create() {
    GeneticConfiguration cfg =
      new GeneticConfiguration(config, mutation_rate, recombination_rate,
                               evolve_comparators);
    population = new ArrayList(size);
    int ix = 0;
    for (; ix < copies_of_original; ix++)
      population.add(cfg.makeCopy());
    for (; ix < size; ix++)
      population.add(cfg.makeRandomCopy());
  }

  /**
   * Returns all configurations in the current generation.
   */
  public List<GeneticConfiguration> getConfigs() {
    return population;
  }

  public void setNewGeneration(List<GeneticConfiguration> nextgen) {
    this.population = nextgen;
  }

  /**
   * Sorts the population by their achieved F-numbers.
   */
  public void sort() {
    Collections.sort(population);
    for (int ix = 0; ix < population.size(); ix++)
      population.get(ix).setRank(ix + 1);
  }

  /**
   * Returns the best configuration.
   */
  public GeneticConfiguration getBestConfiguration() {
    return population.get(0);
  }

  /**
   * Returns the worst configuration.
   */
  public GeneticConfiguration getWorstConfiguration() {
    return population.get(population.size() - 1);
  }

  /**
   * Returns a random configuration.
   */
  public GeneticConfiguration pickRandomConfig() {
    return population.get((int) Math.random() * population.size());
  }

  /**
   * Runs a tournament among k individuals to find the most fit
   * individual.
   */
  public GeneticConfiguration runTournament(int k) {
    GeneticConfiguration best = pickRandomConfig();
    for (int ix = 1; ix < k; ix++) {
      GeneticConfiguration candidate = pickRandomConfig();
      if (candidate.getFNumber() > best.getFNumber())
        best = candidate;
    }
    return best;
  }

  /**
   * Sets the size of the population.
   */
  public void setSize(int size) {
    this.size = size;
  }

  public void setMutationRate(int mutation_rate) {
    this.mutation_rate = mutation_rate;
  }

  public void setRecombinationRate(double recombination_rate) {
    this.recombination_rate = recombination_rate;
  }

  public void setEvolveComparators(boolean evolve_comparators) {
    this.evolve_comparators = evolve_comparators;
  }

  public void setCopiesOfOriginal(int copies) {
    this.copies_of_original = copies;
  }

  /**
   * Returns the size of the population.
   */
  public int size() {
    return size;
  }
}
1266045
@Override
  public Selection<E> value() {
    return value == null ? null : new Selection<E>() {
      @Override
      public E result() {
        return value;
      }

      @Override
      public Object target() {
        return target;
      }
    };
  }
1133662
def _update_pop(self, pop_size):
        """"""
        candidates = []
        for ind in self.population:
            candidates.append(self._crossover(ind))
        self._model_count += len(candidates)
        self.assign_fitnesses(candidates)
        for i in range(len(self.population)):
            if candidates[i].fitness > self.population[i].fitness:
                self.population[i] = candidates[i]
        return
1300969
@Override
  public Result<K, V> apply(final Result<K, V> previousOperation) {
    if(previousOperation == null) {
      return this;
    } else {
      return previousOperation;
    }
  }
926167
public double getPopulationVariance() {
      if (getCount() <= 0) {
         return Double.NaN;
      } else if (getCount() == 1) {
         return 0d;
      }
      return Math.abs(getSumOfSquares() - getAverage() * getSum()) / getCount();
   }
154577
def RWSelection(self, mating_pool_size):
		'''
		
		'''
		A = numpy.zeros(self.length)
		mating_pool = numpy.zeros(mating_pool_size)
	
		[F,S,P] = self.rankingEval()
		
		P_Sorted = numpy.zeros(self.length)
		for i in range(self.length):
			P_Sorted[i] = P[S[i]]
	
		for i in range(self.length):
			A[i] = P_Sorted[0:(i+1)].sum()

		i = 0
		j = 0
		while j < mating_pool_size:
			r = numpy.random.random()
			i = 0
			while A[i] < r:
				i += 1
			if numpy.shape(numpy.where(mating_pool==i))[1] == 0:
				mating_pool[j] =S[i]
				j += 1

		return mating_pool
6683
@SuppressWarnings("unchecked")
    static ObjectProperty<Paint> Text_selectionFillProperty(Text text) {
        try {
            if (mText_selectionFillProperty == null) {
                mText_selectionFillProperty = Text.class.getMethod(
                        isJava9orLater ? "selectionFillProperty" : "impl_selectionFillProperty");
            }
            return (ObjectProperty<Paint>) mText_selectionFillProperty.invoke(text);
        } catch(NoSuchMethodException | SecurityException | IllegalAccessException |
                IllegalArgumentException | InvocationTargetException e) {
            e.printStackTrace();
            throw new Error(e);
        }
    }
773958
private void executeOperation(DbUnitDatabasePopulator populator, DataSource dataSource) throws Exception {

        Connection connection = null;

        try {
            connection = getConnection(dataSource);
            populator.populate(connection);

        } finally {
            if (connection != null && !isConnectionTransactional(connection, dataSource)) {
                // if the connection is transactional, closing it. Otherwise,
                // expects that the framework will do it
                releaseConnection(connection, dataSource);
            }
        }
    }
1337514
@Override
  protected List<S> reproduction(List<S> population) {
    List<S> offspring = crossoverOperator.execute(population);
    mutationOperator.execute(offspring.get(0));

    return offspring;
  }
725733
public List<S> matingSelection(int cid, int type) {
    int rnd1, rnd2;

    List<S> parents = new ArrayList<>(2);

    int nLength = neighborhood[cid].length;

    ArrayList<Integer> activeList = new ArrayList<>();
    if (type == 1) {
      for (int i = 0; i < nLength; i++) {
        int idx = neighborhood[cid][i];
        for (int j = 0; j < populationSize; j++) {
          if (subregionIdx[idx][j] == 1) {
            activeList.add(idx);
            break;
          }
        }
      }
      if (activeList.size() < 2) {
        activeList.clear();
        for (int i = 0; i < populationSize; i++) {
          for (int j = 0; j < populationSize; j++) {
            if (subregionIdx[i][j] == 1) {
              activeList.add(i);
              break;
            }
          }
        }
      }
      int activeSize = activeList.size();
      rnd1 = randomGenerator.nextInt(0, activeSize - 1);
      do {
        rnd2 = randomGenerator.nextInt(0, activeSize - 1);
      } while (rnd1 == rnd2);  // in a very extreme case, this will be a dead loop
      ArrayList<Integer> list1 = new ArrayList<>();
      ArrayList<Integer> list2 = new ArrayList<>();
      int id1 = activeList.get(rnd1);
      int id2 = activeList.get(rnd2);
      for (int i = 0; i < populationSize; i++) {
        if (subregionIdx[id1][i] == 1) {
          list1.add(i);
        }
        if (subregionIdx[id2][i] == 1) {
          list2.add(i);
        }
      }
      int p1 = randomGenerator.nextInt(0, list1.size() - 1);
      int p2 = randomGenerator.nextInt(0, list2.size() - 1);
      parents.add(population.get(list1.get(p1)));
      parents.add(population.get(list2.get(p2)));
    } else {
      for (int i = 0; i < populationSize; i++) {
        for (int j = 0; j < populationSize; j++) {
          if (subregionIdx[i][j] == 1) {
            activeList.add(i);
            break;
          }
        }
      }
      int activeSize = activeList.size();
      rnd1 = randomGenerator.nextInt(0, activeSize - 1);
      do {
        rnd2 = randomGenerator.nextInt(0, activeSize - 1);
      } while (rnd1 == rnd2);  // in a very extreme case, this will be a dead loop
      ArrayList<Integer> list1 = new ArrayList<>();
      ArrayList<Integer> list2 = new ArrayList<>();
      int id1 = activeList.get(rnd1);
      int id2 = activeList.get(rnd2);
      for (int i = 0; i < populationSize; i++) {
        if (subregionIdx[id1][i] == 1) {
          list1.add(i);
        }
        if (subregionIdx[id2][i] == 1) {
          list2.add(i);
        }
      }
      int p1 = randomGenerator.nextInt(0, list1.size() - 1);
      int p2 = randomGenerator.nextInt(0, list2.size() - 1);
      parents.add(population.get(list1.get(p1)));
      parents.add(population.get(list2.get(p2)));
    }

    return parents;
  }
666368
protected void fill(GroupContainerPopulator containerPopulator,
                        Object controlFactory,
                        CommandButtonConfigurer configurer,
                        List previousButtons) {

        Assert.notNull(containerPopulator, "containerPopulator");
        Assert.notNull(controlFactory, "controlFactory");
        Assert.notNull(configurer, "configurer");

        if (members.size() > 0 && isLeadingSeparator()) {
            containerPopulator.addSeparator();
        }

        for (Iterator iterator = members.iterator(); iterator.hasNext();) {
            GroupMember member = (GroupMember)iterator.next();
            member.fill(containerPopulator, controlFactory, configurer, previousButtons);
        }

        if (members.size() > 0 && isEndingSeparator()) {
            containerPopulator.addSeparator();
        }

    }
1121546
@SuppressWarnings("unchecked")
    private T select(T[] population) {
        double worst = population[0].fitness();
        double[] fitness = new double[size];
        switch (selection) {
            case ROULETTE_WHEEL:
                if (worst > 0.0) {
                    worst = 0.0;
                }
                
                // In Roulete wheel selection, we don't do such scaling in
                // general. However, in case of negative fitness socres,
                // we need scale them to positive.
                for (int i = 0; i < size; i++) {
                    fitness[i] = population[i].fitness() - worst;
                }

                Math.unitize1(fitness);

                return population[Math.random(fitness)];

            case SCALED_ROULETTE_WHEEL:
                for (int i = 0; i < size; i++) {
                    fitness[i] = population[i].fitness() - worst;
                }

                Math.unitize1(fitness);

                return population[Math.random(fitness)];

            case RANK:
                for (int i = 0; i < size; i++) {
                    fitness[i] = i + 1;
                }

                Math.unitize1(fitness);

                return population[Math.random(fitness)];

            case TOURNAMENT:
                Chromosome[] pool = new Chromosome[tournamentSize];
                for (int i = 0; i < tournamentSize; i++) {
                    pool[i] = population[Math.randomInt(size)];
                }

                Arrays.sort(pool);
                for (int i = 1; i <= tournamentSize; i++) {
                    double p = Math.random();
                    if (p < tournamentProbability) {
                        return (T) pool[tournamentSize - i];
                    }
                }
                
                return (T) pool[tournamentSize - 1];
        }

        return null;
    }
966784
public MemberSelector createSelector(CommunicationStrategy selectionStrategy) {
    MemberSelector selector = new MemberSelector(leader, members, selectionStrategy, this);
    selectors.add(selector);
    return selector;
  }