Package org.optaplanner.constraint.drl
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 thePlanningSolutionannotationScore_- 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 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 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterElementAdded(org.optaplanner.core.impl.domain.variable.descriptor.ListVariableDescriptor<Solution_> variableDescriptor, Object entity, int index)voidafterElementMoved(org.optaplanner.core.impl.domain.variable.descriptor.ListVariableDescriptor<Solution_> variableDescriptor, Object sourceEntity, int sourceIndex, Object destinationEntity, int destinationIndex)voidafterElementRemoved(org.optaplanner.core.impl.domain.variable.descriptor.ListVariableDescriptor<Solution_> variableDescriptor, Object entity, int index)voidafterEntityAdded(org.optaplanner.core.impl.domain.entity.descriptor.EntityDescriptor<Solution_> entityDescriptor, Object entity)voidafterEntityRemoved(org.optaplanner.core.impl.domain.entity.descriptor.EntityDescriptor<Solution_> entityDescriptor, Object entity)voidafterProblemFactAdded(Object problemFact)voidafterProblemFactRemoved(Object problemFact)voidafterProblemPropertyChanged(Object problemFactOrEntity)voidafterVariableChanged(org.optaplanner.core.impl.domain.variable.descriptor.VariableDescriptor<Solution_> variableDescriptor, Object entity)Score_calculateScore()voidclose()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.KieSessiongetKieSession()booleanisConstraintMatchEnabled()booleanrequiresFlushing()voidsetWorkingSolution(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, 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 org.optaplanner.core.api.score.Score<Score_>> scoreHolder
-
-
Constructor Detail
-
DrlScoreDirector
public DrlScoreDirector(DrlScoreDirectorFactory<Solution_,Score_> scoreDirectorFactory, boolean lookUpEnabled, boolean constraintMatchEnabledPreference)
-
-
Method Detail
-
getKieSession
public org.kie.api.runtime.KieSession getKieSession()
-
setWorkingSolution
public void setWorkingSolution(Solution_ workingSolution)
- Specified by:
setWorkingSolutionin interfaceorg.optaplanner.core.impl.score.director.InnerScoreDirector<Solution_,Score_ extends org.optaplanner.core.api.score.Score<Score_>>- Overrides:
setWorkingSolutionin classorg.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:
closein interfaceAutoCloseable- Specified by:
closein interfaceorg.optaplanner.core.impl.score.director.InnerScoreDirector<Solution_,Score_ extends org.optaplanner.core.api.score.Score<Score_>>- Overrides:
closein classorg.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)
-
afterVariableChanged
public void afterVariableChanged(org.optaplanner.core.impl.domain.variable.descriptor.VariableDescriptor<Solution_> variableDescriptor, Object entity)
- Specified by:
afterVariableChangedin interfaceorg.optaplanner.core.impl.score.director.InnerScoreDirector<Solution_,Score_ extends org.optaplanner.core.api.score.Score<Score_>>- Overrides:
afterVariableChangedin classorg.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_>>>
-
afterElementAdded
public void afterElementAdded(org.optaplanner.core.impl.domain.variable.descriptor.ListVariableDescriptor<Solution_> variableDescriptor, Object entity, int index)
- Specified by:
afterElementAddedin interfaceorg.optaplanner.core.impl.score.director.InnerScoreDirector<Solution_,Score_ extends org.optaplanner.core.api.score.Score<Score_>>- Overrides:
afterElementAddedin classorg.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_>>>
-
afterElementRemoved
public void afterElementRemoved(org.optaplanner.core.impl.domain.variable.descriptor.ListVariableDescriptor<Solution_> variableDescriptor, Object entity, int index)
- Specified by:
afterElementRemovedin interfaceorg.optaplanner.core.impl.score.director.InnerScoreDirector<Solution_,Score_ extends org.optaplanner.core.api.score.Score<Score_>>- Overrides:
afterElementRemovedin classorg.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_>>>
-
afterElementMoved
public void afterElementMoved(org.optaplanner.core.impl.domain.variable.descriptor.ListVariableDescriptor<Solution_> variableDescriptor, Object sourceEntity, int sourceIndex, Object destinationEntity, int destinationIndex)
- Specified by:
afterElementMovedin interfaceorg.optaplanner.core.impl.score.director.InnerScoreDirector<Solution_,Score_ extends org.optaplanner.core.api.score.Score<Score_>>- Overrides:
afterElementMovedin classorg.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)
-
afterProblemFactAdded
public void afterProblemFactAdded(Object problemFact)
- Specified by:
afterProblemFactAddedin interfaceorg.optaplanner.core.api.score.director.ScoreDirector<Solution_>- Overrides:
afterProblemFactAddedin classorg.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:
afterProblemPropertyChangedin interfaceorg.optaplanner.core.api.score.director.ScoreDirector<Solution_>- Overrides:
afterProblemPropertyChangedin classorg.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:
afterProblemFactRemovedin interfaceorg.optaplanner.core.api.score.director.ScoreDirector<Solution_>- Overrides:
afterProblemFactRemovedin classorg.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_>>>
-
-