org.drools.planner.core.score.director.incremental
Class IncrementalScoreDirector

java.lang.Object
  extended by org.drools.planner.core.score.director.AbstractScoreDirector<IncrementalScoreDirectorFactory>
      extended by org.drools.planner.core.score.director.incremental.IncrementalScoreDirector
All Implemented Interfaces:
ScoreDirector

public class IncrementalScoreDirector
extends AbstractScoreDirector<IncrementalScoreDirectorFactory>

Incremental java implementation of ScoreDirector, which only recalculates the Score of the part of the Solution workingSolution that changed, instead of the going through the entire Solution. This is incremental calculation, which is fast.

See Also:
ScoreDirector

Field Summary
 
Fields inherited from class org.drools.planner.core.score.director.AbstractScoreDirector
calculateCount, chainedVariableToTrailingEntitiesMap, hasChainedVariables, logger, scoreDirectorFactory, workingSolution
 
Constructor Summary
IncrementalScoreDirector(IncrementalScoreDirectorFactory scoreDirectorFactory, IncrementalScoreCalculator incrementalScoreCalculator)
           
 
Method Summary
 void afterAllVariablesChanged(Object entity)
           
 void afterEntityAdded(Object entity)
           
 void afterEntityRemoved(Object entity)
           
 void afterProblemFactAdded(Object problemFact)
           
 void afterProblemFactChanged(Object problemFact)
           
 void afterProblemFactRemoved(Object problemFact)
           
 void afterVariableChanged(Object entity, String variableName)
           
 void beforeAllVariablesChanged(Object entity)
           
 void beforeEntityAdded(Object entity)
           
 void beforeEntityRemoved(Object entity)
           
 void beforeProblemFactAdded(Object problemFact)
           
 void beforeProblemFactChanged(Object problemFact)
           
 void beforeProblemFactRemoved(Object problemFact)
           
 void beforeVariableChanged(Object entity, String variableName)
           
protected  String buildScoreCorruptionAnalysis(ScoreDirector uncorruptedScoreDirector)
           
 Score calculateScore()
          Calculates the Score and updates the workingSolution accordingly.
 void setWorkingSolution(Solution workingSolution)
          The workingSolution must never be the same instance as the bestSolution, it should be a (un)changed clone.
 
Methods inherited from class org.drools.planner.core.score.director.AbstractScoreDirector
assertWorkingScore, dispose, getCalculateCount, getScoreDefinition, getScoreDirectorFactory, getSolutionDescriptor, getTrailingEntity, getWorkingPlanningEntityList, getWorkingSolution, isWorkingSolutionInitialized, setCalculatedScore, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IncrementalScoreDirector

public IncrementalScoreDirector(IncrementalScoreDirectorFactory scoreDirectorFactory,
                                IncrementalScoreCalculator incrementalScoreCalculator)
Method Detail

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<IncrementalScoreDirectorFactory>
Parameters:
workingSolution - never null

beforeEntityAdded

public void beforeEntityAdded(Object entity)
Specified by:
beforeEntityAdded in interface ScoreDirector
Overrides:
beforeEntityAdded in class AbstractScoreDirector<IncrementalScoreDirectorFactory>

afterEntityAdded

public void afterEntityAdded(Object entity)
Specified by:
afterEntityAdded in interface ScoreDirector
Overrides:
afterEntityAdded in class AbstractScoreDirector<IncrementalScoreDirectorFactory>

beforeAllVariablesChanged

public void beforeAllVariablesChanged(Object entity)
Specified by:
beforeAllVariablesChanged in interface ScoreDirector
Overrides:
beforeAllVariablesChanged in class AbstractScoreDirector<IncrementalScoreDirectorFactory>

afterAllVariablesChanged

public void afterAllVariablesChanged(Object entity)
Specified by:
afterAllVariablesChanged in interface ScoreDirector
Overrides:
afterAllVariablesChanged in class AbstractScoreDirector<IncrementalScoreDirectorFactory>

beforeVariableChanged

public void beforeVariableChanged(Object entity,
                                  String variableName)
Specified by:
beforeVariableChanged in interface ScoreDirector
Overrides:
beforeVariableChanged in class AbstractScoreDirector<IncrementalScoreDirectorFactory>

afterVariableChanged

public void afterVariableChanged(Object entity,
                                 String variableName)
Specified by:
afterVariableChanged in interface ScoreDirector
Overrides:
afterVariableChanged in class AbstractScoreDirector<IncrementalScoreDirectorFactory>

beforeEntityRemoved

public void beforeEntityRemoved(Object entity)
Specified by:
beforeEntityRemoved in interface ScoreDirector
Overrides:
beforeEntityRemoved in class AbstractScoreDirector<IncrementalScoreDirectorFactory>

afterEntityRemoved

public void afterEntityRemoved(Object entity)
Specified by:
afterEntityRemoved in interface ScoreDirector
Overrides:
afterEntityRemoved in class AbstractScoreDirector<IncrementalScoreDirectorFactory>

beforeProblemFactAdded

public void beforeProblemFactAdded(Object problemFact)
Specified by:
beforeProblemFactAdded in interface ScoreDirector
Overrides:
beforeProblemFactAdded in class AbstractScoreDirector<IncrementalScoreDirectorFactory>

afterProblemFactAdded

public void afterProblemFactAdded(Object problemFact)
Specified by:
afterProblemFactAdded in interface ScoreDirector
Overrides:
afterProblemFactAdded in class AbstractScoreDirector<IncrementalScoreDirectorFactory>

beforeProblemFactChanged

public void beforeProblemFactChanged(Object problemFact)
Specified by:
beforeProblemFactChanged in interface ScoreDirector
Overrides:
beforeProblemFactChanged in class AbstractScoreDirector<IncrementalScoreDirectorFactory>

afterProblemFactChanged

public void afterProblemFactChanged(Object problemFact)
Specified by:
afterProblemFactChanged in interface ScoreDirector
Overrides:
afterProblemFactChanged in class AbstractScoreDirector<IncrementalScoreDirectorFactory>

beforeProblemFactRemoved

public void beforeProblemFactRemoved(Object problemFact)
Specified by:
beforeProblemFactRemoved in interface ScoreDirector
Overrides:
beforeProblemFactRemoved in class AbstractScoreDirector<IncrementalScoreDirectorFactory>

afterProblemFactRemoved

public void afterProblemFactRemoved(Object problemFact)
Specified by:
afterProblemFactRemoved in interface ScoreDirector
Overrides:
afterProblemFactRemoved in class AbstractScoreDirector<IncrementalScoreDirectorFactory>

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<IncrementalScoreDirectorFactory>


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