org.optaplanner.core.api.score.calculator

## Interface ConstraintMatchAwareIncrementalScoreCalculator<Solution_,Score_ extends Score>

- Type Parameters:
    `Solution_` - the solution type, the class with the `PlanningSolution` annotation
    `Score_` - the score type to go with the solution
  All Superinterfaces:
    IncrementalScoreCalculator<Solution_,Score_>
  All Known Subinterfaces:
    ConstraintMatchAwareIncrementalScoreCalculator<Solution_>

      public interface ConstraintMatchAwareIncrementalScoreCalculator<Solution_,Score_ extends Score>
      extends IncrementalScoreCalculator<Solution_,Score_>

  Allows a `IncrementalScoreCalculator` to report `ConstraintMatchTotal`s for explaining a score (= which score constraints match for how much) and also for score corruption analysis.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `Collection<ConstraintMatchTotal>` | `getConstraintMatchTotals()`
    `Map<Object,Indictment>` | `getIndictmentMap()`
    `void` | `resetWorkingSolution(Solution_ workingSolution, boolean constraintMatchEnabled)` Allows for increased performance because it only tracks if constraintMatchEnabled is true.

    - ### Methods inherited from interface org.optaplanner.core.api.score.calculator.IncrementalScoreCalculator

      `afterEntityAdded, afterEntityRemoved, afterVariableChanged, beforeEntityAdded, beforeEntityRemoved, beforeVariableChanged, calculateScore, resetWorkingSolution`

- - ### Method Detail

    - #### resetWorkingSolution

          void resetWorkingSolution(Solution_ workingSolution,
                                    boolean constraintMatchEnabled)

      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` - never null, to pass to `resetWorkingSolution(Solution_, boolean)`.
        `constraintMatchEnabled` - true if `getConstraintMatchTotals()` or `getIndictmentMap()` might be called.

    - #### getConstraintMatchTotals

          Collection<ConstraintMatchTotal> getConstraintMatchTotals()

      Returns:
        never null
      Throws:
        `IllegalStateException` - if `resetWorkingSolution(Solution_, boolean)`'s constraintMatchEnabled parameter was false
      See Also:
        `ScoreDirector.getConstraintMatchTotals()`

    - #### getIndictmentMap

          Map<Object,Indictment> getIndictmentMap()

      Returns:
        null if it should be calculated non-incrementally from `getConstraintMatchTotals()`
      Throws:
        `IllegalStateException` - if `resetWorkingSolution(Solution_, boolean)`'s constraintMatchEnabled parameter was false
      See Also:
        `ScoreDirector.getIndictmentMap()`

Copyright © 2006–2021 JBoss by Red Hat. All rights reserved.