Class DrlScoreDirector<Solution_,Score_ extends Score<Score_>>
- java.lang.Object
-
- ai.timefold.solver.core.impl.score.director.AbstractScoreDirector<Solution_,Score_,DrlScoreDirectorFactory<Solution_,Score_>>
-
- ai.timefold.solver.constraint.drl.DrlScoreDirector<Solution_,Score_>
-
- Type Parameters:
Solution_- the solution type, the class with thePlanningSolutionannotationScore_- the score type to go with the solution
- All Implemented Interfaces:
ScoreDirector<Solution_>,InnerScoreDirector<Solution_,Score_>,AutoCloseable,Cloneable
public class DrlScoreDirector<Solution_,Score_ extends Score<Score_>> extends AbstractScoreDirector<Solution_,Score_,DrlScoreDirectorFactory<Solution_,Score_>>
Drools implementation ofScoreDirector, which directs the Rule Engine to calculate theScoreof theworking solution.- See Also:
ScoreDirector
-
-
Field Summary
Fields Modifier and Type Field Description static StringGLOBAL_SCORE_HOLDER_KEYprotected org.kie.api.runtime.KieSessionkieSessionprotected AbstractScoreHolder<Score_>scoreHolder-
Fields inherited from class ai.timefold.solver.core.impl.score.director.AbstractScoreDirector
allChangesWillBeUndoneBeforeStepEnds, calculationCount, constraintMatchEnabledPreference, expectShadowVariablesInCorrectState, logger, lookUpEnabled, lookUpManager, scoreDirectorFactory, variableListenerSupport, workingEntityListRevision, workingInitScore, workingSolution
-
-
Constructor Summary
Constructors Constructor Description DrlScoreDirector(DrlScoreDirectorFactory<Solution_,Score_> scoreDirectorFactory, boolean lookUpEnabled, boolean constraintMatchEnabledPreference, boolean expectShadowVariablesInCorrectState)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterEntityAdded(EntityDescriptor<Solution_> entityDescriptor, Object entity)voidafterEntityRemoved(EntityDescriptor<Solution_> entityDescriptor, Object entity)voidafterListVariableChanged(ListVariableDescriptor<Solution_> variableDescriptor, Object entity, int fromIndex, int toIndex)voidafterProblemFactAdded(Object problemFact)voidafterProblemFactRemoved(Object problemFact)voidafterProblemPropertyChanged(Object problemFactOrEntity)voidafterVariableChanged(VariableDescriptor<Solution_> variableDescriptor, Object entity)Score_calculateScore()voidclose()Map<String,ConstraintMatchTotal<Score_>>getConstraintMatchTotalMap()Map<Object,Indictment<Score_>>getIndictmentMap()org.kie.api.runtime.KieSessiongetKieSession()booleanisConstraintMatchEnabled()booleanrequiresFlushing()voidsetWorkingSolution(Solution_ workingSolution)-
Methods inherited from class ai.timefold.solver.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, expectShadowVariablesInCorrectState, forceTriggerVariableListeners, getCalculationCount, getScoreDefinition, getScoreDirectorFactory, getSolutionDescriptor, getSupplyManager, getWorkingEntityListRevision, getWorkingSolution, incrementCalculationCount, isConstraintConfiguration, isWorkingEntityListDirty, lookUpWorkingObject, lookUpWorkingObjectOrReturnNull, overwriteConstraintMatchEnabledPreference, resetCalculationCount, setAllChangesWillBeUndoneBeforeStepEnds, setCalculatedScore, setWorkingEntityListDirty, toString, triggerVariableListeners
-
-
-
-
Field Detail
-
GLOBAL_SCORE_HOLDER_KEY
public static final String GLOBAL_SCORE_HOLDER_KEY
- See Also:
- Constant Field Values
-
kieSession
protected org.kie.api.runtime.KieSession kieSession
-
scoreHolder
protected AbstractScoreHolder<Score_ extends Score<Score_>> scoreHolder
-
-
Constructor Detail
-
DrlScoreDirector
public DrlScoreDirector(DrlScoreDirectorFactory<Solution_,Score_> scoreDirectorFactory, boolean lookUpEnabled, boolean constraintMatchEnabledPreference, boolean expectShadowVariablesInCorrectState)
-
-
Method Detail
-
getKieSession
public org.kie.api.runtime.KieSession getKieSession()
-
setWorkingSolution
public void setWorkingSolution(Solution_ workingSolution)
- Specified by:
setWorkingSolutionin interfaceInnerScoreDirector<Solution_,Score_ extends Score<Score_>>- Overrides:
setWorkingSolutionin classAbstractScoreDirector<Solution_,Score_ extends Score<Score_>,DrlScoreDirectorFactory<Solution_,Score_ extends Score<Score_>>>
-
calculateScore
public Score_ calculateScore()
-
isConstraintMatchEnabled
public boolean isConstraintMatchEnabled()
-
getConstraintMatchTotalMap
public Map<String,ConstraintMatchTotal<Score_>> getConstraintMatchTotalMap()
-
getIndictmentMap
public Map<Object,Indictment<Score_>> getIndictmentMap()
-
requiresFlushing
public boolean requiresFlushing()
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceInnerScoreDirector<Solution_,Score_ extends Score<Score_>>- Overrides:
closein classAbstractScoreDirector<Solution_,Score_ extends Score<Score_>,DrlScoreDirectorFactory<Solution_,Score_ extends Score<Score_>>>
-
afterEntityAdded
public void afterEntityAdded(EntityDescriptor<Solution_> entityDescriptor, Object entity)
- Overrides:
afterEntityAddedin classAbstractScoreDirector<Solution_,Score_ extends Score<Score_>,DrlScoreDirectorFactory<Solution_,Score_ extends Score<Score_>>>
-
afterVariableChanged
public void afterVariableChanged(VariableDescriptor<Solution_> variableDescriptor, Object entity)
- Specified by:
afterVariableChangedin interfaceInnerScoreDirector<Solution_,Score_ extends Score<Score_>>- Overrides:
afterVariableChangedin classAbstractScoreDirector<Solution_,Score_ extends Score<Score_>,DrlScoreDirectorFactory<Solution_,Score_ extends Score<Score_>>>
-
afterListVariableChanged
public void afterListVariableChanged(ListVariableDescriptor<Solution_> variableDescriptor, Object entity, int fromIndex, int toIndex)
- Specified by:
afterListVariableChangedin interfaceInnerScoreDirector<Solution_,Score_ extends Score<Score_>>- Overrides:
afterListVariableChangedin classAbstractScoreDirector<Solution_,Score_ extends Score<Score_>,DrlScoreDirectorFactory<Solution_,Score_ extends Score<Score_>>>
-
afterEntityRemoved
public void afterEntityRemoved(EntityDescriptor<Solution_> entityDescriptor, Object entity)
- Overrides:
afterEntityRemovedin classAbstractScoreDirector<Solution_,Score_ extends Score<Score_>,DrlScoreDirectorFactory<Solution_,Score_ extends Score<Score_>>>
-
afterProblemFactAdded
public void afterProblemFactAdded(Object problemFact)
- Specified by:
afterProblemFactAddedin interfaceScoreDirector<Solution_>- Overrides:
afterProblemFactAddedin classAbstractScoreDirector<Solution_,Score_ extends Score<Score_>,DrlScoreDirectorFactory<Solution_,Score_ extends Score<Score_>>>
-
afterProblemPropertyChanged
public void afterProblemPropertyChanged(Object problemFactOrEntity)
- Specified by:
afterProblemPropertyChangedin interfaceScoreDirector<Solution_>- Overrides:
afterProblemPropertyChangedin classAbstractScoreDirector<Solution_,Score_ extends Score<Score_>,DrlScoreDirectorFactory<Solution_,Score_ extends Score<Score_>>>
-
afterProblemFactRemoved
public void afterProblemFactRemoved(Object problemFact)
- Specified by:
afterProblemFactRemovedin interfaceScoreDirector<Solution_>- Overrides:
afterProblemFactRemovedin classAbstractScoreDirector<Solution_,Score_ extends Score<Score_>,DrlScoreDirectorFactory<Solution_,Score_ extends Score<Score_>>>
-
-