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_> VariableDescriptorAwareScoreDirector<Solution_>,AutoCloseable,Cloneable
public final class EasyScoreDirector<Solution_,Score_ extends Score<Score_>>
extends AbstractScoreDirector<Solution_,Score_,EasyScoreDirectorFactory<Solution_,Score_>>
Easy java implementation of
ScoreDirector, which recalculates the Score
of the working solution every time. This is non-incremental calculation, which is slow.
This score director implementation does not support ScoreExplanation.getConstraintMatchTotalMap() and
ScoreExplanation.getIndictmentMap().- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classEasyScoreDirector.Builder<Solution_,Score_ extends Score<Score_>> Nested classes/interfaces inherited from class ai.timefold.solver.core.impl.score.director.AbstractScoreDirector
AbstractScoreDirector.AbstractScoreDirectorBuilder<Solution_,Score_ extends Score<Score_>, Factory_ extends AbstractScoreDirectorFactory<Solution_, Score_, Factory_>, Builder_ extends AbstractScoreDirector.AbstractScoreDirectorBuilder<Solution_, Score_, Factory_, Builder_>> -
Field Summary
Fields inherited from class ai.timefold.solver.core.impl.score.director.AbstractScoreDirector
constraintMatchPolicy, logger, scoreDirectorFactory, variableListenerSupport, workingSolution -
Method Summary
Modifier and TypeMethodDescriptionCalculates theScoreand updates theworking solutionaccordingly.ConstraintMatchs are not supported by thisScoreDirectorimplementation.ConstraintMatchs are not supported by thisScoreDirectorimplementation.booleanSome score directors keep a set of changes that they only apply whenInnerScoreDirector.calculateScore()is called.voidsetWorkingSolution(Solution_ workingSolution) Theworking solutionmust never be the same instance as thebest solution, it should be a (un)changed clone.Methods inherited from class ai.timefold.solver.core.impl.score.director.AbstractScoreDirector
afterEntityAdded, afterEntityRemoved, afterListVariableChanged, afterListVariableElementAssigned, afterListVariableElementUnassigned, afterProblemFactAdded, afterProblemFactRemoved, afterProblemPropertyChanged, afterVariableChanged, assertExpectedUndoMoveScore, assertExpectedWorkingScore, assertPredictedScoreFromScratch, assertShadowVariablesAreNotStale, assertWorkingScoreFromScratch, beforeEntityAdded, beforeEntityRemoved, beforeListVariableChanged, beforeListVariableElementAssigned, beforeListVariableElementUnassigned, beforeProblemFactAdded, beforeProblemFactRemoved, beforeProblemPropertyChanged, beforeVariableChanged, buildScoreCorruptionAnalysis, buildShadowVariableAnalysis, clearVariableListenerEvents, clone, cloneSolution, close, createChildThreadScoreDirector, executeMove, executeTemporaryMove, expectShadowVariablesInCorrectState, forceTriggerVariableListeners, getCalculationCount, getConstraintMatchPolicy, getListVariableStateSupply, getMoveDirector, getScoreDefinition, getScoreDirectorFactory, getSolutionCorruptionAfterUndo, getSolutionDescriptor, getSupplyManager, getVariableDescriptorCache, getWorkingEntityListRevision, getWorkingGenuineEntityCount, getWorkingInitScore, getWorkingSolution, incrementCalculationCount, isConstraintConfiguration, isWorkingEntityListDirty, isWorkingSolutionInitialized, lookUpWorkingObject, lookUpWorkingObjectOrReturnNull, resetCalculationCount, setAllChangesWillBeUndoneBeforeStepEnds, setCalculatedScore, setMoveRepository, setWorkingEntityListDirty, setWorkingSolution, toString, triggerVariableListenersMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ai.timefold.solver.core.impl.score.director.InnerScoreDirector
afterEntityAdded, afterEntityRemoved, beforeEntityAdded, beforeEntityRemoved, buildScoreAnalysis, cloneWorkingSolution, isDerivedMethods inherited from interface ai.timefold.solver.core.impl.score.director.VariableDescriptorAwareScoreDirector
afterListVariableChanged, afterListVariableElementAssigned, afterListVariableElementUnassigned, afterVariableChanged, beforeListVariableChanged, beforeListVariableElementAssigned, beforeListVariableElementUnassigned, beforeVariableChanged, changeVariableFacade
-
Method Details
-
getEasyScoreCalculator
-
calculateScore
Description copied from interface:InnerScoreDirectorCalculates theScoreand updates theworking solutionaccordingly.- Returns:
- never null, the
Scoreof theworking solution
-
setWorkingSolution
Description copied from interface:InnerScoreDirectorTheworking solutionmust never be the same instance as thebest solution, it should be a (un)changed clone.- Parameters:
workingSolution- never null
-
getConstraintMatchTotalMap
ConstraintMatchs are not supported by thisScoreDirectorimplementation.- Returns:
- throws
IllegalStateException - Throws:
IllegalStateException- always- See Also:
-
getIndictmentMap
ConstraintMatchs are not supported by thisScoreDirectorimplementation.- Returns:
- throws
IllegalStateException - Throws:
IllegalStateException- always- See Also:
-
requiresFlushing
public boolean requiresFlushing()Description copied from interface:InnerScoreDirectorSome score directors 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.
-