# RiverSoftAVG Products Help

 Navigation: Inference Engine Component Suite (IECS) > CLIPS Fuzzy Logic (Non-CLIPS)

One of the most exciting new features of the IECS in version 2 is the addition of fuzzy logic.  Fuzzy Logic is a method for modeling and reasoning about imprecise or approximate concepts.  The following topics describe Fuzzy Logic and Fuzzy Sets in general:

What is Fuzzy Logic?

Fuzzy Set Theory

Fuzzy Inference

Defuzzification

How does fuzzy logic work in the IECS?  Version 2 has extended the CLIPS syntax to accommodate fuzzy logic. Fuzzy Types are defined using a new def construct, similar to deftemplate or defrule, called deftype (see Type Definitions). The deftype construct accepts the name of the type, followed by its base types (in this case FUZZY), and then the definition of the type. To define the Temperature type used above, the user would write:

(deftype Temperature extends (type FUZZY)

(range 0.0000 100.0000)

(units Celcius)

(values

(term hot (s 50.0000 90.0000))

(term warm (pi 50.0000 50.0000))

(term cold (z 10.0000 50.0000))

))

Now, to actually use the Temperature type, we need to define it in a deftemplate slot, using the optional type modifier:

(deftemplate water

(slot temp (type Temperature))

)

After defining the deftemplate, we can create facts normally using the fuzzy sets and hedges (please see Fuzzy Expressions for more details):

(water (temp hot or [very cold and not warm]))

(water (temp not somewhat hot))

Rules can also be written:

(defrule water-hot

(water (temp ?temp&hot) )

=>

(printout t "Water is hot " (moment-defuzzify ?temp)))

The IECS also provides very powerful inferencing capabilities based on Fuzzy Logic. Not only does it calculate the strength of the rule activations, but provides both methods of Fuzzy Correlation: product and minimum. It also supports FIVE different Fuzzy Inference methods: min-max, sum, mean, product, and bounded-sum.

Finally, it provides both defuzzification methods: maximum and center of gravity. To get a scalar value for a fuzzy set, you use either the maximum-defuzzify or moment-defuzzify functions:

(moment-defuzzify (create-fuzzy-value Temperature [warm > 0.6500] or [very [extremely hot]]))

RiverSoftAVG Products Help © 1996-2016 Thomas G. Grubb