Solution_
- the solution type, the class with the PlanningSolution
annotationpublic interface InnerScoreDirector<Solution_> extends ScoreDirector<Solution_>
Modifier and Type | Method and Description |
---|---|
void |
assertExpectedUndoMoveScore(Move move,
Score beforeMoveScore)
Asserts that if the
Score is calculated for the current working solution
in the current ScoreDirector (with incremental calculation residue),
it is equal to the parameter beforeMoveScore . |
void |
assertExpectedWorkingScore(Score expectedWorkingScore,
Object completedAction)
Asserts that if the
Score is calculated for the current working solution
in the current ScoreDirector (with possibly incremental calculation residue),
it is equal to the parameter expectedWorkingScore . |
void |
assertPredictedScoreFromScratch(Score predictedScore,
Object completedAction)
Asserts that if the
Score is calculated for the current working solution
in a fresh ScoreDirector (with no incremental calculation residue),
it is equal to the parameter predictedScore . |
void |
assertShadowVariablesAreNotStale(Score expectedWorkingScore,
Object completedAction)
Asserts that if all
VariableListener s are forcibly triggered,
and therefore all shadow variables are updated if needed,
that none of the shadow variables of the working solution change,
Then also asserts that the Score calculated for the working solution afterwards
is equal to the parameter expectedWorkingScore . |
void |
assertWorkingScoreFromScratch(Score workingScore,
Object completedAction)
Asserts that if the
Score is calculated for the current working solution
in a fresh ScoreDirector (with no incremental calculation residue),
it is equal to the parameter workingScore . |
ScoreDirector<Solution_> |
clone()
Clones this
ScoreDirector and its working solution . |
Solution_ |
cloneSolution(Solution_ originalSolution)
Returns a planning clone of the solution,
which is not a shallow clone nor a deep clone nor a partition clone.
|
Solution_ |
cloneWorkingSolution()
Returns a planning clone of the solution,
which is not a shallow clone nor a deep clone nor a partition clone.
|
InnerScoreDirector<Solution_> |
createChildThreadScoreDirector(ChildThreadType childThreadType) |
Score |
doAndProcessMove(Move<Solution_> move,
boolean assertMoveScoreFromScratch) |
void |
doAndProcessMove(Move<Solution_> move,
boolean assertMoveScoreFromScratch,
Consumer<Score> moveProcessor) |
long |
getCalculationCount() |
ScoreDefinition |
getScoreDefinition() |
InnerScoreDirectorFactory<Solution_> |
getScoreDirectorFactory() |
SolutionDescriptor<Solution_> |
getSolutionDescriptor() |
SupplyManager |
getSupplyManager() |
int |
getWorkingEntityCount() |
List<Object> |
getWorkingEntityList() |
long |
getWorkingEntityListRevision() |
int |
getWorkingValueCount() |
boolean |
isWorkingEntityListDirty(long expectedWorkingEntityListRevision) |
void |
overwriteConstraintMatchEnabledPreference(boolean constraintMatchEnabledPreference) |
void |
resetCalculationCount() |
void |
setAllChangesWillBeUndoneBeforeStepEnds(boolean allChangesWillBeUndoneBeforeStepEnds)
Do not waste performance by propagating changes to step (or higher) mechanisms.
|
afterEntityAdded, afterEntityRemoved, afterProblemFactAdded, afterProblemFactRemoved, afterProblemPropertyChanged, afterVariableChanged, afterVariableChanged, beforeEntityAdded, beforeEntityRemoved, beforeProblemFactAdded, beforeProblemFactRemoved, beforeProblemPropertyChanged, beforeVariableChanged, beforeVariableChanged, calculateScore, changeVariableFacade, close, dispose, explainScore, getConstraintMatchTotalMap, getConstraintMatchTotals, getIndictmentMap, getWorkingSolution, isConstraintMatchEnabled, lookUpWorkingObject, lookUpWorkingObjectOrReturnNull, setWorkingSolution, triggerVariableListeners
void overwriteConstraintMatchEnabledPreference(boolean constraintMatchEnabledPreference)
constraintMatchEnabledPreference
- false if a ScoreDirector
implementation
should not do ConstraintMatch
tracking even if it supports it.long getWorkingEntityListRevision()
isWorkingEntityListDirty(long)
later onScore doAndProcessMove(Move<Solution_> move, boolean assertMoveScoreFromScratch)
move
- never nullassertMoveScoreFromScratch
- true will hurt performancevoid doAndProcessMove(Move<Solution_> move, boolean assertMoveScoreFromScratch, Consumer<Score> moveProcessor)
move
- never nullassertMoveScoreFromScratch
- true will hurt performancemoveProcessor
- never null, use this to store the score as well as call the acceptor and foragerboolean isWorkingEntityListDirty(long expectedWorkingEntityListRevision)
expectedWorkingEntityListRevision
- anInnerScoreDirectorFactory<Solution_> getScoreDirectorFactory()
SolutionDescriptor<Solution_> getSolutionDescriptor()
ScoreDefinition getScoreDefinition()
Solution_ cloneWorkingSolution()
Solution_ cloneSolution(Solution_ originalSolution)
originalSolution
- never nullint getWorkingEntityCount()
>= 0
List<Object> getWorkingEntityList()
int getWorkingValueCount()
>= 0
long getCalculationCount()
void resetCalculationCount()
SupplyManager getSupplyManager()
ScoreDirector<Solution_> clone()
ScoreDirector
and its working solution
.
Use ScoreDirector.getWorkingSolution()
to retrieve the working solution
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.
InnerScoreDirector<Solution_> createChildThreadScoreDirector(ChildThreadType childThreadType)
void setAllChangesWillBeUndoneBeforeStepEnds(boolean allChangesWillBeUndoneBeforeStepEnds)
allChangesWillBeUndoneBeforeStepEnds
- true if all changes will be undonevoid assertExpectedWorkingScore(Score expectedWorkingScore, Object completedAction)
Score
is calculated for the current working solution
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.
expectedWorkingScore
- never nullcompletedAction
- sometimes null, when assertion fails then the completedAction's Object.toString()
is included in the exception messagevoid assertShadowVariablesAreNotStale(Score expectedWorkingScore, Object completedAction)
VariableListener
s are forcibly triggered,
and therefore all shadow variables are updated if needed,
that none of the shadow variables of the working solution
change,
Then also asserts that the Score
calculated for the working solution
afterwards
is equal to the parameter expectedWorkingScore
.
Used to assert that the shadow variables' state is consistent with the genuine variables' state.
expectedWorkingScore
- never nullcompletedAction
- sometimes null, when assertion fails then the completedAction's Object.toString()
is included in the exception messagevoid assertWorkingScoreFromScratch(Score workingScore, Object completedAction)
Score
is calculated for the current working solution
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.
workingScore
- never nullcompletedAction
- sometimes null, when assertion fails then the completedAction's Object.toString()
is included in the exception messageInnerScoreDirectorFactory.assertScoreFromScratch(Solution_)
void assertPredictedScoreFromScratch(Score predictedScore, Object completedAction)
Score
is calculated for the current working solution
in a fresh ScoreDirector
(with no incremental calculation residue),
it is equal to the parameter predictedScore
.
Furthermore, if the assert fails, a score corruption analysis might be included in the exception message.
predictedScore
- never nullcompletedAction
- sometimes null, when assertion fails then the completedAction's Object.toString()
is included in the exception messageInnerScoreDirectorFactory.assertScoreFromScratch(Solution_)
void assertExpectedUndoMoveScore(Move move, Score beforeMoveScore)
Score
is calculated for the current working solution
in the current ScoreDirector
(with incremental calculation residue),
it is equal to the parameter beforeMoveScore
.
Furthermore, if the assert fails, a score corruption analysis might be included in the exception message.
move
- never nullbeforeMoveScore
- never nullCopyright © 2006–2020 JBoss by Red Hat. All rights reserved.