Class EasyScoreDirector<Solution_,Score_ extends Score<Score_>>
java.lang.Object
org.optaplanner.core.impl.score.director.AbstractScoreDirector<Solution_,Score_,EasyScoreDirectorFactory<Solution_,Score_>>
org.optaplanner.core.impl.score.director.easy.EasyScoreDirector<Solution_,Score_>
- Type Parameters:
Solution_
- the solution type, the class with thePlanningSolution
annotationScore_
- the score type to go with the solution
- All Implemented Interfaces:
AutoCloseable
,Cloneable
,ScoreDirector<Solution_>
,InnerScoreDirector<Solution_,
Score_>
public 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:
-
Field Summary
Fields inherited from class org.optaplanner.core.impl.score.director.AbstractScoreDirector
allChangesWillBeUndoneBeforeStepEnds, calculationCount, constraintMatchEnabledPreference, logger, lookUpEnabled, lookUpManager, scoreDirectorFactory, variableListenerSupport, workingEntityListRevision, workingInitScore, workingSolution
-
Constructor Summary
ConstructorDescriptionEasyScoreDirector
(EasyScoreDirectorFactory<Solution_, Score_> scoreDirectorFactory, boolean lookUpEnabled, boolean constraintMatchEnabledPreference, EasyScoreCalculator<Solution_, Score_> easyScoreCalculator) -
Method Summary
Modifier and TypeMethodDescriptionCalculates theScore
and updates theworking solution
accordingly.ConstraintMatch
s are not supported by thisScoreDirector
implementation.ConstraintMatch
s are not supported by thisScoreDirector
implementation.boolean
Always false,ConstraintMatchTotal
s are not supported by thisScoreDirector
implementation.boolean
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 org.optaplanner.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, forceTriggerVariableListeners, getCalculationCount, getScoreDefinition, getScoreDirectorFactory, getSolutionDescriptor, getSupplyManager, getWorkingEntityListRevision, getWorkingSolution, incrementCalculationCount, isConstraintConfiguration, isWorkingEntityListDirty, lookUpWorkingObject, lookUpWorkingObjectOrReturnNull, overwriteConstraintMatchEnabledPreference, resetCalculationCount, setAllChangesWillBeUndoneBeforeStepEnds, setCalculatedScore, setWorkingEntityListDirty, setWorkingSolution, toString, triggerVariableListeners
-
Constructor Details
-
EasyScoreDirector
public EasyScoreDirector(EasyScoreDirectorFactory<Solution_, Score_> scoreDirectorFactory, boolean lookUpEnabled, boolean constraintMatchEnabledPreference, EasyScoreCalculator<Solution_, Score_> easyScoreCalculator)
-
-
Method Details
-
getEasyScoreCalculator
-
calculateScore
Description copied from interface:InnerScoreDirector
Calculates theScore
and updates theworking solution
accordingly.- Returns:
- never null, the
Score
of theworking solution
-
isConstraintMatchEnabled
public boolean isConstraintMatchEnabled()Always false,ConstraintMatchTotal
s are not supported by thisScoreDirector
implementation.- Returns:
- false
-
getConstraintMatchTotalMap
ConstraintMatch
s are not supported by thisScoreDirector
implementation.- Returns:
- throws
IllegalStateException
- Throws:
IllegalStateException
- always- See Also:
-
getIndictmentMap
ConstraintMatch
s are not supported by thisScoreDirector
implementation.- Returns:
- throws
IllegalStateException
- Throws:
IllegalStateException
- always- See Also:
-
requiresFlushing
public boolean requiresFlushing()Description copied from interface:InnerScoreDirector
Some 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.
-