private FilterResult<G, C> filter(
		final Seq<Phenotype<G, C>> population,
		final long generation
	) {
		int killCount = 0;
		int invalidCount = 0;

		final MSeq<Phenotype<G, C>> pop = MSeq.of(population);
		for (int i = 0, n = pop.size(); i < n; ++i) {
			final Phenotype<G, C> individual = pop.get(i);

			if (!_constraint.test(individual)) {
				pop.set(i, _constraint.repair(individual, generation));
				++invalidCount;
			} else if (individual.age(generation) >
						_evolutionParams.maximalPhenotypeAge())
			{
				pop.set(i, Phenotype.of(_genotypeFactory.newInstance(), generation));
				++killCount;
			}
		}

		return new FilterResult<>(pop.toISeq(), killCount, invalidCount);
	}
Create a new GA engine with the given parameters.

@param evaluator the population fitness evaluator
@param genotypeFactory the genotype factory this GA is working with.
@param constraint phenotype constraint which can override the default
       implementation the {@link Phenotype#isValid()} method and repairs
       invalid phenotypes when needed.
@param optimize the kind of optimization (minimize or maximize)
@param evolutionParams the evolution parameters, which influences the
       evolution process
@param executor the executor used for executing the single evolved steps
@param clock the clock used for calculating the timing results
@param interceptor the evolution interceptor, which gives additional
       possibilities to influence the actual evolution
@throws NullPointerException if one of the arguments is {@code null}
@throws IllegalArgumentException if the given integer values are smaller
        than one.
jenetics/src/main/java/io/jenetics/engine/Engine.java