Rules Examples

There are a number of different types of boolean and fuzzy rule examples. The majority of the examples are source ruleset files that can be loaded into the ruleset editor and then from within that development environment, the rulesets can be modified, recompiled, processed, and debugged.

To start the ruleset editor, use the runRsEditor command which is located in the ABLE bin directory. The editor also can be started from within the Able Agent Editor environment by using the Tools/RuleSet Editor... menu item from the menu bar.

Once the ruleset editor is running, make note of the following menu and tool bar items:

These are the editor actions you will use to "play" with the source rulesets.

To load a ruleset into the editor, use one of the editor's Open... menu items. The editor identifies source ruleset files as follows:

File Extension File Type
.rs SOURCE RuleSet Files
.rs_ser SERIALIZED RuleSet Files
.rs_xml XML RuleSet Documents

After initially loading a source ruleset file into the editor or after making any change to a ruleset, always use Verify to recompile the ruleset and make it ready to run. To run the ruleset, use Run. If you wish to graphically view the fuzzy sets defined in a fuzzy ruleset, use View fuzzy sets....

Note that any source rule language file may be saved as an XML document using the ruleset editor actions Save XML and Save XML as....

RuleSet Source Files

The following rulesets can be loaded into the editor and then viewed, changed, and run from there:

*.rs
To be written....
rsBondRating.rs
This nearly pure fuzzy ruleset, when given data for Profit, Capital, Interest, and Debt, will determine a bond rating of A, AA, or AAA. You may change the values used in the assertion rules for Profit, Capital, Interest, and Debt, re-verify and re-run the ruleset to determine new bond ratings.
rsBugs.rs
When given the attributes of an insect, this ruleset attempts to determine the type of bug. Although this ruleset contains no fuzzy variables at all (!), it demonstrates that the fuzzy inference engine can do simple boolean reasoning. It is not recommended you use it for this purpose, however. To use, change the assertions in the ruleset, re-verify, and re-run.
rsHedgeDemo.rs
This ruleset, while a valid ruleset, doesn't have any rules that do anything at all useful. What it does do is show how each hedge can modify the shape (or membership function) of linear and bell-shaped sets. To see this visually, Verify the ruleset and then use View fuzzy sets to display a window of fuzzy set graphs. Note that you can drag the column headers in the display to rearrange the order in which the graphs are displayed. You might want to place the graph for "very" next to the graph for "extremely" to see how they compare.

Do not bother to Run the ruleset.

rsMedical.rs
This ruleset is mixed boolean and fuzzy with only body temperature represented as a fuzzy variable. Given a set of symptoms, the ruleset attempts a diagnosis. To use, change the assertions in the ruleset, re-verify, and re-run.
rsTrout.rs
This ruleset is mixed boolean and fuzzy and tries to determine a type of trout from a set of characteristics. To use, change the assertions in the ruleset, re-verify, and re-run.

RuleSet XML Files

In addition to reading source ruleset files, the ruleset editor can read XML documents. When an XML document is loaded into the ruleset editor (using the Open XML editor action) the XML statements are converted to Able Rule Language (ARL) statements, which are more concise and easier to read. You can change the statements in the edit buffer (remember to Verify your changes) and if you want to save your changes you have the choice of saving the ruleset as an XML document or as a source rule language file.

The following XML documents can be loaded into the editor and then viewed, changed and run from there:

*.rs_xml
To be written....
rsBondRating.rs_xml
This XML document is logically equivalent to the source rule language file of the same name. When loaded into the editor, however, the rule language statements will not appear exactly identical to the source rule language file. This is because the Able Rule Language (ARL) statements are regenerated from the XML and formatting conventions may be different from the original source.

Sample Java Program

Another example, SampleSensorEffector.java, is a simple Java program that makes use of a ruleset by the same name and demonstrates

This program can be run in two ways:

  1. The program is available from within the Able Agent Editor -- it appears on the Samples tab. Click on the SampleSensorEffector icon to create a bean on the editor's canvas, and then select Process from the bean's popup menu. Not much happens visually, but if you watch the command window from which you started the Able Agent Editor you will see a lot of messages fly by. Review the program's source code in conjunction with the ruleset file to determine what happens during processing.


  2. The program can be changed, recompiled, and, as it has a main() method, run from your operating system's command line. When doing this, make sure your classpath is set properly -- the classpath must contain all of the jar files referenced in ABLE's runnit command found in the bin directory.

    If you want to experiment with the program in this way, it is recommended that you copy the Java source file and the ruleset file to your own working directory. In the Java program, change (1) the package name and (2) the path which points to your copied ruleset file, and then compile and run the program. You can use use ABLE's runnit command as an example to make your own runnit for your new Java program.

    Note that this new program will not show up on the Able Agent Editor's tabs. You can make it do so, however, but this is documented elsewhere. Without going into explicit details here, suffice it to say that (1) you will need a manifest file that states the program is a JavaBean, (2) you must package your new Java program in a jar file, and (3) you must add the jar file's name to an entry in the able.preferences file. Furthermore, your new program, like any JavaBean, will need BeanInfo and Customizer files; these are also provided as examples. You can make your customizer as simple or as complex as you wish -- the ruleset editor itself is actually just a JavaBean Customizer used by the Able Agent Editor, but a rather complex one!

Tutorial

Yet another example, Underwriting, is actually part of the ABLE tutorial and should be used in conjunction with that.


Last modified: Tue Jul 3 15:18:43 CDT 2001