T
- the data type to be used by the TestCaseProblem.public abstract class TestCaseProblem<T> extends Problem
TestCaseProblem
must simply override parseTestCase()
to convert parsed
problem data strings into the required data type (T).Problem
Modifier and Type | Class and Description |
---|---|
static class |
TestCaseProblem.TestCase<U>
Basic data type for encapsulating test cases, it simply
contains arrays of inputs and outputs and associated getters.
|
Constructor and Description |
---|
TestCaseProblem(Resources resources)
Creates a new TestCaseProblem object.
|
Modifier and Type | Method and Description |
---|---|
void |
addTestCase(java.lang.String[] inputs,
java.lang.String[] outputs)
Adds test cases to the problem instance as they get parsed from a
problem data file.
|
void |
clearTestCases()
Remove all test cases.
|
javafx.collections.ObservableList<TestCaseProblem.TestCase<T>> |
getTestCases() |
int |
hasImprovement(Population population)
Used to assert whether a given population has a chromosome that is an improvement over
the current best chromosome.
|
void |
parseProblemData(java.io.File file,
ModifiableResources resources)
Parses the specified file and uses the parsed data to
set up the problem type instance appropriately.
|
evaluate, getBestFitness, getFileExtension, getFitnessOrientation, getFunctionSet, hasPerfectSolution, reset
getLocalParameters, toString
public TestCaseProblem(Resources resources)
resources
- a reference to the experiment's resources.public javafx.collections.ObservableList<TestCaseProblem.TestCase<T>> getTestCases()
public final void addTestCase(java.lang.String[] inputs, java.lang.String[] outputs)
parseTestCase
, which
must be implemented by subclasses.inputs
- the inputs represented as strings.outputs
- the outputs represented as strings.public void clearTestCases()
public void parseProblemData(java.io.File file, ModifiableResources resources)
Problem
ModifiableResources
instance.
parseProblemData
in class Problem
file
- the data file to parse.resources
- a modifiable reference to the experiment's resources.public int hasImprovement(Population population)
Problem
hasImprovement
in class Problem
population
- the population potentially containing a fitter chromosome.