diff options
author | Eduardo Pedroni <ep625@york.ac.uk> | 2014-02-11 22:17:30 +0000 |
---|---|---|
committer | Eduardo Pedroni <ep625@york.ac.uk> | 2014-02-11 22:17:30 +0000 |
commit | ccdecd80ffe482fbe994515e98eeae68fb4ca401 (patch) | |
tree | 50013c63d2e524ac69350256dd87fc0902dce0f9 /src/jcgp/ea | |
parent | dd3b6446671f31d716eb07e546c6150b4d080abd (diff) |
Finished writing chromosome tests, implemented active node detection, started writing node tests.
Diffstat (limited to 'src/jcgp/ea')
-rw-r--r-- | src/jcgp/ea/StandardMutator.java | 22 |
1 files changed, 11 insertions, 11 deletions
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())); + } + } } } } |