aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/ea
diff options
context:
space:
mode:
Diffstat (limited to 'src/jcgp/ea')
-rw-r--r--src/jcgp/ea/EvolutionaryAlgorithm.java15
-rw-r--r--src/jcgp/ea/Mutator.java9
-rw-r--r--src/jcgp/ea/StandardEA.java20
-rw-r--r--src/jcgp/ea/StandardMutator.java13
4 files changed, 57 insertions, 0 deletions
diff --git a/src/jcgp/ea/EvolutionaryAlgorithm.java b/src/jcgp/ea/EvolutionaryAlgorithm.java
new file mode 100644
index 0000000..6e264aa
--- /dev/null
+++ b/src/jcgp/ea/EvolutionaryAlgorithm.java
@@ -0,0 +1,15 @@
+package jcgp.ea;
+
+import jcgp.population.Population;
+
+public abstract class EvolutionaryAlgorithm {
+
+ protected Mutator mutator;
+
+ public EvolutionaryAlgorithm(Mutator mutator) {
+ this.mutator = mutator;
+ }
+
+ public abstract void evolve(Population population);
+
+}
diff --git a/src/jcgp/ea/Mutator.java b/src/jcgp/ea/Mutator.java
new file mode 100644
index 0000000..df3fe1c
--- /dev/null
+++ b/src/jcgp/ea/Mutator.java
@@ -0,0 +1,9 @@
+package jcgp.ea;
+
+import jcgp.population.Chromosome;
+
+public interface Mutator {
+
+ void mutate(Chromosome chromosome);
+
+}
diff --git a/src/jcgp/ea/StandardEA.java b/src/jcgp/ea/StandardEA.java
new file mode 100644
index 0000000..fe0b3f9
--- /dev/null
+++ b/src/jcgp/ea/StandardEA.java
@@ -0,0 +1,20 @@
+package jcgp.ea;
+
+import jcgp.population.Chromosome;
+import jcgp.population.Population;
+
+public class StandardEA extends EvolutionaryAlgorithm {
+
+ public StandardEA(Mutator mutator) {
+ super(mutator);
+
+ }
+
+ @Override
+ public void evolve(Population population) {
+ for (Chromosome chromosome : population) {
+ mutator.mutate(chromosome);
+ }
+ }
+
+}
diff --git a/src/jcgp/ea/StandardMutator.java b/src/jcgp/ea/StandardMutator.java
new file mode 100644
index 0000000..731215d
--- /dev/null
+++ b/src/jcgp/ea/StandardMutator.java
@@ -0,0 +1,13 @@
+package jcgp.ea;
+
+import jcgp.population.Chromosome;
+
+public class StandardMutator implements Mutator {
+
+ @Override
+ public void mutate(Chromosome chromosome) {
+
+
+ }
+
+}