From 24e57f68ed5e98bcfa9042c280e7db81ef2065c2 Mon Sep 17 00:00:00 2001 From: Marcel Kronfeld Date: Mon, 16 Aug 2010 08:35:56 +0000 Subject: [PATCH] Cosmetics (synch with MK branch) --- src/eva2/server/go/populations/Population.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/eva2/server/go/populations/Population.java b/src/eva2/server/go/populations/Population.java index 9cdd32e5..80a658ef 100644 --- a/src/eva2/server/go/populations/Population.java +++ b/src/eva2/server/go/populations/Population.java @@ -1005,6 +1005,24 @@ public class Population extends ArrayList implements PopulationInterface, Clonea return pop; } + /** + * This method returns the n current worst individuals from the population, where + * the sorting criterion is delivered by an AbstractEAIndividualComparator. + * There are less than n individuals returned if the population is smaller than n. + * If n is <= 0, then all individuals are returned and effectively just sorted + * by fitness. + * This does not check constraints! + * + * @param n number of individuals to look out for + * @return The m worst individuals, where m <= n + * + */ + public Population getWorstNIndividuals(int n, int fitIndex) { + Population pop = new Population(n); + getSortedNIndividuals(n, false, pop, new AbstractEAIndividualComparator(fitIndex)); + return pop; + } + /** * This method returns a clone of the population instance with sorted individuals, where * the sorting criterion is delivered by a Comparator.