Solution_ - the solution type, the class with the PlanningSolution annotationpublic class IncrementalScoreDirector<Solution_> extends AbstractScoreDirector<Solution_,IncrementalScoreDirectorFactory<Solution_>>
ScoreDirector, which only recalculates the Score
of the part of the working solution that changed,
instead of the going through the entire PlanningSolution. This is incremental calculation, which is fast.ScoreDirectorallChangesWillBeUndoneBeforeStepEnds, calculationCount, constraintMatchEnabledPreference, logger, lookUpEnabled, lookUpManager, scoreDirectorFactory, variableListenerSupport, workingEntityListRevision, workingInitScore, workingSolution| Constructor and Description |
|---|
IncrementalScoreDirector(IncrementalScoreDirectorFactory<Solution_> scoreDirectorFactory,
boolean lookUpEnabled,
boolean constraintMatchEnabledPreference,
IncrementalScoreCalculator<Solution_> incrementalScoreCalculator) |
afterEntityAdded, afterEntityRemoved, afterVariableChanged, assertExpectedWorkingScore, assertShadowVariablesAreNotStale, assertWorkingScoreFromScratch, beforeEntityAdded, beforeEntityRemoved, beforeVariableChanged, buildScoreCorruptionAnalysis, changeVariableFacade, clone, cloneSolution, cloneWorkingSolution, createChildThreadScoreDirector, dispose, getCalculationCount, getScoreDefinition, getScoreDirectorFactory, getSolutionDescriptor, getSupplyManager, getWorkingEntityCount, getWorkingEntityList, getWorkingEntityListRevision, getWorkingSolution, getWorkingValueCount, isAllChangesWillBeUndoneBeforeStepEnds, isConstraintMatchEnabledPreference, isLookUpEnabled, isWorkingEntityListDirty, lookUpWorkingObject, overwriteConstraintMatchEnabledPreference, resetCalculationCount, setAllChangesWillBeUndoneBeforeStepEnds, setCalculatedScore, setWorkingEntityListDirty, toString, triggerVariableListenerspublic IncrementalScoreDirector(IncrementalScoreDirectorFactory<Solution_> scoreDirectorFactory, boolean lookUpEnabled, boolean constraintMatchEnabledPreference, IncrementalScoreCalculator<Solution_> incrementalScoreCalculator)
public IncrementalScoreCalculator<Solution_> getIncrementalScoreCalculator()
public void setWorkingSolution(Solution_ workingSolution)
ScoreDirectorworking solution must never be the same instance as the
best solution, it should be a (un)changed clone.
Only call this method on a separate ScoreDirector instance,
built by Solver.getScoreDirectorFactory(),
not on the one used inside the Solver itself.
setWorkingSolution in interface ScoreDirector<Solution_>setWorkingSolution in class AbstractScoreDirector<Solution_,IncrementalScoreDirectorFactory<Solution_>>workingSolution - never nullpublic Score calculateScore()
ScoreDirectorScore and updates the working solution accordingly.Score of the working solutionpublic boolean isConstraintMatchEnabled()
ScoreDirector.getConstraintMatchTotals() can be calledpublic Collection<ConstraintMatchTotal> getConstraintMatchTotals()
ScoreDirectorScore of ScoreDirector.calculateScore() by splitting it up per constraint type
(which is usually a score rule).
The sum of ConstraintMatchTotal.getScoreTotal() equals ScoreDirector.calculateScore().
public Map<Object,Indictment> getIndictmentMap()
ScoreDirectorScore.
An indictment is basically the inverse of ScoreDirector.getConstraintMatchTotals():
it is a Score total for each justification Object
in ConstraintMatch.getJustificationList().
Warning: In practice, it often doesn't include the full impact on the Score,
for example in DRL score rules with accumulate, the accumulate elements won't be indicted.
The sum of ConstraintMatchTotal.getScoreTotal() differs from ScoreDirector.calculateScore()
because each ConstraintMatch.getScore() is counted
for each justification in ConstraintMatch.getJustificationList().
public void beforeEntityAdded(EntityDescriptor<Solution_> entityDescriptor, Object entity)
beforeEntityAdded in class AbstractScoreDirector<Solution_,IncrementalScoreDirectorFactory<Solution_>>public void afterEntityAdded(EntityDescriptor<Solution_> entityDescriptor, Object entity)
afterEntityAdded in class AbstractScoreDirector<Solution_,IncrementalScoreDirectorFactory<Solution_>>public void beforeVariableChanged(VariableDescriptor variableDescriptor, Object entity)
beforeVariableChanged in interface ScoreDirector<Solution_>beforeVariableChanged in class AbstractScoreDirector<Solution_,IncrementalScoreDirectorFactory<Solution_>>public void afterVariableChanged(VariableDescriptor variableDescriptor, Object entity)
afterVariableChanged in interface ScoreDirector<Solution_>afterVariableChanged in class AbstractScoreDirector<Solution_,IncrementalScoreDirectorFactory<Solution_>>public void beforeEntityRemoved(EntityDescriptor<Solution_> entityDescriptor, Object entity)
beforeEntityRemoved in class AbstractScoreDirector<Solution_,IncrementalScoreDirectorFactory<Solution_>>public void afterEntityRemoved(EntityDescriptor<Solution_> entityDescriptor, Object entity)
afterEntityRemoved in class AbstractScoreDirector<Solution_,IncrementalScoreDirectorFactory<Solution_>>public void beforeProblemFactAdded(Object problemFact)
beforeProblemFactAdded in interface ScoreDirector<Solution_>beforeProblemFactAdded in class AbstractScoreDirector<Solution_,IncrementalScoreDirectorFactory<Solution_>>public void afterProblemFactAdded(Object problemFact)
afterProblemFactAdded in interface ScoreDirector<Solution_>afterProblemFactAdded in class AbstractScoreDirector<Solution_,IncrementalScoreDirectorFactory<Solution_>>public void beforeProblemPropertyChanged(Object problemFactOrEntity)
beforeProblemPropertyChanged in interface ScoreDirector<Solution_>beforeProblemPropertyChanged in class AbstractScoreDirector<Solution_,IncrementalScoreDirectorFactory<Solution_>>public void afterProblemPropertyChanged(Object problemFactOrEntity)
afterProblemPropertyChanged in interface ScoreDirector<Solution_>afterProblemPropertyChanged in class AbstractScoreDirector<Solution_,IncrementalScoreDirectorFactory<Solution_>>public void beforeProblemFactRemoved(Object problemFact)
beforeProblemFactRemoved in interface ScoreDirector<Solution_>beforeProblemFactRemoved in class AbstractScoreDirector<Solution_,IncrementalScoreDirectorFactory<Solution_>>public void afterProblemFactRemoved(Object problemFact)
afterProblemFactRemoved in interface ScoreDirector<Solution_>afterProblemFactRemoved in class AbstractScoreDirector<Solution_,IncrementalScoreDirectorFactory<Solution_>>Copyright © 2006–2017 JBoss by Red Hat. All rights reserved.