Rod Mancisidor reported a problem with FuzzyJess that showed
different behaviour for a pair of rules that if modified slightly gave
incorrect
results. The modifications should have resulted in equivalent rules with
the same output but did not. A temporary fix (shown below) requires a change
to
the Jess Class Node2. Comments Ernest?
The situation in very simple terms is as follows:
(defrule r1
(theTemp ?t&:(fuzzy-match ?t "hot"))
=>
(assert (thePress (new nrc.fuzzy.FuzzyValue ?*pressFvar* "low or
medium")))
)
(defrule r2
(theTemp ?t&:(fuzzy-match ?t "medium"))
=>
(assert (thePress (new nrc.fuzzy.FuzzyValue ?*pressFvar* "high")))
)
with an asserted fact
(theTemp (new nrc.fuzzy.FuzzyValue ?*tempFvar* "very medium")))
Both rules will fire and the output fuzzy fact 'theTemp' will reult in a
fuzzy value
being calcualted that has the global result of the 2 assertions.
By changing the rules slightly to be:
(defrule r1
(hot ?hot)
(theTemp ?t&:(fuzzy-match ?t ?hot))
=>
(assert (thePress (new nrc.fuzzy.FuzzyValue ?*pressFvar* "low or
medium")))
)
(defrule r2
(medium ?medium)
(theTemp ?t&:(fuzzy-match ?t ?medium))
=>
(assert (thePress (new nrc.fuzzy.FuzzyValue ?*pressFvar* "high")))
)
the results should be the same (2 other facts are asserted to provide
hot and medium fuzzy values). But the execution resulted in no global
result and instead led to 2 facts for 'theTemp'.
The problem can be fixed by changing 2 lines in the Node2.java code
of Jess. This is a temporary fix and requires Ernest to verify that this is
in fact the appropriate way to deal with it.
The 2 lines are:
1. line 337 in routine doRunTestsVaryRight changes from:
passAlong(Rete.getFactory().newToken(lt, rt));
to
passAlong(Rete.getFactory().newToken(lt.prepare(), rt));
2. line 404 in routine doRunTestsVaryLeft changes from
Token nt = Rete.getFactory().newToken(lt, rt);
to
Token nt = Rete.getFactory().newToken(lt.prepare(), rt);
---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list (use your own address!) List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------