Open sc-syf opened 5 years ago
Our implementation is not based on that paper but in this one.
I didn't have time to inspect the code yet, but I think you are right. I transcribed the paper's example and there is more OrdinaryMatchNode instances that it should:
from pyknow import *
class KE(KnowledgeEngine):
@Rule(OR(AND(Fact(1), Fact(2), Fact(3)),
AND(Fact(1), Fact(2), Fact(4), Fact(5)),
AND(Fact(1), Fact(2), Fact(4), Fact(3))))
def test(self):
pass
ke=KE()
ke.matcher.show_network()
I will reread the original paper and the one you pointed out and see if there is any differences we can use to optimize the creation of the beta network.
Thank you!
I checked the source code for creating OrdinaryMatchNode at https://github.com/buguroo/pyknow/blob/develop/pyknow/matchers/rete/utils.py#L167-L186
And compared it to the paper's figure 2.2(a) (matched for C1^C2).
Is it needed for creating a shared OrdinaryMatchNode If two conjunctive normal form has the same facts?
for example,
Rule(OR(AND(Fact(a=1), Fact(b=2), Fact(c=3)), AND(Fact(a=1), Fact(b=2), Fact(c=4))))
It seems that two OrdinaryMatchNode node for(Fact(a=1), Fact(b=2))
will be created. Is it right? or should we need a same OrdinaryMatchNode for(Fact(a=1), Fact(b=2))
?