Original Source Here

# Understanding Fuzzy Logic Systems

*Images used in my articles are Properties of the Respective Organisations and are used here solely for Reference, Illustrative and Educational Purposes Only. [Images Source: Google (Aside from some images, in whose case, the source is specifically mentioned below the image)*

This article focuses on understanding —

- Fuzzy Logic
- Fuzzy Logic Systems
- Fuzzy Logic Architecture
- Operations
- Some Practical Examples
- Applications
- Advantages
- Disadvantages

# What is Fuzzy Logic?

Let’s understand Traditional Logic First, then Fuzzy Logic.

Traditional Logic is very Black & White. It’s either there, or it isn’t. It’s either true or false. It’s either A or B.

In Traditional Logic, something can be represented by either having a value of True; which is 1, or False; which is 0.

But in Fuzzy Logic, you can also be anywhere between 0 & 1. So, you can have something true, but only partially True, like 0.7, or False with 0.3. There is no fixed answer as to whether 0.7 is true or false because it’s neither 0 nor 1.

Fuzzy logic is a branch of the mathematical study of ‘multivalued logic’.

Whereas ordinary logic deals with statements of absolute truth (Black & White), fuzzy logic addresses sets with subjective or relative definitions.

This attempts to mimic the way humans analyze problems and make decisions, in a way that relies on vague or imprecise values rather than absolute truth or falsehood.

Fuzzy logic was developed in 1965, by Professor Lotfi A. Zadeh, at the University of California, Berkley. The first application was to perform computer data processing based on natural values.

For Instance —

— Consider a tap, which supports both hot & cold water temperatures.

In Traditional Logic, you represent this by either having hot or cold representing 0 or 1 respectively. Nothing else.

But with Fuzzy Logic, we can have a gradient or a slope from cold to hot, so we could have something like Lukewarm, Very Hot, Freezing, etc., instead of just hot or cold.

Here’s the same example but in a different scenario —

In Boolean, we say a glass of hot water; i.e 1 or high, or a glass of cold water; i.e. 0 or low, but in Fuzzy logic, We may say a glass of warm water which is neither hot nor cold and could represent it as 0.7 or 0.3 for hot and cold respectively.

Another Perspective —

**Boolean Logic:** Yes or No, True or False, Present or Absent, A or B. (0 or 1).

**Fuzzy Logic:** Certainly Yes, Possibly No, Maybe Yes, Can’t Say, Possibly Yes, etc.

Another Example to *drill* the concept into your brain —

In this image, is the sky clear or cloudy?

In Boolean Logic, I can choose between 0 (clear sky) and 1 (cloudy sky).

I could probably say that the sky is clear, but it is not completely true because there is also a couple of clouds present. How do you describe that?

In Fuzzy Logic, 0 and 1 are *only* the extremes of a continuous variable. The variable can also take intermediate values such as 0.7, 0.5, 0.1, etc.

In Fuzzy logic, I can assign to the variable the value of say 0.5 on a scale of two extremes, between 0 (clear sky) and 1 (cloudy sky).

In practice, I say that the sky is clear but also a little cloudy. In doing so, I better represent the real situation.

This is clearer when communicating the information; instead of saying “the sky is clear, but there are some clouds”, which doesn’t share the information fully, you can say “on a scale of 0 to 1, where 0 is no clouds, and 1 is a cloudy sky, the sky is at a 0.5” (refer above image) or something of that sort.

# The Architecture behind Fuzzy Logic

A Fuzzy Logic Architecture looks something like this —

Let’s take a look at the components of this Architecture in brief detail —

**Fuzzification Module- **It transforms the system inputs, which are crisp numbers, into fuzzy sets. It splits the input signal into five steps such as —

**1. Fuzzifier**:

It accepts the measured variables as input and converts the numerical values to linguistic variables.

- It transforms the physical values as well as the error signals to a normalized ‘fuzzy subset’ which consists of an interval for the input values range and membership functions that describe the probability of the state of the input variables.
- The input signal is split into five states — Large Positive, Medium Positive, Small, Medium Negative, and Large Negative.

## 2. **Controller**:

- It consists of the knowledge base as well as the inference engine. The knowledge base stores the membership functions and the fuzzy rules, obtained by knowledge of system operation per the environment.
- The inference engine performs processing of the obtained membership functions and fuzzy rules. In other words, the inference engine assigns outputs based on linguistic information.

## 3. De-fuzzifier:

It performs the reverse process of the Fuzzifier. Or, In other words, it converts the fuzzy values to normal numerical or physical signals and sends them to the physical system to control the system’s operation.

# Fuzzy Logic System Operation

The fuzzy operation involves the use of fuzzy sets and membership functions. Each fuzzy set is a representation of a linguistic variable that defines the possible state of the output.

The membership Function is the function of a generic value in a fuzzy set, such that both the generic value and the fuzzy set belong to a universal set.

The degrees of membership of that generic value in the fuzzy set determine the output, based on the principle of IF-THEN.

The memberships are assigned based on the assumption of outputs with the help of inputs and the rate of change of inputs. A membership function is a graphical representation of the fuzzy set.

Consider this —

A value ‘x’ such that x ∈ X (refer to graph) for an interval [0,1] and a fuzzy set A **⊆** X. The membership function of ‘x’ in subset A is given as fA(x). Note that ‘x’ here denotes the membership value.

Here, the x-axis denotes the universal set, and the y-axis denotes the membership degrees.

It is also important to note that these membership functions can be triangular, singleton, trapezoidal, or Gaussian in shape.

# Practical Example of a Fuzzy System

(Adopted from www.electricaltechnology.org)

Let us design a simple fuzzy control system to control the operation of a washing machine such that the fuzzy system controls the washing process, water intake, wash time, and spin speed.

— The input parameters here are the volume of clothes, degree of dirt, and type of dirt.

While the volume of clothes would determine the water intake, the degree of dirt in turn would be determined by the transparency of water, and the type of dirt is determined by the time at which the watercolor remains unchanged.

**Step 1:**

The first step would involve defining linguistic variables and terms. For the inputs, the linguistic variables are as given below —

**Type of Dirt:**{Greasy, Medium, Not Greasy }**Quality of Dirt**: {Large, Medium, Small}

For output, the linguistic variables are as given below —

**Wash Time:** {Short, Very Short, Long, Medium, Very Long}

**Step 2:**

The second step involves the construction of membership functions.

**Given below are graphs determining Membership Functions for the two inputs are as given below:**

**Membership Functions for Quality of Dirt**

**Membership Functions for Type of Dirt**

**Step 3:**

The third step involves developing a set of rules for the knowledge base. Given below is the set of rules using IF-THEN logic.

- If the quality of the dirt is Small and the Type of dirt is Greasy, THEN Wash Time is Long.
- If the quality of the dirt is Medium and the Type of dirt is Greasy, THEN Wash Time is Long.
- If the quality of the dirt is Large and the Type of dirt is Greasy, THEN Wash Time is Very Long.
- If the quality of the dirt is Small and the Type of dirt is Medium, THEN Wash Time is Medium.
- If the quality of dirt is Medium and the Type of dirt is Medium, THEN Wash Time is Medium.
- If the quality of dirt is Large and the Type of dirt is Medium, THEN Wash Time is Medium.
- If the quality of the dirt is Small and the Type of dirt is Non-Greasy, THEN Wash Time is Very Short.
- If the quality of the dirt is Medium and the Type of dirt is Non-Greasy, THEN Wash Time is Medium.
- If the quality of the dirt is Large and the Type of dirt is Greasy, THEN Wash Time is Very Short.

**Step 4:**

The fuzzifier which initially had converted the sensor inputs to these linguistic variables now applies the above rules to perform the fuzzy set operations (like MIN and MAX) to determine the output fuzzy functions. Based on the output fuzzy sets, the membership function is developed.

## Step 5:

The final step is the de-fuzzification step where the De-fuzzifier uses the output membership functions to determine the output washing time.

# Applications

Various types of AI systems and technologies use fuzzy logic. This includes vehicle intelligence, consumer electronics, medicine, software, chemicals, and aerospace; just to name a few applications.

- In automobiles, fuzzy logic is used for gear selection and is based on factors such as engine load, road conditions, and style of driving.
- In dishwashers, it is used to determine the washing strategy and power needed, which is based on factors such as the number of dishes and the level of food residue on the dishes.
- In copy machines, it is used to adjust drum voltage based on factors such as humidity, picture density, and temperature.
- In aerospace, it is used to manage altitude control for satellites and spacecraft based on environmental factors.
- In medicine, it is used for computer-aided diagnoses, based on factors such as symptoms and medical history.
- Chemical distillation is used to control pH and temperature variables.
- In Natural language processing, it is used to determine semantic relations between concepts represented by words and other linguistic variables.
- In environmental control systems, such as air conditioners and heaters, fuzzy logic determines output based on factors such as current temperature and target temperature.
- In a business rules engine, fuzzy logic may be used to streamline decision-making according to predetermined criteria.

# Advantages of Fuzzy Logic Systems

- A Fuzzy Logic System is flexible and allows modification in the rules.
- Since these systems involve human reasoning and decision-making, they are useful in providing solutions to complex solutions in different types of applications.
- Even imprecise, distorted, and error-input information is also accepted by the system.
- The systems can be easily constructed.

# Disadvantages of Fuzzy Logic Systems

- This system can work with any type of input whether it is imprecise, distorted, or noisy input information.
- The construction of Fuzzy Logic Systems is easy and understandable.
- Fuzzy logic comes with mathematical concepts of set theory and the reasoning of that is quite simple.
- It provides a very efficient solution to complex problems in all fields of life as it resembles human reasoning and decision-making.
- The algorithms can be described with little data, so little memory is required.

# Other Resources

Artificial Intelligence — Fuzzy Logic Systems (tutorialspoint.com)

Fuzzy Logic | Introduction — GeeksforGeeks

What is Fuzzy Logic? — Definition from SearchEnterpriseAI (techtarget.com)

AI/ML

Trending AI/ML Article Identified & Digested via Granola by Ramsey Elbasheer; a Machine-Driven RSS Bot