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

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

    public class DrlScoreDirector<Solution_,​Score_ extends org.optaplanner.core.api.score.Score<Score_>>
    extends org.optaplanner.core.impl.score.director.AbstractScoreDirector<Solution_,​Score_,​DrlScoreDirectorFactory<Solution_,​Score_>>
    Drools implementation of ScoreDirector, which directs the Rule Engine to calculate the Score of the working solution.
    See Also:
    ScoreDirector
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String GLOBAL_SCORE_HOLDER_KEY  
      protected org.kie.api.runtime.KieSession kieSession  
      protected AbstractScoreHolder<Score_> scoreHolder  
      • 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 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 afterListVariableChanged​(org.optaplanner.core.impl.domain.variable.descriptor.ListVariableDescriptor<Solution_> variableDescriptor, Object entity, int fromIndex, int toIndex)  
      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()  
      org.kie.api.runtime.KieSession getKieSession()  
      boolean isConstraintMatchEnabled()  
      boolean requiresFlushing()  
      void setWorkingSolution​(Solution_ workingSolution)  
      • Methods inherited from class org.optaplanner.core.impl.score.director.AbstractScoreDirector

        afterEntityAdded, afterEntityRemoved, afterListVariableChanged, afterListVariableElementAssigned, afterListVariableElementAssigned, afterListVariableElementUnassigned, afterListVariableElementUnassigned, afterVariableChanged, assertExpectedUndoMoveScore, assertExpectedWorkingScore, assertNonNullPlanningIds, assertPredictedScoreFromScratch, assertShadowVariablesAreNotStale, assertWorkingScoreFromScratch, beforeEntityAdded, beforeEntityAdded, beforeEntityRemoved, beforeEntityRemoved, beforeListVariableChanged, beforeListVariableChanged, beforeListVariableElementAssigned, beforeListVariableElementAssigned, beforeListVariableElementUnassigned, beforeListVariableElementUnassigned, beforeProblemFactAdded, beforeProblemFactRemoved, beforeProblemPropertyChanged, beforeVariableChanged, beforeVariableChanged, buildScoreCorruptionAnalysis, buildShadowVariableAnalysis, changeVariableFacade, clone, cloneSolution, cloneWorkingSolution, createChildThreadScoreDirector, doAndProcessMove, doAndProcessMove, getCalculationCount, getScoreDefinition, getScoreDirectorFactory, getSolutionDescriptor, getSupplyManager, getWorkingEntityListRevision, getWorkingSolution, isConstraintConfiguration, isWorkingEntityListDirty, lookUpWorkingObject, lookUpWorkingObjectOrReturnNull, overwriteConstraintMatchEnabledPreference, resetCalculationCount, setAllChangesWillBeUndoneBeforeStepEnds, setCalculatedScore, setWorkingEntityListDirty, toString, triggerVariableListeners
    • Constructor Detail

    • Method Detail

      • getKieSession

        public org.kie.api.runtime.KieSession getKieSession()
      • setWorkingSolution

        public void setWorkingSolution​(Solution_ workingSolution)
        Specified by:
        setWorkingSolution in interface org.optaplanner.core.impl.score.director.InnerScoreDirector<Solution_,​Score_ extends org.optaplanner.core.api.score.Score<Score_>>
        Overrides:
        setWorkingSolution in class org.optaplanner.core.impl.score.director.AbstractScoreDirector<Solution_,​Score_ extends org.optaplanner.core.api.score.Score<Score_>,​DrlScoreDirectorFactory<Solution_,​Score_ extends org.optaplanner.core.api.score.Score<Score_>>>
      • 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()
      • afterEntityAdded

        public void afterEntityAdded​(org.optaplanner.core.impl.domain.entity.descriptor.EntityDescriptor<Solution_> entityDescriptor,
                                     Object entity)
        Overrides:
        afterEntityAdded in class org.optaplanner.core.impl.score.director.AbstractScoreDirector<Solution_,​Score_ extends org.optaplanner.core.api.score.Score<Score_>,​DrlScoreDirectorFactory<Solution_,​Score_ extends org.optaplanner.core.api.score.Score<Score_>>>
      • 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_>,​DrlScoreDirectorFactory<Solution_,​Score_ extends org.optaplanner.core.api.score.Score<Score_>>>
      • afterListVariableChanged

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

        public void afterEntityRemoved​(org.optaplanner.core.impl.domain.entity.descriptor.EntityDescriptor<Solution_> entityDescriptor,
                                       Object entity)
        Overrides:
        afterEntityRemoved in class org.optaplanner.core.impl.score.director.AbstractScoreDirector<Solution_,​Score_ extends org.optaplanner.core.api.score.Score<Score_>,​DrlScoreDirectorFactory<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_>,​DrlScoreDirectorFactory<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_>,​DrlScoreDirectorFactory<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_>,​DrlScoreDirectorFactory<Solution_,​Score_ extends org.optaplanner.core.api.score.Score<Score_>>>