From ccdecd80ffe482fbe994515e98eeae68fb4ca401 Mon Sep 17 00:00:00 2001 From: Eduardo Pedroni Date: Tue, 11 Feb 2014 22:17:30 +0000 Subject: Finished writing chromosome tests, implemented active node detection, started writing node tests. --- src/jcgp/ea/StandardMutator.java | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/jcgp/ea') diff --git a/src/jcgp/ea/StandardMutator.java b/src/jcgp/ea/StandardMutator.java index 6a4af1a..447338a 100644 --- a/src/jcgp/ea/StandardMutator.java +++ b/src/jcgp/ea/StandardMutator.java @@ -15,17 +15,17 @@ public class StandardMutator implements Mutator { for (int i = 0; i < mutations; i++) { 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())); -// } -// } + + if (m instanceof Output) { + m.setConnection(chromosome.getRandomConnection()); + } 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(((Node) m).getColumn())); + } + } } } } -- cgit v1.2.3