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.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/jcgp/JCGP.java b/src/jcgp/JCGP.java
index 1e847fb..f949944 100644
--- a/src/jcgp/JCGP.java
+++ b/src/jcgp/JCGP.java
@@ -7,9 +7,9 @@ import jcgp.backend.modules.es.MuPlusLambda;
import jcgp.backend.modules.es.TournamentSelection;
import jcgp.backend.modules.mutator.Mutator;
import jcgp.backend.modules.mutator.PointMutator;
-import jcgp.backend.modules.problem.DigitalCircuit;
+import jcgp.backend.modules.problem.DigitalCircuitProblem;
import jcgp.backend.modules.problem.Problem;
-import jcgp.backend.modules.problem.SymbolicRegression;
+import jcgp.backend.modules.problem.SymbolicRegressionProblem;
import jcgp.backend.modules.problem.TestCaseProblem;
import jcgp.backend.parser.ChromosomeParser;
import jcgp.backend.parser.FunctionParser;
@@ -60,8 +60,8 @@ public class JCGP {
// problem types
private Problem[] problems = new Problem[] {
- new SymbolicRegression(resources),
- new DigitalCircuit(resources) };
+ new SymbolicRegressionProblem(resources),
+ new DigitalCircuitProblem(resources) };
private Problem problem;
/*
@@ -84,7 +84,7 @@ public class JCGP {
jcgp.loadParameters(new File(args[0]));
if (jcgp.getProblem() instanceof TestCaseProblem) {
- TestCaseParser.parse(new File(args[2]), (TestCaseProblem<?>) jcgp.getProblem());
+ ((TestCaseProblem<?>) jcgp.getProblem()).parse(new File(args[2]));
}
jcgp.start();
@@ -230,7 +230,8 @@ public class JCGP {
private void reportGeneration() {
if (resources.reportInterval() > 0) {
if (resources.currentGeneration() % resources.reportInterval() == 0) {
- resources.println("[CGP] Generation: " + resources.currentGeneration());
+ resources.println("[CGP] Generation: " + resources.currentGeneration() + ", fittest chromosome ("
+ + population.getFittestIndex() + ") has fitness: " + population.getFittest().getFitness());
}
}
}
@@ -260,7 +261,9 @@ public class JCGP {
public void loadTestCases(File file) {
if (problem instanceof TestCaseProblem) {
- TestCaseParser.parse(file, (TestCaseProblem<?>) problem);
+ TestCaseParser.parseParameters(file, resources);
+ reset();
+ ((TestCaseProblem<?>) problem).parse(file);
}
}