org.optaplanner.core.impl.score.director.incremental
Class IncrementalScoreDirector
java.lang.Object
org.optaplanner.core.impl.score.director.AbstractScoreDirector<IncrementalScoreDirectorFactory>
org.optaplanner.core.impl.score.director.incremental.IncrementalScoreDirector
- All Implemented Interfaces:
- Cloneable, ScoreDirector
public class IncrementalScoreDirector
- extends AbstractScoreDirector<IncrementalScoreDirectorFactory>
Incremental java implementation of 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.
- See Also:
ScoreDirector
Methods inherited from class org.optaplanner.core.impl.score.director.AbstractScoreDirector |
afterEntityAdded, afterEntityRemoved, afterVariableChanged, appendLegacyConstraintOccurrences, assertExpectedWorkingScore, assertWorkingScoreFromScratch, beforeEntityAdded, beforeEntityRemoved, beforeVariableChanged, clone, cloneWorkingSolution, countWorkingSolutionUninitializedVariables, dispose, getCalculateCount, getConstraintMatchTotals, getScoreDefinition, getScoreDirectorFactory, getSolutionDescriptor, getTrailingEntity, getWorkingEntityCount, getWorkingEntityList, getWorkingSolution, getWorkingValueCount, isConstraintMatchEnabled, isWorkingSolutionInitialized, setCalculatedScore, toString |
IncrementalScoreDirector
public IncrementalScoreDirector(IncrementalScoreDirectorFactory scoreDirectorFactory,
IncrementalScoreCalculator incrementalScoreCalculator)
getIncrementalScoreCalculator
public IncrementalScoreCalculator getIncrementalScoreCalculator()
setWorkingSolution
public void setWorkingSolution(Solution workingSolution)
- Description copied from interface:
ScoreDirector
- The
workingSolution
must never be the same instance as the bestSolution
,
it should be a (un)changed clone.
- Specified by:
setWorkingSolution
in interface ScoreDirector
- Overrides:
setWorkingSolution
in class AbstractScoreDirector<IncrementalScoreDirectorFactory>
- Parameters:
workingSolution
- never null
calculateScore
public Score calculateScore()
- Description copied from interface:
ScoreDirector
- Calculates the
Score
and updates the workingSolution
accordingly.
- Returns:
- never null, the
Score
of the workingSolution
beforeEntityAdded
public void beforeEntityAdded(PlanningEntityDescriptor entityDescriptor,
Object entity)
- Overrides:
beforeEntityAdded
in class AbstractScoreDirector<IncrementalScoreDirectorFactory>
afterEntityAdded
public void afterEntityAdded(PlanningEntityDescriptor entityDescriptor,
Object entity)
- Overrides:
afterEntityAdded
in class AbstractScoreDirector<IncrementalScoreDirectorFactory>
beforeVariableChanged
public void beforeVariableChanged(PlanningVariableDescriptor variableDescriptor,
Object entity)
- Overrides:
beforeVariableChanged
in class AbstractScoreDirector<IncrementalScoreDirectorFactory>
afterVariableChanged
public void afterVariableChanged(PlanningVariableDescriptor variableDescriptor,
Object entity)
- Overrides:
afterVariableChanged
in class AbstractScoreDirector<IncrementalScoreDirectorFactory>
beforeShadowVariableChanged
public void beforeShadowVariableChanged(Object entity,
String variableName)
- Overrides:
beforeShadowVariableChanged
in class AbstractScoreDirector<IncrementalScoreDirectorFactory>
afterShadowVariableChanged
public void afterShadowVariableChanged(Object entity,
String variableName)
- Overrides:
afterShadowVariableChanged
in class AbstractScoreDirector<IncrementalScoreDirectorFactory>
beforeEntityRemoved
public void beforeEntityRemoved(PlanningEntityDescriptor entityDescriptor,
Object entity)
- Overrides:
beforeEntityRemoved
in class AbstractScoreDirector<IncrementalScoreDirectorFactory>
afterEntityRemoved
public void afterEntityRemoved(PlanningEntityDescriptor entityDescriptor,
Object entity)
- Overrides:
afterEntityRemoved
in class AbstractScoreDirector<IncrementalScoreDirectorFactory>
beforeProblemFactAdded
public void beforeProblemFactAdded(Object problemFact)
- Specified by:
beforeProblemFactAdded
in interface ScoreDirector
- Overrides:
beforeProblemFactAdded
in class AbstractScoreDirector<IncrementalScoreDirectorFactory>
afterProblemFactAdded
public void afterProblemFactAdded(Object problemFact)
- Specified by:
afterProblemFactAdded
in interface ScoreDirector
- Overrides:
afterProblemFactAdded
in class AbstractScoreDirector<IncrementalScoreDirectorFactory>
beforeProblemFactChanged
public void beforeProblemFactChanged(Object problemFact)
- Specified by:
beforeProblemFactChanged
in interface ScoreDirector
- Overrides:
beforeProblemFactChanged
in class AbstractScoreDirector<IncrementalScoreDirectorFactory>
afterProblemFactChanged
public void afterProblemFactChanged(Object problemFact)
- Specified by:
afterProblemFactChanged
in interface ScoreDirector
- Overrides:
afterProblemFactChanged
in class AbstractScoreDirector<IncrementalScoreDirectorFactory>
beforeProblemFactRemoved
public void beforeProblemFactRemoved(Object problemFact)
- Specified by:
beforeProblemFactRemoved
in interface ScoreDirector
- Overrides:
beforeProblemFactRemoved
in class AbstractScoreDirector<IncrementalScoreDirectorFactory>
afterProblemFactRemoved
public void afterProblemFactRemoved(Object problemFact)
- Specified by:
afterProblemFactRemoved
in interface ScoreDirector
- Overrides:
afterProblemFactRemoved
in class AbstractScoreDirector<IncrementalScoreDirectorFactory>
buildScoreCorruptionAnalysis
protected String buildScoreCorruptionAnalysis(ScoreDirector uncorruptedScoreDirector)
- Overrides:
buildScoreCorruptionAnalysis
in class AbstractScoreDirector<IncrementalScoreDirectorFactory>
- Parameters:
uncorruptedScoreDirector
- never null
- Returns:
- never null
Copyright © 2006-2013 JBoss by Red Hat. All Rights Reserved.