Class EasyScoreDirector<Solution_,Score_ extends Score<Score_>>
- java.lang.Object
-
- ai.timefold.solver.core.impl.score.director.AbstractScoreDirector<Solution_,Score_,EasyScoreDirectorFactory<Solution_,Score_>>
-
- ai.timefold.solver.core.impl.score.director.easy.EasyScoreDirector<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 EasyScoreDirector<Solution_,Score_ extends Score<Score_>> extends AbstractScoreDirector<Solution_,Score_,EasyScoreDirectorFactory<Solution_,Score_>>
Easy java implementation ofScoreDirector, which recalculates theScoreof theworking solutionevery time. This is non-incremental calculation, which is slow. This score director implementation does not supportScoreExplanation.getConstraintMatchTotalMap()andScoreExplanation.getIndictmentMap().- See Also:
ScoreDirector
-
-
Field Summary
-
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 EasyScoreDirector(EasyScoreDirectorFactory<Solution_,Score_> scoreDirectorFactory, boolean lookUpEnabled, boolean constraintMatchEnabledPreference, boolean expectShadowVariablesInCorrectState, EasyScoreCalculator<Solution_,Score_> easyScoreCalculator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Score_calculateScore()Calculates theScoreand updates theworking solutionaccordingly.Map<String,ConstraintMatchTotal<Score_>>getConstraintMatchTotalMap()ConstraintMatchs are not supported by thisScoreDirectorimplementation.EasyScoreCalculator<Solution_,Score_>getEasyScoreCalculator()Map<Object,Indictment<Score_>>getIndictmentMap()ConstraintMatchs are not supported by thisScoreDirectorimplementation.booleanisConstraintMatchEnabled()Always false,ConstraintMatchTotals are not supported by thisScoreDirectorimplementation.booleanrequiresFlushing()Some score directors (such as the Drools-based) keep a set of changes that they only apply whenInnerScoreDirector.calculateScore()is called.-
Methods inherited from class ai.timefold.solver.core.impl.score.director.AbstractScoreDirector
afterEntityAdded, afterEntityAdded, afterEntityRemoved, afterEntityRemoved, afterListVariableChanged, afterListVariableChanged, afterListVariableElementAssigned, afterListVariableElementAssigned, afterListVariableElementUnassigned, afterListVariableElementUnassigned, afterProblemFactAdded, afterProblemFactRemoved, afterProblemPropertyChanged, afterVariableChanged, 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, close, createChildThreadScoreDirector, doAndProcessMove, doAndProcessMove, expectShadowVariablesInCorrectState, forceTriggerVariableListeners, getCalculationCount, getScoreDefinition, getScoreDirectorFactory, getSolutionDescriptor, getSupplyManager, getWorkingEntityListRevision, getWorkingSolution, incrementCalculationCount, isConstraintConfiguration, isWorkingEntityListDirty, lookUpWorkingObject, lookUpWorkingObjectOrReturnNull, overwriteConstraintMatchEnabledPreference, resetCalculationCount, setAllChangesWillBeUndoneBeforeStepEnds, setCalculatedScore, setWorkingEntityListDirty, setWorkingSolution, toString, triggerVariableListeners
-
-
-
-
Constructor Detail
-
EasyScoreDirector
public EasyScoreDirector(EasyScoreDirectorFactory<Solution_,Score_> scoreDirectorFactory, boolean lookUpEnabled, boolean constraintMatchEnabledPreference, boolean expectShadowVariablesInCorrectState, EasyScoreCalculator<Solution_,Score_> easyScoreCalculator)
-
-
Method Detail
-
getEasyScoreCalculator
public EasyScoreCalculator<Solution_,Score_> getEasyScoreCalculator()
-
calculateScore
public Score_ calculateScore()
Description copied from interface:InnerScoreDirectorCalculates theScoreand updates theworking solutionaccordingly.- Returns:
- never null, the
Scoreof theworking solution
-
isConstraintMatchEnabled
public boolean isConstraintMatchEnabled()
Always false,ConstraintMatchTotals are not supported by thisScoreDirectorimplementation.- Returns:
- false
-
getConstraintMatchTotalMap
public Map<String,ConstraintMatchTotal<Score_>> getConstraintMatchTotalMap()
ConstraintMatchs are not supported by thisScoreDirectorimplementation.- Returns:
- throws
IllegalStateException - Throws:
IllegalStateException- always- See Also:
InnerScoreDirector.getIndictmentMap()
-
getIndictmentMap
public Map<Object,Indictment<Score_>> getIndictmentMap()
ConstraintMatchs are not supported by thisScoreDirectorimplementation.- Returns:
- throws
IllegalStateException - Throws:
IllegalStateException- always- See Also:
InnerScoreDirector.getConstraintMatchTotalMap()
-
requiresFlushing
public boolean requiresFlushing()
Description copied from interface:InnerScoreDirectorSome score directors (such as the Drools-based) keep a set of changes that they only apply whenInnerScoreDirector.calculateScore()is called. Until that happens, this set accumulates and could possibly act as a memory leak.- Returns:
- true if the score director can potentially cause a memory leak due to unflushed changes.
-
-