diff options
Diffstat (limited to 'src/jcgp/population/Population.java')
-rw-r--r-- | src/jcgp/population/Population.java | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/src/jcgp/population/Population.java b/src/jcgp/population/Population.java deleted file mode 100644 index f5e0517..0000000 --- a/src/jcgp/population/Population.java +++ /dev/null @@ -1,45 +0,0 @@ -package jcgp.population; - -import jcgp.JCGP.Resources; - - -public class Population { - - private Chromosome[] chromosomes; - private int fittest; - - public Population(Resources resources) { - chromosomes = new Chromosome[(resources.getInt("popSize"))]; - for (int c = 0; c < chromosomes.length; c++) { - chromosomes[c] = new Chromosome(resources); - } - } - - public Population(Chromosome parent, Resources resources) { - chromosomes = new Chromosome[(resources.getInt("popSize"))]; - // make a clone for safety - this.chromosomes[0] = new Chromosome(parent); - // generate the rest of the individuals - for (int c = 1; c < chromosomes.length; c++) { - chromosomes[c] = new Chromosome(chromosomes[0]); - } - } - - /** - * Returns all chromosomes, parents first, then offspring. - * - * @param index - * @return - */ - public Chromosome getChromosome(int index) { - return chromosomes[index]; - } - - public void setBestIndividual(int index) { - fittest = index; - } - - public Chromosome getBestIndividual() { - return chromosomes[fittest]; - } -} |