It appears that Soar is being too enthusiastic about rewriting conditions
to get rid of double negations. Consider this test case:
sp {init
(state <s> ^type state)
-->
(<s> ^x <x>)
(<x> ^y v1 ^y v2)}
sp {test
(state <s> ^x <x>)
-{(<x> -^y)}
-->
(write (crlf) |Match|)}
Since the rule "test" as written should match when there does not exist an
x attribute without any children y attributes, I would expect that this
rule should match only once when the agent is executed. However, when the
production is loaded into Soar, it is automatically rewritten as
sp {test
(state <s> ^x <x>)
(<x> ^y <y*1>)
-->
(write (crlf) |Match|)
and ends up matching twice, one for each y attribute on x. So this rewrite
behavior is incorrect.
An easy hack to fix this behavior is to add an extra test to the negated
condition, like this:
sp {test
(state <s> ^x <x>)
-{(<x> -^y -^this-can-never-exist xxxxxx)}
-->
(write (crlf) |Match|)}
Soar will not distribute the outer negation into the inner two. The
behavior of the rule should be exactly the same as long as the
^this-can-never-exist attribute doesn't appear.
Original issue reported on code.google.com by joseph...@gmail.com on 18 Aug 2009 at 9:56
Original issue reported on code.google.com by
joseph...@gmail.com
on 18 Aug 2009 at 9:56