Interface ScoreDirector<Solution_>

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

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

    • getWorkingSolution

      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.

      Returns:
      never null
    • beforeEntityAdded

      void beforeEntityAdded(Object entity)
    • afterEntityAdded

      void afterEntityAdded(Object entity)
    • 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()
    • beforeEntityRemoved

      void beforeEntityRemoved(Object entity)
    • afterEntityRemoved

      void afterEntityRemoved(Object entity)
    • beforeProblemFactAdded

      void beforeProblemFactAdded(Object problemFact)
    • afterProblemFactAdded

      void afterProblemFactAdded(Object problemFact)
    • beforeProblemPropertyChanged

      void beforeProblemPropertyChanged(Object problemFactOrEntity)
    • afterProblemPropertyChanged

      void afterProblemPropertyChanged(Object problemFactOrEntity)
    • beforeProblemFactRemoved

      void beforeProblemFactRemoved(Object problemFact)
    • afterProblemFactRemoved

      void afterProblemFactRemoved(Object problemFact)
    • lookUpWorkingObject

      <E> E lookUpWorkingObject(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
      Parameters:
      externalObject - sometimes null
      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> E lookUpWorkingObjectOrReturnNull(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
      Parameters:
      externalObject - sometimes null
      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