Reputation: 41
I have a rule that retracts thousands of facts when a certain condition is met. This rule sits in a module that contains two other rules that use "not" statements. My questions are:
Thanks!
Upvotes: 0
Views: 74
Reputation: 711
We've written a lazy algorithm, that avoids re-producing partial matches and activations, until the rule is potentially ready to fire. Being lazy you can use salience to delay when rule is evaluated. http://blog.athico.com/2013/11/rip-rete-time-to-get-phreaky.html
Upvotes: 0
Reputation: 31300
Precise answers aren't possible without knowing the patterns in the rules that use the type of the retracted facts.
Clearly, if Fact
is that type and the rules #2 and #3 contain just
not Fact(...constraints...)
nothing tremendous should happen until the last of those Fact facts (that meets the constraints, if any) is removed from working memory: then an additional node may have to be created, depending on what else is that not CE); this may continue depending on what is after the not CE and result in terminal nodes, i.e., activations.
If a pattern like
Fact(...constraints...)
is in any of these rules, retracting a Fact (that meets these constraints, if any) causes some immediate action on any pending activations and removal of nodes in the network, provided it has been included before.
There is not much you can do to avoid happenings in the Rete network.
That said, the necessity of having to retract thousands of facts is rather scary. How many remain? It might be cheaper to pick out the select few and start over in an entirely new Rete. Or use a design pattern that does not expose all of those thousands at once to the Engine. Or something else.
Upvotes: 1