Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| OptaPlanner distribution 6.2.0.CR1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.optaplanner.core.impl.score.director.drools
Class DroolsScoreDirector

    java.lang.Object
      org.optaplanner.core.impl.score.director.AbstractScoreDirector<DroolsScoreDirectorFactory>
          org.optaplanner.core.impl.score.director.drools.DroolsScoreDirector

All Implemented Interfaces:
  Cloneable, InnerScoreDirector, 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`

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
`allChangesWillBeUndoneBeforeStepEnds, calculateCount, constraintMatchEnabledPreference, logger, scoreDirectorFactory, trailingEntityMapSupport, variableListenerSupport, workingEntityListRevision, workingSolution`

Constructor Summary
`DroolsScoreDirector(DroolsScoreDirectorFactory scoreDirectorFactory, boolean constraintMatchEnabledPreference)`

Method Summary
`void` | `afterEntityAdded(EntityDescriptor entityDescriptor, Object entity)`
`void` | `afterEntityRemoved(EntityDescriptor entityDescriptor, Object entity)`
`void` | `afterProblemFactAdded(Object problemFact)`
`void` | `afterProblemFactChanged(Object problemFact)`
`void` | `afterProblemFactRemoved(Object problemFact)`
`void` | `afterVariableChanged(VariableDescriptor variableDescriptor, Object entity)`
`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 org.optaplanner.core.impl.score.director.AbstractScoreDirector
`afterEntityAdded, afterEntityRemoved, afterVariableChanged, assertExpectedWorkingScore, assertWorkingScoreFromScratch, beforeEntityAdded, beforeEntityAdded, beforeEntityRemoved, beforeEntityRemoved, beforeProblemFactAdded, beforeProblemFactChanged, beforeProblemFactRemoved, beforeVariableChanged, beforeVariableChanged, buildScoreCorruptionAnalysis, cloneWorkingSolution, countWorkingSolutionUninitializedVariables, getCalculateCount, getScoreDefinition, getScoreDirectorFactory, getSolutionDescriptor, getTrailingEntity, getWorkingEntityCount, getWorkingEntityList, getWorkingEntityListRevision, getWorkingSolution, getWorkingValueCount, isAllChangesWillBeUndoneBeforeStepEnds, isWorkingEntityListDirty, isWorkingSolutionInitialized, setAllChangesWillBeUndoneBeforeStepEnds, setCalculatedScore, setWorkingEntityListDirty, toString`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### GLOBAL_SCORE_HOLDER_KEY

    public static final String GLOBAL_SCORE_HOLDER_KEY

See Also:
  Constant Field Values

### kieSession

    protected org.kie.api.runtime.KieSession kieSession

### workingScoreHolder

    protected ScoreHolder workingScoreHolder

Constructor Detail

### DroolsScoreDirector

    public DroolsScoreDirector(DroolsScoreDirectorFactory scoreDirectorFactory,
                               boolean constraintMatchEnabledPreference)

Method Detail

### getKieBase

    protected org.kie.api.KieBase getKieBase()

### getKieSession

    public org.kie.api.runtime.KieSession getKieSession()

### 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.

  Only call this method on a separate `ScoreDirector` instance, build by `Solver.getScoreDirectorFactory()`, not on the one used inside the `Solver` itself.

  Specified by:
    `setWorkingSolution` in interface `ScoreDirector`
  Overrides:
    `setWorkingSolution` in class `AbstractScoreDirector<DroolsScoreDirectorFactory>`
  Parameters:
    `workingSolution` - never null

### getWorkingFacts

    public Collection<Object> getWorkingFacts()

### calculateScore

    public Score calculateScore()

  Description copied from interface: `ScoreDirector`
  Calculates the `Score` and updates the `workingSolution` accordingly.

  Returns:
    never null, the `Score` of the `workingSolution`

### isConstraintMatchEnabled

    public boolean isConstraintMatchEnabled()

  Returns:
    true if `ScoreDirector.getConstraintMatchTotals()` can be called

### getConstraintMatchTotals

    public Collection<ConstraintMatchTotal> getConstraintMatchTotals()

  Returns:
    never null

### clone

    public DroolsScoreDirector clone()

  Description copied from interface: `InnerScoreDirector`
  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.

  Specified by:
    `clone` in interface `InnerScoreDirector`
  Overrides:
    `clone` in class `AbstractScoreDirector<DroolsScoreDirectorFactory>`
  Returns:
    never null

### 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>`

### afterEntityAdded

    public void afterEntityAdded(EntityDescriptor entityDescriptor,
                                 Object entity)

  Overrides:
    `afterEntityAdded` in class `AbstractScoreDirector<DroolsScoreDirectorFactory>`

### afterVariableChanged

    public void afterVariableChanged(VariableDescriptor variableDescriptor,
                                     Object entity)

  Specified by:
    `afterVariableChanged` in interface `ScoreDirector`
  Overrides:
    `afterVariableChanged` in class `AbstractScoreDirector<DroolsScoreDirectorFactory>`

### afterEntityRemoved

    public void afterEntityRemoved(EntityDescriptor entityDescriptor,
                                   Object entity)

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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| OptaPlanner distribution 6.2.0.CR1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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