Lecture On Fuzzy Logic Control
Lecture On Fuzzy Logic Control
Instructor
Barjeev Tyagi
Intelligent Control Techniques
2
Intelligent Control Techniques
or
3
Intelligent Control Techniques
• Fuzzy Logic
• Neural Networks
• Genetic Algorithms
• Machine Learning
• Evolutionary Computation
4
Introduction to Fuzzy Logic
5
Introduction to Fuzzy Logic
6
Introduction to Fuzzy Logic
• Fuzzy logic is a superset of conventional (Boolean) logic that has
been extended to handle the concept of partial truth –the truth
values between "completely true" and "completely false".
• A type of logic that recognizes more than simple true and false
values. With fuzzy logic, propositions can be represented with
degrees of truthfulness and falsehood. For example, the statement,
today is sunny, might be 100% true if there are no clouds, 80% true
if there are a few clouds and 0% true if it rains all day.
7
The Life Cycle of a Process Control System
8
Knowledge Base System (KBS)
9
Knowledge Base System (KBS)
Supervisory Expert Control System
(SECS)
10
Classical/Crisp Sets
11
Fuzzy Sets
12
Fuzzy Sets
A fuzzy set in a universe of discourse U is characterized by a
membership function A ( X ) that takes values in the interval [0, 1].
• Therefore, a fuzzy set is a generalization of a classical set by
allowing the membership functions to take any value between 0 and 1
• A fuzzy set A in U may be represented as a set of ordered pairs of a
generic element X and its membership value, i.e,
A {X , A ( X ) / X U }
• When U is continuous, A is commonly written as
A A( X ) / X
U
13
Fuzzy Sets
• When U is discrete A is commonly written as
A A( X ) / X
U
14
Different Shapes of Fuzzy Sets
15
Types of Fuzzy Sets
Non-Convex Fuzzy Sets
In which membership grade alternatively increases and decreases
on the domain
16
Types of Fuzzy Sets
• -Function
1
0.5
• S-Function
• L-Function
• -Function
• -Function
• G-Function
17
Types of Fuzzy Sets
18
Types of Fuzzy Sets
x U ; A ( x) B ( x)
• The support of a fuzzy set is defined by S ( A) x U ; A ( x) 0
19
Types of Fuzzy Sets
x U ; A ( x) B ( x)
20
Types of Fuzzy Sets
• Subset
21
Operations on fuzzy sets
Union
The union of fuzzy subsets, A and B, of the set X, is denoted as the
fuzzy subset C of X.
C = A B such that for each X
C(x)= Max[A(x), B(x)] = A(x) B(x)
Let X={a, b, c, d}. Assume A and B are two fuzzy subsets of X
where A= {1/a, .7/b,.3/c,0/d} and B={.2/a,.9/b,.4/c.1/d}. Then
C={1/a,.9/b,.4/c,1/d}
22
Operations on fuzzy sets
Intersection
The intersection of the fuzzy subsets A and B is denoted as the
fuzzy subset D of X
D = A B for each x X
23
Operations on fuzzy sets
Complement
24
Fuzzy Arithmetic
Extension Principle
It provides a general method for combining non- fuzzy and fuzzy
concepts of all kind.
The aim is to extend f such that it operates on A1, A2,…….. An, and
returns a fuzzy set F on V.
25
Fuzzy Arithmetic
Definition:
The extension of f, operating on A1, A2,…….. An results in the
following membership function
F (v ) sup min( A1 (u1 )........... An (u n )),
u1 .......... u n
f ( u1 ...... u n ) v
26
Operations on fuzzy sets
Cartesian Product
The Cartesian product of two sets is the set of all possible ordered
pairs whose first component is a member of the first set and
whose second component is a member of the second set.
A=(1,2,3),B=(3,4,5)
{1,3},{1,4},{1,5},{2,3},{2,4},{2,5},{3,3},{3,4},{3,5}}
27
Fuzzy Relations
28
Fuzzy Relations
Definition:
A fuzzy relationship over the pair X,Y is defined as a fuzzy subset
of the Cartesian product
Example:
29
Fuzzy Relations
Crisp relation
Relation as rules
30
Fuzzy Relations
Fuzzy relation
31
Operations on Fuzzy Relations
( x, y ) X Y ; RS ( x, y ) max( R ( x, y ), S ( x, y ))
32
Operations on Fuzzy Relations
Let R be defined on X Y.
ce( F ) F ( y ) /( x, y )
X Y
33
Operations on Fuzzy Relations
Composition
B A R proj(ce( A) R)onY )
34
Example:
170 .4 .1 0 0 0 0 0
172.5 .7 .4 .1 0 0 0 0
175 1 .7 .4 .1 0 0 0
177.5 .7 1 .7 .4 .1 0 0
180 .4 .7 1 .7 .4 .1 0
182.5 .1 .4 .7 1 .7 .4 .1
185 0 .1 .4 .7 1 .7 .4
35
Example:
170 0 0 0 0 0 0 0
172.5 .1 .1 .1 .1 .1 .1 .1
Ce(A) = 175 .4 .4 .4 .4 .4 .4 .4
177.5 .7 .7 .7 .7 .7 .7 .7
180 .9 .9 .9 .9 .9 .9 .9
182.5 1 1 1 1 1 1 1
185 1 1 1 1 1 1 1
36
Example:
37
Example:
38
Operations on Fuzzy Relations
Composition
Consider RX Y and SY Z
Extend both relation to X Y Z, then projection of the intersection
of both extended relation in X Z gives the composition of R and
S.
TX Z R S max min( R ( xi , y j ), s ( y j , zk )) /( xi , zk )
X Z j
39
Fuzzy Implication
Consider a statement
if x is A then y is B
41
Fuzzy Implication (Example)
42
Fuzzy Implication (Example)
43
Fuzzy Implication (Example)
44
Fuzzy Implication (Example)
45
Fuzzy Rules Formation
There are three general forms that exist for any linguistic variables
– Assignment Statement
– Conditional Statement
– Unconditional Statement
46
Fuzzy Rules Formation
47
Fuzzy Logic Systems Architecture
48
Fuzzy Logic Systems Architecture
49
Fuzzy Logic Systems Architecture
• The knowledge base contains information about the boundaries,
possible transformations of the domains, and the fuzzy sets with
their corresponding linguistic terms. This information represents
the data base. In addition, the knowledge base contains a rule base
consisting of linguistic control rules.
50
Mamdani Implication
Consider a rule
if e is PM then u is NS Domain of e and u is [-6,6]
1 2 2 1
PM 2, 3, 1 4, 5, 6 NB NM NS ZE PS PM PB
3 3 3 3
1
1 2 2 1
NS 4, 3, 1 2, 1, 0
3 3 3 3
-6 -5 -3 0 3 5
51
Mamdani Implication
0 1 2 3 4 5 6
E
52
Mamdani Implication
0 0
0 1 0
0
0 1 0
0 1 0
0 1 0
0 1 0
2 3
53
Mamdani Implication
0 0
0 0 1/3 0
0 2/3 0
0 2/3 0
0 2/3 0
0 1/3 0
2 3
54
Mamdani Implication
NS (u ) if NS (u ) PM (3) 2 / 3
u U : CNS (u )
PM (3) 2 / 3 otherwise
or
u U : CNS (u ) min( PM (3), NS (u )) min(2 / 3, NS (u ))
55
Mamdani Implication
PM NS
1 1
-6 -5 -3 0 3 5 -5 -3 0 3 5 6
56
Mamdani Implication
57
Mamdani Implication
The membership functions for the linguistic variables Salary,
Debts, and Risk are given as in ₨ K are
58
Mamdani Implication
Jim has applied for a loan: his salary is ₨ 55K and his
debts amount to ₨ 50K.
Poor Good Excellent
10 15 50 60 Debts
Low Medium High
20 40 60 80 Risk
59
Mamdani Implication
risk medium
salary good
debt large
50 100 15 60 20 80
55 50
risk high
salary poor
10 60 60
55
60
Mamdani Implication
20 60 80 100
61
DEFUZZIFICATION
Defuzzification is a mapping process from a space of fuzzy
control actions defined over an output universe of discourse into a
space of crisp (nonfuzzy) control actions.
62
METHODS OF DEFUZZIFICATION
Defuzzification is the process of conversion of a fuzzy quantity
into a precise quantity.
Defuzzification methods
Centroid method,
Weighted average method,
Max-membership principle,
Mean-max membership,
Center of sums,
Center of largest area,
First of maxima, last of maxima.
63
METHODS OF DEFUZZIFICATION
CENTROID METHOD
64
METHODS OF DEFUZZIFICATION
65
METHODS OF DEFUZZIFICATION
Mean of Maxima (MOM):
• The defuzzified result represent the mean value of all actions,
whose membership function reach the maximum.
n
x
x i 1 i
n
66
METHODS OF DEFUZZIFICATION
CENTER OF SUMS:
• This method employs the algebraic sum of the individual fuzzy
subsets
• The calculations are very fast
• The defuzzified value x* is given by
67
METHODS OF DEFUZZIFICATION
CENTER OF LARGEST AREA:
• The output consists of at least two convex fuzzy subsets which are
not overlapping.
• The output is biased towards a side of one membership function.
• The defuzzified value x* is given by
where is the convex subregion that has the largest area making up
68
METHODS OF DEFUZZIFICATION
FIRST OF MAXIMA (LAST OF MAXIMA):
69
Takagi-Sugeno Method
70
Takagi-Sugeno Method
71
Takagi-Sugeno Method
Takagi, T., & Sugeno, M. (1985). ‘Fuzzy Identification of Systems and its
Applications to Modeling and Control’. IEEE Transactions on Systems,
Man and Cybernetics. Volume No. SMC-15 (No.1) pp 116-132.
Tomohiro Takagi and Michio Sugeno recognised two important
points:
72
Takagi-Sugeno Method
• Literature on conventional control systems has suggested that a complex non-
linear system can be described as a collection of subsystems that were combined
based on a logical (Boolean) switching system function.
73
Takagi-Sugeno Method
Consider a domain where all fuzzy sets are associated with linear
membership functions.
x is μ A and y is μ B μ A μB
74
Takagi-Sugeno Method
Takagi and Sugeno have described a fuzzy implication R is of the
format:
R: if (x1 is mA(x1),… xk is mA(xk)) then y = g(x1, …, xk)
Where:
Variable of the consequence whose
y value is inferred
75
Takagi-Sugeno Method
Consider a system with n implications (rules); the variable of
consequence, y, will have to be notated for each of these
implications, leading to yi variables of consequence. There are
three stages of computations in Takagi-Sugeno controllers:
• FUZZIFICATION: Fuzzify the input. For all input variables compute the
implication for each of the rules;
• INFERENCE or CONSEQUENCES: For each implication compute the
consequence for a rule which fires. Compute the output y for the rule by using
the linear relationship between the inputs and the output (y = p0 + p1x1 + … +
pkxk.).
• AGGREGATE (& DEFUZZIFICATION): The final output y is inferred from n-
implications and given as an average of all individual implications yi with
weights |y= yi |:
• y = (S |y= yi | * yi )/ S |y= yi |
76
Takagi-Sugeno Method
Consider the following fuzzy implications (or rules) R1,R2, R3 used
in the design of a Takagi-Sugeno controller:
where y (i) refers to the consequent variable for each rule labelled Ri
and x1 and x2 refer to the input variables that appear in premise of
the rules.
77
Takagi-Sugeno Method
The membership function for small1, small2, big1 and big2 are
given as follows x Small1 Small2 Big1 Big2
0 1 1 0 0
1 0.938 0.875 0 0
2 0.875 0.75 0 0
3 0.813 0.625 0 0.125
4 0.75 0.5 0 0.25
5 0.688 0.375 0 0.375
6 0.625 0.25 0 0.5
7 0.563 0.125 0 0.625
8 0.5 0 0 0.75
9 0.438 0 0 0.875
10 0.375 0 0 1
11 0.313 0 0.1 1
12 0.25 0 0.2 1
13 0.188 0 0.3 1
14 0.125 0 0.4 1
15 0.063 0 0.5 1
16 0 0 0.6 1
17 0 0 0.7 1
18 0 0 0.8 1
19 0 0 0.9 1
20 0 0 1 1
78
Takagi-Sugeno Method
The membership function for small1, small2, big1 and big2 are
given as follows Takagi-Sugeno Example pp 117
1
0.9
0.8
Membership Function
0.7
Small1
0.6
0.5
Small2
0.4
0.3 Big1
0.2
0.1 Big2
0
0 5 10 15 20
Input x
79
Takagi-Sugeno Method
Let us compute the FINAL OUTPUT y for the following values:
x1 = 12 & x2 = 5
using Takagi and Sugeno‟s formula:
y = (S |y= yi | * yi )/ S |y= yi |
where |y= yi | stands for the truth value of a given proposition.
Truth
Rule Premise 1 Premise 2 Consequen Value
Min (Premise 1
ce & Premise2)
81
Takagi-Sugeno Method
AGGREGATION (&DEFUZZIFICATION):
x1 = 12 & x2 = 5
y = (S |y= yi | * yi )/ S |y= yi |
Using a Centre of Area computation for y we get:
y y (i )
* y (i )
i 1,3
y
y y (i )
i 1,3
0.25 *17 0.2 * 24 0.375 *15
y 17.8
0.25 0.2 0.375
82
Takagi-Sugeno Method
In Sugeno‟s model, each rule has a crisp output, the overall input is
obtained by a weighted average – this avoids the time-consuming
process of defuzzification required in a Mamdani model. The
weighted average operator is replaced by a weighted sum to reduce
computation further.
83
Takagi-Sugeno Method
Function approximation with a Sugeno model
The Sugeno model can be viewed as a collection of locally approximating linear
models
y
A x : 0,1
y a2 x b2
y a1 x b1
x Rules
IF x is Small THEN y a1 x b1
Small Medium Large
IF x is Medium THEN y a2 x b2
IF x is Big THEN y a3 x b3
x
x 0.2 ; 0.8 ; 0
84
Further Reading
1. Y. F. Li, C. C. Lau, “Development of Fuzzy Algorithms for Servo
Systems”, IEEE Int. Conf. on Robotics and Automation,
Philadelphia, USA, April 24-29, 1988
85
References
1. T. J Ross, Fuzzy Logic With Engineering Application, Wiley
86
87