public class IncrementalScoreDirector extends AbstractScoreDirector<IncrementalScoreDirectorFactory>
ScoreDirector
, which only recalculates the Score
of the part of the Solution
workingSolution that changed,
instead of the going through the entire Solution
. This is incremental calculation, which is fast.ScoreDirector
allChangesWillBeUndoneBeforeStepEnds, calculateCount, constraintMatchEnabledPreference, logger, scoreDirectorFactory, variableListenerSupport, workingEntityListRevision, workingSolution
Constructor and Description |
---|
IncrementalScoreDirector(IncrementalScoreDirectorFactory scoreDirectorFactory,
boolean constraintMatchEnabledPreference,
IncrementalScoreCalculator incrementalScoreCalculator) |
afterEntityAdded, afterEntityRemoved, afterVariableChanged, assertExpectedWorkingScore, assertShadowVariablesAreNotStale, assertWorkingScoreFromScratch, beforeEntityAdded, beforeEntityRemoved, beforeVariableChanged, buildScoreCorruptionAnalysis, changeVariableFacade, clone, cloneSolution, cloneWorkingSolution, countWorkingSolutionUninitializedVariables, dispose, getCalculateCount, getScoreDefinition, getScoreDirectorFactory, getSolutionDescriptor, getSupplyManager, getWorkingEntityCount, getWorkingEntityList, getWorkingEntityListRevision, getWorkingSolution, getWorkingValueCount, isAllChangesWillBeUndoneBeforeStepEnds, isWorkingEntityListDirty, resetCalculateCount, setAllChangesWillBeUndoneBeforeStepEnds, setCalculatedScore, setWorkingEntityListDirty, toString, triggerVariableListeners
public IncrementalScoreDirector(IncrementalScoreDirectorFactory scoreDirectorFactory, boolean constraintMatchEnabledPreference, IncrementalScoreCalculator incrementalScoreCalculator)
public IncrementalScoreCalculator getIncrementalScoreCalculator()
public void setWorkingSolution(Solution workingSolution)
ScoreDirector
workingSolution
must never be the same instance as the bestSolution
,
it should be a (un)changed clone.
Only call this method on a separate ScoreDirector
instance,
build by Solver.getScoreDirectorFactory()
,
not on the one used inside the Solver
itself.
setWorkingSolution
in interface ScoreDirector
setWorkingSolution
in class AbstractScoreDirector<IncrementalScoreDirectorFactory>
workingSolution
- never nullpublic Score calculateScore()
ScoreDirector
Score
and updates the workingSolution
accordingly.Score
of the workingSolution
public boolean isConstraintMatchEnabled()
ScoreDirector.getConstraintMatchTotals()
can be calledpublic Collection<ConstraintMatchTotal> getConstraintMatchTotals()
public void beforeEntityAdded(EntityDescriptor entityDescriptor, Object entity)
beforeEntityAdded
in class AbstractScoreDirector<IncrementalScoreDirectorFactory>
public void afterEntityAdded(EntityDescriptor entityDescriptor, Object entity)
afterEntityAdded
in class AbstractScoreDirector<IncrementalScoreDirectorFactory>
public void beforeVariableChanged(VariableDescriptor variableDescriptor, Object entity)
beforeVariableChanged
in interface ScoreDirector
beforeVariableChanged
in class AbstractScoreDirector<IncrementalScoreDirectorFactory>
public void afterVariableChanged(VariableDescriptor variableDescriptor, Object entity)
afterVariableChanged
in interface ScoreDirector
afterVariableChanged
in class AbstractScoreDirector<IncrementalScoreDirectorFactory>
public void beforeEntityRemoved(EntityDescriptor entityDescriptor, Object entity)
beforeEntityRemoved
in class AbstractScoreDirector<IncrementalScoreDirectorFactory>
public void afterEntityRemoved(EntityDescriptor entityDescriptor, Object entity)
afterEntityRemoved
in class AbstractScoreDirector<IncrementalScoreDirectorFactory>
public void beforeProblemFactAdded(Object problemFact)
beforeProblemFactAdded
in interface ScoreDirector
beforeProblemFactAdded
in class AbstractScoreDirector<IncrementalScoreDirectorFactory>
public void afterProblemFactAdded(Object problemFact)
afterProblemFactAdded
in interface ScoreDirector
afterProblemFactAdded
in class AbstractScoreDirector<IncrementalScoreDirectorFactory>
public void beforeProblemFactChanged(Object problemFact)
beforeProblemFactChanged
in interface ScoreDirector
beforeProblemFactChanged
in class AbstractScoreDirector<IncrementalScoreDirectorFactory>
public void afterProblemFactChanged(Object problemFact)
afterProblemFactChanged
in interface ScoreDirector
afterProblemFactChanged
in class AbstractScoreDirector<IncrementalScoreDirectorFactory>
public void beforeProblemFactRemoved(Object problemFact)
beforeProblemFactRemoved
in interface ScoreDirector
beforeProblemFactRemoved
in class AbstractScoreDirector<IncrementalScoreDirectorFactory>
public void afterProblemFactRemoved(Object problemFact)
afterProblemFactRemoved
in interface ScoreDirector
afterProblemFactRemoved
in class AbstractScoreDirector<IncrementalScoreDirectorFactory>
Copyright © 2006–2016 JBoss by Red Hat. All rights reserved.