Soft Computing: Lecture Notes
Soft Computing: Lecture Notes
Soft Computing: Lecture Notes
LECTURE NOTES
In 1996, Lotfi Aliasker Zadeh (LAZ) introduced the term hard computing.
According to LAZ: we term a computing as Hard computing, if
o Precise result is guaranteed.
o Control action is unambiguous.
o Control action is formally defined (i.e., with mathematical model or algorithm).
Examples of hard computing
Many more…
Soft computing
The term soft computing was proposed by the inventor of fuzzy logic, Lotfi A. Zadeh. He
describes it as follows:
Definition: Soft computing is a collection of methodologies that aim to exploit, the tolerance
for imprecision and uncertainty to achieve tractability, robustness, and low solution cost. Its
principal constituents are fuzzy logic, neuro-computing and probabilistic reasoning. The role
model for soft computing is human mind.
Characteristics of Soft Computing
Hybrid computing
Basic concepts of fuzzy algebra and then how to solve problems using Fuzzy logic.
The framework of Genetic algorithm and solving varieties of optimization problems.
How to build an artificial neural network and train it with input data to solve a number
of problems, which are not possible to solve with hard computing.
Crisp Logic
In the world of crisp logic the answer to any question is bi-valued i.e. Yes/No or True/False.
In the example below let us choose any liquid from milk, water, coke, and sprite and ask a
question that “Is the liquid colorless?”. The answer will be very obvious one of the two values
i.e. Yes/No.
Fuzzy Logic
On the contrary in fuzzy logic the answer to any question are multi-valued i.e. May be/May not
be/Absolutely/Partially/etc.. These represent real world scenarios where is quite difficult to
crisp answer like Yes/No.
In the example below let us select a person from the list given and ask “whether the person is
honest?”. The answer to this question can be Extremely honest/Very honest/Honest at
times/Extremely dishonest. A score can be assigned (on the right most side of the figure) to
each of these answers that measures the honesty of that person quantatively. The score
decides the honesty in a person, the more is the score the more honest the person is likely to
be and vice-versa.
World is Fuzzy
In real world nothing can be answered with certainty and no value can as precisely calculated
for a given problem. The reason for this being the uncertainty and vagueness of data that is
available to us. Taking these vague data into consideration we cannot precisely answer any
question with certainty.
Here, All are the sets of finite numbers of individuals. Such a set is called crisp set. The
traditional sets are called as crisp sets. These sets are bounded by a well defined boundary,
either the elements are in the set or outside.
Example of fuzzy set
Let us discuss about fuzzy set.
S = The entire population of the Class of soft computing.
G = All Good Students.
Example:
𝐺 = {(𝐴𝑎𝑟𝑦𝑎, 0.8), (𝑅𝑎𝑔𝑖𝑛𝑖, 0.7), (𝑅𝑎𝑣𝑖𝑠ℎ, 0.1), (𝑆𝑢𝑛𝑖𝑡𝑎, 0.9)}
Crisp Set Fuzzy Set
1. 𝑆 = {𝑠|𝑠 ∈ 𝑋} 1. 𝑆 = {(𝑠, 𝜇(𝑠))|𝑠 ∈
𝑋 𝑎𝑛𝑑 𝜇(𝑠) 𝑖𝑠 𝑡ℎ𝑒 𝑑𝑒𝑔𝑟𝑒𝑒 𝑜𝑓𝑚𝑒𝑚𝑏𝑒𝑟𝑠ℎ𝑖𝑝}
2. It is a collection of elements 2. It is a collection of ordered pairs.
3. Inclusion of an element 𝑠 ∈ 𝑋 into S is 3. Inclusion of an element 𝑠 ∈ 𝑋 in S is fzzy,
crisp, that is, has strict boundary yes or no. that is, if present, then with a degree of
membership.
Note: A crisp set is a fuzzy set, but, a fuzzy set is not necessarily a crisp set.
Example:
𝐻 = {(ℎ , 1), (ℎ , 1), (ℎ , 1), … , (ℎ , 1)} is a non empty set with n elements.
𝑁 = {(𝑛 , 0), (𝑛 , 0), (𝑛 , 0), … , (𝑛 , 0)} is null set with no elements in it.
In case of a crisp set, the elements are with extreme values of degree of membership values
namely 1 or 0. So a crisp set can always be converted to a fuzzy set but the reverse in never
true.
Degree of membership
How to decide the degree of memberships of elements in a fuzzy set?
𝐸𝑋 ∶ 𝑀𝑎𝑟𝑘𝑠 ≥ 90
𝐴 ∶ 80 ≤ 𝑀𝑎𝑟𝑘𝑠 < 90
𝐵 ∶ 70 ≤ 𝑀𝑎𝑟𝑘𝑠 < 80
𝐶 ∶ 60 ≤ 𝑀𝑎𝑟𝑘𝑠 < 70
𝐷 ∶ 70 ≤ 𝑀𝑎𝑟𝑘𝑠 < 60
𝑃 ∶ 35 ≤ 𝑀𝑎𝑟𝑘𝑠 < 50
𝐹 ∶ 𝑀𝑎𝑟𝑘𝑠 < 35
High Temperature
Low Pressure
Color of Apple
Sweetness of Orange
Weight of Mango
Note: Degree of membership values lie in the range[0,1].
Some basic terminologies and notations
Definition of Membership function and fuzzy set
“if X is a universe of discourse and 𝑥 ∈ 𝑋, then a fuzzy set A in X is defined as a set of ordered
pairs, that is 𝐴 = {(𝑥, 𝜇 (𝑥))|𝑥 ∈ 𝑋 } where 𝜇 (𝑥) is called the membership function for the
fuzzy set A”
Note: 𝜇 (𝑥)map each element of X onto a membership grade/ value between 0 and 1 (both
inclusive).
Question: How and who decides 𝜇 (𝑥) for a fuzzy set A in X?
Example:
X = All cities in India
A = City of comfort
𝐴
= {(𝐷𝑒𝑙ℎ𝑖, 0.7), (𝐵𝑎𝑛𝑔𝑎𝑙𝑜𝑟𝑒, 0.9), (𝐶ℎ𝑒𝑛𝑛𝑎𝑖, 0.8), (𝐻𝑦𝑑𝑒𝑟𝑎𝑏𝑎𝑑, 0.6), (𝐾𝑜𝑙𝑘𝑎𝑡𝑎, 0.3), (𝐾ℎ𝑎𝑟𝑎𝑔𝑝𝑢𝑟, 0.0)}
Membership function with discrete membership values
Either elements or their membership values or both also may be discrete values
Support : The support of a fuzzy set A is the set of all points 𝑥 ∈ 𝑋 such that 𝜇 (𝑥) > 0.
Core: The core of a fuzzy set A is the set of all points x in X such that 𝜇 (𝑋) = 1
Normality: A fuzzy set A is a normal if its core is non-empty. In other words, we can always find
a point 𝑥 ∈ 𝑋 such that 𝜇 (𝑋) = 1
Crossover point : A crossover point of a fuzzy set A is a point 𝑥 ∈ 𝑋 at which 𝜇 (𝑋) = 0.5. That
is Crossover (A) = {𝑥|𝜇 (𝑥) = 0.5}.
Fuzzy Singleton: A fuzzy set whose support is a single point in X with 𝜇 (𝑥) = 1 is called a fuzzy
singleton. That is |𝐴| = {𝑥|𝜇 (𝑥) = 1}
Example: India will win the T20 tournament with a chance 60% means that our of 100 matches,
India own 60 matches.
Prediction Vs. Forecasting
The fuzzy vs. probability is analogical to prediction vs. forecasting
Prediction: When you start guessing about things
Forecasting: When you take the information from the past job and apply it to new job.
The main difference:
Prediction is based on the best guess from experiences.
Forecasting is based on data you have actually recorded and packed from previous job.
Fuzzy membership functions
A fuzzy set is completely characterized by its membership function (sometimes abbreviated as
MF and denoted by 𝜇). So, it would be important to learn how a membership function can be
expressed (mathematically or otherwise).
Note: A membership function can be on
a. A discrete universe of discourse and
b. A continuous universe of discourse.
Trapezoidal MF: It is specified by four parameters {a,b,c,d} and can be defined as follows:
0 𝑖𝑓 𝑥 ≤ 𝑎
⎧𝑥 − 𝑎 ⎫
⎪ 𝑖𝑓 𝑎 ≤ 𝑥 ≤ 𝑏⎪
⎪𝑏 − 𝑎 ⎪
𝑡𝑟𝑎𝑝𝑒𝑧𝑜𝑖𝑑(𝑥; 𝑎, 𝑏, 𝑐, 𝑑) = 1 𝑖𝑓 𝑏 ≤ 𝑥 ≤ 𝑐
⎨𝑑 − 𝑥 ⎬
⎪ 𝑖𝑓 𝑐 ≤ 𝑥 ≤ 𝑑 ⎪
⎪𝑑 − 𝑐 ⎪
⎩ 0 𝑖𝑓 𝑑 ≤ 𝑥 ⎭
Gaussian MF: It is specified by two parameters {𝑐, 𝜎} and can be defined as below:
( )
𝑔𝑎𝑢𝑠𝑠𝑖𝑎𝑛 (𝑥; 𝑐, 𝜎) = 𝑒
Generalized Bell: It is also called Cauchy MF. It is a generalized bell MF is specified by three
parameters {a,b,c} and is defined as:
1
𝑏𝑒𝑙𝑙(𝑥; 𝑎, 𝑏, 𝑐) =
𝑥−𝑐
1+
𝑎
Sigmoidal MFs:
Parameter: {a,c}; where c = crossover point and a = slope at c;
1
𝑆𝑖𝑔𝑚𝑜𝑖𝑑(𝑥; 𝑎, 𝑐) =
1+𝑒
Grading System
A fuzzy implementation will look like the following.
𝐸𝑥𝑐𝑒𝑙𝑙𝑒𝑛𝑡 ∶ 𝑀𝑎𝑟𝑘𝑠 ≥ 90
𝑉𝑒𝑟𝑦 𝐺𝑜𝑜𝑑 ∶ 75 ≤ 𝑀𝑎𝑟𝑘𝑠 < 90
𝐺𝑜𝑜𝑑 ∶ 60 ≤ 𝑀𝑎𝑟𝑘𝑠 < 75
𝐴𝑣𝑒𝑟𝑎𝑔𝑒 ∶ 50 ≤ 𝑀𝑎𝑟𝑘𝑠 < 60
𝑃𝑜𝑜𝑟 ∶ 35 ≤ 𝑀𝑎𝑟𝑘𝑠 < 50
𝐵𝑎𝑑 ∶ 𝑀𝑎𝑟𝑘𝑠 < 35
You can decide a standard fuzzy MF for each of the fuzzy grade.
Generation of MFs
Given a membership function of a fuzzy set representing a linguistic hedge, we can derive many
more MFs representing several other linguistic hedges using the concept of Concentration and
Dilation.
Or 𝜇 (𝑥) = 𝐴 .
= (𝜇 (𝑥)) .
Example:
𝐴(𝑥) = {(𝑥 , 0.2), (𝑥 , 0.3), (𝑥 , 0.5), (𝑥 , 0.6)}
𝐵(𝑦) = {(𝑦 , 0.8), (𝑦 , 0.6), (𝑦 , 0.3)}
𝑦 𝑦 𝑦
𝑥 0.2 0.2 0.2
(A x B): 𝜇 (𝑥, 𝑦) = min 𝜇 (𝑥), 𝜇 (𝑦) = 𝑥 0.3 0.3 0.3
𝑥 0.5 0.5 0.3
𝑥 0.6 0.6 0.3
𝐴∪𝐵 =𝐵∪𝐴
𝐴∩𝐵 =𝐵∩𝐴
Associative:
(𝐴 ∪ 𝐵) ∪ 𝐶 = 𝐴 ∪ (𝐵 ∪ 𝐶)
(𝐴 ∩ 𝐵) ∩ 𝐶 = 𝐴 ∩ (𝐵 ∩ 𝐶)
Distributive:
𝐴 ∪ (𝐵 ∩ 𝐶) = (𝐴 ∪ 𝐵) ∩ (𝐴 ∪ 𝐶)
𝐴 ∩ (𝐵 ∪ 𝐶) = (𝐴 ∩ 𝐵) ∪ (𝐴 ∩ 𝐶)
Idempotence:
𝐴∪𝐴 =𝐴
𝐴∩𝐴 =𝐴
𝐴∪∅=𝐴
𝐴∩∅=∅
Transitivity:
If 𝐴 ⊆ 𝐵; 𝐵 ⊆ 𝐶 then A ⊆ C
Involution:
(𝐴 ) = 𝐴
De Morgan’s Law:
(𝐴 ∪ 𝐵) = 𝐴 ∩ 𝐵
(𝐴 ∩ 𝐵) = 𝐴 ∪ 𝐵
Example of Fuzzy Set Operations
Let A and B are two fuzzy sets defined over a universe of discourse X with membership function
𝜇 (𝑥) and 𝜇 (𝑥) respectively. Two MFs 𝜇 (𝑥) and 𝜇 (𝑥) are shown graphically.
The Plots of union 𝐴 ∪ 𝐵 and intersection 𝐴 ∩ 𝐵 are shown in the figure below.
Example : Complementation
The plots of complement 𝜋 (𝑥) of the fuzzy set A is shown in the figure below.
1. 𝐴 , 𝐵
𝑥 1
𝐴 = 1 − 𝜇 (𝑥) = 1 − =
1+𝑥 1+𝑥
1 (2 − 1)
𝐵 = 1 − μ (x) = 1 − 2 = 1− =
2 2
2. 𝐴 ∪ 𝐵
3. 𝐴 ∩ 𝐵
4. (𝐴 ∪ 𝐵)
1 1
0.9 0.9
0.8 0.8
0.7 0.7
0.6 0.6
0.5 0.5
0.4 0.4
0.3 0.3
0.2 0.2
0.1 0.1
0 0
0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10
1 1
0.9 0.9
0.8 0.8
0.7 0.7
0.6 0.6
0.5 0.5
0.4 0.4
0.3 0.3
0.2 0.2
0.1 0.1
0 0
0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10
1 0.5
0.95 0.45
0.9 0.4
0.85 0.35
0.8 0.3
0.75 0.25
0.7 0.2
0.65 0.15
0.6 0.1
0.55 0.05
0.5 0
0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10
0.5 1
0.45 0.95
0.4 0.9
0.35 0.85
0.3 0.8
0.25 0.75
0.2 0.7
0.15 0.65
0.6
0.1
0.55
0.05
0.5
0 0 1 2 3 4 5 6 7 8 9 10
0 1 2 3 4 5 6 7 8 9 10
Fuzzy Relations
Crisp Relations
Operation on crisp relations
Example on crisp relations
Fuzzy relations
Operations on Fuzzy relations
Examples on fuzzy relations
Crisp relations
Order pair:
Suppose, A and B are two crisp sets. Then Cartesian product denoted as A x B is a
collection of order pairs, such that
𝐴 x 𝐵 = {(𝑎, 𝑏)|𝑎 ∈ 𝐴 𝑎𝑛𝑑 𝑏 ∈ 𝐵}
Nore:
1. 𝐴 𝑥 𝐵 ≠ 𝐵 𝑥 𝐴
2. |𝐴 𝑥 𝐵| = |𝐴|𝑥 |𝐵|
3. 𝐴 𝑥 𝐵 provides a mapping from 𝑎 ∈ 𝐴 𝑡𝑜 𝑏 ∈ 𝐵
A particular mapping so mentioned is called a relation.
Example:
Consider the two crisp set A and B as given below. A={1,2,3,4} and B={3,5,7}
Then A x B ={(1,3), (1,5), (1,7), (2,3), (2,5), (2,7), (3,3), (3,5), (3,7), (4,3), (4,5), (4,7)}
Let us define a relation as 𝑅 = {(𝑎, 𝑏)|𝑏 = 𝑎 + 1, (𝑎, 𝑏) ∈ 𝐴 𝑥 𝐵}
Then R={(2,3),(4,5)} in this case.
We can represent the relation R in a matrix form as follows.
1 0 0 0
𝑅=2 1 0 0
3 0 0 0
4 0 1 0
Operations on crisp relations
Suppose, R(x,y) and S(x,y) are the two relations defined over two crisp set 𝑥 ∈ 𝐴 𝑎𝑛𝑑 𝑦 ∈ 𝐵
𝑏 𝑏
𝑎 0.2 0.2
𝑅 =𝐴𝑥𝐵=
𝑎 0.5 0.6
𝑎 0.4 0.4
Suppose, R(x,y) and S(x,y) are the two fuzzy relations defined over A x B.
Example: 𝑋 = {𝑥 , 𝑥 , 𝑥 }, 𝑌 = {𝑦 , 𝑦 } 𝑎𝑛𝑑 𝑍 = {𝑧 , 𝑧 , 𝑧 }
𝑦 𝑦
𝑧 𝑧 𝑧
𝑥 0.5 0.1
𝑅= 𝑎𝑛𝑑 𝑆 = 𝑦 0.6 0.4 0.7
𝑥 0.2 0.9
𝑦 0.5 0.8 0.9
𝑥 0.8 0.6
𝑧 𝑧 𝑧
𝑥 0.5 0.4 0.5
𝑅∘𝑆=
𝑥 0.5 0.8 0.9
𝑥 0.6 0.6 0.7
Example:
Consider the following two sets P and D, which represent a set of paddy plants and a set of
plants diseases. More precisely
𝑃 = {𝑃 , 𝑃 , 𝑃 , 𝑃 } a set of four varieties of paddy plants
𝐷 = {𝐷 , 𝐷 , 𝐷 , 𝐷 } a set of the four various diseases affecting the plants.
In addition to these, also consider another set 𝑆 = {𝑆 , 𝑆 , 𝑆 , 𝑆 } be the common symptoms of
the diseases.
Let, R be a relation on P x D, representing which plant is susceptible to which diseases which is
stated as
𝐷 𝐷 𝐷 𝐷
𝑃 0.6 0.6 0.9 0.8
𝑅=𝑃 0.1 0.2 0.9 0.8
𝑃 0.9 0.3 0.4 0.8
𝑃 0.9 0.8 0.4 0.2
Also, consider T to be the another relation on D x S, which is given by
𝑆 𝑆 𝑆 𝑆
𝐷 0.1 0.2 0.7 0.9
𝑇=𝐷 1.0 1.0 1.0 0.6
𝐷 0.0 0.0 0.5 0.9
𝐷 0.9 1.0 0.8 0.2
Obtain the association of plants with the different symptoms of the disease using max-min
composition.
𝑆 𝑆 𝑆 𝑆
𝑃 0.8 0.8 0.8 0.9
𝑅∘𝑇 =𝑃 0.8 0.8 0.8 0.9
𝑃 0.8 0.8 0.8 0.9
𝑃 0.8 0.8 0.7 0.9
Example:
𝑎 𝑏
𝛼 𝛽 𝛾 𝛿
0.1 0.3 0.5 0.7 𝛼 0.9 0.1
𝑅= 1 𝑎𝑛𝑑 𝑆 = 𝛽 0.2 0.3
2 0.4 0.2 0.8 0.9
𝛾 0.5 0.6
3 0.6 0.8 0.3 0.2
𝛿 0.7 0.2
Find 𝑅 ∘ 𝑆
Fuzzy Proposition:
The basic assumption upon which crisp logic is based- that every proposition is either
TRUE or FLASE
The classical two-valued logic can be extended to multi-valued logic,
As an example, three valued logic to denote true(1), false(0) and indeterminacy (1/2).
Different operations with three-valued logic can be extended as shown in the truth table:
𝒂 𝒃 ⋀ ⋁ ~𝒂 =
0 0 0 0 0 1 1
0 ½ 0 ½ 0 1 ½
0 1 0 1 0 1 0
½ 0 0 ½ ½ ½ ½
½ ½ ½ ½ ½ ½ 1
½ 1 ½ 1 ½ 1 ½
1 0 0 1 1 0 0
1 ½ ½ 1 1 ½ ½
1 1 1 1 1 1 1
Fuzzy connective used in the above table are:
AND (⋀)
OR (⋁)
NOT (~)
IMPLICATION (=> )
EQUAL (=)
Fuzzy connectives defined for such a three-valued logic better can be stated as follows:
The fundamental difference between crisp (classical) proposition and fuzzy propositions
is in the range of the truth values.
While each classical proposition is required to be either true of false, the truth or galsity
of fuzzy proposition is a matter of degree.
The degree of truth of each fuzzy proposition is expressed by a value in the interval [0.1]
both inclusive.
Canonical representation of fuzzy proposition
For a given value v of variable V in proposition P, T(P) denotes the degree of truth proposition
P.
Fuzzy Implications
Fuzzy Rule
Examples of fuzzy implications
Interpretation of fuzzy rules
Product operators
Zadeh’s Max-Min rule and some example
Fuzzy Rule
A fuzzy implication (also known as fuzzy if-then rule, fuzzy rule or fuzzy conditional
statement) assumes the form:
o 𝒊𝒇 𝑥 𝑖𝑠 𝐴 𝒕𝒉𝒆𝒏 𝑦 𝑖𝑠 𝐵 where, A and B are linguistic variables defined by fuzzy
sets A and B on the universe of discourses X and Y, respectively.
Often, x is A is called the antecedent or premise, while y is B is called the consequence
or conclusion.
Fuzzy Implication : Example 1
A coupled with B
A entails B
Interpretation as A coupled with B
𝜇 (𝑥, 𝑦) = 𝑓 𝜇 (𝑥), 𝜇 (𝑦) = 𝑓(𝑎, 𝑏) 𝑤𝑖𝑡ℎ 𝑎 = 𝜇 (𝑥), 𝑏 = 𝜇 (𝑦) and f is the fuzzy
implication function.
In the following, few implications of 𝑅 ∶ 𝐴 → 𝐵
Min operator:
Interpretation of A entails B
There are three main ways to interpret such implication:
Material Implication:
o 𝑅∶𝐴→𝐵=𝐴 ∪ 𝐵
Propositional Calculus:
o 𝑅 ∶ 𝐴 → 𝐵 = 𝐴 ∪ (𝐴 ∪ 𝐵)
Extended propositional calculus:
o 𝑅 ∶ 𝐴 → 𝐵 = (𝐴 ∩ 𝐵 ) ∪ 𝐵
Product Operators:
With the above mentioned implications, there are a number of fuzzy implication functions that
are popularly followed in fuzzy rule-based system.
𝑅 = (𝐴 𝑥 𝐵) ∪ (𝐴 𝑥 𝑌)
Here, Y is the universe of discourse with membership values for 𝑦 ∈ 𝑌 is 1, that is , 𝜋 (𝑦) =
1∀𝑦 ∈ 𝑌;
Suppose: 𝑋 = {𝑎, 𝑏, 𝑐, 𝑑}𝑎𝑛𝑑 𝑌 = {1,2,3,4}𝑎𝑛𝑑 𝐴 = {(𝑎, 0.0, ), (𝑏, 0.8), (𝑐, 0.6), (𝑑, 1.0)},
𝐵 = {(1,0.2, ), (2,1.0), (3,0.8), (4,0.0)} are two fuzzy sets.
We are to determine 𝑅 = (𝐴 𝑥 𝐵) ∪ (𝐴 𝑥 𝑌)
1 2 3 4
𝑎 1 1 1 1
𝑅 = (𝐴 𝑥 𝐵) ∪ (𝐴 𝑥 𝑌) = 𝑏 0.2 0.8 0.8 0.2
𝑐 0.4 0.6 0.6 0.4
𝑑 0.2 1.0 0.8 0
Example 4:
Fuzzy Inferences
Let’s start with propositional logic. We know the following in propositional logic.
30 40 50
𝑄𝑆 = 𝑉𝐻 ⋄ 𝑅 = [0.6 0.9 1.0] ⋄ 70 0.8 1.0 0.6
80 0.8 1.0 0.6
90 0.7 0.7 0.7
𝑄𝑆 = [0.8 0.9 0.7]
What is defuzzification?
𝑅1. 𝑖𝑓 𝑥 𝑖𝑠 𝐴 𝑡ℎ𝑒𝑛 𝑦 𝑖𝑠 𝐶
𝑅. 𝑖𝑓 𝑥 𝑖𝑠 𝐵 𝑡ℎ𝑒𝑛 𝑦 𝑖𝑠 𝐷
A pictorial representation of the above rule vase is shown in the following figure.
What is the crisp value that can be inferred from the above rules given an input say x’?
Why Defuzzification?
The fuzzy results generated can note be used in an application, where decision has to be taken
only in crisp values. For the A/C system we have.
Example. 𝑖𝑓 𝑡𝑒𝑚𝑝𝑒𝑟𝑎𝑡𝑢𝑟𝑒 𝑖𝑠 𝑇 𝑇ℎ𝑒𝑛 𝑟𝑜𝑡𝑎𝑡𝑖𝑜𝑛 𝑖𝑠 𝑅 .
Here, may be input 𝑇 is fuzzy, but action rotation should be based on the crisp value of 𝑅 .
Defuzzification Techniques
Defuzzification methods
Lambda-cut method
Maxima method
Centroid method
Weighted average method
Lambda-cut method
In this method a fuzzy set A is transformed into a crisp set 𝐴 for a given value of 𝜆(0 ≤ 𝜆 ≤ 1)
In other-words, 𝐴 = {𝑥|𝜇 (𝑥) ≥ 𝜆}
That is, the value of Lambda-cut set 𝐴 is x, when the membership value corresponding to x is
greater than or equal to the specified 𝜆.
This Lambda-cut set 𝐴 is also called alpha-cut set.
𝜆 = 0.6
𝐴 . = {(𝑥 , 1), (𝑥 , 0), (𝑥 , 0), (𝑥 , 0)} = {𝑥 }
𝐴 = {(𝑥 , 0.1), (𝑥 , 0.5), (𝑥 , 0.8), (𝑥 , 0.7)}
𝜆 = 0.2
𝐴 . = {(𝑥 , 0), (𝑥 , 1), (𝑥 , 1), (𝑥 , 1)} = {𝑥 , 𝑥 , 𝑥 }
Lambda-cut sets: Example
𝜇(𝑥) 𝑥 𝑥 𝑥 𝑥 𝑥
P 0.1 0.2 0.7 0.5 0.4
Q 0.9 0.6 0.3 0.2 0.8
𝑃 . ,𝑄 .
(𝑃 ∪ 𝑄) .
(𝑃 ∪ 𝑃) .
(𝑃 ∩ 𝑄) .
The Lambda-cut method for a fuzzy set can also be extended to fuzzy relation also.
If A and B are two fuzzy sets, defined with the same universe of discourse, then
(𝐴 ∪ 𝐵) = 𝐴 ∪ 𝐵
(𝐴 ∩ 𝐵) = 𝐴 ∩ 𝐵
(𝐴 ) ≠ 𝐴 except for values of 𝜆 = 0.5
For any 𝜆 ≤ 𝛼, where 𝛼 varies between 0 and 1, it is true that 𝐴 ≤ 𝐴 , where the values of
𝐴 is the universe of discourse.
if R and S are two fuzzy relation, defined with the same fuzzy sets over the same universe of discourses,
then
(𝑅 ∪ 𝑆) = 𝑅 ∪ 𝑆
(𝑅 ∩ 𝑆) = 𝑅 ∩ 𝑆
(𝑅 ) ≠ 𝑅
For any 𝜆 ≤ 𝛼, where 𝛼 varies between 0 and 1, it is true that 𝑅 ≤𝑅
Lambda-cut method converts a fuzzy set (or a fuzzy relation) into crisp set (or relation).
The output of a fuzzy system can ve a single fuzzy set or union of two or more fuzzy sets. To understand
the second concept, let us consider a fuzzy system with n-rules.
𝑅 : 𝑖𝑓 𝑥 𝑖𝑠 𝐴 𝑡ℎ𝑒𝑛 𝑦 𝑖𝑠 𝐵
𝑅 : 𝑖𝑓 𝑥 𝑖𝑠 𝐴 𝑡ℎ𝑒𝑛 𝑦 𝑖𝑠 𝐵
… … … … … … … … … … … ….
…………………………………
𝑅 : 𝑖𝑓 𝑥 𝑖𝑠 𝐴 𝑡ℎ𝑒𝑛 𝑦 𝑖𝑠 𝐵
𝐵 = 𝐵 ∪ 𝐵 ∪ ………𝐵
Output fuzzy set: Illustration
𝑅 : 𝑖𝑓 𝑥 𝑖𝑠 𝐴 𝑡ℎ𝑒𝑛 𝑦 𝑖𝑠 𝐶
𝑅 : 𝑖𝑓 𝑥 𝑖𝑠 𝐴 𝑡ℎ𝑒𝑛 𝑦 𝑖𝑠 𝐶
Here the output fuzzy set 𝐶 = 𝐶 ∪ 𝐶 . For instance, let us consider the following:
Defuzzification Methods
Following defuzzification methods are known to calculate crisp output in the situations as
discussed in the last lecture.
Maxima Methods
o Height method
o First of maxima (FoM)
o Last of maxima (LoM)
o Mean of maxima (MoM)
Centroid Methods
o Centre of gravity method (CoG)
o Centre of sum method (CoS)
o Centre of area method (CoA)
Weighted average method
Maxima Methods
Height method
First of maxima (FoM)
Last of maxima (LoM)
Mean of maxima (MoM)
Maxima method : Height Method
This method is based on Max-membership principle, and defined as follows.
𝜇 (𝑥 ∗ ) ≥ 𝜇 (𝑥) for all 𝑥 𝜖 𝑋.
Note:
∑ (𝑥 )
𝑥∗ = ∈
|𝑀|
Where, 𝑀 = {𝑥 |𝜇(𝑥 ) = ℎ(𝐶)} and h(C) is the height of the fuzzy set C.
MoM : Example 1
Suppose, a fuzzy set Young is defined as follows:
𝑌𝑜𝑢𝑛𝑔 = {(15,0.5), (20,0.8), (25,0.8), (30,0.5), (35,0.3)}
Then the crisp value of Young using MoM method is
20 + 25
𝑥∗ = = 22.5
2
Thus, a person of 22.5 years old is treated as young!
MoM: Example 2
What is the crisp value of the fuzzy set using MoM in the following case?
𝑎+𝑏
𝑥∗ =
2
Note:
Centroid Methods
The basic principle in CoG method is to find the point x where a vertical line would slice
the aggregate into two equal masses.
Mathematically, the CoG can be expressed as follows:
∫ 𝑥. 𝜇 (𝑥)𝑑(𝑥)
𝑥∗ =
∫ 𝜇 (𝑥)𝑑(𝑥)
The lower part shows the area of the region.
Graphically
Note:
Divide the entire region into a number of small regular regions (e.g. triangles, trapezoid,
etc.)
0.3𝑥 0≤𝑥<2
⎧
⎪ 0.7 2 ≤ 𝑥 < 2.7
𝜇 (𝑥) = 𝑥 − 2 2.7 ≤ 𝑥 < 3
⎨ 1 3≤𝑥<4
⎪
⎩ (−0.5𝑥 + 3) 4≤𝑥≤6
.
For 𝐴 : 𝑦 − 0 = (𝑥 − 0), 𝑜𝑟 𝑦 = 0.35𝑥
For 𝐴 : 𝑦 = 0.7
For 𝐴 : 𝑦 − 0 = (𝑥 − 2), 𝑜𝑟 𝑦 = 𝑥 − 2
For 𝐴 : 𝑦 = 1
∫ . ( ) ( )
Thus, 𝑥 ∗ = ( ) ( )
=
∫
.
𝑁= 0.35𝑥 𝑑𝑥 + 0.7𝑥 𝑑𝑥 + (𝑥 − 2𝑥)𝑑𝑥 + 𝑥𝑑𝑥 + (−0.5𝑥 + 3𝑥)𝑑𝑥
.
= 10.98
.
𝐷= 0.35𝑥𝑑𝑥 + 0.7𝑥𝑑𝑥 + (𝑥 − 2)𝑑𝑥 + 𝑑𝑥 + (−0.5𝑥 + 3)𝑑𝑥
.
= 3.445
10.98
𝑥∗ = = 3.187
3.445
Centroid Method : CoS
If the output fuzzy set = 𝐶 ∪ 𝐶 ∪ … … … 𝐶 , then the crisp value according to CoS is defined
as
∑ 𝑥𝐴
𝑥∗ =
∑ 𝐴
Here, 𝐴 denotes the area of the region bounded by the fuzzy set 𝐶 𝑎𝑛𝑑 𝑥 is the geometric
centre of the area 𝐴 . Graphically,
Note:
In the CoG method, the overlapping area is counted once, whereas, in CoS, the
overlapping is counted twice or so.
In CoS, we use the centre of area and hence, its name instead of centre of gravity as in
CoG.
CoS : Example
Consider the three output fuzzy sets as shown in the following plots:
Note:
The crisp value of 𝐶 = 𝐶 ∪ 𝐶 ∪ 𝐶 using CoG method can be found to be calculated as
𝑥 ∗ = 4.9
Centroid method : Centre of largest area
If the fuzzy set has two sub regions, then the centre of gravity of the sub region with the largest
area can be used to calculate the defuzzified value.
∫ . ( ) ( )
Mathematically, 𝑥 ∗ = ( ) ( )
∫
Here, 𝐶 is the region with largest area, x’is the centre of gravity 𝐶 .
Graphically,
Exercise 1 :
Find the crisp value of the following using all defuzzified methods.
Exercise 2:
Find the crisp value of the following using all defuzzified methods.
Exercise 3 :
The membership function defining a student as Average, Good, and Excellent denoted
by respective membership functions are as shown below.
The width of a road as narrow and wide is defined by two fuzzy sets, whose membership
functions are plotted as shown above.
If a road with its degree of membership value is 0.4 then what will be its width (in crisp)
measure.
Hint:
Use COG method for the shaded region.
Exercise 5 :
The faulty measure of a circuit is defined fuzzily by three fuzzy sets namely Robust(R),
Fault tolerant (FT) and Faulty (F), defined by three membership functions with number
of faults occur as universe of discourses and is shown below.
Concept of fuzzy theory can be applied in many applications, such as fuzzy reasoning,
fuzzy clustering, fuzzy programming, etc.
Out of all these applications, fuzzy reasoning, also called fuzzy logic controller (FLC) is
an important application.
Fuzzy logic controllers are special expert systems. In general a FLC employs a knowledge
base expressed in terms of a fuzzy inference rules and a fuzzy inference engine to solve
a problem.
We use FLC where an exact mathematical formulation of the problem is not possible or
very difficult.
These difficulties are due to non-linearities, time-varying nature of the process, large
unpredictable environment disturbances, etc.
Step 1: Measurements (inputs) are taken of all variables that represent relevant
condition of controller process.
Step 2: These measurements are converted into appropriate fuzzy sets to express
measurements uncertainties. This step is called fuzzification.
Step 3: The fuzzified measurements are then used by the inference engine to evaluate
the control rules stored in the fuzzy rule base. The result of this evaluation is a fuzzy set
(or several fuzzy sets) defined on the universe of possible actions.
Step 4: This output fuzzy is then converted into a single (crisp) value (or a vector of
values). This is the final step called defuzzification. The defuzzidied values represent
actions to be taken by the fuzzy controller.
There are mainly two approaches of FLC.
Mamdani Approach
Takagi and Sugeno’s Approach
o Mamdani approach follows linguistic fuzzy modeling and characterized by its
high interpretability and low accuracy.
o On the other hand, Takagi and Sugeno’s approach follows precise fuzzy
modeling (numerical) and obtains high accuracy but at the cost of low
interpretability.
We illustrate the above two approached with examples.
Mamdani Approach: Mobile Robot
We consider two parameters: D, the distance from the robot to an object and 𝜽 the
angle of motion of an object with respect to the robot.
The value of these parameters with respect to the most critical object will decide an
output called deviation (𝜹).
We assume the range of values of D is [0.1, … ,2.2] in meter and 𝜃 is [−90, … ,0, … ,90] in
degree.
After identifying the relevant input and output variables of the controller and their
range of values, the Mamdani approach is to select some meaningful states called
linguistic states for each variable and express them by appropriate fuzzy sets.
Linguistic States
For the current example, we consider the following linguistic states for the three parameters.
Distance is represented using four linguistic states:
Angle (for both angular direction (𝜃) and deviation (𝛿) are represented using five linguistic
states:
LT: Left
AL: Ahead Left
AA: Ahead
AR: Ahead Right
RT: Right
Three different fuzzy sets for the three different parameters are given below:
Once the fuzzy sets of all parameters are worked out, our next step in FLC design is to
decide fuzzy rule base of the FLC.
The rule base for the FLC of mobile robot is shown in the form of a table below.
𝑳𝑻 𝑨𝑳 𝑨𝑨 𝑨𝑹 𝑹𝑻
𝑽𝑵 𝐴𝐴 𝐴𝑅 𝐴𝐿 𝐴𝐿 𝐴𝐴
𝑵𝑹 𝐴𝐴 𝐴𝐴 𝑅𝑇 𝐴𝐴 𝐴𝐴
𝑭𝑹 𝐴𝐴 𝐴𝐴 𝐴𝑅 𝐴𝐴 𝐴𝐴
𝑽𝑭 𝐴𝐴 𝐴𝐴 𝐴𝐴 𝐴𝐴 𝐴𝐴
Fuzzification of Inputs
The next step is the fuzzification of inputs. Let us consider, at any instant, the object O 3
is critical to the Mobile Robot and distance D=1.04 m and angle 𝜃=30.
For this input, we are to decide the deviation 𝛿 of the robot as output.
From the given fuzzy sets and input parameters values, we say that the distance
D=1.04m may be called as either NR (near) or FR (far).
Similarly, the input angle 𝜃=30. can be declared as either AA (ahead) or AR (ahead right).
Input
o D=1.04m
o 𝜃=30.
Hence, we are to determine the membership values corresponding to these values which is as
follows.
In practice, all rules which are above certain threshold value of the rule strength are selected
for the output computation.
Let the threshold of 𝛼 be 0.3400. then the selected rules are
Fuzzy Output
The next step is to determine the fuzzified outputs corresponding to each fired rules. The
working principle of doing this is first discussed and then we illustrate with the running
example.
Suppose, only two fuzzy rules, R1 and R2, for which we are to decide fuzzy output
Note:
Defuzzification
The fuzzy output needs to be defuzzufued and its crisp value has to be determined for the
output to take decision.
Conclusion:
Therefore, the robot should deviate by 19.58089 degree towards the right with respect to the
line joining to the move of direction to avoid collision with the obstacle O 3.
Suppose:
𝑎 = 1, 𝑎 = 2, 𝑎 = 3 𝑖𝑓 𝐼 = 𝐿, 𝑀 𝑎𝑛𝑑 𝐻, 𝑟𝑒𝑠𝑝𝑒𝑐𝑡𝑖𝑣𝑒𝑙𝑦
The input I1 =6.0 can be called either L and M. Similarly, the input I2 =2.2 can be declared
either FR or VF.
Genetic Algorithm
Basically used to solve optimization problem.
It is used to find the global maxima and global minima for a given f(x). GA is used for these kind
of optimization problem. A function is called as the optimization problem and
this function is either to be maximized or minimized. This objective function is subjected to a
number of constraint . This is no more a trivial problem and this cannot be solved
in a normal time and so it requires some pragmatic approach like soft computing techniques. So
this problem is no more a simple problem. Traditionally a numbers of method are there with
the following limitation.
Computationally expensive.
For a discontinuous objective function, method may fail.
Method may not be suitable for parallel computing.
Discrete (integer) variable are difficult to handle.
Methods may not necessarily adaptive.
Evolutionary algorithms have been evolved to address the above mentioned limitations of
solving optimization problems with traditional approaches.
EVOLUTIONARY ALGORITHMS
The algorithms, which follows some biological and physical behaviors:
Biological behaviors:
Genetics
Evolution
To optimize highly complex objective functions:
Mosquito: 6
Frogs: 26
Human: 46
Goldfish: 94
Genetic Code
Reproduction
Information propagation: An offspring has many of its characteristics of its parents (i.e.
information passes from parents to its offspring) [Heredity]
Population diversity: Variation in characteristics in the next generation. [Diversity]
Survival for existence: Only a small percentage of the offspring produced survive to
adulthood. [Selection]
Survival of the best: Offspring survived depends on their inherited characteristics.
[Ranking]
Mutation:
To make the process forcefully dynamic when variations in population going to stable.
FRAMEWORK OF GA
Note:
GA is an iterative process.
It is a searching technique.
Working cycle with / without convergence.
Solution is not necessarily guaranteed. Usually, terminated with a local optima.
Objective function(s)
Constraint(s)
Input parameters
Fitness evaluation (it may be algorithm or mathematical formula)
Encoding
Decoding
GA OPERATORS
In fact, a GA implantation involved with the realization of the following operations.
SSGA Features
Binary encoding
Real value encoding
Order encoding
Tree encoding
Often, GAs are specified according to the encoding scheme it follows. For example
Individual
Population
An individual is a single solution while a population is a set of individuals at an instant of
searching process.
Note:
A gene is the GA’s representation of a single factor (i.e. a design parameter), which has a
domain of values (continuous, discontinuous, discrete etc.) symbol, numbering, etc.
In GA, there is a mapping from genotype to phenotype. This eventually decides the
performance (namely speed and accuracy) of the problem solving.
There are many ways of encoding:
There are n items, each item has its own cost and weight .
There is a knapsack of total capacity w.
The problem is to take as many items as possible but not exceeding the capacity of the
knapsack.
This is an optimization problem and can be better described as follows.
Example 2:
Equivalently,
Example 2: What is the obtainable accuracy, for the binary representation for a variable
X in the range ?
Example 3: In the above case, what is the binary representation of X = 34.35?
Methodology: Step 2 [Obtaining the binary representation]
Once, we know the length of binary string for an obtainable accuracy (i.e. precision), then we
can have the following mapping relation from a real value X to its binary equivalent decoded
value XB, which is given by
Order Encoding
Let us have a look into the following instance of the Travelling Salesman Problem (TSP).
TSP:
Design parameters:
Minimizing
Subject to
where
Here, P is an ordered collection of cities and such that
TREE ENCODING
In this encoding scheme, a solution is encoded in the form of a binary tree.
Given:
Desirable floor plan aspect ratio , where H and W are the height
and width of the floor plan, respectively.
Timing information
A legal floor plan is a floor plan that satisfies the following constraints.
Constraints:
Each node represents a vertical cut-line or horizontal cut-line, and letter V and H refer to
vertical and horizontal cut-operators.
Each leaf node represents a rectangle blocks.
Example: Floor Plan I
Note:
The operators H and V expressed in polish notation carry the following meanings.
Problem
How many number of solutions possible with n blocks in a floor planning problem?