Fuzzy Inference Systems
Fuzzy Inference Systems
A. Mamdani Inference
Let's delve into Mamdani inference, a cornerstone of fuzzy logic systems. I'll provide an in-depth explanation
with plenty of examples to solidify your understanding.
Mamdani inference is one of the most common and intuitive methods for designing fuzzy inference systems. It's
a rule-based approach that emulates how humans reason and make decisions when dealing with imprecise or
vague information. Essentially, it takes fuzzy inputs, applies fuzzy rules, and produces a fuzzy output. This fuzzy
output then needs to be defuzzified (converted back into a crisp, real-world value) to provide a concrete action
or decision.
Mamdani inference follows a structured process, typically involving these crucial steps:
1. Fuzzification:
o This is the process of transforming crisp (precise) input values into fuzzy sets. Crisp inputs, such
as temperature being 25°C, are converted into linguistic variables (e.g., "Warm," "Hot," or
"Cold") with associated membership degrees (how strongly the input belongs to each fuzzy
set).
o Each crisp input is assigned a degree of membership to one or more fuzzy sets defined for that
input variable. This assignment is done using membership functions (MFs), which are graphical
representations of the degree of membership (ranging from 0 to 1) for each fuzzy set. Common
MFs include triangular, trapezoidal, and Gaussian functions.
o This is the core of the Mamdani inference process. The system uses a set of fuzzy rules to
determine how the fuzzy inputs influence the fuzzy outputs. These rules are in the form of
"IF…THEN…" statements, where both the "IF" part (antecedent) and the "THEN" part
(consequent) involve fuzzy sets.
o Each rule is evaluated based on the membership degrees of the fuzzy inputs in the antecedent
(IF) part. The evaluation determines the degree to which the rule is fired or activated. This
often involves the use of fuzzy operators (AND, OR, NOT) to combine the membership degrees
of the multiple fuzzy sets within a rule's antecedent.
o AND: Usually implemented using the minimum operator (min). Membership(A AND
B) = min(Membership(A), Membership(B))
o The result of rule evaluation is a fuzzy set representing the output's membership function,
which is then 'clipped' (min operator) or 'scaled' (product operator) based on the degree of
rule firing. This clipped or scaled output fuzzy set represents the fuzzy output for that specific
rule.
o Since a fuzzy inference system usually has multiple rules that might be fired simultaneously,
the outputs of individual rules need to be combined (aggregated) to form a single fuzzy output.
o The most common aggregation method is using the maximum (max) operator. For example,
the output fuzzy sets from each rule are combined using max. The overlapping fuzzy sets will
take the highest membership value. The resulting aggregated fuzzy output is then ready for
defuzzification.
4. Defuzzification:
o The final step involves converting the fuzzy output into a crisp (precise) output value. This is
done because in real-world applications, we need a specific action or decision, not a fuzzy set.
o Several defuzzification methods exist, but the most common ones are:
o Centroid (Center of Gravity - COG): This method calculates the centroid (geometric
center) of the area under the aggregated output fuzzy set. This is the most commonly
used defuzzification method. The centroid can be calculated as the point at which the
total area under the curve can be perfectly balanced if a line were drawn through that
point.
o Mean of Maxima (MOM): This method finds all points in the output fuzzy set that
have the highest membership degree and then calculates the average of the x-values
of these points.
o Bisector of Area: This method finds the point on the x-axis that divides the area under
the fuzzy set into two equal areas.
o Largest of Maxima (LOM): This method chooses the largest x-value corresponding to
the maximum membership degree.
o Smallest of Maxima (SOM): This method chooses the smallest x-value corresponding
to the maximum membership degree.
Let's consider a simplified example of a fuzzy logic system to control a washing machine's wash time based on
two inputs:
1. Fuzzification:
o Input 1: Dirtiness
o Low: Triangular MF, peaking at low dirtiness values (e.g., 0-2 on a dirtiness scale).
o Medium: Triangular MF, peaking at medium dirtiness values (e.g., 3-6 on a dirtiness
scale).
o High: Triangular MF, peaking at high dirtiness values (e.g., 7-10 on a dirtiness scale).
o Small: Triangular MF, peaking at small amounts of clothes (e.g., 0-2 kg).
o Medium: Triangular MF, peaking at medium amounts of clothes (e.g., 3-5 kg).
o Large: Triangular MF, peaking at large amounts of clothes (e.g., 6-8 kg).
o Rule 1: IF (Dirtiness IS Low) AND (Amount of Clothes IS Small) THEN (Wash Time IS Short)
o Rule 2: IF (Dirtiness IS Medium) AND (Amount of Clothes IS Medium) THEN (Wash Time IS Medium)
o Rule 3: IF (Dirtiness IS High) AND (Amount of Clothes IS Large) THEN (Wash Time IS Long)
o Rule 1:
o Rule 2:
o Dirtiness IS Medium: Let's assume the membership degree for a dirtiness of 6 in the "Medium"
set is 0.7.
o Amount of Clothes IS Medium: Let's assume the membership degree for 4 kg in the "Medium"
set is 0.8.
o AND: min(0.7, 0.8) = 0.7 (Rule 2 is fired with a strength of 0.7)
o Rule 3:
o Dirtiness IS High: Let's assume the membership degree for a dirtiness of 6 in the "High" set is
0.0.
o Amount of Clothes IS Large: Let's assume the membership degree for 4 kg in the "Large" set is
0.0.
We use the max operator to aggregate the outputs. The fuzzy set corresponding to Rule 2 (Medium) will have its
values kept as it is the only one with a membership value above 0.
4. Defuzzification:
We will use the Centroid (COG) method to determine the final wash time. Imagine the fuzzy sets
for Short, Medium, and Long (after clipping based on rule firing). The area under the Medium set (clipped at 0.7)
is calculated, and its centroid (the point on the x-axis that balances the area) is found. Let's say the centroid
calculation, based on the area under the Medium function, returns a value of 22 minutes. (The exact calculation
depends on the shape of the membership functions and the degree of clipping).
Conclusion:
o Human-Like Reasoning: Allows incorporating expert knowledge and fuzzy linguistic rules.
Disadvantages:
o Computationally Intensive: Especially with a large number of rules and complex membership functions.
o Rule Design Can Be Time-Consuming: Requires defining the fuzzy sets, membership functions, and
rules.
o Sensitivity to Defuzzification Method: The choice of defuzzification method can impact the final
output.
o Rule Weighting: You can assign weights to individual rules to indicate their importance in the decision-
making process.
o Input Scaling and Output Scaling: These methods can be used to map the range of inputs and outputs
for better results.
o Fuzzy Logic Toolbox (in MATLAB): Software like MATLAB provides tools to simplify the design,
implementation, and testing of fuzzy logic systems.
In Summary:
Mamdani inference provides a powerful and flexible approach to fuzzy logic, allowing you to create systems that
can handle uncertainty and make decisions based on imprecise information. By understanding the steps involved,
from fuzzification to defuzzification, and the use of fuzzy operators, you can effectively implement Mamdani
inference in various applications, from simple control systems to more complex decision-making scenarios.
Remember that the specific implementation details, such as the choice of membership functions, rules, and
defuzzification method, depend on the specific application and desired performance. Practice with different
examples and experiment with different parameters to gain a deeper understanding of the technique.
Source: https://i.ytimg.com/vi/moQak7BXsI8/hq720.jpg
B. Sugeno Inference
Sugeno Inference: A Deep Dive into Fuzzy Rule-Based Systems
Sugeno inference, also known as Takagi-Sugeno-Kang (TSK) inference, is a powerful and widely used
method within the realm of fuzzy logic. It represents a departure from the more traditional Mamdani
inference, offering advantages in terms of computational efficiency and the potential for
mathematical analysis. Unlike Mamdani, which uses fuzzy sets in its output, Sugeno utilizes crisp,
mathematical functions within its consequent parts. This fundamental difference significantly
impacts how the system processes information and generates outputs. Let's break down Sugeno
inference step-by-step, exploring its key characteristics and illustrating them with illustrative
examples.
o Fuzzification: Input variables are converted from crisp values into fuzzy sets. This involves
defining membership functions (MFs) that describe the degree to which a particular input
belongs to a specific fuzzy set (e.g., "Low," "Medium," "High"). Common membership
functions used in Sugeno include triangular, trapezoidal, and Gaussian functions.
o Rule Evaluation (Inference): The heart of the system, where fuzzy rules are evaluated to
determine the degree to which each rule is fired. This involves the following steps:
o Rule Antecedent Evaluation: The antecedent (IF part) of each fuzzy rule is evaluated
using fuzzy operators (e.g., AND, OR). The result is a single value that represents the
truth degree of the rule's antecedent.
o Defuzzification: The final step, where the fuzzy output (a set of fuzzy sets for Mamdani) is
converted into a crisp, numerical output value. This is where Sugeno's core difference lies.
Instead of defuzzifying a fuzzy set, Sugeno uses a weighted average or a similar approach
based on the firing strength of each rule.
o Linear Sugeno: The consequent part of each rule is a linear equation of the input variables.
This is the most common type. The output is a weighted average of these linear equations.
o Constant Sugeno: The consequent part of each rule is simply a constant value. This is a
simplified version of the linear Sugeno. The output is the weighted average of these
constants.
o Crisp Outputs: Sugeno rules always output crisp values (either constants or linear functions
of the inputs), not fuzzy sets. This simplifies the defuzzification process significantly.
o Mathematical Analysis: The linear structure of Sugeno systems allows for easier
mathematical analysis and optimization using techniques like linear programming and
adaptive learning. This makes them suitable for control applications where precise control is
crucial.
o Rule Representation: Sugeno rules have a specific structure: IF (input_1 is A1) AND (input_2
is A2) THEN (output = f(input_1, input_2))
Let's illustrate Sugeno inference with a simple example: controlling the speed of a car based on the
accelerator pedal position and the road slope.
a. Inputs:
o Accelerator Pedal Position: A crisp value ranging from 0% (no acceleration) to 100% (full
throttle).
o Road Slope: A crisp value representing the slope of the road, from -10% (downhill) to +10%
(uphill).
o Road Slope:
Here are some sample rules, with each rule having a linear equation in the THEN part:
3. IF (Accelerator is High) AND (Slope is Positive) THEN (Speed = 30 + 1.5 * Accelerator + Slope)
o Accelerator is Low: 0
o Accelerator is Medium: 0
o Accelerator is High: 0.6
o Slope is Negative: 0
o Slope is Zero: 0
2. Rule Evaluation: Now, for each rule, we evaluate the antecedent and get its firing strength:
o Rule 2: (Accelerator is Medium) AND (Slope is Zero). The degree of membership for
both is 0, the firing strength of rule 2 is 0.
o Rule 3: (Accelerator is High) AND (Slope is Positive). The firing strength of rule 3 is
min(0.6, 0.7) = 0.6. (Using the 'min' operator for the AND function. Other operators
like the product could also be used.)
3. Output Calculation: For each rule, we apply its equation using the input values:
4. Defuzzification (Weighted Average): The final step is to aggregate all active rules.
o Weighted Average: Calculate the weighted average of the rule outputs using the
firing strengths:
o Optimized Output: Ensures a smooth and often optimized response from the system.
o No Defuzzification in the Strict Sense: Defuzzification is integrated into the rule evaluation
process, simplifying the system's structure.
o Suitable for Adaptive Systems: Linear structure makes it easier to adjust rule parameters
(e.g., coefficients in the linear equations) through learning algorithms.
o Linearity Assumption: The linear assumption might not be sufficient for all applications, and
can restrict the expressiveness of the fuzzy system compared to Mamdani. Other functions
can be employed in the output, but this makes the system less easy to analyze.
o Limited Interpretation: Direct interpretation of the fuzzy logic system's behavior is harder
compared to Mamdani due to the loss of fuzzy sets in the output.
7. Applications
o Control Systems: Automotive control (e.g., engine control, cruise control), industrial process
control.
8. Conclusion
Sugeno inference is a powerful and versatile approach to fuzzy logic, offering advantages in
computational efficiency and mathematical analysis. Its linear structure makes it particularly well-
suited for control applications and systems that require precise and optimized outputs. By
understanding the core principles, rule structure, and differences from Mamdani, you can effectively
leverage Sugeno inference to design and implement sophisticated fuzzy logic systems for a wide
range of applications. Remember that the specific choice between Sugeno and Mamdani depends on
the requirements of the application, the complexity of the problem, and the need for interpretability
and/or optimization. Consider which best addresses the target performance goals when choosing.
Source: https://researchhubs.com/uploads/Sugeno%20Fuzzy%20model%201.jpg
C. Fuzzy Rule Base
The Fuzzy Rule Base: The Heart of Fuzzy Logic Decision-Making
The fuzzy rule base is arguably the most critical component of a fuzzy logic system. It acts as the
knowledge repository, holding the expert knowledge and control strategies that translate inputs into
desired outputs. Think of it as the "brain" of the fuzzy system, where the reasoning and decision-
making take place. It's a collection of "if-then" rules, where both the "if" (antecedent) and the "then"
(consequent) parts involve fuzzy sets and linguistic variables.
Let's delve deeper into the fuzzy rule base, breaking it down step-by-step:
The core of the fuzzy rule base is composed of fuzzy rules, expressed in a human-readable format,
typically using the "if-then" structure:
o IF (antecedent - conditions about the input variables) THEN (consequent - actions or outputs
based on the antecedent)
This format allows fuzzy logic to capture the intuitive, imprecise reasoning that humans often
employ. It's more natural and flexible than crisp (binary) rules, which would rigidly define conditions.
Instead of using precise numerical values, fuzzy rules utilize linguistic variables. A linguistic variable is
a variable whose values are words or sentences in natural language. Examples include:
o Valve_Opening: Values like "Closed," "Slightly Open," "Moderately Open," "Fully Open."
Each linguistic variable is associated with a set of fuzzy sets. A fuzzy set represents a fuzzy concept or
linguistic term. Instead of a crisp membership (either in or out), fuzzy sets allow for partial
membership. This is the key to handling imprecision.
o For example, the fuzzy set "Hot" for the linguistic variable "Temperature" would define a
membership function. This function assigns a degree of membership (a value between 0 and
1) to each possible temperature value, indicating how well that temperature belongs to the
"Hot" category. A high temperature might have a membership value of 0.9, while a slightly
warm temperature might have a value of 0.3.
o Antecedent (IF part): This part specifies the conditions that must be met for the rule to be
triggered. It consists of one or more fuzzy propositions, connected by logical operators (AND,
OR, NOT). Each proposition involves a fuzzy set (e.g., "Temperature is Hot"). The membership
function of the fuzzy set determines the degree to which the antecedent is satisfied.
o Consequent (THEN part): This part specifies the action to be taken or the output to be
generated when the antecedent is satisfied. It also consists of one or more fuzzy
propositions, also involving fuzzy sets associated with the output linguistic variables (e.g.,
"Valve_Opening is Slightly Open"). The consequent determines how the fuzzy output will be
interpreted and used.
Fuzzy rule bases can contain various types of rules, depending on the application:
o Mamdani Rules: The consequent part also contains a fuzzy set defined by a membership
function. This is the most intuitive and widely used type. (Most of the examples above are
Mamdani Rules)
o Sugeno Rules (or Takagi-Sugeno-Kang Rules): The consequent is a function of the input
variables, usually a linear equation. This is often preferred for control applications because it
can be more computationally efficient and easier to optimize.
When an input is presented to the fuzzy system, the following steps occur:
1. Fuzzification: The crisp input values are converted into fuzzy sets using the membership
functions defined for the input linguistic variables. This involves determining the degree of
membership for each input value in the relevant fuzzy sets. For example, if the temperature
is 35°C, the fuzzification process might determine that it has a membership value of 0.8 in
the "Hot" fuzzy set and 0.2 in the "Warm" fuzzy set.
2. Rule Evaluation (Firing): Each rule in the rule base is evaluated based on the degree of
membership of the inputs in the antecedent fuzzy sets. The logical operators (AND, OR, NOT)
are applied to the degrees of membership in the antecedent to determine the overall firing
strength of the rule. This results in a value between 0 and 1 representing how much the rule
is triggered.
o AND (Minimum Operator): The firing strength is the minimum of the membership
values of the input variables in the antecedent.
o NOT (Complement Operator): The firing strength is 1 minus the membership value.
3. Aggregation (Combining Outputs): If multiple rules are fired (i.e., have a firing strength
greater than 0), their individual outputs (fuzzy sets in Mamdani and Tsukamoto, crisp outputs
in Sugeno) need to be combined to produce a single fuzzy output. The aggregation method
depends on the design of the fuzzy logic system. Common methods include:
o Max (Maximum): The membership functions of the consequent fuzzy sets are
combined by taking the maximum membership value at each point.
o Sum (Summation): The membership functions of the consequent fuzzy sets are
combined by adding their membership values at each point.
o Probor (Probabilistic OR): Calculates the aggregated value using a formula based on
the probabilistic union of the fuzzy sets.
4. Defuzzification (Converting Fuzzy Output to a Crisp Value): This is the final step where the
combined fuzzy output (a fuzzy set) is converted into a crisp (numerical) value. This crisp
output is then used by the system. Common defuzzification methods include:
o Centroid (or Center of Area): Calculates the center of gravity of the area under the
aggregated membership function. This is the most common method.
o Mean of Maxima (MOM): The average of the points where the membership
function reaches its maximum value.
o Bisector of Area (BOA): The value that divides the area under the membership
function into two equal parts.
o Largest of Maxima (LOM) & Smallest of Maxima (SOM) : The largest and smallest
values where the membership function reaches its maximum value.
Creating a good fuzzy rule base requires careful consideration of the following:
o Knowledge Acquisition: Gathering knowledge from experts, existing systems, or data. This
can involve interviewing domain experts, studying the behavior of an existing control system,
or analyzing data to identify patterns.
o Membership Function Design: Defining the shapes and parameters of the membership
functions for each fuzzy set. This involves specifying the ranges and shapes (e.g., triangular,
trapezoidal, Gaussian) that best represent the fuzzy concepts.
o Rule Formulation: Formulating the "if-then" rules that capture the desired behavior of the
system.
o Testing and Tuning: Evaluating the performance of the fuzzy logic system and refining the
rule base through testing and adjustment. This may involve modifying membership
functions, adding or removing rules, or changing the fuzzy operators.
7. Examples
o Example Rules:
o How it works:
2. Fuzzification: 20°C might be "Warm" with membership 0.6 and "Hot" with
membership 0.4.
3. Rule Evaluation: Rule 2 fires with strength 0.6, and Rule 3 fires with strength
0.4.
4. Aggregation: The outputs (fuzzy sets for "Medium" and "Low") are
aggregated using a method such as "Max".
o Example Rules:
o How it works:
3. Rule Evaluation: The firing strength of each rule is calculated based on the
antecedent's membership.
4. Aggregation: The weighted average of the consequents is calculated based
on the firing strengths. For example, if Rule 2's firing strength is 0.5 and Rule
3's is 0.3, the weighted average washing time might be (0.5 * 20) + (0.3 * 30)
= 19 minutes.
o Handles Uncertainty and Imprecision: Provides a natural way to represent and reason with
vague or uncertain information.
o Membership Function Design: Choosing and tuning membership functions can significantly
impact performance and requires expertise.
o Computational Complexity: Can become computationally intensive if the rule base becomes
very large.
o Parameter Tuning: Requires careful tuning of the rule base parameters (membership
functions, fuzzy operators) to achieve optimal performance.
In Conclusion:
The fuzzy rule base is the central core of a fuzzy logic system. It is built on "if-then" rules that
leverage linguistic variables and fuzzy sets to encode expert knowledge, handle uncertainty, and
make decisions. The rule base is not a rigid set of binary statements, but rather a flexible system that
can adapt to different scenarios and nuances of imprecise information. Its design requires a good
understanding of the system being controlled and the art of expressing these relationships in the
fuzzy logic language, making it a powerful tool for a wide range of applications, from control systems
to decision-making processes.