Interface ScoreDirectorFactoryService<Solution_,Score_ extends Score<Score_>>
- Type Parameters:
Solution_
- the solution type, the class with thePlanningSolution
annotationScore_
- the score type to go with the solution
- All Known Implementing Classes:
DrlScoreDirectorFactoryService
,EasyScoreDirectorFactoryService
,IncrementalScoreDirectorFactoryService
public interface ScoreDirectorFactoryService<Solution_,Score_ extends Score<Score_>>
All
ScoreDirectorFactory
implementations must provide an implementation of this interface,
as well as an entry in META-INF/services/org.optaplanner.core.impl.score.director.ScoreDirectorFactoryService file.
This makes it available for discovery in ScoreDirectorFactoryFactory
via ServiceLoader
.-
Method Summary
Modifier and TypeMethodDescriptionbuildScoreDirectorFactory
(ClassLoader classLoader, SolutionDescriptor<Solution_> solutionDescriptor, ScoreDirectorFactoryConfig config) Returns aSupplier
which returns new instance of a score director defined bygetSupportedScoreDirectorType()
.default int
If multiple services are available for the same config, the one with the higher priority is picked.
-
Method Details
-
getPriority
default int getPriority()If multiple services are available for the same config, the one with the higher priority is picked. Used by the CS services to ensure Drools is picked if both Drools and Bavet are available.- Returns:
-
getSupportedScoreDirectorType
ScoreDirectorType getSupportedScoreDirectorType()- Returns:
- never null, the score director type that is implemented by the factory
-
buildScoreDirectorFactory
Supplier<AbstractScoreDirectorFactory<Solution_,Score_>> buildScoreDirectorFactory(ClassLoader classLoader, SolutionDescriptor<Solution_> solutionDescriptor, ScoreDirectorFactoryConfig config) Returns aSupplier
which returns new instance of a score director defined bygetSupportedScoreDirectorType()
. This is done so that the actual factory is only instantiated after all the configuration fail-fasts have been performed.- Parameters:
classLoader
-solutionDescriptor
- never null, solution descriptor provided by the solverconfig
- never null, configuration to use for instantiating the factory- Returns:
- null when this type is not configured
- Throws:
IllegalStateException
- if the configuration has an issue
-