OptaPlanner core 6.2.0.Beta1

org.optaplanner.core.impl.score.director
Interface InnerScoreDirector

All Superinterfaces:
ScoreDirector
All Known Implementing Classes:
AbstractScoreDirector, DroolsScoreDirector, EasyScoreDirector, IncrementalScoreDirector

public interface InnerScoreDirector
extends ScoreDirector


Method Summary
 void assertExpectedWorkingScore(Score expectedWorkingScore, Object completedAction)
          Asserts that if the Score is calculated for the current workingSolution in the current ScoreDirector (with possibly incremental calculation residue), it is equal to the parameter expectedWorkingScore.
 void assertWorkingScoreFromScratch(Score workingScore, Object completedAction)
          Asserts that if the Score is calculated for the current workingSolution in a fresh ScoreDirector (with no incremental calculation residue), it is equal to the parameter workingScore.
 ScoreDirector clone()
          Clones this ScoreDirector and its workingSolution.
 Solution cloneWorkingSolution()
           
 int countWorkingSolutionUninitializedVariables()
           
 long getCalculateCount()
           
 ScoreDefinition getScoreDefinition()
           
 InnerScoreDirectorFactory getScoreDirectorFactory()
           
 SolutionDescriptor getSolutionDescriptor()
           
 Object getTrailingEntity(GenuineVariableDescriptor chainedVariableDescriptor, Object planningValue)
           
 int getWorkingEntityCount()
           
 List<Object> getWorkingEntityList()
           
 long getWorkingEntityListRevision()
           
 int getWorkingValueCount()
           
 boolean isWorkingEntityListDirty(long expectedWorkingEntityListRevision)
           
 boolean isWorkingSolutionInitialized()
           
 void setAllChangesWillBeUndoneBeforeStepEnds(boolean allChangesWillBeUndoneBeforeStepEnds)
          Do not waste performance by propagating changes to step (or higher) mechanisms.
 
Methods inherited from interface org.optaplanner.core.impl.score.director.ScoreDirector
afterEntityAdded, afterEntityRemoved, afterProblemFactAdded, afterProblemFactChanged, afterProblemFactRemoved, afterVariableChanged, afterVariableChanged, beforeEntityAdded, beforeEntityRemoved, beforeProblemFactAdded, beforeProblemFactChanged, beforeProblemFactRemoved, beforeVariableChanged, beforeVariableChanged, calculateScore, dispose, getConstraintMatchTotals, getWorkingSolution, isConstraintMatchEnabled, setWorkingSolution
 

Method Detail

getWorkingEntityListRevision

long getWorkingEntityListRevision()
Returns:
used to check isWorkingEntityListDirty(long) later on

isWorkingEntityListDirty

boolean isWorkingEntityListDirty(long expectedWorkingEntityListRevision)
Parameters:
expectedWorkingEntityListRevision - an
Returns:
true if the entityList might have a different set of instances now

getScoreDirectorFactory

InnerScoreDirectorFactory getScoreDirectorFactory()
Returns:
never null

getSolutionDescriptor

SolutionDescriptor getSolutionDescriptor()
Returns:
never null

getScoreDefinition

ScoreDefinition getScoreDefinition()
Returns:
never null

cloneWorkingSolution

Solution cloneWorkingSolution()

getWorkingEntityCount

int getWorkingEntityCount()
Returns:
>= 0

getWorkingEntityList

List<Object> getWorkingEntityList()
Returns:
never null: an empty list if there are none

getWorkingValueCount

int getWorkingValueCount()
Returns:
>= 0

countWorkingSolutionUninitializedVariables

int countWorkingSolutionUninitializedVariables()

isWorkingSolutionInitialized

boolean isWorkingSolutionInitialized()
Returns:
true if the workingSolution is initialized

getCalculateCount

long getCalculateCount()
Returns:
at least 0L

clone

ScoreDirector clone()
Clones this ScoreDirector 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.

Returns:
never null

getTrailingEntity

Object getTrailingEntity(GenuineVariableDescriptor chainedVariableDescriptor,
                         Object planningValue)
Parameters:
chainedVariableDescriptor - never null, must be GenuineVariableDescriptor.isChained() true and known to the SolutionDescriptor
planningValue - sometimes null
Returns:
never null

setAllChangesWillBeUndoneBeforeStepEnds

void setAllChangesWillBeUndoneBeforeStepEnds(boolean allChangesWillBeUndoneBeforeStepEnds)
Do not waste performance by propagating changes to step (or higher) mechanisms.

Parameters:
allChangesWillBeUndoneBeforeStepEnds - true if all changes will be undone

assertExpectedWorkingScore

void assertExpectedWorkingScore(Score expectedWorkingScore,
                                Object completedAction)
Asserts that if the Score 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,

Parameters:
expectedWorkingScore - never null
completedAction - sometimes null, when assertion fails then the completedAction's Object.toString() is included in the exception message

assertWorkingScoreFromScratch

void assertWorkingScoreFromScratch(Score workingScore,
                                   Object completedAction)
Asserts that if the Score 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.

Parameters:
workingScore - never null
completedAction - sometimes null, when assertion fails then the completedAction's Object.toString() is included* in the exception message
See Also:
InnerScoreDirectorFactory.assertScoreFromScratch(Solution)

OptaPlanner core 6.2.0.Beta1

Copyright © 2006-2014 JBoss by Red Hat. All Rights Reserved.