public class BendableBigDecimalScoreHolder extends AbstractScoreHolder
BendableBigDecimalScore
,
Serialized FormAbstractScoreHolder.ConstraintActivationUnMatchListener
constraintMatchEnabled, constraintMatchTotalMap, indictmentMap, zeroScore
Constructor and Description |
---|
BendableBigDecimalScoreHolder(boolean constraintMatchEnabled,
int hardLevelsSize,
int softLevelsSize) |
Modifier and Type | Method and Description |
---|---|
void |
addHardConstraintMatch(org.kie.api.runtime.rule.RuleContext kcontext,
int hardLevel,
BigDecimal weight) |
void |
addMultiConstraintMatch(org.kie.api.runtime.rule.RuleContext kcontext,
BigDecimal[] hardWeights,
BigDecimal[] softWeights) |
void |
addSoftConstraintMatch(org.kie.api.runtime.rule.RuleContext kcontext,
int softLevel,
BigDecimal weight) |
Score |
extractScore(int initScore)
|
int |
getHardLevelsSize() |
BigDecimal |
getHardScore(int hardLevel) |
int |
getSoftLevelsSize() |
BigDecimal |
getSoftScore(int softLevel) |
extractJustificationList, getConstraintMatchTotals, getIndictmentMap, isConstraintMatchEnabled, registerConstraintMatch
public BendableBigDecimalScoreHolder(boolean constraintMatchEnabled, int hardLevelsSize, int softLevelsSize)
public int getHardLevelsSize()
public BigDecimal getHardScore(int hardLevel)
public int getSoftLevelsSize()
public BigDecimal getSoftScore(int softLevel)
public void addHardConstraintMatch(org.kie.api.runtime.rule.RuleContext kcontext, int hardLevel, BigDecimal weight)
kcontext
- never null, the magic variable in DRLhardLevel
- 0 <= hardLevel <
getHardLevelsSize()
.
The scoreLevel
is hardLevel
for hard levels and softLevel + hardLevelSize
for soft levels.weight
- never null, higher is better, negative for a penalty, positive for a rewardpublic void addSoftConstraintMatch(org.kie.api.runtime.rule.RuleContext kcontext, int softLevel, BigDecimal weight)
kcontext
- never null, the magic variable in DRLsoftLevel
- 0 <= softLevel <
getSoftLevelsSize()
.
The scoreLevel
is hardLevel
for hard levels and softLevel + hardLevelSize
for soft levels.weight
- never null, higher is better, negative for a penalty, positive for a rewardpublic void addMultiConstraintMatch(org.kie.api.runtime.rule.RuleContext kcontext, BigDecimal[] hardWeights, BigDecimal[] softWeights)
kcontext
- never null, the magic variable in DRLhardWeights
- never null, array of length getHardLevelsSize()
, does not contain any nullssoftWeights
- never null, array of length getSoftLevelsSize()
, does not contain any nullspublic Score 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–2017 JBoss by Red Hat. All rights reserved.