Package org.optaplanner.core.api.score
Interface ScoreManager<Solution_>
-
- Type Parameters:
Solution_
- the solution type, the class with thePlanningSolution
annotation
- All Known Implementing Classes:
DefaultScoreManager
public interface ScoreManager<Solution_>
A stateless service to help calculateScore
,ConstraintMatchTotal
,Indictment
, etc.To create a ScoreManager, use
create(SolverFactory)
.These methods are thread-safe unless explicitly stated otherwise.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static <Solution_>
ScoreManager<Solution_>create(SolverFactory<Solution_> solverFactory)
Uses aSolverFactory
to build aScoreManager
.String
explainScore(Solution_ solution)
Returns a diagnostic text that explains the solution through theConstraintMatch
API to identify which constraints or planning entities cause that score quality.Score
updateScore(Solution_ solution)
-
-
-
Method Detail
-
create
static <Solution_> ScoreManager<Solution_> create(SolverFactory<Solution_> solverFactory)
Uses aSolverFactory
to build aScoreManager
.- Type Parameters:
Solution_
- the solution type, the class with thePlanningSolution
annotation- Parameters:
solverFactory
- never null- Returns:
- never null
-
explainScore
String explainScore(Solution_ solution)
Returns a diagnostic text that explains the solution through theConstraintMatch
API to identify which constraints or planning entities cause that score quality. In case of aninfeasible
solution, this can help diagnose the cause of that.Do not parse this string. Instead, to provide this information in a UI or a service, use
SolverFactory.getScoreDirectorFactory()
to retrieveScoreDirector.getConstraintMatchTotalMap()
andScoreDirector.getIndictmentMap()
and convert those into a domain specific API.This method is thread-safe.
- Returns:
- null if
updateScore(Object)
returns null with the same solution - See Also:
ScoreDirector.explainScore()
-
-