1

Is it possible to use the hard and soft constraint score in the consequences part of a rule but one of them has a non-zero value. e.g.

scoreHolder.addHardConstraintMatch(kcontext, $weight * isHard);
scoreHolder.addSoftConstraintMatch(kcontext, $weight * isSoft);

where the isHard/isSoft one of them is 1 the other is zero.

The above always took the value of the last statement executed (which is the softconstraint)

Shadi Moadad
  • 78
  • 1
  • 7

1 Answers1

2

That is a known issue in OptaPlanner 6.2.0 and lower. The problem lies in AbstractScoreHolder because it only take the rule id as a key, not the score level.

Geoffrey De Smet
  • 26,223
  • 11
  • 73
  • 120
  • 2
    As of 6.3.0.CR2 (http://www.optaplanner.org/download/releaseNotes/releaseNotes6.3.html#_other_improvements, available soon), OptaPlanner will support multiple constraint matches in the consequences part of a Drools rule. See https://issues.jboss.org/browse/PLANNER-284 for more info. – Ondrej Skopek Aug 21 '15 at 16:23