org.drools.planner.core.score.director.drools
Class DroolsScoreDirector
java.lang.Object
org.drools.planner.core.score.director.AbstractScoreDirector<DroolsScoreDirectorFactory>
org.drools.planner.core.score.director.drools.DroolsScoreDirector
- All Implemented Interfaces:
- ScoreDirector
public class DroolsScoreDirector
- extends AbstractScoreDirector<DroolsScoreDirectorFactory>
Drools implementation of ScoreDirector
, which directs the Rule Engine to calculate the Score
of the Solution
workingSolution.
- See Also:
ScoreDirector
Methods inherited from class org.drools.planner.core.score.director.AbstractScoreDirector |
assertWorkingScore, beforeAllVariablesChanged, beforeEntityAdded, beforeEntityRemoved, beforeProblemFactAdded, beforeProblemFactChanged, beforeProblemFactRemoved, beforeVariableChanged, getCalculateCount, getScoreDefinition, getScoreDirectorFactory, getSolutionDescriptor, getTrailingEntity, getWorkingPlanningEntityList, getWorkingSolution, isWorkingSolutionInitialized, setCalculatedScore, toString |
GLOBAL_SCORE_HOLDER_KEY
public static final String GLOBAL_SCORE_HOLDER_KEY
- See Also:
- Constant Field Values
workingMemory
protected org.drools.StatefulSession workingMemory
workingScoreHolder
protected ScoreHolder workingScoreHolder
DroolsScoreDirector
public DroolsScoreDirector(DroolsScoreDirectorFactory scoreDirectorFactory)
getRuleBase
protected org.drools.RuleBase getRuleBase()
getWorkingMemory
public org.drools.WorkingMemory getWorkingMemory()
- Returns:
- never null
setWorkingSolution
public void setWorkingSolution(Solution workingSolution)
- Description copied from interface:
ScoreDirector
- The workingSolution must never be the same instance as the bestSolution, it should be a (un)changed clone.
- Specified by:
setWorkingSolution
in interface ScoreDirector
- Overrides:
setWorkingSolution
in class AbstractScoreDirector<DroolsScoreDirectorFactory>
- Parameters:
workingSolution
- never null
getWorkingFacts
public Collection<Object> getWorkingFacts()
afterEntityAdded
public void afterEntityAdded(Object entity)
- Specified by:
afterEntityAdded
in interface ScoreDirector
- Overrides:
afterEntityAdded
in class AbstractScoreDirector<DroolsScoreDirectorFactory>
afterAllVariablesChanged
public void afterAllVariablesChanged(Object entity)
- Specified by:
afterAllVariablesChanged
in interface ScoreDirector
- Overrides:
afterAllVariablesChanged
in class AbstractScoreDirector<DroolsScoreDirectorFactory>
afterVariableChanged
public void afterVariableChanged(Object entity,
String variableName)
- Specified by:
afterVariableChanged
in interface ScoreDirector
- Overrides:
afterVariableChanged
in class AbstractScoreDirector<DroolsScoreDirectorFactory>
afterEntityRemoved
public void afterEntityRemoved(Object entity)
- Specified by:
afterEntityRemoved
in interface ScoreDirector
- Overrides:
afterEntityRemoved
in class AbstractScoreDirector<DroolsScoreDirectorFactory>
afterProblemFactAdded
public void afterProblemFactAdded(Object problemFact)
- Specified by:
afterProblemFactAdded
in interface ScoreDirector
- Overrides:
afterProblemFactAdded
in class AbstractScoreDirector<DroolsScoreDirectorFactory>
afterProblemFactChanged
public void afterProblemFactChanged(Object problemFact)
- Specified by:
afterProblemFactChanged
in interface ScoreDirector
- Overrides:
afterProblemFactChanged
in class AbstractScoreDirector<DroolsScoreDirectorFactory>
afterProblemFactRemoved
public void afterProblemFactRemoved(Object problemFact)
- Specified by:
afterProblemFactRemoved
in interface ScoreDirector
- Overrides:
afterProblemFactRemoved
in class AbstractScoreDirector<DroolsScoreDirectorFactory>
calculateScore
public Score calculateScore()
- Description copied from interface:
ScoreDirector
- Calculates the
Score
and updates the workingSolution accordingly.
- Returns:
- never null, the
Score
of the working solution
buildScoreCorruptionAnalysis
protected String buildScoreCorruptionAnalysis(ScoreDirector uncorruptedScoreDirector)
- Overrides:
buildScoreCorruptionAnalysis
in class AbstractScoreDirector<DroolsScoreDirectorFactory>
dispose
public void dispose()
- Description copied from interface:
ScoreDirector
- Needs to be called after use because some implementations needs to clean up their resources.
- Specified by:
dispose
in interface ScoreDirector
- Overrides:
dispose
in class AbstractScoreDirector<DroolsScoreDirectorFactory>
Copyright © 2001-2012 JBoss by Red Hat. All Rights Reserved.