|
OptaPlanner core 6.0.0.Final | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.optaplanner.core.impl.score.director.AbstractScoreDirector<DroolsScoreDirectorFactory>
org.optaplanner.core.impl.score.director.drools.DroolsScoreDirector
public class DroolsScoreDirector
Drools implementation of ScoreDirector
, which directs the Rule Engine to calculate the Score
of the Solution
workingSolution.
ScoreDirector
Field Summary | |
---|---|
static String |
GLOBAL_SCORE_HOLDER_KEY
|
protected org.kie.api.runtime.KieSession |
kieSession
|
protected ScoreHolder |
workingScoreHolder
|
Fields inherited from class org.optaplanner.core.impl.score.director.AbstractScoreDirector |
---|
calculateCount, constraintMatchEnabledPreference, logger, scoreDirectorFactory, trailingEntityMapSupport, variableListenerSupport, workingSolution |
Constructor Summary | |
---|---|
DroolsScoreDirector(DroolsScoreDirectorFactory scoreDirectorFactory)
|
Method Summary | |
---|---|
void |
afterEntityAdded(PlanningEntityDescriptor entityDescriptor,
Object entity)
|
void |
afterEntityRemoved(PlanningEntityDescriptor entityDescriptor,
Object entity)
|
void |
afterProblemFactAdded(Object problemFact)
|
void |
afterProblemFactChanged(Object problemFact)
|
void |
afterProblemFactRemoved(Object problemFact)
|
void |
afterShadowVariableChanged(Object entity,
String variableName)
|
void |
afterVariableChanged(PlanningVariableDescriptor variableDescriptor,
Object entity)
|
protected void |
appendLegacyConstraintOccurrences(StringBuilder analysis,
ScoreDirector corruptedScoreDirector,
ScoreDirector uncorruptedScoreDirector)
Deprecated. |
Score |
calculateScore()
Calculates the Score and updates the workingSolution accordingly. |
DroolsScoreDirector |
clone()
Clones this ScoreDirector and its workingSolution . |
void |
dispose()
Needs to be called after use because some implementations needs to clean up their resources. |
Collection<ConstraintMatchTotal> |
getConstraintMatchTotals()
|
protected org.kie.api.KieBase |
getKieBase()
|
org.kie.api.runtime.KieSession |
getKieSession()
|
Collection<Object> |
getWorkingFacts()
|
boolean |
isConstraintMatchEnabled()
|
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 java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String GLOBAL_SCORE_HOLDER_KEY
protected org.kie.api.runtime.KieSession kieSession
protected ScoreHolder workingScoreHolder
Constructor Detail |
---|
public DroolsScoreDirector(DroolsScoreDirectorFactory scoreDirectorFactory)
Method Detail |
---|
protected org.kie.api.KieBase getKieBase()
public org.kie.api.runtime.KieSession getKieSession()
public void setWorkingSolution(Solution workingSolution)
ScoreDirector
workingSolution
must never be the same instance as the bestSolution
,
it should be a (un)changed clone.
setWorkingSolution
in interface ScoreDirector
setWorkingSolution
in class AbstractScoreDirector<DroolsScoreDirectorFactory>
workingSolution
- never nullpublic Collection<Object> getWorkingFacts()
public Score calculateScore()
ScoreDirector
Score
and updates the workingSolution
accordingly.
Score
of the workingSolution
public boolean isConstraintMatchEnabled()
isConstraintMatchEnabled
in interface ScoreDirector
isConstraintMatchEnabled
in class AbstractScoreDirector<DroolsScoreDirectorFactory>
ScoreDirector.getConstraintMatchTotals()
can be calledpublic Collection<ConstraintMatchTotal> getConstraintMatchTotals()
getConstraintMatchTotals
in interface ScoreDirector
getConstraintMatchTotals
in class AbstractScoreDirector<DroolsScoreDirectorFactory>
public DroolsScoreDirector clone()
ScoreDirector
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.
clone
in interface ScoreDirector
clone
in class AbstractScoreDirector<DroolsScoreDirectorFactory>
public void dispose()
ScoreDirector
dispose
in interface ScoreDirector
dispose
in class AbstractScoreDirector<DroolsScoreDirectorFactory>
public void afterEntityAdded(PlanningEntityDescriptor entityDescriptor, Object entity)
afterEntityAdded
in class AbstractScoreDirector<DroolsScoreDirectorFactory>
public void afterVariableChanged(PlanningVariableDescriptor variableDescriptor, Object entity)
afterVariableChanged
in class AbstractScoreDirector<DroolsScoreDirectorFactory>
public void afterShadowVariableChanged(Object entity, String variableName)
afterShadowVariableChanged
in class AbstractScoreDirector<DroolsScoreDirectorFactory>
public void afterEntityRemoved(PlanningEntityDescriptor entityDescriptor, Object entity)
afterEntityRemoved
in class AbstractScoreDirector<DroolsScoreDirectorFactory>
public void afterProblemFactAdded(Object problemFact)
afterProblemFactAdded
in interface ScoreDirector
afterProblemFactAdded
in class AbstractScoreDirector<DroolsScoreDirectorFactory>
public void afterProblemFactChanged(Object problemFact)
afterProblemFactChanged
in interface ScoreDirector
afterProblemFactChanged
in class AbstractScoreDirector<DroolsScoreDirectorFactory>
public void afterProblemFactRemoved(Object problemFact)
afterProblemFactRemoved
in interface ScoreDirector
afterProblemFactRemoved
in class AbstractScoreDirector<DroolsScoreDirectorFactory>
@Deprecated protected void appendLegacyConstraintOccurrences(StringBuilder analysis, ScoreDirector corruptedScoreDirector, ScoreDirector uncorruptedScoreDirector)
appendLegacyConstraintOccurrences
in class AbstractScoreDirector<DroolsScoreDirectorFactory>
|
OptaPlanner core 6.0.0.Final | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |