Fuzzy Logic Primer
Fuzzy Logic Primer
This section is not intended to explain fuzzy logic in-depth. What I do explain here is a quick glance at the most important things about fuzzy logic as it pertains to my project. There are books which can describe fuzzy logic better than I ever could. I can't recommend one over another to you, but I suggest going to the library and seeing what you can find on the subject.
Another great resource is of course, the Internet. Wikipedia has a very succinct description of fuzzy logic. It's a good place to start reading. A more complete description can be found here. Or, you may want to read my full project report (PDF), which goes into greater depth than I do here.
Alright, let's get started. Fuzzy logic departs from "traditional" logic in that it does not use "crisp" sets. Let's say that our universe of discourse is all non-zero numbers. Then, we can classify all such numbers in one of two sets: the set of positive or the set of negative numbers. A number must belong to one set or the either. In crisp logic, a number cannot have partial membership in one set and partial membership in another. Either it belongs in that set or it doesn't. Fuzzy logic, however, allows us to have such partial membership. In fuzzy logic, we can define an element x that has partial membership in set A and partial membership in set B. Usually, membership values range from 0.0 to 1.0.
The next thing we need to discuss are linguistic variables. These are the variables which are used in fuzzy logic. Linguistic variables must be defined in terms of membership sets. A linguistic variable can have anywhere from one to an unlimited number of membership sets. Let's illustrate this with an example. Say you have a variable named Wealth or Money Accumulated. We can define three membership sets for this variable: Poor, Wealthy, and Insanely Rich. How many membership sets we have and how they are shaped is completely up to us. Yes, membership sets have shapes. The figure below shows the above linguistic variable.
So in the above diagram, you can see that if we have $67.50, we belong to the Poor membership set by a value of 0.10 and to the Wealthy membership set by a value of 0.35. Notice the shapes of the membership sets are triangular in this case. We are not limited to that shape, we can have trapezoids, sigmoids, and other curves.
A fuzzy logic control system consists of a series of at least one linguistic input variable and one linguistic output variable. The inputs and output are related by a series of linguistic rules. These are simply a number of if-then statements that link the two types of variables. For example, let's say our fuzzy control system will decide if we buy or don't buy a car. Our inputs will be Wealth and Car Condition. Our output will be Decision. Some sample rules could be:
IF Wealth is Insanely Rich and Car Condition is OK, THEN Decision is Buy
Note that our output Decision in this case would probably consist of singleton membership sets, that is, the output would only be fully buy or fully don't buy (essentially re-creating a crisp output). That's part of the beauty of fuzzy logic, you can force certain variable to behave crisply if you need them to.
So once you have a set of rules, how do you get something useful out of the control system? That process is called defuzzification. For a given set of crisp input values, the variables are fuzzified through the membership sets, the set of rules involved is determined, and the output is defuzzified to arrive a crisp value. Defuzzification is a somewhat difficult process to explain in just a few sentences. Essentially, what is determined is exactly how much each of the rules has an influence on the output. We can do this in several ways, two popular techniques are a centroid calculation or a center of area calculation. If this sounds cryptic to you, I strongly suggest you refer to the above sources I mentioned.
That is, in a few paragraphs, how a fuzzy logic control system works. I again apologize if anything is unclear, but I urge you to do further background reading.