Package org.optaplanner.core.api.score
Interface ScoreExplanation<Solution_,Score_ extends Score<Score_>>
-
- Type Parameters:
Solution_- the solution type, the class with thePlanningSolutionannotationScore_- the actual score type
- All Known Implementing Classes:
DefaultScoreExplanation
public interface ScoreExplanation<Solution_,Score_ extends Score<Score_>>Build byScoreManager.explainScore(Object)to holdConstraintMatchTotals andIndictments necessary to explain the quality of a particularScore.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Map<String,ConstraintMatchTotal<Score_>>getConstraintMatchTotalMap()Map<Object,Indictment<Score_>>getIndictmentMap()Explains the impact of each planning entity or problem fact on theScore.Score_getScore()Return theScorebeing explained.Solution_getSolution()Retrieve thePlanningSolutionthat the score being explained comes from.StringgetSummary()Returns a diagnostic text that explains theScorethrough theConstraintMatchAPI to identify which constraints or planning entities cause that score quality.
-
-
-
Method Detail
-
getSolution
Solution_ getSolution()
Retrieve thePlanningSolutionthat the score being explained comes from.- Returns:
- never null
-
getScore
Score_ getScore()
Return theScorebeing explained. If the specificScoretype used by thePlanningSolutionis required, callgetSolution()and retrieve it from there.- Returns:
- never null
-
getSummary
String getSummary()
Returns a diagnostic text that explains theScorethrough theConstraintMatchAPI to identify which constraints or planning entities cause that score quality. In case of aninfeasiblesolution, 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
getConstraintMatchTotalMap()andgetIndictmentMap()and convert those into a domain specific API.- Returns:
- never null
-
getConstraintMatchTotalMap
Map<String,ConstraintMatchTotal<Score_>> getConstraintMatchTotalMap()
Explains theScoreofgetScore()()} by splitting it up perConstraint.The sum of
ConstraintMatchTotal.getScore()equalsgetScore()()}.- Returns:
- never null, the key is the
constraintId(to create one, useConstraintMatchTotal.composeConstraintId(String, String)). - See Also:
getIndictmentMap()
-
getIndictmentMap
Map<Object,Indictment<Score_>> getIndictmentMap()
Explains the impact of each planning entity or problem fact on theScore. AnIndictmentis basically the inverse of aConstraintMatchTotal: it is aScoretotal for each justificationObjectinConstraintMatch.getJustificationList().The sum of
ConstraintMatchTotal.getScore()differs fromgetScore()()} because eachConstraintMatch.getScore()is counted for each justification inConstraintMatch.getJustificationList().- Returns:
- never null, the key is a
problem factor aplanning entity - See Also:
getConstraintMatchTotalMap()
-
-