
freak.core.graph.Recombination Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of freak-core Show documentation
Show all versions of freak-core Show documentation
Core library of the Free Evolutionary Algorithm Toolkit
/*
* This file is part of FrEAK. For licensing and copyright information
* please see the file COPYING in the root directory of this
* distribution or contact .
*/
package freak.core.graph;
import freak.core.control.ScheduleInterface;
import freak.core.modulesupport.IncompatibleModuleException;
import freak.core.modulesupport.UnsupportedEnvironmentException;
import freak.core.searchspace.SearchSpace;
/**
* An abstract superclass for all recombination operators.
*
* @author Dirk
*/
abstract public class Recombination extends AbstractVariation {
/**
* Creates a new Recombination
operator.
*
* @param graph a link back to the operator graph.
*/
public Recombination(OperatorGraph graph) {
super(graph);
}
public void testSchedule(ScheduleInterface schedule)
throws UnsupportedEnvironmentException {
super.testSchedule(schedule);
// test if the operator's package is compatible with the current
// search space
SearchSpace searchSpace = schedule.getPhenotypeSearchSpace();
String searchSpaceName = searchSpace.getClass().getName().toLowerCase();
searchSpaceName = searchSpaceName.substring(searchSpaceName.lastIndexOf('.') + 1, searchSpaceName.length());
String packageName = this.getClass().getPackage().getName();
if (!(packageName.endsWith(searchSpaceName) || packageName.endsWith("common"))) {
throw new IncompatibleModuleException(schedule.getPhenotypeSearchSpace(), "Wrong search space.");
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy