diff options
author | Eduardo Pedroni <ep625@york.ac.uk> | 2014-02-12 11:57:18 +0000 |
---|---|---|
committer | Eduardo Pedroni <ep625@york.ac.uk> | 2014-02-12 11:57:18 +0000 |
commit | 727801ab8002481fd2d213b45c3b43225b0f73bb (patch) | |
tree | 88f30ff057cb433f4a83a2e2acd4b5391c8935e7 /src/jcgp/population | |
parent | ccdecd80ffe482fbe994515e98eeae68fb4ca401 (diff) |
Added a few more tests, be back after the meeting.
Diffstat (limited to 'src/jcgp/population')
-rw-r--r-- | src/jcgp/population/Output.java | 1 | ||||
-rw-r--r-- | src/jcgp/population/Population.java | 18 |
2 files changed, 9 insertions, 10 deletions
diff --git a/src/jcgp/population/Output.java b/src/jcgp/population/Output.java index b3cb648..0171d7b 100644 --- a/src/jcgp/population/Output.java +++ b/src/jcgp/population/Output.java @@ -2,7 +2,6 @@ package jcgp.population; import java.util.ArrayList; - public class Output implements MutableElement { private Connection source; diff --git a/src/jcgp/population/Population.java b/src/jcgp/population/Population.java index fb968fb..56f1b50 100644 --- a/src/jcgp/population/Population.java +++ b/src/jcgp/population/Population.java @@ -8,15 +8,15 @@ public class Population implements Iterable<Chromosome> { private Chromosome[] population; - public Population() { - population = new Chromosome[Parameters.getPopulationSize()]; - for (int c = 0; c < population.length; c++) { - population[c] = new Chromosome(); - } - } - public Population(Chromosome ... chromosomes) { - population = chromosomes; + if (chromosomes.length > 0) { + population = chromosomes; + } else { + population = new Chromosome[Parameters.getPopulationSize()]; + for (int c = 0; c < population.length; c++) { + population[c] = new Chromosome(); + } + } } @Override @@ -45,7 +45,7 @@ public class Population implements Iterable<Chromosome> { public void remove() { // not allowed // since this would shift everything back one position, increment index - index++; + // index++; } }; |