diff options
author | Eduardo Pedroni <ep625@york.ac.uk> | 2014-04-22 08:48:11 +0100 |
---|---|---|
committer | Eduardo Pedroni <ep625@york.ac.uk> | 2014-04-22 08:48:11 +0100 |
commit | 6769419bea279935c4a3a84616d45ee7d4a6345c (patch) | |
tree | 79a8c80865f0663e82eb9986f5b7c5f999e64aab /src/jcgp/backend/population | |
parent | efe490fec1c7a94f004b496c7c97c82083fe44ec (diff) |
Chromosome parser is buggy, need to fix that.
Diffstat (limited to 'src/jcgp/backend/population')
-rw-r--r-- | src/jcgp/backend/population/Node.java | 8 | ||||
-rw-r--r-- | src/jcgp/backend/population/Population.java | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/jcgp/backend/population/Node.java b/src/jcgp/backend/population/Node.java index 6a558a4..b716ff8 100644 --- a/src/jcgp/backend/population/Node.java +++ b/src/jcgp/backend/population/Node.java @@ -31,8 +31,12 @@ public class Node extends Gene implements MutableElement, Connection { @Override public void setConnection(int index, Connection newConnection) { - connections[index] = newConnection; - chromosome.recomputeActiveNodes(); + if (newConnection instanceof Node) { + if (((Node) newConnection).getColumn() < column) { + connections[index] = newConnection; + chromosome.recomputeActiveNodes(); + } + } } public void initialise(Function newFunction, Connection ... newConnections) throws InsufficientConnectionsException { diff --git a/src/jcgp/backend/population/Population.java b/src/jcgp/backend/population/Population.java index 1bbdc54..b6dd055 100644 --- a/src/jcgp/backend/population/Population.java +++ b/src/jcgp/backend/population/Population.java @@ -4,7 +4,7 @@ import jcgp.backend.resources.Resources; public class Population { - private Chromosome[] chromosomes; + private final Chromosome[] chromosomes; private final Resources resources; private int fittest = 0; |