org.optaplanner.core.api.score.calculator

## Interface IncrementalScoreCalculator<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 Known Subinterfaces:
    ConstraintMatchAwareIncrementalScoreCalculator<Solution_,Score_>, ConstraintMatchAwareIncrementalScoreCalculator<Solution_>, IncrementalScoreCalculator<Solution_>
  All Known Implementing Classes:
    AbstractIncrementalScoreCalculator

      public interface IncrementalScoreCalculator<Solution_,Score_ extends Score>

  Used for incremental java `Score` calculation. This is much faster than `EasyScoreCalculator` but requires much more code to implement too.

  Any implementation is naturally stateful.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `afterEntityAdded(Object entity)`
    `void` | `afterEntityRemoved(Object entity)`
    `void` | `afterVariableChanged(Object entity, String variableName)`
    `void` | `beforeEntityAdded(Object entity)`
    `void` | `beforeEntityRemoved(Object entity)`
    `void` | `beforeVariableChanged(Object entity, String variableName)`
    `Score_` | `calculateScore()` This method is only called if the `Score` cannot be predicted.
    `void` | `resetWorkingSolution(Solution_ workingSolution)` There are no `beforeEntityAdded(Object)` and `afterEntityAdded(Object)` calls for entities that are already present in the workingSolution.

- - ### Method Detail

    - #### resetWorkingSolution

          void resetWorkingSolution(Solution_ workingSolution)

      There are no `beforeEntityAdded(Object)` and `afterEntityAdded(Object)` calls for entities that are already present in the workingSolution.
      Parameters:
        `workingSolution` - never null

    - #### beforeEntityAdded

          void beforeEntityAdded(Object entity)

      Parameters:
        `entity` - never null, an instance of a `PlanningEntity` class

    - #### afterEntityAdded

          void afterEntityAdded(Object entity)

      Parameters:
        `entity` - never null, an instance of a `PlanningEntity` class

    - #### beforeVariableChanged

          void beforeVariableChanged(Object entity,
                                     String variableName)

      Parameters:
        `entity` - never null, an instance of a `PlanningEntity` class
        `variableName` - never null, either a genuine or shadow `PlanningVariable`

    - #### afterVariableChanged

          void afterVariableChanged(Object entity,
                                    String variableName)

      Parameters:
        `entity` - never null, an instance of a `PlanningEntity` class
        `variableName` - never null, either a genuine or shadow `PlanningVariable`

    - #### beforeEntityRemoved

          void beforeEntityRemoved(Object entity)

      Parameters:
        `entity` - never null, an instance of a `PlanningEntity` class

    - #### afterEntityRemoved

          void afterEntityRemoved(Object entity)

      Parameters:
        `entity` - never null, an instance of a `PlanningEntity` class

    - #### calculateScore

          Score_ calculateScore()

      This method is only called if the `Score` cannot be predicted. The `Score` can be predicted for example after an undo `Move`.
      Returns:
        never null

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