package model.ea.operators;

import helper.ConfigurationHelper;
import model.ea.Population;

@SuppressWarnings("unused")
public class BestSelectionOperator implements IEnvironmentSelectionOperator {
	 private int numberOfSelections = ConfigurationHelper.getInstance().getPropertyInteger("IndividualsPerPopulation", 10);
	 
	/**
	 * Takes the population after Recombination and Mutation selects
	 * the number of needed best individuals from parents and children.
	 * @param population Population instance
	 */
	@Override
	public void select(Population population) {
		population.sortByFitness();
		int poolSize = population.getPool().size();
		for (int i = poolSize-1; i >= numberOfSelections; i--) {
			population.getPool().remove(i);
		}
	}
}

@@ -90,36 +90,8 @@
 n;%0A%0A
-@SuppressWarnings(%22unused%22)%0A
 publ
@@ -103,16 +103,27 @@
 ass Best
+Environment
 Selectio
@@ -123,24 +123,16 @@
 election
-Operator
  impleme
@@ -160,16 +160,8 @@
 tion
-Operator
  %7B%0A%09

Comment was added to this operator.