Search in sources :

Example 1 with MutationSearchAlgorithm

use of org.kanonizo.algorithms.MutationSearchAlgorithm in project kanonizo by kanonizo.

the class Framework method setupFitnessFunction.

/**
 * Create the instance of the fitness function that will be used to guide a metaheuristic search.
 * It is assumed that the Fitness Function has been set by the main method and is contained in the
 * {@link Properties#FITNESS_FUNC} object. Default case is an {@link APFDFunction}, and other
 * options include {@link APLCFunction} at present. More will be added soon
 */
protected void setupFitnessFunction() {
    FitnessFunction<SystemUnderTest> func;
    switch(Properties.COVERAGE_APPROACH) {
        case LINE:
            func = new APLCFunction(sut);
            break;
        case BRANCH:
            func = new APBCFunction(sut);
            break;
        default:
            func = new APLCFunction(sut);
    }
    if (algorithm instanceof MutationSearchAlgorithm) {
        func = ((MutationSearchAlgorithm) algorithm).getFitnessFunction();
    }
    sut.getTestSuite().setFitnessFunction(func);
    Properties.INSTRUMENT = func instanceof InstrumentedFitnessFunction;
}
Also used : InstrumentedFitnessFunction(org.kanonizo.algorithms.metaheuristics.fitness.InstrumentedFitnessFunction) MutationSearchAlgorithm(org.kanonizo.algorithms.MutationSearchAlgorithm) SystemUnderTest(org.kanonizo.framework.objects.SystemUnderTest) APBCFunction(org.kanonizo.algorithms.metaheuristics.fitness.APBCFunction) APLCFunction(org.kanonizo.algorithms.metaheuristics.fitness.APLCFunction)

Aggregations

MutationSearchAlgorithm (org.kanonizo.algorithms.MutationSearchAlgorithm)1 APBCFunction (org.kanonizo.algorithms.metaheuristics.fitness.APBCFunction)1 APLCFunction (org.kanonizo.algorithms.metaheuristics.fitness.APLCFunction)1 InstrumentedFitnessFunction (org.kanonizo.algorithms.metaheuristics.fitness.InstrumentedFitnessFunction)1 SystemUnderTest (org.kanonizo.framework.objects.SystemUnderTest)1