aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/JCGP.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jcgp/JCGP.java')
-rw-r--r--src/jcgp/JCGP.java24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/jcgp/JCGP.java b/src/jcgp/JCGP.java
index f980c00..1e6d628 100644
--- a/src/jcgp/JCGP.java
+++ b/src/jcgp/JCGP.java
@@ -5,12 +5,15 @@ import java.io.File;
import jcgp.backend.modules.es.EvolutionaryStrategy;
import jcgp.backend.modules.es.MuPlusLambda;
import jcgp.backend.modules.es.TournamentSelection;
+import jcgp.backend.modules.mutator.FixedPointMutator;
import jcgp.backend.modules.mutator.Mutator;
-import jcgp.backend.modules.mutator.PointMutator;
+import jcgp.backend.modules.mutator.PercentPointMutator;
+import jcgp.backend.modules.mutator.ProbabilisticMutator;
import jcgp.backend.modules.problem.DigitalCircuitProblem;
import jcgp.backend.modules.problem.Problem;
import jcgp.backend.modules.problem.SymbolicRegressionProblem;
import jcgp.backend.modules.problem.TestCaseProblem;
+import jcgp.backend.modules.problem.TravellingSalesmanProblem;
import jcgp.backend.parsers.ChromosomeParser;
import jcgp.backend.parsers.FunctionParser;
import jcgp.backend.parsers.ParameterParser;
@@ -49,19 +52,22 @@ public class JCGP {
*/
// mutators
private Mutator[] mutators = new Mutator[] {
- new PointMutator(resources) };
+ new PercentPointMutator(resources),
+ new FixedPointMutator(resources),
+ new ProbabilisticMutator(resources)};
private Mutator mutator = mutators[0];
// evolutionary algorithms
private EvolutionaryStrategy[] evolutionaryStrategies = new EvolutionaryStrategy[] {
new MuPlusLambda(resources),
- new TournamentSelection(resources) };
+ new TournamentSelection(resources)};
private EvolutionaryStrategy evolutionaryStrategy = evolutionaryStrategies[0];
// problem types
private Problem[] problems = new Problem[] {
new SymbolicRegressionProblem(resources),
- new DigitalCircuitProblem(resources) };
+ new DigitalCircuitProblem(resources),
+ new TravellingSalesmanProblem(resources)};
private Problem problem = problems[0];
/*
@@ -178,7 +184,6 @@ public class JCGP {
}
public void nextGeneration() {
- System.out.println("service: doing next gen");
if (!finished) {
problem.evaluate(population, (Resources) resources);
reportGeneration();
@@ -264,12 +269,9 @@ public class JCGP {
reset();
}
- public void loadTestCases(File file) {
- if (problem instanceof TestCaseProblem) {
- TestCaseParser.parseParameters(file, resources);
- reset();
- TestCaseParser.parse(file, (TestCaseProblem<?>) problem, resources);
- }
+ public void loadProblemData(File file) {
+ problem.parse(file, resources);
+ reset();
}
public void loadChromosome(File file, int chromosomeIndex) {