aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/ea/StandardMutator.java
diff options
context:
space:
mode:
authorEduardo Pedroni <ep625@york.ac.uk>2014-03-08 14:48:25 +0000
committerEduardo Pedroni <ep625@york.ac.uk>2014-03-08 14:48:25 +0000
commitd63d3145f0f2abcee1bb88457324f4aaf9b9320e (patch)
treedfb19082adfba8989c4fd95ef286b8c1e7a1f2b1 /src/jcgp/ea/StandardMutator.java
parentef7a850a8f2f81ccaa07f25d9b7ad602e84d88c9 (diff)
Slowly refactoring Parameters to fit the GUI a little better...
Diffstat (limited to 'src/jcgp/ea/StandardMutator.java')
-rw-r--r--src/jcgp/ea/StandardMutator.java31
1 files changed, 0 insertions, 31 deletions
diff --git a/src/jcgp/ea/StandardMutator.java b/src/jcgp/ea/StandardMutator.java
deleted file mode 100644
index b9c0a4e..0000000
--- a/src/jcgp/ea/StandardMutator.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package jcgp.ea;
-
-import jcgp.Parameters;
-import jcgp.Utilities;
-import jcgp.population.Chromosome;
-import jcgp.population.MutableElement;
-import jcgp.population.Node;
-import jcgp.population.Output;
-
-public class StandardMutator implements Mutator {
-
- @Override
- public void mutate(Chromosome chromosome) {
- int mutations = (int) (Parameters.getMutationRate() * (((double) Parameters.getNodeCount() + Parameters.getOutputs()) / 100));
-
- for (int i = 0; i < mutations; i++) {
- MutableElement m = chromosome.getRandomMutableElement();
-
- 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()));
- }
- }
- }
- }
-}