Class BavetConstraintStreamScoreDirector<Solution_,​Score_ extends org.optaplanner.core.api.score.Score<Score_>>

  • Type Parameters:
    Solution_ - the solution type, the class with the PlanningSolution annotation
    All Implemented Interfaces:
    AutoCloseable, Cloneable, org.optaplanner.core.api.score.director.ScoreDirector<Solution_>, org.optaplanner.core.impl.score.director.InnerScoreDirector<Solution_,​Score_>

    public final class BavetConstraintStreamScoreDirector<Solution_,​Score_ extends org.optaplanner.core.api.score.Score<Score_>>
    extends org.optaplanner.core.impl.score.director.AbstractScoreDirector<Solution_,​Score_,​BavetConstraintStreamScoreDirectorFactory<Solution_,​Score_>>
    FP streams implementation of ScoreDirector, which only recalculates the Score of the part of the working solution that changed, instead of the going through the entire PlanningSolution. This is incremental calculation, which is fast.
    See Also:
    ScoreDirector
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected BavetConstraintSession<Solution_,​Score_> session  
      • Fields inherited from class org.optaplanner.core.impl.score.director.AbstractScoreDirector

        allChangesWillBeUndoneBeforeStepEnds, calculationCount, constraintMatchEnabledPreference, logger, lookUpEnabled, lookUpManager, scoreDirectorFactory, variableListenerSupport, workingEntityListRevision, workingInitScore, workingSolution
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void afterElementAdded​(org.optaplanner.core.impl.domain.variable.descriptor.ListVariableDescriptor<Solution_> variableDescriptor, Object entity, int index)  
      void afterElementMoved​(org.optaplanner.core.impl.domain.variable.descriptor.ListVariableDescriptor<Solution_> variableDescriptor, Object sourceEntity, int sourceIndex, Object destinationEntity, int destinationIndex)  
      void afterElementRemoved​(org.optaplanner.core.impl.domain.variable.descriptor.ListVariableDescriptor<Solution_> variableDescriptor, Object entity, int index)  
      void afterEntityAdded​(org.optaplanner.core.impl.domain.entity.descriptor.EntityDescriptor<Solution_> entityDescriptor, Object entity)  
      void afterEntityRemoved​(org.optaplanner.core.impl.domain.entity.descriptor.EntityDescriptor<Solution_> entityDescriptor, Object entity)  
      void afterProblemFactAdded​(Object problemFact)  
      void afterProblemFactRemoved​(Object problemFact)  
      void afterProblemPropertyChanged​(Object problemFactOrEntity)  
      void afterVariableChanged​(org.optaplanner.core.impl.domain.variable.descriptor.VariableDescriptor<Solution_> variableDescriptor, Object entity)  
      Score_ calculateScore()  
      void close()  
      Map<String,​org.optaplanner.core.api.score.constraint.ConstraintMatchTotal<Score_>> getConstraintMatchTotalMap()  
      Map<Object,​org.optaplanner.core.api.score.constraint.Indictment<Score_>> getIndictmentMap()  
      BavetConstraintSession<Solution_,​Score_> getSession()  
      boolean isConstraintMatchEnabled()  
      boolean requiresFlushing()  
      void setWorkingSolution​(Solution_ workingSolution)  
      • Methods inherited from class org.optaplanner.core.impl.score.director.AbstractScoreDirector

        afterEntityAdded, afterEntityRemoved, afterVariableChanged, assertExpectedUndoMoveScore, assertExpectedWorkingScore, assertNonNullPlanningIds, assertPredictedScoreFromScratch, assertShadowVariablesAreNotStale, assertWorkingScoreFromScratch, beforeElementAdded, beforeElementMoved, beforeElementRemoved, beforeEntityAdded, beforeEntityAdded, beforeEntityRemoved, beforeEntityRemoved, beforeProblemFactAdded, beforeProblemFactRemoved, beforeProblemPropertyChanged, beforeVariableChanged, beforeVariableChanged, buildScoreCorruptionAnalysis, buildShadowVariableAnalysis, changeVariableFacade, clone, cloneSolution, cloneWorkingSolution, createChildThreadScoreDirector, doAndProcessMove, doAndProcessMove, getCalculationCount, getScoreDefinition, getScoreDirectorFactory, getSolutionDescriptor, getSupplyManager, getWorkingEntityListRevision, getWorkingSolution, isAllChangesWillBeUndoneBeforeStepEnds, isConstraintConfiguration, isConstraintMatchEnabledPreference, isLookUpEnabled, isWorkingEntityListDirty, lookUpWorkingObject, lookUpWorkingObjectOrReturnNull, overwriteConstraintMatchEnabledPreference, resetCalculationCount, setAllChangesWillBeUndoneBeforeStepEnds, setCalculatedScore, setWorkingEntityListDirty, toString, triggerVariableListeners
    • Method Detail

      • calculateScore

        public Score_ calculateScore()
      • isConstraintMatchEnabled

        public boolean isConstraintMatchEnabled()
      • getConstraintMatchTotalMap

        public Map<String,​org.optaplanner.core.api.score.constraint.ConstraintMatchTotal<Score_>> getConstraintMatchTotalMap()
      • getIndictmentMap

        public Map<Object,​org.optaplanner.core.api.score.constraint.Indictment<Score_>> getIndictmentMap()
      • requiresFlushing

        public boolean requiresFlushing()
      • afterVariableChanged

        public void afterVariableChanged​(org.optaplanner.core.impl.domain.variable.descriptor.VariableDescriptor<Solution_> variableDescriptor,
                                         Object entity)
        Specified by:
        afterVariableChanged in interface org.optaplanner.core.impl.score.director.InnerScoreDirector<Solution_,​Score_ extends org.optaplanner.core.api.score.Score<Score_>>
        Overrides:
        afterVariableChanged in class org.optaplanner.core.impl.score.director.AbstractScoreDirector<Solution_,​Score_ extends org.optaplanner.core.api.score.Score<Score_>,​BavetConstraintStreamScoreDirectorFactory<Solution_,​Score_ extends org.optaplanner.core.api.score.Score<Score_>>>
      • afterElementAdded

        public void afterElementAdded​(org.optaplanner.core.impl.domain.variable.descriptor.ListVariableDescriptor<Solution_> variableDescriptor,
                                      Object entity,
                                      int index)
        Specified by:
        afterElementAdded in interface org.optaplanner.core.impl.score.director.InnerScoreDirector<Solution_,​Score_ extends org.optaplanner.core.api.score.Score<Score_>>
        Overrides:
        afterElementAdded in class org.optaplanner.core.impl.score.director.AbstractScoreDirector<Solution_,​Score_ extends org.optaplanner.core.api.score.Score<Score_>,​BavetConstraintStreamScoreDirectorFactory<Solution_,​Score_ extends org.optaplanner.core.api.score.Score<Score_>>>
      • afterElementRemoved

        public void afterElementRemoved​(org.optaplanner.core.impl.domain.variable.descriptor.ListVariableDescriptor<Solution_> variableDescriptor,
                                        Object entity,
                                        int index)
        Specified by:
        afterElementRemoved in interface org.optaplanner.core.impl.score.director.InnerScoreDirector<Solution_,​Score_ extends org.optaplanner.core.api.score.Score<Score_>>
        Overrides:
        afterElementRemoved in class org.optaplanner.core.impl.score.director.AbstractScoreDirector<Solution_,​Score_ extends org.optaplanner.core.api.score.Score<Score_>,​BavetConstraintStreamScoreDirectorFactory<Solution_,​Score_ extends org.optaplanner.core.api.score.Score<Score_>>>
      • afterElementMoved

        public void afterElementMoved​(org.optaplanner.core.impl.domain.variable.descriptor.ListVariableDescriptor<Solution_> variableDescriptor,
                                      Object sourceEntity,
                                      int sourceIndex,
                                      Object destinationEntity,
                                      int destinationIndex)
        Specified by:
        afterElementMoved in interface org.optaplanner.core.impl.score.director.InnerScoreDirector<Solution_,​Score_ extends org.optaplanner.core.api.score.Score<Score_>>
        Overrides:
        afterElementMoved in class org.optaplanner.core.impl.score.director.AbstractScoreDirector<Solution_,​Score_ extends org.optaplanner.core.api.score.Score<Score_>,​BavetConstraintStreamScoreDirectorFactory<Solution_,​Score_ extends org.optaplanner.core.api.score.Score<Score_>>>
      • afterProblemFactAdded

        public void afterProblemFactAdded​(Object problemFact)
        Specified by:
        afterProblemFactAdded in interface org.optaplanner.core.api.score.director.ScoreDirector<Solution_>
        Overrides:
        afterProblemFactAdded in class org.optaplanner.core.impl.score.director.AbstractScoreDirector<Solution_,​Score_ extends org.optaplanner.core.api.score.Score<Score_>,​BavetConstraintStreamScoreDirectorFactory<Solution_,​Score_ extends org.optaplanner.core.api.score.Score<Score_>>>
      • afterProblemPropertyChanged

        public void afterProblemPropertyChanged​(Object problemFactOrEntity)
        Specified by:
        afterProblemPropertyChanged in interface org.optaplanner.core.api.score.director.ScoreDirector<Solution_>
        Overrides:
        afterProblemPropertyChanged in class org.optaplanner.core.impl.score.director.AbstractScoreDirector<Solution_,​Score_ extends org.optaplanner.core.api.score.Score<Score_>,​BavetConstraintStreamScoreDirectorFactory<Solution_,​Score_ extends org.optaplanner.core.api.score.Score<Score_>>>
      • afterProblemFactRemoved

        public void afterProblemFactRemoved​(Object problemFact)
        Specified by:
        afterProblemFactRemoved in interface org.optaplanner.core.api.score.director.ScoreDirector<Solution_>
        Overrides:
        afterProblemFactRemoved in class org.optaplanner.core.impl.score.director.AbstractScoreDirector<Solution_,​Score_ extends org.optaplanner.core.api.score.Score<Score_>,​BavetConstraintStreamScoreDirectorFactory<Solution_,​Score_ extends org.optaplanner.core.api.score.Score<Score_>>>