6 releases
0.1.5 | May 11, 2020 |
---|---|
0.1.4 | Apr 21, 2020 |
0.1.2 | Feb 23, 2020 |
#1655 in Algorithms
350KB
7K
SLoC
phreak_engine
The Phreak_engine package contains a rules engine, an optimized fact matching program, using the phreak algorithm.
Fact matching algorithms are used as implementations underneath many vendor products for Complex Event Processing CEP, Decision Engines, Planners and BPM tools.
WORK IN PROGRESS
This is the beginning of a concept, and definitely not stable in any way. It is a study of the phreak algorithm that might be usefull some day.
lib.rs
:
The Phreak algorithm is a Rule matching algorithm, based upon the Rete algorithm, as described in the paper "Production Matching for Large Learning Systems" by Robert B. Doorenbos, January 31, 1995, CMU-CS-95-113
The algorithm is used to match facts against a number of rules to see if any combination triggers the rule. A rule is called a production, and when a combination of facts matches the rule, it is called an activation.
The phreak algorithm is implemented by the Drools project. We are not trying to create a java to rust port, but instead we are building an algorithm from scratch with the ideas from the Drools documentation.
We aim to use only safe rust code.
We are trying to obtain a good performance by focusing on the following concepts:
-
Lazy evaluation
The fastest code is code you don't execute.
-
Cache friendly evaluation
By grouping data evaluation, we try to optimize cache usage for the CPU.
-
Minimize data allocations
Allocations are slow, so they should be avoided. We use the rust ownership model to safely pass around data instead of passing on copies.
Dependencies
~2.5–3.5MB
~69K SLoC