aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/backend/population/Chromosome.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jcgp/backend/population/Chromosome.java')
-rw-r--r--src/jcgp/backend/population/Chromosome.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/jcgp/backend/population/Chromosome.java b/src/jcgp/backend/population/Chromosome.java
index b99b817..0dfa801 100644
--- a/src/jcgp/backend/population/Chromosome.java
+++ b/src/jcgp/backend/population/Chromosome.java
@@ -159,7 +159,8 @@ public class Chromosome implements Comparable<Chromosome> {
* this instance. In practice, this iterates through the
* entire chromosome making equivalent connections and
* setting functions to the same values as those in the
- * specified chromosome.
+ * specified chromosome. It also sets the fitness of the
+ * copy to the same value as the original.
* <br>
* It is assumed that both chromosomes have the same
* topology; while this method will still run if that is not
@@ -205,6 +206,9 @@ public class Chromosome implements Comparable<Chromosome> {
System.out.println("Warning: Connection of subtype " + copyOutput.getClass().toString() + " is not explicitly handled by copy constructor.");
}
}
+
+ // copy fitness as well
+ this.fitness = clone.getFitness();
}
/**
@@ -264,7 +268,6 @@ public class Chromosome implements Comparable<Chromosome> {
* number of inputs exactly, an exception is thrown.
*
* @param values the values the input should take.
- * @throws ParameterMismatchException if the wrong number of values is received.
*/
public void setInputs(Object ... values) {
// if the values provided don't match the specified number of inputs, the user should be warned