FAI unit-3
FAI unit-3
The term fuzzy refers to things that are not clear or are vague. In the real world many times we
encounter a situation when we can’t determine whether the state is true or false, their fuzzy logic
provides very valuable flexibility for reasoning. In this way, we can consider the inaccuracies and
uncertainties of any situation.
Fuzzy Logic is a form of many-valued logic in which the truth values of variables may be any real
number between 0 and 1, instead of just the traditional values of true or false. It is used to deal with
imprecise or uncertain information and is a mathematical method for representing vagueness and
uncertainty in decision-making.
Fuzzy Logic is based on the idea that in many cases, the concept of true or false is too restrictive, and
that there are many shades of gray in between. It allows for partial truths, where a statement can be
partially true or false, rather than fully true or false.
Fuzzy Logic is used in a wide range of applications, such as control systems, image processing, natural
language processing, medical diagnosis, and artificial intelligence.
The fundamental concept of Fuzzy Logic is the membership function, which defines the degree of
membership of an input value to a certain set or category. The membership function is a mapping
from an input value to a membership degree between 0 and 1, where 0 represents non-membership
and 1 represents full membership.
Fuzzy Logic is implemented using Fuzzy Rules, which are if-then statements that express the
relationship between input variables and output variables in a fuzzy way. The output of a Fuzzy Logic
system is a fuzzy set, which is a set of membership degrees for each possible output value.
In summary, Fuzzy Logic is a mathematical method for representing vagueness and uncertainty in
decision-making, it allows for partial truths, and it is used in a wide range of applications. It is based
on the concept of membership function and the implementation is done using Fuzzy rules.
In the boolean system truth value, 1.0 represents the absolute truth value and 0.0 represents the
absolute false value. But in the fuzzy system, there is no logic for the absolute truth and absolute
false value. But in fuzzy logic, there is an intermediate value too present which is partially true and
partially false.
ARCHITECTURE
• RULE BASE: It contains the set of rules and the IF-THEN conditions provided by the experts to
govern the decision-making system, on the basis of linguistic information. Recent
developments in fuzzy theory offer several effective methods for the design and tuning of
fuzzy controllers. Most of these developments reduce the number of fuzzy rules.
• FUZZIFICATION: It is used to convert inputs i.e. crisp numbers into fuzzy sets. Crisp inputs are
basically the exact inputs measured by sensors and passed into the control system for
processing, such as temperature, pressure, rpm’s, etc.
• INFERENCE ENGINE: It determines the matching degree of the current fuzzy input with
respect to each rule and decides which rules are to be fired according to the input field.
Next, the fired rules are combined to form the control actions.
• DEFUZZIFICATION: It is used to convert the fuzzy sets obtained by the inference engine into a
crisp value. There are several defuzzification methods available and the best-suited one is
used with a specific expert system to reduce the error.
Membership function
Definition: A graph that defines how each point in the input space is mapped to membership value
between 0 and 1. Input space is often referred to as the universe of discourse or universal set (u),
which contains all the possible elements of concern in each particular application.
• Singleton fuzzifier
• Gaussian fuzzifier
• It can emulate human deductive thinking, that is, the process people use to infer conclusions
from what they know.
• Any uncertainties can be easily dealt with the help of fuzzy logic.
• This system can work with any type of inputs whether it is imprecise, distorted or noisy input
information.
• 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.
• Many researchers proposed different ways to solve a given problem through fuzzy logic
which leads to ambiguity. There is no systematic approach to solve a given problem through
fuzzy logic.
• Proof of its characteristics is difficult or impossible in most cases because every time we do
not get a mathematical description of our approach.
• As fuzzy logic works on precise as well as imprecise data so most of the time accuracy is
compromised.
Application
• It is used in the aerospace field for altitude control of spacecraft and satellites.
• It has been used in the automotive system for speed control, traffic control.
• It is used for decision-making support systems and personal evaluation in the large company
business.
• It has application in the chemical industry for controlling the pH, drying, chemical distillation
process.
• Fuzzy logic is used in Natural language processing and various intensive applications in
Artificial Intelligence.
• Fuzzy logic is extensively used in modern control systems such as expert systems.
• Fuzzy Logic is used with Neural Networks as it mimics how a person would make decisions,
only much faster. It is done by Aggregation of data and changing it into more meaningful
data by forming partial truths as Fuzzy sets.
Difference Between Crisp Set and Fuzzy Set
Crisp Set: Countability and finiteness are identical properties which are the collection objects of crisp
set. ‘X‘ is a crisp set defined as the group of elements present over the universal set i.e. U. In this
case a random element is present that may be a part of X or not that means two ways are possible to
define the set. These are first element would become from set X, or it does not come from X.
Fuzzy Set: The Integration of the elements having a changing degree of membership in the set is
called as fuzzy set. The word “fuzzy” indicates vagueness, On the other hand, we can say that the
replacement among various degrees of the membership implies that the vague and ambiguity of the
fuzzy set. Hence, the measurement of the membership of the elements from the universe in the set
against a function for detecting the uncertainty and ambiguity.
Crisp set defines the value is either 0 Fuzzy set defines the value between 0 and 1
1
or 1. including both 0 and 1.
Full membership means totally Partial membership means true to false, yes
7
true/false, yes/no, 0/1. to no, 0 to 1.
Crisp Set
Fuzzy Set
Conclusion:
The part of distinct set theories are fuzzy set and crisp set, where there are no-finite numbers of
logic are implemented in fuzzy set while only two numbers of logic are implemented in crisp set.
In classical set theory, the union of two sets involves all elements belonging to either set. In fuzzy set
theory, the degree of membership of an element in the union of two fuzzy sets \( A \) and \( B \) is
the maximum of its degree of membership in each set.
#### Formula:
\[
\]
Where:
#### Example:
Let \( A \) and \( B \) be two fuzzy sets of "temperature" with membership functions as follows:
In classical set theory, the intersection of two sets involves elements that belong to both sets. For
fuzzy sets, the degree of membership of an element in the intersection of two fuzzy sets \( A \) and \(
B \) is the minimum of its membership values in each set.
#### Formula:
\[
\]
#### Example:
Using the same fuzzy sets \( A \) and \( B \) from the previous example:
The fuzzy intersection \( A \cap B \) will have membership values:
The complement of a fuzzy set represents the "opposite" of the set. The degree of membership of an
element in the complement of a fuzzy set \( A \) is 1 minus the membership value in the original set.
#### Formula:
\[
\]
#### Example:
- \( \mu_A(20) = 0.2 \)
- \( \mu_A(30) = 0.6 \)
- \( \mu_A(40) = 0.8 \)
#### Formula:
\[
\]
#### Example:
The Cartesian product of two fuzzy sets \( A \) and \( B \) is a fuzzy relation \( R \), where each
element \( (x, y) \) has a membership value that is the minimum of the membership values of \( x \)
in \( A \) and \( y \) in \( B \).
#### Formula:
\[
\]
#### Example:
Let:
These operations allow fuzzy logic to handle uncertainties in a mathematically precise way, making it
useful in fields like control systems, decision making, and artificial intelligence.
Membership Function
We already know that fuzzy logic is not logic that is fuzzy but logic that is used to describe fuzziness.
This fuzziness is best characterized by its membership function. In other words, we can say that
membership function represents the degree of truth in fuzzy logic.
Following are a few important points relating to the membership function −
• Membership functions were first introduced in 1965 by Lofti A. Zadeh in his first research
paper “fuzzy sets”.
• Membership functions characterize fuzziness (i.e., all the information in fuzzy set), whether
the elements in fuzzy sets are discrete or continuous.
Mathematical Notation
We have already studied that a fuzzy set à in the universe of information U can be defined as a set of
ordered pairs and it can be represented mathematically as −
A˜={(y,μA˜(y))|y∈U}A~={(y,μA~(y))|y∈U}
Here μA˜(∙)μA~(∙) = membership function of A˜A~; this assumes values in the range from 0 to 1,
i.e., μA˜(∙)∈[0,1]μA~(∙)∈[0,1]. The membership function μA˜(∙)μA~(∙) maps UU to the membership
spaceMM.
The dot (∙)(∙) in the membership function described above, represents the element in a fuzzy set;
whether it is discrete or continuous.
Core
For any fuzzy set A˜A~, the core of a membership function is that region of universe that is
characterize by full membership in the set. Hence, core consists of all those elements yy of the
universe of information such that,
μA˜(y)=1μA~(y)=1
Support
For any fuzzy set A˜A~, the support of a membership function is the region of universe that is
characterize by a nonzero membership in the set. Hence core consists of all those elements yy of the
universe of information such that,
μA˜(y)>0μA~(y)>0
Boundary
For any fuzzy set A˜A~, the boundary of a membership function is the region of universe that is
characterized by a nonzero but incomplete membership in the set. Hence, core consists of all those
elements yy of the universe of information such that,
1>μA˜(y)>01>μA~(y)>0
Fuzzy rule
Fuzzy rules are used within fuzzy logic systems to infer an output based on input variables. Modus
ponens and modus tollens are the most important rules of inference.[1] A modus ponens rule is in the
form
Premise: x is A
Implication: IF x is A THEN y is B
Consequent: y is B
In crisp logic, the premise x is A can only be true or false. However, in a fuzzy rule, the premise x is
A and the consequent y is B can be true to a degree, instead of entirely true or entirely false.[2] This is
achieved by representing the linguistic variables A and B using fuzzy sets.[2] In a fuzzy rule, modus
ponens is extended to generalised modus ponens:.[2]
Premise: x is A*
Implication: IF x is A THEN y is B
Consequent: y is B*
The key difference is that the premise x is A can be only partially true. As a result, the consequent y is
B is also partially true. Truth is represented as a real number between 0 and 1, where 0 is false and 1
is true.
[edit]
As an example, consider a rule used to control a three-speed fan. A binary IF-THEN statement may be
then
IF temperature >= 30
THEN fan speed is 3
The disadvantage of this rule is that it uses a strict temperature as a threshold, but the user may
want the fan to still function at this speed when temperature = 29.9. A fuzzy IF-THEN statement may
be
IF temperature is hot
[edit]
Rules can connect multiple variables through fuzzy set operations using t-norms and t-conorms.
The degree of truth assigned to temperature is hot and to humidity is high. The result of a t-norm
operation on these two degrees is used as the degree of truth that fan speed is fast.
The result of a t-conorm operation on these two degrees is used as the degree of truth that fan
speed is fast.
The fuzzy set not hot is the complement of hot. The degree of truth assigned to temperature is not
hot is used as the degree of truth that fan speed is slow.
T-conorms are less commonly used as rules can be represented by AND and OR connectors
exclusively.
### **Theory**
1. **Fuzzification**:
- Fuzzification is the process of transforming crisp input values into degrees of membership for
corresponding fuzzy sets. This is done using **membership functions** that represent fuzzy
concepts (e.g., "low", "medium", "high").
- The core of a FIS is a set of **if-then rules**. These rules are in the form of:
\[
\text{If } x_1 \text{ is } A_1 \text{ and } x_2 \text{ is } A_2, \dots, \text{ then } y \text{ is } B
\]
Where \( x_1, x_2, \dots \) are input variables, \( A_1, A_2, \dots \) are fuzzy sets representing
linguistic terms, and \( B \) is the output fuzzy set.
- Each rule is evaluated by applying **fuzzy logic operations** (AND, OR, NOT) to determine the
degree of truth for the premise. The result is a fuzzy set representing the output.
3. **Aggregation**:
- If more than one fuzzy rule is activated, the results from each rule are combined into a single
fuzzy set. This process is called **aggregation**. In aggregation, the outputs from all rules are
combined using operations like maximum or addition.
4. **Defuzzification**:
- Defuzzification is the process of converting the fuzzy output obtained from the aggregation into a
crisp value. Common defuzzification methods include the **centroid method**, **mean of
maximum**, and **maximum membership** method.
1. **Mamdani Fuzzy Inference**: Proposed by Ebrahim Mamdani in 1975. It uses fuzzy sets for both
inputs and outputs and applies fuzzy operations to evaluate rules.
2. **Sugeno Fuzzy Inference**: Named after Takagi-Sugeno-Kang. It uses fuzzy sets for the inputs but
crisp outputs in the form of a linear function.
Suppose we are designing a fuzzy control system for a washing machine to determine the **washing
time** based on two inputs: **dirt level** and **cloth load**.
1. **Inputs**:
2. **Output**:
We define the fuzzy sets for inputs and outputs using membership functions:
- **Dirt Level**:
- Light (0 - 4 kg)
- Moderate (3 - 7 kg)
- Heavy (6 - 10 kg)
- **Washing Time**:
For example, if the dirt level is 40%, it may partially belong to the "Medium" and "High" fuzzy sets
with membership values \( \mu_{\text{Medium}}(40) = 0.8 \) and \( \mu_{\text{High}}(40) = 0.2 \).
1. **Rule 1**: IF Dirt level is Low AND Cloth load is Light THEN Washing time is Short.
2. **Rule 2**: IF Dirt level is Medium AND Cloth load is Moderate THEN Washing time is Medium.
3. **Rule 3**: IF Dirt level is High AND Cloth load is Heavy THEN Washing time is Long.
Now, suppose the **dirt level is 40%** and the **cloth load is 5 kg**. The degrees of membership
are:
The **inference engine** evaluates these rules using fuzzy logic. For example, Rule 2 is activated
with \( \mu_{\text{Medium}}(40) = 0.8 \) and \( \mu_{\text{Moderate}}(5) = 0.7 \). The result of Rule
2 is the minimum of these values: \( 0.7 \). Rule 3 is activated with \( \mu_{\text{High}}(40) = 0.2 \)
and \( \mu_{\text{Heavy}}(5) = 0.3 \), resulting in \( 0.2 \).
To convert the fuzzy output to a crisp value, we apply **defuzzification**. Using the **centroid
method**, we calculate the weighted average of the fuzzy outputs, resulting in a crisp washing time
(e.g., 35 minutes).
### **Conclusion**
In this example, the **fuzzy inference system** determines the washing time based on the fuzzy
input variables (dirt level and cloth load) and applies fuzzy rules to infer the appropriate output
(washing time). This approach mimics human reasoning, handling vague and imprecise information
in a flexible way.
Fuzzy logic has been widely applied in control systems because of its ability to handle
imprecision and uncertainty. Traditional control systems are often based on precise
mathematical models, but fuzzy logic provides a framework for designing controllers using
human-like reasoning, even when system dynamics are not fully known. This makes fuzzy
logic ideal for complex, nonlinear systems where exact models are difficult to obtain.
1. **Rule-based control**: Fuzzy logic control relies on a set of "if-then" rules to define the
control strategy.
2. **Handling imprecision**: Unlike conventional control methods, fuzzy logic can work
with imprecise inputs and model uncertainty effectively.
3. **Linguistic variables**: Inputs and outputs are described using linguistic terms (e.g.,
"low," "medium," "high") rather than precise numerical values.
4. **Nonlinear mapping**: Fuzzy logic controllers (FLCs) can handle nonlinear behavior by
capturing it in fuzzy rules.
---
Fuzzy logic controllers are used in various industrial, consumer, and technological
applications due to their robustness and flexibility.
In air conditioners, fuzzy logic control systems adjust the temperature more efficiently than
traditional controllers. The system takes inputs such as the difference between the desired and
current temperature and adjusts the cooling power based on rules like:
- If the temperature is "slightly high," then the cooling power should be "low."
- If the temperature is "very high," then the cooling power should be "high."
Using fuzzy logic, the controller dynamically adjusts to user preferences and environmental
conditions, providing a more comfortable environment without abrupt changes in
temperature.
#### 2. **Washing Machine Control**
**Example**: Fuzzy logic is widely used in modern washing machines to determine the
washing cycle based on factors like load size, dirt level, and fabric type.
By using fuzzy logic, the machine optimizes energy consumption, water usage, and washing
effectiveness.
In an autonomous vehicle, fuzzy logic is applied to manage complex driving scenarios where
exact inputs cannot always be predicted. For instance, the system can assess the following
inputs:
- Vehicle speed
- Distance from the car ahead
- Road conditions (wet, dry, etc.)
Fuzzy logic enables smooth acceleration, braking, and steering, improving safety and comfort
in driving conditions that involve uncertainty.
#### 4. **Robotics**
**Example**: Fuzzy logic is used in robotic control for path planning, obstacle avoidance,
and handling dynamic environments.
In a robotic vacuum cleaner, for example, fuzzy logic helps the robot decide:
- How to navigate around obstacles (e.g., furniture)
- When to increase or decrease speed based on floor type (e.g., carpet vs. tile)
Fuzzy rules:
- If the obstacle is "very close," then "turn" and "slow down."
- If the battery level is "low," then "return to charging station."
Robots with fuzzy logic can adapt to new environments without requiring a detailed
mathematical model, making them more versatile in unstructured settings.
This application leads to reduced traffic congestion and smoother traffic flow without relying
on precise timing intervals.
In complex industrial processes like controlling the pH level in a chemical reactor, fuzzy
logic controllers handle uncertainties in input variables (temperature, concentration, etc.) to
maintain stability. The fuzzy controller takes inputs such as:
- Current pH level
- Temperature of the mixture
- Concentration of reactants
Fuzzy logic helps improve accuracy and safety in industrial applications by dynamically
adjusting the control actions in real time.
---
- **Inputs**:
- Room temperature (e.g., 28°C)
- Desired temperature (e.g., 24°C)
- **Defuzzification**:
- Based on the rules, the system defuzzifies the fuzzy output, setting the cooling power to
60%.
- **Result**:
- The air conditioner operates at 60% power, cooling the room gradually until the desired
temperature is reached, avoiding sudden changes that could lead to discomfort.
---
### **Conclusion**
Fuzzy logic provides a powerful approach for controlling systems that are complex,
nonlinear, or difficult to model mathematically. Its ability to work with linguistic variables
and handle uncertainty makes it suitable for a wide range of real-world applications, from
household appliances to autonomous vehicles and industrial processes. Through fuzzification,
inference, and defuzzification, fuzzy controllers can deliver robust and flexible control
solutions.
Chapter 5
Defuzzification Methods
Fuzzy rule based systems evaluate linguistic if-then rules using fuzzification, inference and composition
procedures. They produce fuzzy results which usually have to be converted into crisp output. To
transform the fuzzy results in to crisp, defuzzification is performed.
Defuzzification is the process of converting a fuzzified output into a single crisp value with respect to a
fuzzy set. The defuzzified value in FLC (Fuzzy Logic Controller) represents the action to be taken in
controlling the process.
∑ . ∑
∗
= ∑ ∑
,
Here, n is the number of fuzzy sets, N is the number of fuzzy variables, μ is the
membership function for the k-th fuzzy set.
Example
1
©Debasis Samanta, Indian Institute of Technology Kharagpur
∗
The defuzzified value is defined as :
∗ ∑
= ∑
,
Here, represents the firing area of rules and k is the total number of rules fired and
represents the center of area.
The aggregated fuzzy set of two fuzzy sets and is shown in Figure 1. Let the area of this two
fuzzy sets are and .
= ½ * [(8-1) + (7-3)] * 0.5 = ½ * 11 * 0.5 = 55/20=2.75
= ½ * [(9-3) + (8-4)] * 0.3 = ½ * 10 * 0.3 = 3/2 =1.5
Now the center of area of the fuzzy set is let say = (7+3)/2= 5 and
the center of area of the fuzzy set is = (8+4)/2=6.
∗ . . . ∗ . ∗
Now the defuzzified value = = = 22.75/4.25 = 5.35
. .
0.5
µ
0.4
A1
0.3
0.2
A2
0.1
0 1 2 3 4 5 6 7 8 9 x
∗
2
©Debasis Samanta, Indian Institute of Technology Kharagpur
∗
For discrete membership function, the defuzzified value denoted as using COG is defined as:
∗ ∑ .
= ∑
, Here indicates the sample element, μ is
the membership function, and n represents the number of elements in the sample.
∗
For continuous membership function, is defined as :
∗ µ
=
µ
µ 0.5
0.4 2
3
0.3
0.2
0.1 1 4 5
0 1 2 3 4 5 6 7 8 9 x
Example:
∗
The defuzzified value using COG is defined as:
∗ ∑
= ∑
, Here N indicates the number of sub-areas, and
3
©Debasis Samanta, Indian Institute of Technology Kharagpur
Centroid of sub-area1 will be (1+3+3)/3 = 7/3 =2.333
Centroid of sub-area2 will be (7+3)/2 = 10/2 = 5
Centroid of sub-area3 will be (7+7+7.5)/3 = 21.5/3 =7.166
Centroid of sub-area4 will be (7+7.5)/2 =14.5/2=7.25
Centroid of sub-are5 will be (7.5+8)/2 =15.5/2 = 7.75
Centroid of sub-area6 will be (8+8+9)/3 = 25/3 = 8.333
Now we can calculate . and is shown in table 1.
Table 1
Sub‐area number Area( ) Centroid of area( ) .
1 0.5 2.333 1.1665
2 02 5 10
3 .05 7.166 0.3583
4 .15 7.25 1.0875
5 .15 7.75 1.1625
6 .15 8.333 1.2499
∗
∑
The defuzzified value will be
∑
. . . . .
=
. . . . .
= (15.0247)/3 =5.008
∗
5.008
4
©Debasis Samanta, Indian Institute of Technology Kharagpur
∑µ .
∗
= ∑µ
Here ∑ denotes the algebraic summation and x is the element with maximum membership
function.
µ(x)
0.8
0.6
0.4
50 60 70 80 90 100 x
Example:
Let A be a fuzzy set that tells about a student as shown in figure 3 and the elements with
corresponding maximum membership values are also given.
A = {(P, 0.6), (F, 0.4),(G, 0.2),(VG, 0.2), (E, 0)}
Here, the linguistic variable P represents a Pass student, F stands for a Fair student, G
represents a Good student, VG represents a Very Good student and E for an Excellent student.
∗ ∗ . ∗ . ∗ . ∗ . ∗
=
. . . .
= 98/1.4=70
The defuzzified value for the fuzzy set A with weighted average method represents a Fair
student.
Maxima Methods
5
©Debasis Samanta, Indian Institute of Technology Kharagpur
This method considers values with maximum membership. There are different maxima methods
with different conflict resolution strategies for multiple maxima.
o First of Maxima Method (FOM)
o Last of Maxima Method (LOM)
o Mean of Maxima Method (MOM)
µ(x)
1.0
0.8
0.6
0.4
0.2
0 2 4 6 8 10 12 x
In the example given for FOM, the defuzzified value for LOM method will be ∗ = 8
6
©Debasis Samanta, Indian Institute of Technology Kharagpur
∑
∗
= ,
| |
Here, M = { | μ ( ) is equal to the height of the fuzzy set A} and |M| is the cardinality
of the set M.
Example
In the example as shown in Fig. , x = 4, 6, 8 have maximum membership values and hence
|M| = 3
∑
∗
According to MOM method, =
| |
References:
2. Jean J. Saade and Hassan B. Diab. “Defuzzification Methods and New Techniques for Fuzzy
Controllers”, Iranian Journal of Electrical and Computer Engineering, 2004.
3. Aarthi Chandramohan, M. V. C. Rao and M. Senthil Arumugam: “Two new and useful
defuzzification methods based on root mean square value”, Soft Computing, 2006.
7
©Debasis Samanta, Indian Institute of Technology Kharagpur