public class HardMediumSoftLongScoreHolder extends AbstractScoreHolder<HardMediumSoftLongScore>
HardMediumSoftScore
,
Serialized FormAbstractScoreHolder.ConstraintActivationUnMatchListener
Modifier and Type | Field and Description |
---|---|
protected long |
hardScore |
protected Map<org.kie.api.definition.rule.Rule,BiConsumer<org.kie.api.runtime.rule.RuleContext,Long>> |
matchExecutorByNumberMap |
protected Map<org.kie.api.definition.rule.Rule,BiConsumer<org.kie.api.runtime.rule.RuleContext,HardMediumSoftLongScore>> |
matchExecutorByScoreMap
Slower than
matchExecutorByNumberMap |
protected long |
mediumScore |
protected long |
softScore |
constraintMatchEnabled, constraintMatchTotalMap, indictmentMap, zeroScore
Constructor and Description |
---|
HardMediumSoftLongScoreHolder(boolean constraintMatchEnabled) |
Modifier and Type | Method and Description |
---|---|
void |
addHardConstraintMatch(org.kie.api.runtime.rule.RuleContext kcontext,
long hardWeight) |
void |
addMediumConstraintMatch(org.kie.api.runtime.rule.RuleContext kcontext,
long mediumWeight) |
void |
addMultiConstraintMatch(org.kie.api.runtime.rule.RuleContext kcontext,
long hardWeight,
long mediumWeight,
long softWeight) |
void |
addSoftConstraintMatch(org.kie.api.runtime.rule.RuleContext kcontext,
long softWeight) |
void |
configureConstraintWeight(org.kie.api.definition.rule.Rule rule,
HardMediumSoftLongScore constraintWeight)
Sets up a
ConstraintWeight from the ConstraintConfiguration during initialization. |
HardMediumSoftLongScore |
extractScore(int initScore)
|
long |
getHardScore() |
long |
getMediumScore() |
long |
getSoftScore() |
void |
impactScore(org.kie.api.runtime.rule.RuleContext kcontext)
For internal use only, use penalize() or reward() instead.
|
void |
impactScore(org.kie.api.runtime.rule.RuleContext kcontext,
long weightMultiplier)
For internal use only, use penalize() or reward() instead.
|
void |
penalize(org.kie.api.runtime.rule.RuleContext kcontext)
Penalize a match by the
ConstraintWeight negated. |
void |
penalize(org.kie.api.runtime.rule.RuleContext kcontext,
long weightMultiplier)
Penalize a match by the
ConstraintWeight negated and multiplied with the weightMultiplier for all score levels. |
void |
penalize(org.kie.api.runtime.rule.RuleContext kcontext,
long hardWeightMultiplier,
long mediumWeightMultiplier,
long softWeightMultiplier)
Penalize a match by the
ConstraintWeight negated and multiplied with the specific weightMultiplier per score level. |
void |
reward(org.kie.api.runtime.rule.RuleContext kcontext)
Reward a match by the
ConstraintWeight . |
void |
reward(org.kie.api.runtime.rule.RuleContext kcontext,
long weightMultiplier)
Reward a match by the
ConstraintWeight multiplied with the weightMultiplier for all score levels. |
void |
reward(org.kie.api.runtime.rule.RuleContext kcontext,
long hardWeightMultiplier,
long mediumWeightMultiplier,
long softWeightMultiplier)
Reward a match by the
ConstraintWeight multiplied with the specific weightMultiplier per score level. |
extractJustificationList, getConstraintMatchTotalMap, getConstraintMatchTotals, getIndictmentMap, impactScore, impactScore, isConstraintMatchEnabled, registerConstraintMatch, setJustificationListConverter
protected final Map<org.kie.api.definition.rule.Rule,BiConsumer<org.kie.api.runtime.rule.RuleContext,Long>> matchExecutorByNumberMap
protected final Map<org.kie.api.definition.rule.Rule,BiConsumer<org.kie.api.runtime.rule.RuleContext,HardMediumSoftLongScore>> matchExecutorByScoreMap
matchExecutorByNumberMap
protected long hardScore
protected long mediumScore
protected long softScore
public HardMediumSoftLongScoreHolder(boolean constraintMatchEnabled)
public long getHardScore()
public long getMediumScore()
public long getSoftScore()
public void configureConstraintWeight(org.kie.api.definition.rule.Rule rule, HardMediumSoftLongScore constraintWeight)
ScoreHolder
ConstraintWeight
from the ConstraintConfiguration
during initialization.configureConstraintWeight
in interface ScoreHolder<HardMediumSoftLongScore>
configureConstraintWeight
in class AbstractScoreHolder<HardMediumSoftLongScore>
rule
- never nullconstraintWeight
- never null, with Score.getInitScore()
equal to 0.public void penalize(org.kie.api.runtime.rule.RuleContext kcontext)
ConstraintWeight
negated.kcontext
- never null, the magic variable in DRLpublic void penalize(org.kie.api.runtime.rule.RuleContext kcontext, long weightMultiplier)
ConstraintWeight
negated and multiplied with the weightMultiplier for all score levels.kcontext
- never null, the magic variable in DRLweightMultiplier
- at least 0public void penalize(org.kie.api.runtime.rule.RuleContext kcontext, long hardWeightMultiplier, long mediumWeightMultiplier, long softWeightMultiplier)
ConstraintWeight
negated and multiplied with the specific weightMultiplier per score level.
Slower than penalize(RuleContext, long)
.kcontext
- never null, the magic variable in DRLhardWeightMultiplier
- at least 0mediumWeightMultiplier
- at least 0softWeightMultiplier
- at least 0public void reward(org.kie.api.runtime.rule.RuleContext kcontext)
ConstraintWeight
.kcontext
- never null, the magic variable in DRLpublic void reward(org.kie.api.runtime.rule.RuleContext kcontext, long weightMultiplier)
ConstraintWeight
multiplied with the weightMultiplier for all score levels.kcontext
- never null, the magic variable in DRLweightMultiplier
- at least 0public void reward(org.kie.api.runtime.rule.RuleContext kcontext, long hardWeightMultiplier, long mediumWeightMultiplier, long softWeightMultiplier)
ConstraintWeight
multiplied with the specific weightMultiplier per score level.
Slower than reward(RuleContext, long)
.kcontext
- never null, the magic variable in DRLhardWeightMultiplier
- at least 0mediumWeightMultiplier
- at least 0softWeightMultiplier
- at least 0public void impactScore(org.kie.api.runtime.rule.RuleContext kcontext)
AbstractScoreHolder
impactScore
in class AbstractScoreHolder<HardMediumSoftLongScore>
kcontext
- never nullpublic void impactScore(org.kie.api.runtime.rule.RuleContext kcontext, long weightMultiplier)
AbstractScoreHolder
impactScore
in class AbstractScoreHolder<HardMediumSoftLongScore>
kcontext
- never nullweightMultiplier
- anypublic void addHardConstraintMatch(org.kie.api.runtime.rule.RuleContext kcontext, long hardWeight)
kcontext
- never null, the magic variable in DRLhardWeight
- higher is better, negative for a penalty, positive for a rewardpublic void addMediumConstraintMatch(org.kie.api.runtime.rule.RuleContext kcontext, long mediumWeight)
kcontext
- never null, the magic variable in DRLmediumWeight
- higher is better, negative for a penalty, positive for a rewardpublic void addSoftConstraintMatch(org.kie.api.runtime.rule.RuleContext kcontext, long softWeight)
kcontext
- never null, the magic variable in DRLsoftWeight
- higher is better, negative for a penalty, positive for a rewardpublic void addMultiConstraintMatch(org.kie.api.runtime.rule.RuleContext kcontext, long hardWeight, long mediumWeight, long softWeight)
kcontext
- never null, the magic variable in DRLhardWeight
- higher is better, negative for a penalty, positive for a rewardmediumWeight
- higher is better, negative for a penalty, positive for a rewardsoftWeight
- higher is better, negative for a penalty, positive for a rewardpublic HardMediumSoftLongScore extractScore(int initScore)
ScoreHolder
Score
, calculated by the KieSession
for DroolsScoreDirector
.
Should not be called directly, use ScoreDirector.calculateScore()
instead.
initScore
- <= 0
, managed by OptaPlanner, needed as a parameter in the Score
's creation
method, see Score.getInitScore()
Score
of the working PlanningSolution
Copyright © 2006–2020 JBoss by Red Hat. All rights reserved.