Package org.optaplanner.core.api.solver
Interface SolutionManager<Solution_,Score_ extends Score<Score_>>
- Type Parameters:
Solution_
- the solution type, the class with thePlanningSolution
annotationScore_
- 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 aSolverFactory
to build aSolutionManager
.static <Solution_,
Score_ extends Score<Score_>, ProblemId_>
SolutionManager<Solution_,Score_> create
(SolverManager<Solution_, ProblemId_> solverManager) Uses aSolverManager
to build aSolutionManager
.default ScoreExplanation<Solution_,
Score_> As defined byexplain(Object)
, usingSolutionUpdatePolicy.UPDATE_ALL
.explain
(Solution_ solution, SolutionUpdatePolicy solutionUpdatePolicy) Calculates and retrievesConstraintMatchTotal
s andIndictment
s 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 aSolverFactory
to build aSolutionManager
.- Type Parameters:
Solution_
- the solution type, the class with thePlanningSolution
annotationScore_
- 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 aSolverManager
to build aSolutionManager
.- Type Parameters:
Solution_
- the solution type, the class with thePlanningSolution
annotationScore_
- the actual score typeProblemId_
- the ID type of a submitted problem, such asLong
orUUID
- 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
SolutionUpdatePolicy
didn'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 retrievesConstraintMatchTotal
s andIndictment
s 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:
-