Fuzzy System (Fs) Examples

There are a number of different types of fuzzy examples. The majority of them are source fuzzy ruleset files that can be loaded into the fuzzy ruleset editor and then used for experimentation.

Fuzzy Ruleset Source Files

Fuzzy ruleset source files have an extension of .frs. The files are human readable and can be created and changed with any text editor. ABLE provides a special text editor, called the fuzzy ruleset editor, with an integrated parser, that makes it easy to create, test, and debug source fuzzy rulesets. The fuzzy ruleset editor can be started by using the runFuzzyEditor command located in the ABLE bin directory; the editor also can be started from within the Able Agent Editor by using Tools/Fuzzy RuleSet Editor... from the menu bar.

Once the fuzzy 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 fuzzy rulesets.

After initially loading a fuzzy ruleset into the editor or after making any change to a ruleset, always use Verify to compile 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 ruleset, use View fuzzy sets....

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

rsBondRating.frs
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.frs
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.frs
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.frs
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.frs
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.

Fuzzy XML Documents

In addition to reading source fuzzy ruleset files, the fuzzy ruleset editor can read fuzzy XML documents. When an XML document is loaded into the fuzzy ruleset editor (using the Open XML editor action) the XML statements are converted to fuzzy rule language 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 a fuzzy XML document or as a fuzzy source file.

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

rsBondRating.xml
This fuzzy 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 rule language statements are regenerated from the XML and formatting conventions may be different from the original source.

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

Fuzzy Java Program

Another example, SampleSensorEffector.java, is a simple Java program that makes use of a fuzzy 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 fuzzy 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 fuzzy 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 fuzzy 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 fuzzy 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 fuzzy 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: Fri Jun 9 11:05:15 CDT 2000