A Quick Tour of the ARulesXL Excel Environment |
Top Installation Introduction Samples Tutorial Reference Release Notes
An ARulesXL rule set is a collection of facts, decision tables, rules, formulas and logical relations that are used to determine the output fact values based on input fact values.
For example,consider these rules used to determine the price of a phone call based on whether the call was made on a weekend or weekday and during the day or night:
The output is the value of the fact rate, and the inputs are the values of the facts weekend and daytime. Here are the rules in an ARulesXL rule set:
The rule set is queried very much like a database using the function RQuery(). In the function window above you can see the query that asks to find the value of rate. It also sets the input facts, weekend and daytime to the values in cells C4 and C5. RQuery() returns the value of rate derived from the rules in the rule set named RateRules.
ARulesXL also supports decision tables. The same application could have been expressed using a decision table:
The choice of which to use really just depends on which seems to fit the specifications more naturally.
In addition to input and output properties, a rule set can have intermediate facts that are used to determine the value of output properties.
Suppose we wanted the inputs to be:
And we wanted the rule set to determine the price of the call. Also, the rate is not fixed, but a multiple of a single base rate. The new specifications are:
The output fact will now be price. The output fact is also called a goal of the rule set.
A combination of decision tables, rules, and fact values are used in the rule set to determine the value of price. Note that decision tables and rules can be used together to determine fact values. Weekend is determined with a simple decision case for the easy days, but rules are used for the exception case of Friday, which can be either a weekend or not depending on the time.
The decision tables, rules, facts and formulas are entered in any order in the rule set, much as data is entered in a database. A rule engine is used to determine the output property value from the inputs. It will dynamically choose the rules and table entries necessary for producing the answer.
The output property becomes a goal of the rule engine. If that property depends on other properties, those properties become sub-goals of the rule engine. Each of those might require further sub-goals until the input properties are reached. Here are the sub-goals used in the example query.
Internally, the rules are stored in an optimized format allowing for fast query execution based on differing inputs. Because the goal tree is dynamically generated, the developer does NOT have to worry about flow of control. The rules are simply written as specified.
This is why it is easy to develop, maintain and audit this type of application using a rule engine like ARulesXL.
Copyright ©2005-7 Amzi! inc. All Rights Reserved.
|