Interface ConstraintMatchAwareIncrementalScoreCalculator<Solution_,Score_ extends Score<Score_>>
- Type Parameters:
Solution_- the solution type, the class with thePlanningSolutionannotationScore_- theScoretype
- All Superinterfaces:
IncrementalScoreCalculator<Solution_,Score_>
public interface ConstraintMatchAwareIncrementalScoreCalculator<Solution_,Score_ extends Score<Score_>>
extends IncrementalScoreCalculator<Solution_,Score_>
Allows a
IncrementalScoreCalculator to report ConstraintMatchTotals
for explaining a score (= which score constraints match for how much)
and also for score corruption analysis.-
Method Summary
Modifier and TypeMethodDescription@NonNull Collection<ConstraintMatchTotal<Score_>>@Nullable Map<Object,Indictment<Score_>> voidresetWorkingSolution(@NonNull Solution_ workingSolution, boolean constraintMatchEnabled) Allows for increased performance because it only tracks if constraintMatchEnabled is true.Methods inherited from interface ai.timefold.solver.core.api.score.calculator.IncrementalScoreCalculator
afterEntityAdded, afterEntityRemoved, afterListVariableChanged, afterListVariableElementAssigned, afterListVariableElementUnassigned, afterVariableChanged, beforeEntityAdded, beforeEntityRemoved, beforeListVariableChanged, beforeListVariableElementAssigned, beforeListVariableElementUnassigned, beforeVariableChanged, calculateScore, resetWorkingSolution
-
Method Details
-
resetWorkingSolution
Allows for increased performance because it only tracks if constraintMatchEnabled is true.Every implementation should call
resetWorkingSolution(Solution_, boolean)and only handle the constraintMatchEnabled parameter specifically (or ignore it).- Parameters:
workingSolution- to pass toresetWorkingSolution(Solution_, boolean).constraintMatchEnabled- true ifgetConstraintMatchTotals()orgetIndictmentMap()might be called.
-
getConstraintMatchTotals
@NonNull Collection<ConstraintMatchTotal<Score_>> getConstraintMatchTotals()- Returns:
- never null;
if a constraint is present in the problem but resulted in no matches,
it should still be present with a
ConstraintMatchTotal.getConstraintMatchSet()size of 0. - Throws:
IllegalStateException- ifresetWorkingSolution(Solution_, boolean)'s constraintMatchEnabled parameter was false
-
getIndictmentMap
@Nullable Map<Object,Indictment<Score_>> getIndictmentMap()- Returns:
- null if it should to be calculated non-incrementally from
getConstraintMatchTotals() - Throws:
IllegalStateException- ifresetWorkingSolution(Solution_, boolean)'s constraintMatchEnabled parameter was false- See Also:
-