Package org.optaplanner.core.api.solver
Interface SolutionManager<Solution_,Score_ extends Score<Score_>>
- Type Parameters:
Solution_- the solution type, the class with thePlanningSolutionannotationScore_- the actual score type
- All Known Implementing Classes:
DefaultSolutionManager
public interface SolutionManager<Solution_,Score_ extends Score<Score_>>
A stateless service to help calculate
Score, ConstraintMatchTotal,
Indictment, etc.
To create a SolutionManager instance, use create(SolverFactory).
These methods are thread-safe unless explicitly stated otherwise.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <Solution_,Score_ extends Score<Score_>>
SolutionManager<Solution_,Score_> create(SolverFactory<Solution_> solverFactory) Uses aSolverFactoryto build aSolutionManager.static <Solution_,Score_ extends Score<Score_>, ProblemId_>
SolutionManager<Solution_,Score_> create(SolverManager<Solution_, ProblemId_> solverManager) Uses aSolverManagerto build aSolutionManager.default ScoreExplanation<Solution_,Score_> As defined byexplain(Object), usingSolutionUpdatePolicy.UPDATE_ALL.explain(Solution_ solution, SolutionUpdatePolicy solutionUpdatePolicy) Calculates and retrievesConstraintMatchTotals andIndictments necessary for describing the quality of a particular solution.default Score_As defined byupdate(Object, SolutionUpdatePolicy), usingSolutionUpdatePolicy.UPDATE_ALL.update(Solution_ solution, SolutionUpdatePolicy solutionUpdatePolicy) Updates the given solution according to theSolutionUpdatePolicy.
-
Method Details
-
create
static <Solution_,Score_ extends Score<Score_>> SolutionManager<Solution_,Score_> create(SolverFactory<Solution_> solverFactory) Uses aSolverFactoryto build aSolutionManager.- Type Parameters:
Solution_- the solution type, the class with thePlanningSolutionannotationScore_- the actual score type- Parameters:
solverFactory- never null- Returns:
- never null
-
create
static <Solution_,Score_ extends Score<Score_>, SolutionManager<Solution_,ProblemId_> Score_> create(SolverManager<Solution_, ProblemId_> solverManager) Uses aSolverManagerto build aSolutionManager.- Type Parameters:
Solution_- the solution type, the class with thePlanningSolutionannotationScore_- the actual score typeProblemId_- the ID type of a submitted problem, such asLongorUUID- Parameters:
solverManager- never null- Returns:
- never null
-
update
As defined byupdate(Object, SolutionUpdatePolicy), usingSolutionUpdatePolicy.UPDATE_ALL. -
update
Updates the given solution according to theSolutionUpdatePolicy.- Parameters:
solution- never nullsolutionUpdatePolicy- never null; if unsure, pickSolutionUpdatePolicy.UPDATE_ALL- Returns:
- possibly null if already null and
SolutionUpdatePolicydidn't cause its update - See Also:
-
explain
As defined byexplain(Object), usingSolutionUpdatePolicy.UPDATE_ALL. -
explain
ScoreExplanation<Solution_,Score_> explain(Solution_ solution, SolutionUpdatePolicy solutionUpdatePolicy) Calculates and retrievesConstraintMatchTotals andIndictments necessary for describing the quality of a particular solution.- Parameters:
solution- never nullsolutionUpdatePolicy- never null; if unsure, pickSolutionUpdatePolicy.UPDATE_ALL- Returns:
- never null
- Throws:
IllegalStateException- when constraint matching is disabled or not supported by the underlying score calculator, such asEasyScoreCalculator.- See Also:
-