GNaive / naive-rete

Python RETE algorithm
MIT License
64 stars 35 forks source link

Variable-binding check not working if they occur inside a single condition #25

Closed Cybernetic1 closed 3 years ago

Cybernetic1 commented 5 years ago

Let's say if we have this condition:

    c1 = Has('A', '$x', '$x')

and the following WMEs:

    WME('A', '0', '2'),
    WME('A', '1', '1').

The condition should be satisfied only by the second WME, but not the first. However, Naive-Rete seems to activate both conditions.

Cybernetic1 commented 5 years ago

According to the Doorenbos 1995 paper, section 2.3:

Strictly speaking, in most versions of Rete, the alpha network performs not only constant tests but also intra-condition variable-binding consistency tests, where one variable occurs more than once in a single condition: eg. (<x> ^self <x>). Such tests are rare in SOAR, so we will not discuss them extensively here.

64kbytes commented 3 years ago

Should be fixed by https://github.com/GNaive/naive-rete/pull/30