Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional Algorithms for Rules Evaluation #25

Open
Clayton7510 opened this issue Mar 6, 2017 · 3 comments
Open

Additional Algorithms for Rules Evaluation #25

Clayton7510 opened this issue Mar 6, 2017 · 3 comments
Assignees

Comments

@Clayton7510
Copy link
Collaborator

Rules Engine uses CoR for sequential rules evaluation. It works! And for many situations, it's serves the need. However, for more ambitious applications, it would be nice to have other algorithms for rules evaluation available. The catch is that other algorithms should have a sequential dependency component to provide predictable execution between dependent rules. In addition, rules evaluation algorithms should be pluggable - the library certainly allows for it.

This is not pressing. On the 1. Make it work 2. Make it good 3. Make it fast hierarchy, it's definitely in the 3rd category. And there are other things (like versioning and BDSL) that should take precedence. But this is something that will be needed at some point down the line.

@Clayton7510
Copy link
Collaborator Author

OK, here's the thought...
The focus should be on ease of use and predictable execution over raw performance. If a radical departure in thinking is needed or a different problem focus is required then, hey, there are existing algorithms (like Rete) and tools (like Drools) available that do exactly that.

So, the idea here is not to convert RuleBook to inference engine - it's a rules abstraction that focuses on predictable execution. The solution needs to allow for a [mostly] sequential rule chain execution while making optimizations where it can. However, for the application and the developer, no functional differences should be noticed. I have a few ideas involving parallel & out-of-order execution combined with some caching.

But I'm definitely open to other approaches.

@Clayton7510
Copy link
Collaborator Author

Extending that thought: I think I want to take some of the ideas from Rete and apply them to what looks like sequential execution. That way, performance benefits will be realized, but without turning this thing into an inference engine (different type of rules engine). Like Rete, when rules are completely independent then ordering doesn't matter. But unlike Rete, the order is taken into account when the same data is updated and then used in a sequential pair in the RuleBook. Instead of breaking everything apart and recompiling the dependencies, dependencies are maintained and then broken into independent rule chains when possible - kind of inverting the approach to accommodate (seemingly) sequential rule chains.

@Clayton7510 Clayton7510 modified the milestones: Release 0.6, Release 0.5 Mar 15, 2017
@Clayton7510 Clayton7510 modified the milestones: Release 0.5, Release 0.6 Apr 10, 2017
@Clayton7510 Clayton7510 removed this from the Release 0.6 milestone Apr 27, 2017
@Clayton7510 Clayton7510 self-assigned this Nov 23, 2018
@Clayton7510
Copy link
Collaborator Author

Clayton7510 commented Nov 23, 2018

OK, this on deck next after the 0.11 release (ETA next week). And some changes are necessary. If you are an old-skool user of RuleBook and you are using the Java Builder DSL and adding fact values directly to rules and invoking those rules using rule.invoke() then things are going to change a bit. I think the given() method in the builder is going to have to change to specify the facts declared for use in the rule. This probably won't affect hardly anyone using this since the CoRRuleBook discards any facts directly added to rules (for thread safety). But... this does mean if you've created custom rules, the Rule interface may change.

Why?

Well, I am adding a ReteRuleBook. And Rete-like algos match rules based on the facts each rule needs (or based on the facts used in LHS/condition, but I think I am going to equate declared facts to LHS/condition required facts).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant