/** * @param kcontext never null, the magic variable in DRL * @param softWeight higher is better, negative for a penalty, positive for a reward */ public void addSoftConstraintMatch(RuleContext kcontext, long softWeight) { softScore += softWeight; registerConstraintMatch(kcontext, () -> softScore -= softWeight, () -> HardMediumSoftLongScore.of(0L, 0L, softWeight)); }
/** * @param kcontext never null, the magic variable in DRL * @param hardWeight higher is better, negative for a penalty, positive for a reward */ public void addHardConstraintMatch(RuleContext kcontext, long hardWeight) { hardScore += hardWeight; registerConstraintMatch(kcontext, () -> hardScore -= hardWeight, () -> HardMediumSoftLongScore.of(hardWeight, 0L, 0L)); }
/** * @param kcontext never null, the magic variable in DRL * @param mediumWeight higher is better, negative for a penalty, positive for a reward */ public void addMediumConstraintMatch(RuleContext kcontext, long mediumWeight) { mediumScore += mediumWeight; registerConstraintMatch(kcontext, () -> mediumScore -= mediumWeight, () -> HardMediumSoftLongScore.of(0L, mediumWeight, 0L)); }
/** * @param kcontext never null, the magic variable in DRL * @param hardWeight higher is better, negative for a penalty, positive for a reward * @param mediumWeight higher is better, negative for a penalty, positive for a reward * @param softWeight higher is better, negative for a penalty, positive for a reward */ public void addMultiConstraintMatch(RuleContext kcontext, long hardWeight, long mediumWeight, long softWeight) { hardScore += hardWeight; mediumScore += mediumWeight; softScore += softWeight; registerConstraintMatch(kcontext, () -> { hardScore -= hardWeight; mediumScore -= mediumWeight; softScore -= softWeight; }, () -> HardMediumSoftLongScore.of(hardWeight, mediumWeight, softWeight)); }