aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEduardo Pedroni <ep625@york.ac.uk>2014-01-30 16:03:33 +0000
committerEduardo Pedroni <ep625@york.ac.uk>2014-01-30 16:03:33 +0000
commit761021e0551beaaaac1120ef6da37a70281974b2 (patch)
treee5ec3899242ff1b0c87131340c2c3c617ebe841b
parent2fa054bf63006dedc98639ff08b3f2c637c5d74b (diff)
Started formally implementing the class structure but ran into some issues. I'll re-design the structure to account for function mutations, function variety, generic data types and modularized behaviour.
-rw-r--r--.classpath1
-rw-r--r--README20
-rw-r--r--src/jcgp/Main.java10
-rw-r--r--src/jcgp/chromosome/Chromosome.java17
-rw-r--r--src/jcgp/chromosome/element/ChromosomeElement.java7
-rw-r--r--src/jcgp/chromosome/element/Input.java11
-rw-r--r--src/jcgp/chromosome/element/MutableElement.java12
-rw-r--r--src/jcgp/chromosome/element/Node.java26
-rw-r--r--src/jcgp/chromosome/element/Output.java26
-rw-r--r--src/jcgp/chromosome/functions/Function.java7
-rw-r--r--src/jcgp/chromosome/functions/FunctionSet.java14
-rw-r--r--src/jcgp/tests/Tests.java23
12 files changed, 172 insertions, 2 deletions
diff --git a/.classpath b/.classpath
index fb50116..3e0fb27 100644
--- a/.classpath
+++ b/.classpath
@@ -2,5 +2,6 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/README b/README
index 2150cb9..f869f69 100644
--- a/README
+++ b/README
@@ -1,3 +1,19 @@
-- Development Master Branch -
+- Development Branch -
-This is a clean commit with the basic project, more commits will follow when the project reaches critical points. \ No newline at end of file
+29/1
+
+Started formal development based on data_struct spike.
+
+The first goal is to produce the data structure that represents a chromosome. This structure will rely on a range
+of other classes, which will be developed and tested as well.
+
+Chromosome tests:
+ - a data structure called Chromosome exists
+ - the chromosome instance can return the right outputs based on given inputs
+
+ChromosomeElement tests:
+ - Node is capable of processing its connections using its function and returning the result
+ - Input returns the value it is set to
+ - Outputs returns a single value from its source Node
+
+ \ No newline at end of file
diff --git a/src/jcgp/Main.java b/src/jcgp/Main.java
new file mode 100644
index 0000000..007e617
--- /dev/null
+++ b/src/jcgp/Main.java
@@ -0,0 +1,10 @@
+package jcgp;
+
+public class Main {
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/src/jcgp/chromosome/Chromosome.java b/src/jcgp/chromosome/Chromosome.java
new file mode 100644
index 0000000..19d7e77
--- /dev/null
+++ b/src/jcgp/chromosome/Chromosome.java
@@ -0,0 +1,17 @@
+package jcgp.chromosome;
+
+import java.util.ArrayList;
+
+import jcgp.chromosome.element.ChromosomeElement;
+
+public class Chromosome {
+
+ private ArrayList<ArrayList<? extends ChromosomeElement>> nodes;
+
+ public Chromosome() {
+
+
+
+ }
+
+}
diff --git a/src/jcgp/chromosome/element/ChromosomeElement.java b/src/jcgp/chromosome/element/ChromosomeElement.java
new file mode 100644
index 0000000..2dc9107
--- /dev/null
+++ b/src/jcgp/chromosome/element/ChromosomeElement.java
@@ -0,0 +1,7 @@
+package jcgp.chromosome.element;
+
+public abstract class ChromosomeElement {
+
+ public abstract int evaluate();
+
+}
diff --git a/src/jcgp/chromosome/element/Input.java b/src/jcgp/chromosome/element/Input.java
new file mode 100644
index 0000000..de051dc
--- /dev/null
+++ b/src/jcgp/chromosome/element/Input.java
@@ -0,0 +1,11 @@
+package jcgp.chromosome.element;
+
+public class Input extends ChromosomeElement {
+
+ @Override
+ public int evaluate() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+}
diff --git a/src/jcgp/chromosome/element/MutableElement.java b/src/jcgp/chromosome/element/MutableElement.java
new file mode 100644
index 0000000..ed7e23c
--- /dev/null
+++ b/src/jcgp/chromosome/element/MutableElement.java
@@ -0,0 +1,12 @@
+package jcgp.chromosome.element;
+
+import jcgp.chromosome.Chromosome;
+import jcgp.chromosome.functions.FunctionSet;
+
+public interface MutableElement {
+
+ public void initialise(Chromosome chromosome, FunctionSet functions);
+
+ public void mutate(Chromosome chromosome, FunctionSet functions);
+
+}
diff --git a/src/jcgp/chromosome/element/Node.java b/src/jcgp/chromosome/element/Node.java
new file mode 100644
index 0000000..f97c680
--- /dev/null
+++ b/src/jcgp/chromosome/element/Node.java
@@ -0,0 +1,26 @@
+package jcgp.chromosome.element;
+
+import jcgp.chromosome.Chromosome;
+import jcgp.chromosome.functions.FunctionSet;
+
+public class Node extends ChromosomeElement implements MutableElement {
+
+ @Override
+ public void initialise(Chromosome chromosome, FunctionSet functions) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void mutate(Chromosome chromosome, FunctionSet functions) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public int evaluate() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+}
diff --git a/src/jcgp/chromosome/element/Output.java b/src/jcgp/chromosome/element/Output.java
new file mode 100644
index 0000000..261e77d
--- /dev/null
+++ b/src/jcgp/chromosome/element/Output.java
@@ -0,0 +1,26 @@
+package jcgp.chromosome.element;
+
+import jcgp.chromosome.Chromosome;
+import jcgp.chromosome.functions.FunctionSet;
+
+public class Output extends ChromosomeElement implements MutableElement {
+
+ @Override
+ public void initialise(Chromosome chromosome, FunctionSet functions) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void mutate(Chromosome chromosome, FunctionSet functions) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public int evaluate() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+}
diff --git a/src/jcgp/chromosome/functions/Function.java b/src/jcgp/chromosome/functions/Function.java
new file mode 100644
index 0000000..27697be
--- /dev/null
+++ b/src/jcgp/chromosome/functions/Function.java
@@ -0,0 +1,7 @@
+package jcgp.chromosome.functions;
+
+public abstract class Function {
+
+ public abstract int run();
+
+}
diff --git a/src/jcgp/chromosome/functions/FunctionSet.java b/src/jcgp/chromosome/functions/FunctionSet.java
new file mode 100644
index 0000000..e9d197a
--- /dev/null
+++ b/src/jcgp/chromosome/functions/FunctionSet.java
@@ -0,0 +1,14 @@
+package jcgp.chromosome.functions;
+
+import java.util.ArrayList;
+
+public class FunctionSet {
+
+ private ArrayList<Function> functions;
+
+ public FunctionSet() {
+ functions = new ArrayList<Function>();
+ }
+
+
+}
diff --git a/src/jcgp/tests/Tests.java b/src/jcgp/tests/Tests.java
new file mode 100644
index 0000000..28bfd3d
--- /dev/null
+++ b/src/jcgp/tests/Tests.java
@@ -0,0 +1,23 @@
+package jcgp.tests;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class Tests {
+
+ @Before
+ public void setUp() throws Exception {
+
+
+
+ }
+
+ @Test
+ public void test() {
+ fail("Not yet implemented");
+
+ }
+
+}