문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top