Package org.optaplanner.core.impl.score
Class DefaultScoreExplanation<Solution_,Score_ extends Score<Score_>>
- java.lang.Object
- 
- org.optaplanner.core.impl.score.DefaultScoreExplanation<Solution_,Score_>
 
- 
- All Implemented Interfaces:
- ScoreExplanation<Solution_,Score_>
 
 public final class DefaultScoreExplanation<Solution_,Score_ extends Score<Score_>> extends Object implements ScoreExplanation<Solution_,Score_> 
- 
- 
Constructor SummaryConstructors Constructor Description DefaultScoreExplanation(Solution_ solution, Score_ score, Map<String,ConstraintMatchTotal<Score_>> constraintMatchTotalMap, Map<Object,Indictment<Score_>> indictmentMap)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <Score_ extends Score<Score_>>
 StringexplainScore(Score_ workingScore, Collection<ConstraintMatchTotal<Score_>> constraintMatchTotalCollection, Collection<Indictment<Score_>> indictmentCollection)static <Score_ extends Score<Score_>>
 StringexplainScore(Score_ workingScore, Collection<ConstraintMatchTotal<Score_>> constraintMatchTotalCollection, Collection<Indictment<Score_>> indictmentCollection, int indictmentLimit, int constraintMatchLimit)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.StringtoString()
 
- 
- 
- 
Constructor Detail- 
DefaultScoreExplanationpublic DefaultScoreExplanation(Solution_ solution, Score_ score, Map<String,ConstraintMatchTotal<Score_>> constraintMatchTotalMap, Map<Object,Indictment<Score_>> indictmentMap) 
 
- 
 - 
Method Detail- 
explainScorepublic static <Score_ extends Score<Score_>> String explainScore(Score_ workingScore, Collection<ConstraintMatchTotal<Score_>> constraintMatchTotalCollection, Collection<Indictment<Score_>> indictmentCollection) 
 - 
explainScorepublic static <Score_ extends Score<Score_>> String explainScore(Score_ workingScore, Collection<ConstraintMatchTotal<Score_>> constraintMatchTotalCollection, Collection<Indictment<Score_>> indictmentCollection, int indictmentLimit, int constraintMatchLimit) 
 - 
getSolutionpublic Solution_ getSolution() Description copied from interface:ScoreExplanationRetrieve thePlanningSolutionthat the score being explained comes from.- Specified by:
- getSolutionin interface- ScoreExplanation<Solution_,Score_ extends Score<Score_>>
- Returns:
- never null
 
 - 
getScorepublic Score_ getScore() Description copied from interface:ScoreExplanationReturn theScorebeing explained. If the specificScoretype used by thePlanningSolutionis required, callScoreExplanation.getSolution()and retrieve it from there.
 - 
getConstraintMatchTotalMappublic Map<String,ConstraintMatchTotal<Score_>> getConstraintMatchTotalMap() Description copied from interface:ScoreExplanationExplains theScoreofScoreExplanation.getScore()()} by splitting it up perConstraint.The sum of ConstraintMatchTotal.getScore()equalsScoreExplanation.getScore()()}.- Specified by:
- getConstraintMatchTotalMapin interface- ScoreExplanation<Solution_,Score_ extends Score<Score_>>
- Returns:
- never null, the key is the constraintId(to create one, useConstraintMatchTotal.composeConstraintId(String, String)).
- See Also:
- ScoreExplanation.getIndictmentMap()
 
 - 
getIndictmentMappublic Map<Object,Indictment<Score_>> getIndictmentMap() Description copied from interface:ScoreExplanationExplains 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 fromScoreExplanation.getScore()()} because eachConstraintMatch.getScore()is counted for each justification inConstraintMatch.getJustificationList().- Specified by:
- getIndictmentMapin interface- ScoreExplanation<Solution_,Score_ extends Score<Score_>>
- Returns:
- never null, the key is a problem factor aplanning entity
- See Also:
- ScoreExplanation.getConstraintMatchTotalMap()
 
 - 
getSummarypublic String getSummary() Description copied from interface:ScoreExplanationReturns 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 ScoreExplanation.getConstraintMatchTotalMap()andScoreExplanation.getIndictmentMap()and convert those into a domain specific API.- Specified by:
- getSummaryin interface- ScoreExplanation<Solution_,Score_ extends Score<Score_>>
- Returns:
- never null
 
 
- 
 
-