diff options
author | Eduardo Pedroni <ep625@york.ac.uk> | 2014-05-07 18:38:27 +0100 |
---|---|---|
committer | Eduardo Pedroni <ep625@york.ac.uk> | 2014-05-07 18:38:27 +0100 |
commit | 7f89d81e6f8a5ce82d42c3b852b5219edaa4b86c (patch) | |
tree | cc069b43e1cdf7cb69456fe7e86e1f51d6ea8642 /src/jcgp/backend/population | |
parent | 8189116ea4b5db4675e31dfd04a5687d55e29262 (diff) |
Removed reflection for now, added fitness orientation support
Diffstat (limited to 'src/jcgp/backend/population')
-rw-r--r-- | src/jcgp/backend/population/Chromosome.java | 4 | ||||
-rw-r--r-- | src/jcgp/backend/population/Mutable.java (renamed from src/jcgp/backend/population/MutableElement.java) | 6 | ||||
-rw-r--r-- | src/jcgp/backend/population/Node.java | 6 | ||||
-rw-r--r-- | src/jcgp/backend/population/Output.java | 6 |
4 files changed, 11 insertions, 11 deletions
diff --git a/src/jcgp/backend/population/Chromosome.java b/src/jcgp/backend/population/Chromosome.java index 0dfa801..673bb26 100644 --- a/src/jcgp/backend/population/Chromosome.java +++ b/src/jcgp/backend/population/Chromosome.java @@ -283,12 +283,12 @@ public class Chromosome implements Comparable<Chromosome> { /** * This method is useful for mutating chromosomes. It returns any - * random {@code MutableElement} out of the chromosome with equal + * random {@code Mutable} out of the chromosome with equal * probability. * * @return a random element that can be mutated - node or output. */ - public MutableElement getRandomMutableElement() { + public Mutable getRandomMutable() { // choose output or node int index = resources.getRandomInt(outputs.length + (resources.rows() * resources.columns())); diff --git a/src/jcgp/backend/population/MutableElement.java b/src/jcgp/backend/population/Mutable.java index 5782a99..3ce7065 100644 --- a/src/jcgp/backend/population/MutableElement.java +++ b/src/jcgp/backend/population/Mutable.java @@ -1,7 +1,7 @@ package jcgp.backend.population; /** - * {@code MutableElement} declares the expected behaviour of any + * {@code Mutable} declares the expected behaviour of any * part of a chromosome that is mutable, more specifically * nodes or outputs. Inputs are not mutable since they don't have * connections or functions. @@ -14,7 +14,7 @@ package jcgp.backend.population; * @author Eduardo Pedroni * */ -public interface MutableElement { +public interface Mutable { /** * This method sets the indexed connection to the specified new connection. @@ -48,6 +48,6 @@ public interface MutableElement { * @param element the mutable element to compare to. * @return true if {@code element} is a copy of this element. */ - boolean copyOf(MutableElement element); + boolean copyOf(Mutable element); } diff --git a/src/jcgp/backend/population/Node.java b/src/jcgp/backend/population/Node.java index 704b24e..3bcf3da 100644 --- a/src/jcgp/backend/population/Node.java +++ b/src/jcgp/backend/population/Node.java @@ -10,7 +10,7 @@ import jcgp.backend.function.Function; * contains a function and a number of connections. * The node outputs the result of performing its function * on the values of its connections. Nodes therefore - * implement both {@code MutableElement} and {@code Connection} + * implement both {@code Mutable} and {@code Connection} * since they can be mutated but also connected to. * Nodes are constructed with a fixed number of connections * (determined by the maximum arity of the function set) @@ -20,7 +20,7 @@ import jcgp.backend.function.Function; * @author Eduardo Pedroni * */ -public class Node implements MutableElement, Connection { +public class Node implements Mutable, Connection { private Function function; private Connection[] connections; @@ -124,7 +124,7 @@ public class Node implements MutableElement, Connection { } @Override - public boolean copyOf(MutableElement element) { + public boolean copyOf(Mutable element) { // both cannot be the same instance if (this != element) { // element must be instance of node diff --git a/src/jcgp/backend/population/Output.java b/src/jcgp/backend/population/Output.java index ab693e2..938741b 100644 --- a/src/jcgp/backend/population/Output.java +++ b/src/jcgp/backend/population/Output.java @@ -12,7 +12,7 @@ import java.util.ArrayList; * @author Eduardo Pedroni * */ -public class Output implements MutableElement { +public class Output implements Mutable { private Connection source; private Chromosome chromosome; @@ -56,7 +56,7 @@ public class Output implements MutableElement { * is simply ignored and the output source is * set. * - * @see jcgp.backend.population.MutableElement#setConnection(int, jcgp.backend.population.Connection) + * @see jcgp.backend.population.Mutable#setConnection(int, jcgp.backend.population.Connection) */ @Override public void setConnection(int index, Connection newConnection) { @@ -66,7 +66,7 @@ public class Output implements MutableElement { } @Override - public boolean copyOf(MutableElement m) { + public boolean copyOf(Mutable m) { // both cannot be the same instance if (this != m) { // element must be instance of output |