Class TestGenDroolsScoreDirector<Solution_,Score_ extends Score<Score_>>
- java.lang.Object
 - 
- org.optaplanner.core.impl.score.director.AbstractScoreDirector<Solution_,Score_,DroolsScoreDirectorFactory<Solution_,Score_>>
 - 
- org.optaplanner.core.impl.score.director.drools.DroolsScoreDirector<Solution_,Score_>
 - 
- org.optaplanner.core.impl.score.director.drools.testgen.TestGenDroolsScoreDirector<Solution_,Score_>
 
 
 
 
- 
- All Implemented Interfaces:
 AutoCloseable,Cloneable,ScoreDirector<Solution_>,InnerScoreDirector<Solution_,Score_>
public class TestGenDroolsScoreDirector<Solution_,Score_ extends Score<Score_>> extends DroolsScoreDirector<Solution_,Score_>
 
- 
- 
Field Summary
- 
Fields inherited from class org.optaplanner.core.impl.score.director.drools.DroolsScoreDirector
GLOBAL_SCORE_HOLDER_KEY, kieSession, scoreHolder 
- 
Fields inherited from class org.optaplanner.core.impl.score.director.AbstractScoreDirector
allChangesWillBeUndoneBeforeStepEnds, calculationCount, constraintMatchEnabledPreference, logger, lookUpEnabled, lookUpManager, scoreDirectorFactory, variableListenerSupport, workingEntityListRevision, workingInitScore, workingSolution 
 - 
 
- 
Constructor Summary
Constructors Constructor Description TestGenDroolsScoreDirector(DroolsScoreDirectorFactory<Solution_,Score_> scoreDirectorFactory, boolean lookUpEnabled, boolean constraintMatchEnabledPreference, List<String> scoreDrlList, List<File> scoreDrlFileList) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterEntityAdded(EntityDescriptor<Solution_> entityDescriptor, Object entity)voidafterEntityRemoved(EntityDescriptor<Solution_> entityDescriptor, Object entity)voidafterProblemFactAdded(Object problemFact)voidafterProblemFactRemoved(Object problemFact)voidafterVariableChanged(VariableDescriptor variableDescriptor, Object entity)voidassertShadowVariablesAreNotStale(Score_ expectedWorkingScore, Object completedAction)Asserts that if allVariableListeners are forcibly triggered, and therefore all shadow variables are updated if needed, that none of the shadow variables of theworking solutionchange, Then also asserts that theScorecalculated for theworking solutionafterwards is equal to the parameterexpectedWorkingScore.voidassertWorkingScoreFromScratch(Score_ workingScore, Object completedAction)Asserts that if theScoreis calculated for the currentworking solutionin a freshScoreDirector(with no incremental calculation residue), it is equal to the parameterworkingScore.voidbeforeVariableChanged(VariableDescriptor variableDescriptor, Object entity)Score_calculateScore()Calculates theScoreand updates theworking solutionaccordingly.voidclose()Needs to be called after use because some implementations need to clean up their resources.org.kie.api.runtime.KieSessioncreateKieSession()Map<String,ConstraintMatchTotal<Score_>>getConstraintMatchTotalMap()voidsetWorkingSolution(Solution_ workingSolution)Theworking solutionmust never be the same instance as thebest solution, it should be a (un)changed clone.- 
Methods inherited from class org.optaplanner.core.impl.score.director.drools.DroolsScoreDirector
afterProblemPropertyChanged, getIndictmentMap, getKieSession, getWorkingFacts, isConstraintMatchEnabled 
- 
Methods inherited from class org.optaplanner.core.impl.score.director.AbstractScoreDirector
afterEntityAdded, afterEntityRemoved, afterVariableChanged, assertExpectedUndoMoveScore, assertExpectedWorkingScore, assertNonNullPlanningIds, assertPredictedScoreFromScratch, beforeEntityAdded, beforeEntityAdded, beforeEntityRemoved, beforeEntityRemoved, beforeProblemFactAdded, beforeProblemFactRemoved, beforeProblemPropertyChanged, beforeVariableChanged, buildScoreCorruptionAnalysis, buildShadowVariableAnalysis, changeVariableFacade, clone, cloneSolution, cloneWorkingSolution, createChildThreadScoreDirector, createShadowVariablesViolationMessage, doAndProcessMove, doAndProcessMove, getCalculationCount, getScoreDefinition, getScoreDirectorFactory, getSolutionDescriptor, getSupplyManager, getWorkingEntityCount, getWorkingEntityList, getWorkingEntityListRevision, getWorkingSolution, getWorkingValueCount, isAllChangesWillBeUndoneBeforeStepEnds, isConstraintConfiguration, isConstraintMatchEnabledPreference, isLookUpEnabled, isWorkingEntityListDirty, lookUpWorkingObject, lookUpWorkingObjectOrReturnNull, overwriteConstraintMatchEnabledPreference, resetCalculationCount, setAllChangesWillBeUndoneBeforeStepEnds, setCalculatedScore, setWorkingEntityListDirty, toString, triggerVariableListeners 
 - 
 
 - 
 
