Support for Defeasible Logic and Constraints with Probabilities
- We added support for special constraints that can be violated with certain probablilties. It allows JSR-331 users such as Business Rules vendors to add defeasible logic to their products. Read, for example, how it’s done at OpenRules.
- We introduced a concept “Probability”(enum) with the following standard values:
NEVER(0),
VERY_LOW(10),
LOW(25),
BELOW_MID(35),
MID(50),
ABOVE_MID(60),
HIGH(75),
VERY_HIGH(90),
ALWAYS(100);
- A new Constraint’s method public void post(String name, Probability probability) is used to post a constraint assuming that it can be violated. The parameter probability defines a probability that this constraint will not be violated. If it’s ALWAYS this is the same as a regular constraint posting. If it’s NEVER, the posting of this constraint will fail producing a RuntimeException. All other values allow the constraint to be violated with certain penalties. For instance, probability LOW invokes higher penalty to compare with probability HIGH, but a lower penalty to compare with VERY_LOW.
- The new Problem’s method getTotalConstraintViolation() returns a variable that could be minimized to find a solution that may all synchronize all relative constraint violations. Thus, posting related constraints with different probabilities may resolve their conflicts.