diff options
author | Eduardo Pedroni <ep625@york.ac.uk> | 2014-02-11 16:50:27 +0000 |
---|---|---|
committer | Eduardo Pedroni <ep625@york.ac.uk> | 2014-02-11 16:50:27 +0000 |
commit | dd3b6446671f31d716eb07e546c6150b4d080abd (patch) | |
tree | b30c1ac7599bce9a17f1ea621eecc427256e1486 /src/jcgp/ea | |
parent | 3fc4bf4a2ea7c6cff9810b76964dd3c1388c0b3f (diff) |
Implemented more tests, refactored chromosome more, added the beginnings of active node detection
Diffstat (limited to 'src/jcgp/ea')
-rw-r--r-- | src/jcgp/ea/StandardMutator.java | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/jcgp/ea/StandardMutator.java b/src/jcgp/ea/StandardMutator.java index 8af3f5c..6a4af1a 100644 --- a/src/jcgp/ea/StandardMutator.java +++ b/src/jcgp/ea/StandardMutator.java @@ -14,18 +14,18 @@ public class StandardMutator implements Mutator { int mutations = (int) (Parameters.getMutationRate() * ((double) Parameters.getNodeCount() / 100)); for (int i = 0; i < mutations; i++) { - MutableElement m = Utilities.getRandomMutable(chromosome); - - if (m instanceof Output) { - m.setConnection(Utilities.getRandomConnection(chromosome, m.getColumn())); - } else if (m instanceof Node) { - int geneType = Utilities.getRandomInt(1 + Parameters.getMaxArity()); - if (geneType < 1) { - ((Node) m).setFunction(Utilities.getRandomFunction()); - } else { - m.setConnection(Utilities.getRandomConnection(chromosome, m.getColumn())); - } - } + MutableElement m = chromosome.getRandomMutableElement(); +// +// if (m instanceof Output) { +// m.setConnection(chromosome.getRandomConnection(m.getColumn())); +// } else if (m instanceof Node) { +// int geneType = Utilities.getRandomInt(1 + Parameters.getMaxArity()); +// if (geneType < 1) { +// ((Node) m).setFunction(Utilities.getRandomFunction()); +// } else { +// m.setConnection(chromosome.getRandomConnection(m.getColumn())); +// } +// } } } } |