01EC6218 Soft Computing Module-I: Fuzzy Logic: Dr. Pradeep R. Associate Professor GEC, Bartonhill Pradeep@cet - Ac.in
01EC6218 Soft Computing Module-I: Fuzzy Logic: Dr. Pradeep R. Associate Professor GEC, Bartonhill Pradeep@cet - Ac.in
01EC6218 Soft Computing Module-I: Fuzzy Logic: Dr. Pradeep R. Associate Professor GEC, Bartonhill Pradeep@cet - Ac.in
Dr. Pradeep R.
Associate Professor
GEC, Bartonhill
pradeep@cet.ac.in
What is Fuzzy logic?
Fuzzy logic is a mathematical language to express
something. ::This means it has grammar, syntax,
semantic like a language for communication.
Some other mathematical languages :
Relational algebra (operations on sets)
Boolean algebra (operations on Boolean variables)
Predicate logic (operations on well formed formulae (wff), also called
predicate propositions)
Dictionary meaning
of fuzzy is not clear,
noisy etc.
Antonym of fuzzy
is crisp
Fuzzy logic vs. Crisp logic
Yes or No
Crisp answer
True or False
Milk
Yes
Water
Crisp
A liquid
Coca
No
Sprite
Is the liquid
colorless?
Fuzzy logic vs. Crisp logic
May be
May not be
Fuzzy answer
Absolutely
Partially
etc
Score
99
Extremely honest
· Ankit
· Rajesh
75
Very
· Santosh honest
Fuzzy
55
· Kabita Honest at times
· Salmon
Extremely dishonest 35
Is the person
honest?
Concept of fuzzy system
Fuzzy element(s)
Fuzzy set(s)
I
N
Fuzzy rule(s)
P
U
T
Fuzzy implication(s)
(Inferences)
O
U
T
Fuzzy system
P
U
T
Concept of fuzzy set
To understand the concept of fuzzy set it is better, if we first clear
our idea of crisp set.
X = The entire population of India.
H = All Hindu population = { h1 , h2 , h3 , ... , hL }
M = All Muslim population = { m1 , m2 , m3 , ... , mN }
Universe of discourse X
H
M
Note:
µA(x) map each element of X onto a membership grade (or
membership value) between 0 and 1 (both inclusive).
Question:
How (and who) decides µA(x) for a Fuzzy set A in X ?
Example:
A = City of comfort
A ={(0,0.1),(1,0.30),(2,0.78)……(10,0.1)}
Note : X = discrete value
1.0
0.8
0.6
µ
0.4
0.2
0 2 4 6 8
10
Number of children
(X)
A
A = “Happy family”
Membership function with continuous
membership values
1.0
B ( x) 1
x 50
4
0.8 1
10
0.6
0.4
0.2
0 50 100
B
Age (X)
Note : x = real value
+
=R
B = “Middle aged”
Fuzzy terminologies: Support
A
Fuzzy terminologies: Core
Core: The core of a fuzzy set A is the set of all points x in X such that
µA(x ) = 1
1.0
µ
0.5
x
Fuzzy terminologies: Normality
Normality : A fuzzy set A is a normal if its core is non-empty. In other
words, we can always find a point x ∈ X such that µA(x ) = 1.
1.0
Fuzzy terminologies: Crossover points
Crossover point : A crossover point of a fuzzy set A is a point x
∈ X at which µA(x ) = 0.5. That is
Crossover (A) = {x |µA(x ) = 0.5}.
Fuzzy terminologies: α-cut and strong
α-cut
Aα = {x | µA(x) ≥ α }
Aα ’ = {x | µA(x) > α }
Note :
• A is convex if all its α- level sets are convex.
• Convexity (Aα ) =⇒ Aα is composed of a single line segment only.
Membership function Non-convex
is convex Membership
function
1.0 1.0
Fuzzy terminologies: Bandwidth
Bandwidth :
For a normal and convex fuzzy set, the bandwidth (or width) is
defined as the distance the two unique crossover points:
Bandwidth(A) = | x1 - x2 |
where µA(x1) = µA(x2) = 0.5
Fuzzy terminologies: Symmetry
Symmetry :
Open right
Open left Closed
Membership Functions
Fuzzy membership functions
A fuzzy set is completely characterized by its membership function
(sometimes abbreviated as MF and denoted as µ ). 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.
Example:
1.0 1.0
0.8 0.8
0.6 0.6
µA
µB
0.4 0.4
0.2 0.2
0 2 4 6 8 10 0 10 20 30 40 50
60
µ
µ
x x x
x x
Excellent = Marks ≤ 90
Very good = 75 ≤ Marks ≤ 90
Good = 60 ≤ Marks ≤ 75
Average = 50 ≤ Marks ≤ 60 A fuzzy implementation will look like the
Poor = 35 ≤ Marks ≤ 50 following.
Bad= Marks ≤ 35
Operations on Fuzzy Sets
Union
Intersection
Complement
Products
Basic fuzzy set operations: Union
Union (A ∪ B):
µA∪B (x ) = max{µA(x ), µB (x )}
Example:
A = {(x1, 0.5), (x2, 0.1), (x3, 0.4)} and
B = {(x1, 0.2), (x2, 0.3), (x3, 0.5)};
C = A ∪ B = {(x1, 0.5), (x2, 0.3), (x3, 0.5)}
Intersection
Intersection (A ∩ B):
µA∩B (x ) = min{µA(x ), µB (x )}
Example:
A = {(x1, 0.5), (x2, 0.1), (x3, 0.4)} and
B = {(x1, 0.2), (x2, 0.3), (x3, 0.5)};
C = A ∩ B = {(x1, 0.2), (x2, 0.1), (x3, 0.4)}
fuzzy set operations:
Complement (AC ):
µA (x ) = 1-µA(x )
Example:
A = {(x1, 0.5), (x2, 0.1), (x3, 0.4)}
C = AC = {(x1, 0.5), (x2, 0.9), (x3, 0.6)}
µαA(x ) = α · µA(x )
Sum and Difference
Equality and Power
Cartesian product
Properties of fuzzy sets
Properties of fuzzy sets
Examples:
What are the fuzzy sets representing the following?
1. Not cold climate
2. Not hold climate
3. Extreme climate
4. Pleasant climate
Note: Note that ”Not cold climate” 6 = ”Hot climate” and vice-
versa.
Ans
Fuzzy Resolution Principle
Example
Generation of MFs
Linguistic variables and values
EXTENSION PRINCIPLE
FUZZY RELATIONS
To understand the fuzzy relations, it is better to discuss first
crisp relation.
Suppose, A and B are two (crisp) sets. Then Cartesian
product denoted as A x B is a collection of order pairs, such
that
Ax B = {(a,b)|a €A and b € B}
Note :
(1) Ax B≠ B x A
(2) |A x B| = |A|x |B|
(3)A x B provides a mapping from a € A to b € B.
The mapping so mentioned is called a relation.
Crisp Relation
Example:
Consider the two crisp sets A and B as given below. A ={ 1, 2, 3, 4} 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 R as R = {(a; b)|b = a + 1; (a; b) € Ax B}
Then, R = {(2; 3); (4; 5)} in this case.
We can represent the relation R in a matrix form as follows.
Fuzzy relations
Fuzzy relation is a fuzzy set defined on the Cartesian product of crisp set
X1,X2,…,Xn
Here, n-tuples (x1, x2,… xn) may have varying degree of memberships
within the relationship.
The membership values indicate the strength of the relation between the
tuples.
Example:
X = { typhoid, viral, cold } and Y = { running nose, high temp, shivering }
The fuzzy relation R is defined as
Binary (Fuzzy) relation
A special fuzzy relation called a binary (fuzzy) relation plays an
important role in fuzzy set theory.
A binary fuzzy relation is a fuzzy relation between two sets X
andY and is denoted by R (X,Y).When X ≠Y, binary relations
R (X,Y) are referred to as bipartite graphs.
When X =Y, R is a binary fuzzy relation on a single set X, and
the relations are referred to as directed graphs, or digraphs, and
are denoted by R (X, X) or R (X2).
Operations on Fuzzy relations
Eg:
Eg2:
Fuzzy rule
A fuzzy implication (also known as fuzzy If-Then rule, fuzzy
rule, or fuzzy conditional statement) assumes the form :
If x is A then y is B
where, A and B are two 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
If pressure is High then temperature is Low
If road is Good then driving is Smooth else traffic is High
If mango is Yellow then mango is Sweet else mango is Sour
The fuzzy implication is denoted as R : A B
In essence, it represents a binary fuzzy relation R on the
(Cartesian) product of A x B
Suppose, P and T are two universes of discourses
representing pressure and temperature, respectively as
follows.
P ={1,2,3,4} and T ={10, 15, 20, 25, 30, 35, 40, 45, 50 }
Let the linguistic variable High temperature and Low
pressure are given as
THIGH={(20; 0:2); (25; 0:4); (30; 0:6); (35; 0:6); (40; 0:7);
(45; 0:8); (50; 0:8)}
PLOW = {(1; 0:8); (2; 0:8); (3; 0:6); (4; 0:4)}
Then the fuzzy implication If temperature is High then
pressure is Low can be defined as
R :THIGH PLOW
T-norm operator
Zadeh’s Max-Min rule
Example
Operations of fuzzy sets
Let A and B be fuzzy sets in universal sets U and V respectively.
Fuzzy inferences
Two important inferring procedures are used in fuzzy systems :
If x is A Then y is B
y is B’
————————————
x is A’
Example: GMP
Example: GMT
Example:GMT
Fuzzy logic controller (FLC)
Fuzzy logic control (FLC), initiated by the pioneering work
of Mamdani and Assilian [1975]
To incorporate the "expert experience" of a human operator
In the design of the controller
Input-output relationship is described by a collection of fuzzy
control rules (e.g., IF-THEN rules)
Comprised of four principal components: a fuzzifier, a
fuzzy rule base, an inference engine, and a defuzzifier.
Fuzzy logic controller (FLC)
Input-Output Spaces
Typically, the input variables in a FLC are the state, state
error, state error derivative, state error integral, and so on.
The input vector x which includes the input state linguistic
variables xi form a fuzzy input space U = U1x U2x . . . .x Xn
The output state vector y which includes the output state (or
control) linguistic variables yi form a fuzzy output space
V=V1xV2x . . . .xVn
Among the various fuzzy implications, Mamdani's fuzzy implication method Rc associated
with the max-min composition is the most frequently used in fuzzy logic control.
Let us assume that we have two fuzzy control rules as follows:
R1: IF x is A1 AND y is B1, THEN z is C1
R2: IF x is A2 AND y is B2, THEN z is C2
Then the firing strengths α1 and α2 of the first and second rules
may be expressed as