From dd3b6446671f31d716eb07e546c6150b4d080abd Mon Sep 17 00:00:00 2001 From: Eduardo Pedroni Date: Tue, 11 Feb 2014 16:50:27 +0000 Subject: Implemented more tests, refactored chromosome more, added the beginnings of active node detection --- src/jcgp/ea/StandardMutator.java | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/jcgp/ea') 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())); +// } +// } } } } -- cgit v1.2.3