Interface SolverFactory<Solution_>
- Type Parameters:
Solution_- the solution type, the class with thePlanningSolutionannotation
- All Known Implementing Classes:
DefaultSolverFactory
public interface SolverFactory<Solution_>
Creates
Solver instances.
Most applications only need one SolverFactory.
To create a SolverFactory, use createFromXmlResource(String).
To change the configuration programmatically, create a SolverConfig first
and then use create(SolverConfig).
These methods are thread-safe unless explicitly stated otherwise.
-
Method Summary
Modifier and TypeMethodDescriptionCreates a newSolverinstance.buildSolver(@NonNull SolverConfigOverride<Solution_> configOverride) As defined bybuildSolver().static <Solution_>
@NonNull SolverFactory<Solution_>create(@NonNull SolverConfig solverConfig) Uses aSolverConfigto build aSolverFactory.static <Solution_>
@NonNull SolverFactory<Solution_>createFromXmlFile(@NonNull File solverConfigFile) Reads an XML solver configuration from the file system and uses thatSolverConfigto build aSolverFactory.static <Solution_>
@NonNull SolverFactory<Solution_>createFromXmlFile(@NonNull File solverConfigFile, @Nullable ClassLoader classLoader) As defined bycreateFromXmlFile(File).static <Solution_>
@NonNull SolverFactory<Solution_>createFromXmlResource(@NonNull String solverConfigResource) Reads an XML solver configuration from the classpath and uses thatSolverConfigto build aSolverFactory.static <Solution_>
@NonNull SolverFactory<Solution_>createFromXmlResource(@NonNull String solverConfigResource, @Nullable ClassLoader classLoader) As defined bycreateFromXmlResource(String).
-
Method Details
-
createFromXmlResource
static <Solution_> @NonNull SolverFactory<Solution_> createFromXmlResource(@NonNull String solverConfigResource) Reads an XML solver configuration from the classpath and uses thatSolverConfigto build aSolverFactory. The XML root element must be<solver>.- Type Parameters:
Solution_- the solution type, the class with thePlanningSolutionannotation- Parameters:
solverConfigResource- a classpath resource as defined byClassLoader.getResource(String)- Returns:
- subsequent changes to the config have no effect on the returned instance
-
createFromXmlResource
static <Solution_> @NonNull SolverFactory<Solution_> createFromXmlResource(@NonNull String solverConfigResource, @Nullable ClassLoader classLoader) As defined bycreateFromXmlResource(String).- Type Parameters:
Solution_- the solution type, the class with thePlanningSolutionannotation- Parameters:
solverConfigResource- na classpath resource as defined byClassLoader.getResource(String)classLoader- theClassLoaderto use for loading all resources andClasses, null to use the defaultClassLoader- Returns:
- subsequent changes to the config have no effect on the returned instance
-
createFromXmlFile
static <Solution_> @NonNull SolverFactory<Solution_> createFromXmlFile(@NonNull File solverConfigFile) Reads an XML solver configuration from the file system and uses thatSolverConfigto build aSolverFactory.Warning: this leads to platform dependent code, it's recommend to use
createFromXmlResource(String)instead.- Type Parameters:
Solution_- the solution type, the class with thePlanningSolutionannotation- Returns:
- subsequent changes to the config have no effect on the returned instance
-
createFromXmlFile
static <Solution_> @NonNull SolverFactory<Solution_> createFromXmlFile(@NonNull File solverConfigFile, @Nullable ClassLoader classLoader) As defined bycreateFromXmlFile(File).- Type Parameters:
Solution_- the solution type, the class with thePlanningSolutionannotation- Parameters:
classLoader- theClassLoaderto use for loading all resources andClasses, null to use the defaultClassLoader- Returns:
- subsequent changes to the config have no effect on the returned instance
-
create
Uses aSolverConfigto build aSolverFactory. If you don't need to manipulate theSolverConfigprogrammatically, usecreateFromXmlResource(String)instead.- Type Parameters:
Solution_- the solution type, the class with thePlanningSolutionannotation- Returns:
- subsequent changes to the config have no effect on the returned instance
-
buildSolver
Creates a newSolverinstance. -
buildSolver
As defined bybuildSolver().- Parameters:
configOverride- includes settings that override the default configuration
-