## So, What IS Fuzzy Logic?

Suppose you are driving to a theater you have never been to before. You are on the correct street, but are unsure of the exact location of the building. Rolling down your window, you ask a passing pedestrian where it is. The reply that comes is: “Drive a little farther, and you will see it to your left.” From there, finding the theater is almost trivial, as you intuitively follow your notion of what “a little farther” is. Mathematically, however, those words are not so straightforward. What does “a little farther” *mean*? It’s fuzzy!

*Fuzzy *is often referred to as the *gray* between black and white. A famous example is that of eating an apple. You’re hungry, so you pick up an apple to eat. Before you take a bite, the apple is *whole*. Yet, as you eat it, it starts disappearing, until you’re finally left with nothing. At what point did the actual apple cease to exist? The stages between completeness and nothingness are *gray* or fuzzy. Through fuzzy logic, we can come up with what is known as *fuzzy sets* to solve problems.

In school, we learned that all hypothetical objects can be divided into sets – groups of like objects. If a particular object does not lie within a set, then it belongs to the set’s compliment. In real life, however, we cannot classify things so easily. Take a look at the picture of the green shamrocks. They all have different shades of green. Indeed, some of the lighter shades have yellow mixed into them. So what *is* green? In *Fuzzy Set Theory (FST) *we could define a set called *Green*, and each of the different shades would lie to different extents within the set. That is, a *fuzzy set* can be thought of as a bunch of *memberships,* where each different shade has a membership number. Once we define a set, we can compare two or more shades of green. We’d be able to say *this* is greener than *that*, for it lies to a *greater extent* within our defined set, i.e., it has a *higher* membership. I won’t get into technical details just yet.

Now that I’ve explained on a very basic level what fuzzy logic is, let’s look at why it’s useful. Fuzzy logic has its home in the realm of *Artificial Intelligence*, or “the science and engineering of making intelligent machines” according to *John McCarthy *who coined the term in the first place. An intelligent machine is one that bases its actions on its environment. Basically, it perceives what is going on, and makes proper decisions. The decisions are made based on fuzzy IF-THEN rules.

There are myriad applications for fuzzy logic. It’s used to regulate temperatures and/or water levels in air conditioners, washing machines, dishwashers, microwaves and other washing machines. It’s often used in digital image processing, and classification algorithms. A very interesting application is MASSIVE (Multiple Agent Simulation System in Virtual Environment), which is a software package used for generating crowd-related visual effects for film and television. Movies like *Avatar* and *Lord of the Rings* have included MASSIVE to depict large-scale armies enacting random yet orderly movements.

## Slightly more Technical – Only Slightly!

A fuzzy set can be thought of as a *membership function* that lets us know *to what an extent* an object lies in a particular set. Let’s take the hypothetical example I started with – that of finding the theater. Consider a fuzzy set How-Far which defines the farthest possible distance from where you are as 100 meters. Therefore, any object that lies 100 meters away from you will lie *completely* within the set, with the highest possible membership of 1. (As this is a hypothetical example, we shall assume distances beyond 100 meters are not possible.) If the theater was 30 meters away from you, then it would have a membership of .3 within the set. Therefore, without knowing it, the pedestrian actually described an object with the membership of .3 as being “a little farther” away, thereby giving a mathematical meaning to these words!

Without getting into the mathematics of FST, here are a couple of points to keep in mind about fuzzy sets and memberships:

- Memberships lie in the interval [0,1]
- If an object
*does not*lie in the set, it has a membership of 0 - If an object lies
*completely*within the set, it has a membership of 1 - Fuzzy sets can have a number of shapes, such as those shown in the figure.

These are just two examples of the many shapes that a fuzzy set can take. Another common fuzzy set is the Gaussian. In the example given, the attribute value would be the distance from where you are. So, the theater would have an attribute value of 30 meters, with a membership of .3.

## Further Reading

### Basic Understanding for Beginners

*Fuzzy Thinking: The New Science of Fuzzy Logic* by Bart Kosko

*Fuzzy Logic: The Revolutionary Computer Technology That Is Changing Our World* by Daniel Macneil

### For Further Study

*Fuzzy Sets, Fuzzy Logic, and Fuzzy Systems: Selected Papers by Lotfi A Zadeh* edited by George J Klir & Bo Yuan

*Fuzzy Models and Algorithms for Pattern Recognition and Image Processing* by James C. Bezdek, James Keller, Raghu Krisnapuram, and Nikhil R. Pal

### Links

MATLAB & Simulink based books: https://www.mathworks.com/support/books/index_by_categorytitle.html?category=9&sortby=title

Tutorials:

https://www.seattlerobotics.org/Encoder/mar98/fuz/fl_part1.html#INTRODUCTION