diff options
Diffstat (limited to 'src/jcgp/population')
-rw-r--r-- | src/jcgp/population/Chromosome.java | 2 | ||||
-rw-r--r-- | src/jcgp/population/Connection.java | 2 | ||||
-rw-r--r-- | src/jcgp/population/Input.java | 7 | ||||
-rw-r--r-- | src/jcgp/population/Node.java | 2 | ||||
-rw-r--r-- | src/jcgp/population/Output.java | 2 |
5 files changed, 8 insertions, 7 deletions
diff --git a/src/jcgp/population/Chromosome.java b/src/jcgp/population/Chromosome.java index f61b780..12a8978 100644 --- a/src/jcgp/population/Chromosome.java +++ b/src/jcgp/population/Chromosome.java @@ -158,7 +158,7 @@ public class Chromosome { * @param values * @throws ParameterMismatchException */ - public void setInputs(int ... values) throws ParameterMismatchException { + public void setInputs(Object ... values) throws ParameterMismatchException { // if the values provided don't match the specified number of inputs, the user should be warned if (values.length == inputs.length) { // set inputs for evaluation diff --git a/src/jcgp/population/Connection.java b/src/jcgp/population/Connection.java index 3312de3..ff11d7c 100644 --- a/src/jcgp/population/Connection.java +++ b/src/jcgp/population/Connection.java @@ -2,6 +2,6 @@ package jcgp.population; public interface Connection { - public int getValue(); + public Object getValue(); } diff --git a/src/jcgp/population/Input.java b/src/jcgp/population/Input.java index ee008ce..2154dd9 100644 --- a/src/jcgp/population/Input.java +++ b/src/jcgp/population/Input.java @@ -2,18 +2,19 @@ package jcgp.population; public class Input implements Connection { - private int value = 0, index; + private Object value = 0; + private int index; public Input(int index) { this.index = index; } - public void setValue(int newValue) { + public void setValue(Object newValue) { value = newValue; } @Override - public int getValue() { + public Object getValue() { return value; } diff --git a/src/jcgp/population/Node.java b/src/jcgp/population/Node.java index b2e29df..e58c1a4 100644 --- a/src/jcgp/population/Node.java +++ b/src/jcgp/population/Node.java @@ -23,7 +23,7 @@ public class Node implements MutableElement, Connection { } @Override - public int getValue() { + public Object getValue() { return function.run(Arrays.copyOfRange(connections, 0, function.getArity())); } diff --git a/src/jcgp/population/Output.java b/src/jcgp/population/Output.java index f0bcbbf..dae7278 100644 --- a/src/jcgp/population/Output.java +++ b/src/jcgp/population/Output.java @@ -13,7 +13,7 @@ public class Output implements MutableElement { this.index = index; } - public int calculate() { + public Object calculate() { return source.getValue(); } |