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

java.lang.Object
org.optaplanner.core.impl.score.director.AbstractScoreDirector<Solution_,Score_,DrlScoreDirectorFactory<Solution_,Score_>>
org.optaplanner.constraint.drl.DrlScoreDirector<Solution_,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 final String
     
    protected org.kie.api.runtime.KieSession
     
     

    Fields inherited from class org.optaplanner.core.impl.score.director.AbstractScoreDirector

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

    Constructors
    Constructor
    Description
    DrlScoreDirector(DrlScoreDirectorFactory<Solution_,Score_> scoreDirectorFactory, boolean lookUpEnabled, boolean constraintMatchEnabledPreference)
     
  • Method Summary

    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
     
    void
     
    void
    afterProblemPropertyChanged(Object problemFactOrEntity)
     
    void
    afterVariableChanged(org.optaplanner.core.impl.domain.variable.descriptor.VariableDescriptor<Solution_> variableDescriptor, Object entity)
     
     
    void
     
    Map<String,org.optaplanner.core.api.score.constraint.ConstraintMatchTotal<Score_>>
     
    Map<Object,org.optaplanner.core.api.score.constraint.Indictment<Score_>>
     
    org.kie.api.runtime.KieSession
     
    boolean
     
    boolean
     
    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

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • GLOBAL_SCORE_HOLDER_KEY

      public static final String GLOBAL_SCORE_HOLDER_KEY
      See Also:
    • kieSession

      protected org.kie.api.runtime.KieSession kieSession
    • scoreHolder

      protected AbstractScoreHolder<Score_ extends org.optaplanner.core.api.score.Score<Score_>> scoreHolder
  • Constructor Details

  • Method Details

    • 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()
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface org.optaplanner.core.impl.score.director.InnerScoreDirector<Solution_,Score_ extends org.optaplanner.core.api.score.Score<Score_>>
      Overrides:
      close 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_>>>
    • 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_>>>