aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/population
diff options
context:
space:
mode:
Diffstat (limited to 'src/jcgp/population')
-rw-r--r--src/jcgp/population/Output.java1
-rw-r--r--src/jcgp/population/Population.java18
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++;
}
};