- 
- 
Method Detail
- 
createKieSession
public org.kie.api.runtime.KieSession createKieSession()
 
- 
setWorkingSolution
public void setWorkingSolution(Solution_ workingSolution)
Description copied from interface:InnerScoreDirectorTheworking solutionmust never be the same instance as thebest solution, it should be a (un)changed clone.- Specified by:
 setWorkingSolutionin interfaceInnerScoreDirector<Solution_,Score_ extends Score<Score_>>- Overrides:
 setWorkingSolutionin classDroolsScoreDirector<Solution_,Score_ extends Score<Score_>>- Parameters:
 workingSolution- never null
 
- 
calculateScore
public Score_ calculateScore()
Description copied from interface:InnerScoreDirectorCalculates theScoreand updates theworking solutionaccordingly.- Specified by:
 calculateScorein interfaceInnerScoreDirector<Solution_,Score_ extends Score<Score_>>- Overrides:
 calculateScorein classDroolsScoreDirector<Solution_,Score_ extends Score<Score_>>- Returns:
 - never null, the 
Scoreof theworking solution 
 
- 
assertShadowVariablesAreNotStale
public void assertShadowVariablesAreNotStale(Score_ expectedWorkingScore, Object completedAction)
Description copied from interface:InnerScoreDirectorAsserts that if allVariableListeners are forcibly triggered, and therefore all shadow variables are updated if needed, that none of the shadow variables of theworking solutionchange, Then also asserts that theScorecalculated for theworking solutionafterwards is equal to the parameterexpectedWorkingScore.Used to assert that the shadow variables' state is consistent with the genuine variables' state.
- Specified by:
 assertShadowVariablesAreNotStalein interfaceInnerScoreDirector<Solution_,Score_ extends Score<Score_>>- Overrides:
 assertShadowVariablesAreNotStalein classAbstractScoreDirector<Solution_,Score_ extends Score<Score_>,DroolsScoreDirectorFactory<Solution_,Score_ extends Score<Score_>>>- Parameters:
 expectedWorkingScore- never nullcompletedAction- sometimes null, when assertion fails then the completedAction'sObject.toString()is included in the exception message
 
- 
assertWorkingScoreFromScratch
public void assertWorkingScoreFromScratch(Score_ workingScore, Object completedAction)
Description copied from interface:InnerScoreDirectorAsserts that if theScoreis calculated for the currentworking solutionin a freshScoreDirector(with no incremental calculation residue), it is equal to the parameterworkingScore.Furthermore, if the assert fails, a score corruption analysis might be included in the exception message.
- Specified by:
 assertWorkingScoreFromScratchin interfaceInnerScoreDirector<Solution_,Score_ extends Score<Score_>>- Overrides:
 assertWorkingScoreFromScratchin classAbstractScoreDirector<Solution_,Score_ extends Score<Score_>,DroolsScoreDirectorFactory<Solution_,Score_ extends Score<Score_>>>- Parameters:
 workingScore- never nullcompletedAction- sometimes null, when assertion fails then the completedAction'sObject.toString()is included in the exception message- See Also:
 InnerScoreDirectorFactory.assertScoreFromScratch(Solution_)
 
