Fuzzy Logic and Fuzzy Systems

CS 441/641 Lecture, Zak Williams
"As the complexity of a system increases, our ability to make a precise and significant statement about its behavior diminishes until a threshold is reached beyond which precision and significance become almost mutually exclusive characteristics." -Lotfi Zadeh (considered the "godfather" of fuzzy logic)

Fuzzy Ideas

Regular Logic VS Fuzzy Logic

Regular logic deals with 1s and 0s or true and false: either something is or is not. Fuzzy logic deals with the idea that we do not have a black and white solution to a problem, but rather a lot of gray area in between true and not true.

One way to think of this is to think about the degree to which something is true. One very common example of fuzziness is determining if someone is old. There is not one specific date when you flip to the status of old. It's a gradual process of becoming old. For example if I said someone was 20 years old, this person would be universally considered to be still young. There would be no fuzziness. This person would score 0 (false) on the scale of determining if they are old.

For a different example, lets take someone who is 30 years old. Some people would say that this person is young, even more people would say he is "fairly young," and a few people might say he is old. This person would score somewhere in between 1 and 0, like a 0.3. This is not quite true and not quite false, making it fuzzy. This is the idea of fuzzy logic; that most things are neither true nor false, but rather everything is a matter of degree. One of the things that I have read that really hit home with me is the idea that the more complex a system is the less meaning precise statements have (see the quote at the top of the page).

Simplicity vs Accuracy

Dealing with two values trades accuracy for simplicity. For example, let's say that the cutoff for old is 35 to the day and anything less is considered young. In this case, when someone is 34 we are losing data when we simply rank them false when in fact it should be a matter of degree. A similar situation arises when when we deal with the age of 36. Fuzzy logic is a lot more accurate (40 is kinda old), but a lot harder to implement. We think about fuzzy ideas every day "is the war in Iraq justified?" but transforming fuzziness to computer logic and mathematical logic is complex (maybe not more complex but definitely harder to think about).

Fuzziness vs Probability

It is quite common to mistake fuzziness for probability. In fact, during the history of fuzzy logic, before it was accepted as a valid way of thinking, statisticians said that fuzzy logic was just "probability in disguise" (as said by Bart Kosko in his book Fuzzy Thinking the New Science of Fuzzy Logic). Fuzzy logic is in fact very different from probability. When we are dealing with probability we are dealing with the percent chance of something happening, while fuzzy logic deals with how vague the statement is. For example if we have the statement "the man is tall" and he is given a fuzziness value of 0.4 this is cannot be interpreted as a 40% chance of someone saying the man is tall but rather his tallness value is 0.4.

Fuzzy Math!

Fuzzy Sets

There are two types of sets: crisp sets and fuzzy sets. Crisp sets are the standard sets that we think of. For example , in the set {1,3,5,7} the number 7 is in the set while the number 12 is not. Either something is in the set or it is not. When we deal with a fuzzy set we can deal with something that is kind of in the set, so for the set of tall people someone who is 5ft 8in would be both in the set and out of the set at the same time. For a more mathematical example let's deal with numbers that are 0. The number 1 is definitely not 0 but it is close to 0 in terms of the scope of all of the numbers on the number line, so in this case we can consider 1 to be part of the fuzzy set of 0.

Fuzzy Operations

When we deal with conventional logic we either get a true or false value. What do we get when we and two values that are fuzzy? Well let's just say we have A&B where A is 0.7 and B is 0.4. The first instinct is to average them, but look at our B value. If we are saying A AND B then we certainly cannot have an answer that is larger then the value of one of the things we are anding. So, what we can do is when we and two things together, we take whatever the minimum value is and or the two things together to get the maximum value. Another thing we can do when we and two things together is take the product of the two values: A&B = A*B = 0.28. If we were to take A|B it would look like this: A+B - A*B = 0.82. This guy goes into far more detail then I do on all of the fuzzy math, so if it is something that interests you I would definitely suggest checking it out.

Fuzzy Systems

Fuzzy System Layout

Let's take the fuzzy system example of an air conditioning unit. Here are the two graphs that describe the system where X is the input and Y is the output.

The first graph has 5 states. There is the stop, slow, medium, fast, and blast states, while the second graph deals with temperature. There are 5 rules that come as a result of these graphs. This is called model free estimation, which we do every day (for example when backing out of the driveway we do not have a model, we just have to estimate).

Fuzzy System Rules

One of the coolest things about fuzzy systems is that all of the rules are firing at all times at different degrees! For example if we are at 65 degrees Fahrenheit then Rule 3 would fire at 100% and all of the rest of the rules would fire at 0%. Since you cannot hand your air conditioning unit a fuzzy set you have to defuzzify it. This is the simplest case. Now let's say the temperature increases to 67 degrees Fahrenheit. This input produces 80% "just right" and 15% "warm" and 0% of the other sets (yes, that does not add up to 100%). If we are to shrink both of these by their percentage we would get "fast" shrunk down to 15% of its height and "medium" shrunk down to about 80% of its original height.

Finally, we need to decide what to do with the two triangles that overlap. The book that I am using does not go into very much detail, but I will try to explain it the best I can. If we add the two triangles together we would get one solid curve as shown.

If we were to defuzzify this graph we would end up getting an average of about 58*, which would be the input to our fan speed and would speed up the fan and cool down the room.