Question

I want to enable both positive and negative soft constraints in my application. A +2 implies a positive constraint of weight 2 and a -1 implies a negative constraint of weight 1. Can I supply a negative value as a NEGATIVE_SOFT to imply that it is a positive soft contraint?

insertLogical(new IntConstraintOccurrence("sameDayOrderDifferentDays", 
ConstraintType.NEGATIVE_SOFT,-8,
    $stp1,$stp2));

Otherwise how can I set enable positive and negative soft constraints without having separate rules that inserts NEGATIVE_SOFT and POSITIVE_SOFT depending on the value?

Était-ce utile?

La solution

yes, you can

there is also ConstraintType.POSITIVE_SOFT which are meant for positive constraints., but using 2 accumulates in the same rule is a bad idea, so I d advise to only one type and indeed work with negative numbers too.

Please create a jira issue that this needs to be documented better.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top