T - the type of the expected valuespublic final class TestDataFitnessFunction<T> extends Object implements FitnessFunction
| Constructor and Description |
|---|
TestDataFitnessFunction(Map<Assignments,T> tests,
ToDoubleBiFunction<T,T> rankingFunction)
Creates a
TestDataFitnessFunction which uses the given test cases and ranking function to determine the suitability of candidates. |
| Modifier and Type | Method and Description |
|---|---|
static TestDataFitnessFunction<Integer> |
createIntegerTestDataFitnessFunction(Map<Assignments,Integer> tests)
Returns a new
FitnessFunction which uses the specified test data to assess the fitness of potential solutions. |
double |
evaluate(Node node)
Evaluates the specified
Node using the test data specified when this FitnessFunction was constructed. |
public TestDataFitnessFunction(Map<Assignments,T> tests, ToDoubleBiFunction<T,T> rankingFunction)
TestDataFitnessFunction which uses the given test cases and ranking function to determine the suitability of candidates.tests - a collection of test cases which associate an Assignments (used as input to Node.evaluate(Assignments)) with the corresponding
expected outcomerankingFunction - accepts the expected value (as the first argument) and the actual value (as the second argument) of applying a test case (as represented as an
entry in tests and returns a fitness valuepublic static TestDataFitnessFunction<Integer> createIntegerTestDataFitnessFunction(Map<Assignments,Integer> tests)
FitnessFunction which uses the specified test data to assess the fitness of potential solutions.tests - test data which associates a collection of inputs with their expected outcomespublic double evaluate(Node node)
Node using the test data specified when this FitnessFunction was constructed.evaluate in interface FitnessFunctionnode - the potential solution that whose fitness will be determinednode using each of the inputs of the test dataOakGP Genetic Programming Framework