I am designing a rule evaluation system which need to handle a fact database and certain rules over the database. We currently have a modified version of RETE that works partially right with some drawbacks.
The problem is the rules doesn't limit to exact matches but they must also support inequality (as in less than) and other kinds of fuzzy calculations.
Examples, suppose you have this facts
(Salary John 58000) (Salary Sara 78000) (Employee John) (Boss Sara) (Married John Sara) (Works John Stackoverflow)
you might have a rule that says:
(Salary ?w < 60000) /\ (Married ?w) /\ (Works ?w Stackoverflow) ==> Whatever
Obviously the result will be triggering the rule with an ?w value of "John" but the way we're doing that now is by looping trough each element in the fact base that matches the beggining of the first expression (Salary X X) and then making the comparison and storing the results in the fact base it self. For example, after the first pass you'll have the following item added to the fact base:
(Salary John 58000 < 60000)
and once that is made you perform the joins on the usual RETE way. That way it takes up a lot of space in the fact base, specially because rule can refer to any number and so you have those "calculated" facts as long as the rule is active.
On the other hand you can apply several rules with the first expression and you can keep using the standard matching algorithm to trigger the rules.
Does anyone know of any patterns, references or methods that handle this kind of behavior? The usual LEAPS, TREATS, RETE algorithms only handle (as far as I know) "exact" matching.
By the way, this is C# .NET.