- 
getConstraintMatchTotalMap
public Map<String,ConstraintMatchTotal<Score_>> getConstraintMatchTotalMap()
Description copied from interface:InnerScoreDirectorExplains theScoreofInnerScoreDirector.calculateScore()by splitting it up perConstraint.The sum of
ConstraintMatchTotal.getScore()equalsInnerScoreDirector.calculateScore().Call
InnerScoreDirector.calculateScore()before calling this method, unless that method has already been called since the lastPlanningVariablechanges.- Specified by:
 getConstraintMatchTotalMapin interfaceInnerScoreDirector<Solution_,Score_ extends Score<Score_>>- Overrides:
 getConstraintMatchTotalMapin classDroolsScoreDirector<Solution_,Score_ extends Score<Score_>>- Returns:
 - never null, the key is the 
constraintId(to create one, useConstraintMatchTotal.composeConstraintId(String, String)). - See Also:
 InnerScoreDirector.getIndictmentMap()
 
- 
close
public void close()
Description copied from interface:InnerScoreDirectorNeeds to be called after use because some implementations need to clean up their resources.- Specified by:
 closein interfaceAutoCloseable- Specified by:
 closein interfaceInnerScoreDirector<Solution_,Score_ extends Score<Score_>>- Overrides:
 closein classDroolsScoreDirector<Solution_,Score_ extends Score<Score_>>
 
- 
afterEntityAdded
public void afterEntityAdded(EntityDescriptor<Solution_> entityDescriptor, Object entity)
- Overrides:
 afterEntityAddedin classDroolsScoreDirector<Solution_,Score_ extends Score<Score_>>
 
- 
beforeVariableChanged
public void beforeVariableChanged(VariableDescriptor variableDescriptor, Object entity)
- Specified by:
 beforeVariableChangedin interfaceInnerScoreDirector<Solution_,Score_ extends Score<Score_>>- Overrides:
 beforeVariableChangedin classAbstractScoreDirector<Solution_,Score_ extends Score<Score_>,DroolsScoreDirectorFactory<Solution_,Score_ extends Score<Score_>>>
 
- 
afterVariableChanged
public void afterVariableChanged(VariableDescriptor variableDescriptor, Object entity)
- Specified by:
 afterVariableChangedin interfaceInnerScoreDirector<Solution_,Score_ extends Score<Score_>>- Overrides:
 afterVariableChangedin classDroolsScoreDirector<Solution_,Score_ extends Score<Score_>>
 
- 
afterEntityRemoved
public void afterEntityRemoved(EntityDescriptor<Solution_> entityDescriptor, Object entity)
- Overrides:
 afterEntityRemovedin classDroolsScoreDirector<Solution_,Score_ extends Score<Score_>>
 
- 
afterProblemFactAdded
public void afterProblemFactAdded(Object problemFact)
- Specified by:
 afterProblemFactAddedin interfaceScoreDirector<Solution_>- Overrides:
 afterProblemFactAddedin classDroolsScoreDirector<Solution_,Score_ extends Score<Score_>>
 
- 
afterProblemFactRemoved
public void afterProblemFactRemoved(Object problemFact)
- Specified by:
 afterProblemFactRemovedin interfaceScoreDirector<Solution_>- Overrides:
 afterProblemFactRemovedin classDroolsScoreDirector<Solution_,Score_ extends Score<Score_>>
 
 - 
 
 -