Interface IncrementalScoreCalculator<Solution_,Score_ extends Score<Score_>>
- Type Parameters:
Solution_
- the solution type, the class with thePlanningSolution
annotationScore_
- the score type to go with the solution
- All Known Subinterfaces:
ConstraintMatchAwareIncrementalScoreCalculator<Solution_,
Score_>
public interface IncrementalScoreCalculator<Solution_,Score_ extends Score<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
Modifier and TypeMethodDescriptionvoid
afterEntityAdded
(Object entity) void
afterEntityRemoved
(Object entity) default void
afterListVariableChanged
(Object entity, String variableName, int fromIndex, int toIndex) default void
afterListVariableElementAssigned
(String variableName, Object element) default void
afterListVariableElementUnassigned
(String variableName, Object element) void
afterVariableChanged
(Object entity, String variableName) void
beforeEntityAdded
(Object entity) void
beforeEntityRemoved
(Object entity) default void
beforeListVariableChanged
(Object entity, String variableName, int fromIndex, int toIndex) default void
beforeListVariableElementAssigned
(String variableName, Object element) default void
beforeListVariableElementUnassigned
(String variableName, Object element) void
beforeVariableChanged
(Object entity, String variableName) This method is only called if theScore
cannot be predicted.void
resetWorkingSolution
(Solution_ workingSolution) There are nobeforeEntityAdded(Object)
andafterEntityAdded(Object)
calls for entities that are already present in the workingSolution.
-
Method Details
-
resetWorkingSolution
There are nobeforeEntityAdded(Object)
andafterEntityAdded(Object)
calls for entities that are already present in the workingSolution.- Parameters:
workingSolution
- never null
-
beforeEntityAdded
- Parameters:
entity
- never null, an instance of aPlanningEntity
class
-
afterEntityAdded
- Parameters:
entity
- never null, an instance of aPlanningEntity
class
-
beforeVariableChanged
- Parameters:
entity
- never null, an instance of aPlanningEntity
classvariableName
- never null, either a genuine or shadowPlanningVariable
-
afterVariableChanged
- Parameters:
entity
- never null, an instance of aPlanningEntity
classvariableName
- never null, either a genuine or shadowPlanningVariable
-
beforeListVariableElementAssigned
-
afterListVariableElementAssigned
-
beforeListVariableElementUnassigned
-
afterListVariableElementUnassigned
-
beforeListVariableChanged
-
afterListVariableChanged
-
beforeEntityRemoved
- Parameters:
entity
- never null, an instance of aPlanningEntity
class
-
afterEntityRemoved
- Parameters:
entity
- never null, an instance of aPlanningEntity
class
-
calculateScore
Score_ calculateScore()This method is only called if theScore
cannot be predicted. TheScore
can be predicted for example after an undo move.- Returns:
- never null
-