aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/ea
diff options
context:
space:
mode:
Diffstat (limited to 'src/jcgp/ea')
-rw-r--r--src/jcgp/ea/StandardMutator.java22
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()));
+ }
+ }
}
}
}