Class HardSoftLongScoreHolder

    • Field Detail

      • matchExecutorByNumberMap

        protected final Map<org.kie.api.definition.rule.Rule,​BiConsumer<org.kie.api.runtime.rule.RuleContext,​Long>> matchExecutorByNumberMap
      • hardScore

        protected long hardScore
      • softScore

        protected long softScore
    • Constructor Detail

      • HardSoftLongScoreHolder

        public HardSoftLongScoreHolder​(boolean constraintMatchEnabled)
    • Method Detail

      • getHardScore

        public long getHardScore()
      • getSoftScore

        public long getSoftScore()
      • penalize

        public void penalize​(org.kie.api.runtime.rule.RuleContext kcontext)
        Penalize a match by the ConstraintWeight negated.
        Parameters:
        kcontext - never null, the magic variable in DRL
      • penalize

        public 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.
        Parameters:
        kcontext - never null, the magic variable in DRL
        weightMultiplier - at least 0
      • penalize

        public void penalize​(org.kie.api.runtime.rule.RuleContext kcontext,
                             long hardWeightMultiplier,
                             long softWeightMultiplier)
        Penalize a match by the ConstraintWeight negated and multiplied with the specific weightMultiplier per score level. Slower than penalize(RuleContext, long).
        Parameters:
        kcontext - never null, the magic variable in DRL
        hardWeightMultiplier - at least 0
        softWeightMultiplier - at least 0
      • reward

        public void reward​(org.kie.api.runtime.rule.RuleContext kcontext)
        Reward a match by the ConstraintWeight.
        Parameters:
        kcontext - never null, the magic variable in DRL
      • reward

        public 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.
        Parameters:
        kcontext - never null, the magic variable in DRL
        weightMultiplier - at least 0
      • reward

        public void reward​(org.kie.api.runtime.rule.RuleContext kcontext,
                           long hardWeightMultiplier,
                           long softWeightMultiplier)
        Reward a match by the ConstraintWeight multiplied with the specific weightMultiplier per score level. Slower than reward(RuleContext, long).
        Parameters:
        kcontext - never null, the magic variable in DRL
        hardWeightMultiplier - at least 0
        softWeightMultiplier - at least 0
      • impactScore

        public void impactScore​(org.kie.api.runtime.rule.RuleContext kcontext,
                                long weightMultiplier)
        Description copied from class: AbstractScoreHolder
        For internal use only, use penalize() or reward() instead.
        Overrides:
        impactScore in class AbstractScoreHolder<HardSoftLongScore>
        Parameters:
        kcontext - never null
        weightMultiplier - any
      • addHardConstraintMatch

        public void addHardConstraintMatch​(org.kie.api.runtime.rule.RuleContext kcontext,
                                           long hardWeight)
        Parameters:
        kcontext - never null, the magic variable in DRL
        hardWeight - higher is better, negative for a penalty, positive for a reward
      • addSoftConstraintMatch

        public void addSoftConstraintMatch​(org.kie.api.runtime.rule.RuleContext kcontext,
                                           long softWeight)
        Parameters:
        kcontext - never null, the magic variable in DRL
        softWeight - higher is better, negative for a penalty, positive for a reward
      • addMultiConstraintMatch

        public void addMultiConstraintMatch​(org.kie.api.runtime.rule.RuleContext kcontext,
                                            long hardWeight,
                                            long softWeight)
        Parameters:
        kcontext - never null, the magic variable in DRL
        softWeight - higher is better, negative for a penalty, positive for a reward