|
OptaPlanner distribution 6.1.0.Beta1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.optaplanner.core.impl.score.director.AbstractScoreDirector<F>
public abstract class AbstractScoreDirector<F extends AbstractScoreDirectorFactory>
Abstract superclass for ScoreDirector.
ScoreDirector| Field Summary | |
|---|---|
protected boolean |
allChangesWillBeUndoneBeforeStepEnds
|
protected long |
calculateCount
|
protected boolean |
constraintMatchEnabledPreference
|
protected org.slf4j.Logger |
logger
|
protected F |
scoreDirectorFactory
|
protected TrailingEntityMapSupport |
trailingEntityMapSupport
|
protected PlanningVariableListenerSupport |
variableListenerSupport
|
protected long |
workingEntityListRevision
|
protected Solution |
workingSolution
|
| Constructor Summary | |
|---|---|
protected |
AbstractScoreDirector(F scoreDirectorFactory)
|
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.optaplanner.core.impl.score.director.ScoreDirector |
|---|
calculateScore |
| Field Detail |
|---|
protected final transient org.slf4j.Logger logger
protected final F extends AbstractScoreDirectorFactory scoreDirectorFactory
protected boolean constraintMatchEnabledPreference
protected TrailingEntityMapSupport trailingEntityMapSupport
protected PlanningVariableListenerSupport variableListenerSupport
protected Solution workingSolution
protected long workingEntityListRevision
protected boolean allChangesWillBeUndoneBeforeStepEnds
protected long calculateCount
| Constructor Detail |
|---|
protected AbstractScoreDirector(F scoreDirectorFactory)
| Method Detail |
|---|
public F getScoreDirectorFactory()
getScoreDirectorFactory in interface ScoreDirectorpublic SolutionDescriptor getSolutionDescriptor()
getSolutionDescriptor in interface ScoreDirectorpublic ScoreDefinition getScoreDefinition()
getScoreDefinition in interface ScoreDirectorpublic Solution getWorkingSolution()
ScoreDirectorSolution that is used to calculate the Score.
Because a Score is best calculated incrementally (by delta's),
the ScoreDirector needs to be notified when it's workingSolution changes.
If the Solution has been changed since ScoreDirector.calculateScore() has been called,
the Solution.getScore() of this Solution won't be correct.
getWorkingSolution in interface ScoreDirectorpublic long getWorkingEntityListRevision()
getWorkingEntityListRevision in interface ScoreDirectorScoreDirector.isWorkingEntityListDirty(long) later onpublic boolean isAllChangesWillBeUndoneBeforeStepEnds()
public void setAllChangesWillBeUndoneBeforeStepEnds(boolean allChangesWillBeUndoneBeforeStepEnds)
ScoreDirector
setAllChangesWillBeUndoneBeforeStepEnds in interface ScoreDirectorallChangesWillBeUndoneBeforeStepEnds - true if all changes will be undonepublic long getCalculateCount()
getCalculateCount in interface ScoreDirectorpublic void setWorkingSolution(Solution workingSolution)
ScoreDirectorworkingSolution must never be the same instance as the bestSolution,
it should be a (un)changed clone.
setWorkingSolution in interface ScoreDirectorworkingSolution - never nullpublic boolean isWorkingEntityListDirty(long expectedWorkingEntityListRevision)
isWorkingEntityListDirty in interface ScoreDirectorexpectedWorkingEntityListRevision - an
protected void setWorkingEntityListDirty()
public Solution cloneWorkingSolution()
cloneWorkingSolution in interface ScoreDirectorpublic int getWorkingEntityCount()
getWorkingEntityCount in interface ScoreDirectorpublic List<Object> getWorkingEntityList()
getWorkingEntityList in interface ScoreDirectorpublic int getWorkingValueCount()
getWorkingValueCount in interface ScoreDirectorpublic int countWorkingSolutionUninitializedVariables()
countWorkingSolutionUninitializedVariables in interface ScoreDirectorpublic boolean isWorkingSolutionInitialized()
isWorkingSolutionInitialized in interface ScoreDirectorprotected void setCalculatedScore(Score score)
public boolean isConstraintMatchEnabled()
isConstraintMatchEnabled in interface ScoreDirectorScoreDirector.getConstraintMatchTotals() can be calledpublic Collection<ConstraintMatchTotal> getConstraintMatchTotals()
getConstraintMatchTotals in interface ScoreDirectorpublic AbstractScoreDirector clone()
ScoreDirectorScoreDirector and its workingSolution.
Use ScoreDirector.getWorkingSolution() to retrieve the workingSolution of that clone.
This is heavy method, because it usually breaks incremental score calculation. Use it sparingly.
Therefore it's best to clone lazily by delaying the clone call as long as possible.
clone in interface ScoreDirectorclone in class Objectpublic void dispose()
ScoreDirector
dispose in interface ScoreDirector
public Object getTrailingEntity(PlanningVariableDescriptor chainedVariableDescriptor,
Object planningValue)
getTrailingEntity in interface ScoreDirectorchainedVariableDescriptor - never null, must be PlanningVariableDescriptor.isChained() true
and known to the SolutionDescriptorplanningValue - sometimes null
public final void beforeEntityAdded(Object entity)
beforeEntityAdded in interface ScoreDirectorpublic final void afterEntityAdded(Object entity)
afterEntityAdded in interface ScoreDirector
public final void beforeVariableChanged(Object entity,
String variableName)
beforeVariableChanged in interface ScoreDirector
public final void afterVariableChanged(Object entity,
String variableName)
afterVariableChanged in interface ScoreDirectorpublic final void beforeEntityRemoved(Object entity)
beforeEntityRemoved in interface ScoreDirectorpublic final void afterEntityRemoved(Object entity)
afterEntityRemoved in interface ScoreDirector
public void beforeEntityAdded(PlanningEntityDescriptor entityDescriptor,
Object entity)
public void afterEntityAdded(PlanningEntityDescriptor entityDescriptor,
Object entity)
public void beforeVariableChanged(PlanningVariableDescriptor variableDescriptor,
Object entity)
public void afterVariableChanged(PlanningVariableDescriptor variableDescriptor,
Object entity)
public void beforeShadowVariableChanged(Object entity,
String variableName)
public void afterShadowVariableChanged(Object entity,
String variableName)
public void beforeEntityRemoved(PlanningEntityDescriptor entityDescriptor,
Object entity)
public void afterEntityRemoved(PlanningEntityDescriptor entityDescriptor,
Object entity)
public void beforeProblemFactAdded(Object problemFact)
beforeProblemFactAdded in interface ScoreDirectorpublic void afterProblemFactAdded(Object problemFact)
afterProblemFactAdded in interface ScoreDirectorpublic void beforeProblemFactChanged(Object problemFact)
beforeProblemFactChanged in interface ScoreDirectorpublic void afterProblemFactChanged(Object problemFact)
afterProblemFactChanged in interface ScoreDirectorpublic void beforeProblemFactRemoved(Object problemFact)
beforeProblemFactRemoved in interface ScoreDirectorpublic void afterProblemFactRemoved(Object problemFact)
afterProblemFactRemoved in interface ScoreDirector
public void assertExpectedWorkingScore(Score expectedWorkingScore,
Object completedAction)
ScoreDirectorScore is calculated for the current workingSolution
in the current ScoreDirector (with possibly incremental calculation residue),
it is equal to the parameter expectedWorkingScore.
Used to assert that skipping ScoreDirector.calculateScore() (when the score is otherwise determined) is correct,
assertExpectedWorkingScore in interface ScoreDirectorexpectedWorkingScore - never nullcompletedAction - sometimes null, when assertion fails then the completedAction's Object.toString()
is included in the exception message
public void assertWorkingScoreFromScratch(Score workingScore,
Object completedAction)
ScoreDirectorScore is calculated for the current workingSolution
in a fresh ScoreDirector (with no incremental calculation residue),
it is equal to the parameter workingScore.
Furthermore, if the assert fails, a score corruption analysis might be included in the exception message.
assertWorkingScoreFromScratch in interface ScoreDirectorworkingScore - never nullcompletedAction - sometimes null, when assertion fails then the completedAction's Object.toString()
is included* in the exception messageScoreDirectorFactory.assertScoreFromScratch(Solution)protected String buildScoreCorruptionAnalysis(ScoreDirector uncorruptedScoreDirector)
uncorruptedScoreDirector - never null
@Deprecated
protected void appendLegacyConstraintOccurrences(StringBuilder analysis,
ScoreDirector corruptedScoreDirector,
ScoreDirector uncorruptedScoreDirector)
public String toString()
toString in class Object
|
OptaPlanner distribution 6.1.0.Beta1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||