Fuzzy Logic
Fuzzy Logic
Sets
Introduction to Fuzzy Logic
Introduction to Fuzzy Logic
• The term fuzzy refers to things that are not clear or are vague.
Automatic transmission in cars: Smooth gear shifts based on speed and road
conditions.
Introduction to Fuzzy Logic
• Fuzzy logic, introduced by Lotfi Zadeh in 1965, is a mathematical framework
for dealing with uncertainty and imprecision.
• Fuzzy logic is an extension of classical logic and makes it possible to deal
with imprecise and uncertain data. Superset of Boolean logic that has been extended to
handle the concept of partial truth.
• Unlike traditional binary logic (which operates in strict true (1) or false (0) values), fuzzy logic
deals with degrees of truth, allowing values to range between 0 and 1.
• 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 both inclusive, instead of just the
traditional values of true or false. This is useful in situations where concepts
cannot be strictly categorized but exist on a spectrum. It is used to deal with
imprecise or uncertain information and is a mathematical method for
representing vagueness and uncertainty in decision-making.
Introduction to Fuzzy Logic
• The fuzzy theory provides a mechanism for representing linguistic
constructs such as "high," "low," "medium," "tall," "many."
• In general, fuzzy logic provides an inference structure that enables
appropriate human reasoning capabilities.
• Fuzzy logic is used in modern air conditioners to provide smooth and
efficient temperature control by adjusting cooling intensity
dynamically instead of simply switching between ON and OFF states.
• If the room is slightly warm, the AC lowers the cooling power slightly.
Key Concepts in Fuzzy Logic: Fuzzy Sets
• Fuzzy sets provide a mathematical framework for
mapping the uncertainty of fuzzy logic.
A fuzzy set is a collection of elements where each element has a degree of membership between 0 and 1,
rather than being strictly in or out of the set (as in classical sets). The set theory of classical is the subset of
Fuzzy set theory. Fuzzy logic is based on this theory, which is a generalization of the classical theory of set (i.e.,
crisp set).
Key Concepts in Fuzzy Logic: Fuzzy Sets
Key Concepts in Fuzzy Logic: Fuzzy Sets
A ={(150cm,0),(160cm,0.2),(170cm,0.5),(180cm,0.8),(190cm,1)}
where:
•The first value in each pair represents height (in cm).
•The second value represents the degree of membership (µ_Tall) in the "tall" fuzzy set.
"Tall People": membership
varies between 0 and 1
Some key terms
• Degree of an object belongs to Fuzzy Set is denoted by membership value between 0 to 1.
• 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.
Some key terms
• Linguistic variables and linguistic terms are key concepts in fuzzy logic
that help model vague or imprecise information.
• Linguistic Variables: Linguistic variables are the input or output variables
of the system whose values are words from a natural language, instead
of numerical values. The fuzzy set theory is rooted in linguistic variables.
These are variables described in natural language, such as "high,"
"medium," or "low." They are used in fuzzy logic to facilitate human-like
reasoning and communication.
• A linguistic variable is a fuzzy variable. For example:
The statement “John is tall” implies that the linguistic variable John takes
the linguistic Value tall.
Linguistic Term: A linguistic term (or linguistic value) is a specific word or
phrase that describes a particular state of a linguistic variable.
Height is the linguistic variable. Small, Medium, and Tall are
the linguistic terms representing different categories.
X-axis (Height in meters).
Different height values are mapped to different membership
degrees. Y-axis (Membership Degree μ)
Small (Blue Curve): represents people of short height.
It is simple to compute. Used when data has a single peak and linear transitions are sufficient.
Suppose real-world moderate temperatures are mostly between 15°C and 35°C, with 25°C being the most common
moderate temperature. Set a=15, b=25, and c=35.
•A temperature of 25°C has full membership (1).
•The membership function starts at 0 for x=15.It increases linearly from 15°C to 25°C, reaching 1 at 25°C. Then it
decreases linearly from 25°C to 35°C, reaching 0 at 35°C.
It is defined by four parameters: the start, the start of the flat top, the end of the flat top, and
the end.
A person below 50 has very low membership (close to 0).A person around 60 has partial membership (0.5).
A person above 70 has high membership (close to 1).
Gaussian Membership function: A smooth and bell-shaped function useful for cases where smooth transitions are
needed.
•Example: The average normal body temperature
is 37°C.
•A temperature of 37°C has full membership (1).
•A temperature of 38.5°C or 35.5°C has partial
membership (~0.6).
•A temperature far from 37°C (e.g., 40°C or 34°C)
has very low membership (~0.1 or less).
Crossover Points: The elements where μ(x) = 0.5, indicating a transition from "not tall" to "tall".
Example: If μ(170) = 0.4 and μ(175) = 0.6, then crossover occurs around 170-175cm.
Normality: A fuzzy set is normal if at least one element has a membership value of 1.
Example: Since TALL has μ(185) = 1, μ(190) = 1, μ(195) = 1 it is a normal fuzzy set.
Consider a Fuzzy Set for "Tall People"
Types of fuzzy sets
Cont.
Rule Base is a component used for storing the set of rules and the If-Then conditions
given by the experts are used for controlling the decision-making systems. There are so
many updates that come in the Fuzzy theory recently, which offers effective methods for
designing and tuning of fuzzy controllers. These updates or developments decreases the
number of fuzzy set of rules.
• 2. Fuzzification
• Fuzzification is a module or component for transforming the system inputs, i.e., it
converts the crisp number into fuzzy steps. The crisp numbers are those inputs which
are measured by the sensors and then fuzzification passed them into the control
systems for further processing. This component divides the input signals into following
five states in any Fuzzy Logic system:
• Large Positive (LP)
• Medium Positive (MP)
• Small (S)
• Medium Negative (MN)
• Large negative (LN)
Cont.
• 3. Inference Engine
• This component is a main component in any Fuzzy Logic system (FLS), because all the
information is processed in the Inference Engine. It allows users to find the matching
degree between the current fuzzy input and the rules. After the matching degree, this
system determines which rule is to be added according to the given input field. When
all rules are fired, then they are combined for developing the control actions.
• 4. Defuzzification
• Defuzzification is a module or component, which takes the fuzzy set inputs generated
by the Inference Engine, and then transforms them into a crisp value. It is the last step
in the process of a fuzzy logic system. The crisp value is a type of value which is
acceptable by the user. Various techniques are present to do this, but the user has to
select the best one for reducing the errors.
Cont.
• 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.
• There are largely three types of fuzzifiers:
• Singleton fuzzifier
• Gaussian fuzzifier
• Trapezoidal or triangular fuzzifier
• This function of Membership was introduced in the first papers of fuzzy set
by Zadeh.
• For the Fuzzy set B, the membership function for X is defined as: μB:X → [0,1].
In this function X, each element of set B is mapped to the value between 0 and
1.
• This is called a degree of membership or membership value.
Significance of fuzzy logic in AI
• Handles Uncertainty & Incompleteness
Many real-world AI applications involve incomplete or noisy data. Fuzzy logic helps
make optimal decisions even when exact inputs are not available.
• Mimics Human Reasoning
People naturally think in fuzzy terms (e.g., "warm", "tall", "likely"), and fuzzy logic
helps AI systems interpret qualitative data the way humans do.
• Adaptive & Flexible
Unlike strict rule-based systems, fuzzy logic adapts well to dynamic environments
and can update decisions based on new data.
Improved Control Systems: Fuzzy logic is widely used in control systems (e.g.,
robotics, industrial automation) where crisp logic would be too rigid.
Significance of fuzzy logic in AI
Fuzzy Logic in Autonomous Vehicle Navigation.
A self-driving car needs to adjust its speed based on the distance to the car ahead and the road conditions.
Traditional logic might define strict rules, such as:
IF the distance to the next car is > 50 meters, THEN maintain high speed.
IF the distance is between 20 and 50 meters, THEN maintain moderate speed.
IF the distance is < 20 meters, THEN reduce speed.
This rigid approach fails to handle gradual changes smoothly. Instead, fuzzy logic introduces degrees of distance
and speed control.
Step 1: Define Fuzzy Sets
Instead of sharp boundaries, we define fuzzy sets for distance and speed:
Distance Categories: Near: (0m - 30m) → µ(Near) is high for smaller values.
Medium: (20m - 60m) → µ(Medium) peaks at 40m.
Far: (50m - 100m) → µ(Far) is high for larger values.
Speed Categories:
Slow: (0 - 30 km/h) Moderate: (20 - 60 km/h)Fast: (50 - 120 km/h)
Significance of fuzzy logic in AI
Step 2: Define Fuzzy Rules
Using fuzzy inference, we create a set of rules that adjust speed dynamically:
IF Distance is Near, THEN Speed should be Slow.
IF Distance is Medium, THEN Speed should be Moderate.
IF Distance is Far, THEN Speed should be Fast.
IF Distance is Near AND Traffic Density is High, THEN Speed should be Very Slow.
IF Distance is Medium AND Road is Wet, THEN Speed should be Lower than Moderate.
Step 3: Apply Fuzzy Inference and Defuzzification
Suppose the car detects a distance of 35 meters to the next vehicle.
This value falls between the Medium and Near categories.
The fuzzy inference system (FIS) evaluates multiple rules simultaneously and assigns weightage to "Slow" and
"Moderate" speeds.
Using defuzzification (e.g., centroid method), the system computes an optimal speed, say 42 km/h instead of
jumping between strict categories.
Significance of fuzzy logic in AI
Benefits of Using Fuzzy Logic in Autonomous Vehicles
Smooth Transitions: Avoids sudden changes in speed, making driving
safer.
Adaptability: Works under uncertain conditions (e.g., different road
surfaces, traffic conditions).
Better Human-like Decision Making: Mimics how human drivers adjust
speed in real-time.
Cont.
• Applications of Fuzzy Logic
• Fuzzy logic’s ability to model complex systems with human-like reasoning makes it invaluable in
various fields:
1. Control Systems: Fuzzy logic is widely used in control systems where precise mathematical models
are difficult to obtain. For example, fuzzy logic controls temperature systems by processing inputs
like “too hot,” “warm,” “cool,” and “too cold.”
2. Consumer Electronics: Many household appliances, such as washing machines, utilise fuzzy logic to
optimise performance. A fuzzy logic washing machine can adjust water levels and energy
consumption based on the load’s size and fabric type, ensuring efficient operation.
3. Automotive Systems: Modern cars incorporate fuzzy logic for various functions, including
suspension systems, transmission control, and even determining socio-economic classes for
market analysis.
4. Medical Devices: Fuzzy logic is employed in medical devices for monitoring and diagnostic
purposes, such as taking blood pressure and assessing patient conditions with imprecise data.
• Medical Diagnosis: Used in expert systems to assess symptoms with varying degrees of severity.
• Helps in diagnosing diseases where symptoms overlap.
• Robotics & Decision-Making: Autonomous robots use fuzzy logic to navigate and avoid obstacles.
Cont.