Interface ScoreDirector<Solution_>

Type Parameters:
Solution_ - the solution type, the class with the PlanningSolution annotation
All Known Subinterfaces:
InnerScoreDirector<Solution_,Score_>, RevertableScoreDirector<Solution_>, VariableDescriptorAwareScoreDirector<Solution_>
All Known Implementing Classes:
AbstractScoreDirector, BavetConstraintStreamScoreDirector, EasyScoreDirector, IncrementalScoreDirector, VariableChangeRecordingScoreDirector

public interface ScoreDirector<Solution_>
The ScoreDirector holds the working solution and calculates the Score for it.
  • Method Details

    • getWorkingSolution

      @NonNull Solution_ getWorkingSolution()
      The PlanningSolution that is used to calculate the Score.

      Because a Score is best calculated incrementally (by deltas), the ScoreDirector needs to be notified when its working solution changes.

    • beforeVariableChanged

      void beforeVariableChanged(Object entity, String variableName)
    • afterVariableChanged

      void afterVariableChanged(Object entity, String variableName)
    • beforeListVariableElementAssigned

      void beforeListVariableElementAssigned(Object entity, String variableName, Object element)
    • afterListVariableElementAssigned

      void afterListVariableElementAssigned(Object entity, String variableName, Object element)
    • beforeListVariableElementUnassigned

      void beforeListVariableElementUnassigned(Object entity, String variableName, Object element)
    • afterListVariableElementUnassigned

      void afterListVariableElementUnassigned(Object entity, String variableName, Object element)
    • beforeListVariableChanged

      void beforeListVariableChanged(Object entity, String variableName, int fromIndex, int toIndex)
    • afterListVariableChanged

      void afterListVariableChanged(Object entity, String variableName, int fromIndex, int toIndex)
    • triggerVariableListeners

      void triggerVariableListeners()
    • beforeEntityAdded

      @Deprecated(forRemoval=true, since="1.8.0") default void beforeEntityAdded(Object entity)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Calling this method by user code is not recommended and will lead to unforeseen consequences. Use ProblemChange instead.
    • afterEntityAdded

      @Deprecated(forRemoval=true, since="1.8.0") default void afterEntityAdded(Object entity)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Calling this method by user code is not recommended and will lead to unforeseen consequences. Use ProblemChange instead.
    • beforeEntityRemoved

      @Deprecated(forRemoval=true, since="1.8.0") default void beforeEntityRemoved(Object entity)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Calling this method by user code is not recommended and will lead to unforeseen consequences. Use ProblemChange instead.
    • afterEntityRemoved

      @Deprecated(forRemoval=true, since="1.8.0") default void afterEntityRemoved(Object entity)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Calling this method by user code is not recommended and will lead to unforeseen consequences. Use ProblemChange instead.
    • beforeProblemFactAdded

      @Deprecated(forRemoval=true, since="1.8.0") default void beforeProblemFactAdded(Object problemFact)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Calling this method by user code is not recommended and will lead to unforeseen consequences. Use ProblemChange instead.
    • afterProblemFactAdded

      @Deprecated(forRemoval=true, since="1.8.0") default void afterProblemFactAdded(Object problemFact)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Calling this method by user code is not recommended and will lead to unforeseen consequences. Use ProblemChange instead.
    • beforeProblemPropertyChanged

      @Deprecated(forRemoval=true, since="1.8.0") default void beforeProblemPropertyChanged(Object problemFactOrEntity)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Calling this method by user code is not recommended and will lead to unforeseen consequences. Use ProblemChange instead.
    • afterProblemPropertyChanged

      @Deprecated(forRemoval=true, since="1.8.0") default void afterProblemPropertyChanged(Object problemFactOrEntity)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Calling this method by user code is not recommended and will lead to unforeseen consequences. Use ProblemChange instead.
    • beforeProblemFactRemoved

      @Deprecated(forRemoval=true, since="1.8.0") default void beforeProblemFactRemoved(Object problemFact)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Calling this method by user code is not recommended and will lead to unforeseen consequences. Use ProblemChange instead.
    • afterProblemFactRemoved

      @Deprecated(forRemoval=true, since="1.8.0") default void afterProblemFactRemoved(Object problemFact)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Calling this method by user code is not recommended and will lead to unforeseen consequences. Use ProblemChange instead.
    • lookUpWorkingObject

      <E> @Nullable E lookUpWorkingObject(@Nullable E externalObject)
      Translates an entity or fact instance (often from another Thread or JVM) to this ScoreDirector's internal working instance. Useful for move rebasing and in a ProblemChange.

      Matching is determined by the LookUpStrategyType on PlanningSolution. Matching uses a PlanningId by default.

      Type Parameters:
      E - the object type
      Returns:
      null if externalObject is null
      Throws:
      IllegalArgumentException - if there is no workingObject for externalObject, if it cannot be looked up or if the externalObject's class is not supported
      IllegalStateException - if it cannot be looked up
    • lookUpWorkingObjectOrReturnNull

      <E> @Nullable E lookUpWorkingObjectOrReturnNull(@Nullable E externalObject)
      As defined by lookUpWorkingObject(Object), but doesn't fail fast if no workingObject was ever added for the externalObject. It's recommended to use lookUpWorkingObject(Object) instead, especially in move rebasing code.
      Type Parameters:
      E - the object type
      Returns:
      null if externalObject is null or if there is no workingObject for externalObject
      Throws:
      IllegalArgumentException - if it cannot be looked up or if the externalObject's class is not supported
      IllegalStateException - if it cannot be looked up