Vous êtes sur la page 1sur 117

Intelligent Control Systems

EPM643

Fuzzy Sets theory, Fuzzy Reasoning,


Introduction to FLC

Revised Oct.2017 Dr. Khaled El-Metwally, CU 1


Introduction

Revised Oct.2017 Dr. Khaled El-Metwally, CU 2


A Train Runs in Sandai (1987) !
One of the most Advanced System on the Earth

•The train starts up with gossamer ease,


no jolts, no tug of inertia
•Few people bother to hang on the straps,
even when it stops or starts.
•Halts with accurate precision.
•10% less fuel consumption

The secrete is behind the Fuzzy Logic


14/10/2009 Dr. Khaled El-Metwally, CU - FL2017 3
4 Years Later
In 1991, Los Anglos Was building a subway system and
needed a control system while Sandai Subway system had
carried passengers for 4 years

Robert Townly, engineering manager for automatic train


operationin this project said:
“I’ve heard of fuzzy logic very vaguely and I’m not familiar
with it”.

He added “none of the bids to design the subway used fuzzy


logic”

14/10/2009 Dr. Khaled El-Metwally, CU - FL2017 4


Western Scientists Views
In 1972 conference in Bordeaux, Zadah clashed with Rudolph E. Kalman, the inventor of
Kalman filter!!

“No doubt Prof. Zadah’s enthusiasm for fuzziness has been reinforced
by prevailing political climate in the U.S.- one of unprecedented
permissiveness. ‘Fuzzification’ is a kind of scientific permissiveness; it
tends to result in socially appealing slogans unaccompanied by
discipline of hard scientific work and patient observation.
I must confess that I can not conceive of ‘fuzzification’ as a viable
alternative for scientific method”
14/10/2009 Dr. Khaled El-Metwally, CU - FL2017 5
Western Scientists Views
William Kahan is an mathematician and a collogue of Zadah’s at Berkely University. In
1975 he pointed out;

“Logic is not following the rules of Aristolte blindly. It takes the kind
of pain known to the runner. He knows he is doing something.
When you think of something hard, you’ll feel a similar sort of
pain.
Fuzzy logic is marvelous. It insulates you form pain. It’s the cocaine
of science.”
14/10/2009 Dr. Khaled El-Metwally, CU - FL2017 6
 Why fuzzy?
As Zadeh said, the term is concrete, immediate and
descriptive; we all know what it means. However,
many people in the West were repelled by the word
fuzzy, because it is usually used in a negative sense.
 Why logic?
Fuzziness rests on fuzzy set theory, and fuzzy logic is
just a small part of that theory.

14/10/2009 Dr. Khaled El-Metwally, CU - FL2017 7


The Gifts Fuzzy Logic Gave to the
Japanese
•Intelligent washing machines.

•Intelligent microwave ovens.

•Sharper TV pictures.

•Video Stabilizers.

•Intelligent traffic lights.

•15% less fuel consumption vehicles.


14/10/2009 Dr. Khaled El-Metwally, CU - FL2017 8
Objectives
Introduction to Fuzzy Set Theory
1- Fuzzy Sets
2- MF Formulation
3- Set Operations
4- Fuzzy Extension principle
5- Fuzzy Relations
6- Linguistic Variables
7- Fuzzy Rules
8- Fuzzy Reasoning
Introduction to Fuzzy Control Systems
1- Basic Structure of Fuzzy Systems
2- Fuzzy Inference Systems (different models)

Revised Oct.2017 Dr. Khaled El-Metwally, CU 9


Introduction to Fuzzy Set Theory

1- Fuzzy Sets (revisited)

Revised Oct.2017 Dr. Khaled El-Metwally, CU 10


Lotfi A. Zadeh, The founder of fuzzy logic.

Fuzzy Sets

L. A. Zadeh, “Fuzzy sets,” Information and Control,


vol. 8, pp. 338-353, 1965.

Revised Oct.2017 Dr. Khaled El-Metwally, CU 11


Fuzzy Sets Are Used to Define
the Uncertainties

Revised Oct.2017 Dr. Khaled El-Metwally, CU 12


Types of Uncertainty
• Stochastic uncertainty
– E.g., rolling a dice

• Linguistic uncertainty
– E.g., low price, tall people, young age

• Informational uncertainty
– E.g., credit worthiness, honesty

Revised Oct.2017 Dr. Khaled El-Metwally, CU 13


Crisp or Fuzzy Logic
• Crisp Logic
– A proposition can be true or false only.
• Bob is a student (true)
• Smoking is healthy (false)
– The degree of truth is 0 or 1.
• Fuzzy Logic
– The degree of truth is between 0 and 1.
• William is young (0.3 truth)
• Ariel is smart (0.9 truth)

Revised Oct.2017 Dr. Khaled El-Metwally, CU 14


Crisp Sets
• Classical sets are called crisp sets
– either an element belongs to a set or
not, i.e.,
x A or x A
• Member Function of crisp set
0 x  A
 A ( x)    A ( x) 0,1
1 x  A

Revised Oct.2017 Dr. Khaled El-Metwally, CU 15


Crisp Sets
P : the set of all people.
Y : the set of all young people. P
Y
Young   y y  age( x)  25, x  P

Young ( y)
1

25 y

Revised Oct.2017 Dr. Khaled El-Metwally, CU 16


Crisp sets  A ( x) 0,1

Fuzzy Sets

 A ( x) [0,1]
Example
Young ( y)
1

Revised Oct.2017 Dr. Khaled El-Metwally, CU 17


Definition:
Fuzzy Sets and Membership Functions
If U is a collection of objects denoted generically by x, then
a fuzzy set A in U is defined as a set of ordered pairs:

A  ( x,  A ( x)) x U 
membership
function
U : universe of
discourse.
 A : U  [0,1]
Revised Oct.2017 Dr. Khaled El-Metwally, CU 18
Example: Discrete Fuzzy Sets with
Discrete Universes
• Fuzzy set C = “desirable city to live in”
X = {Cairo, Alex, Asswan} (discrete and nonordered)
C = {(Cairo, 0.9), (Alex, 0.8), (Asswan, 0.6)}
• Fuzzy set A = “sensible number of children”
X = {0, 1, 2, 3, 4, 5, 6} (discrete universe)
A = {(0, .1), (1, .3), (2, .7), (3, 1), (4, .6), (5, .2), (6, .1)}

14/10/2009 Dr. Khaled El-Metwally, CU - FL2017 19


Example (Discrete Universe)

U  {1, 2,3, 4,5,6,7,8} # courses a student may


take in a semester.

 (1, 0.1) (2, 0.3) (3, 0.8) (4,1)  appropriate


A  # courses taken
(5, 0.9) (6, 0.5) (7, 0.2) (8, 0.1) 
1

 A ( x)
0.5

0
2 4 6 8
x : # courses

Revised Oct.2017 Dr. Khaled El-Metwally, CU 20


Example (Discrete Universe)

U  {1, 2,3, 4,5,6,7,8} # courses a student may


take in a semester.

 (1, 0.1) (2, 0.3) (3, 0.8) (4,1)  appropriate


A  # courses taken
(5, 0.9) (6, 0.5) (7, 0.2) (8, 0.1) 

Alternative Representation:

A  0.1/ 1  0.3/ 2  0.8/ 3  1.0 / 4  0.9 / 5  0.5/ 6  0.2 / 7  0.1/ 8

Revised Oct.2017 Dr. Khaled El-Metwally, CU 21


Example (Continuous Universe)

U : the set of positive real numbers possible ages

B  ( x, B ( x)) x U 
1 about 50 years old
 B ( x) 
 x  50 
4

1  
 5  1.2

0.8
Alternative
Representation:  B ( x) 0.6
0.4

B
0.2
1
x
 
0
R  1 x50 4
5 0 20 40 60 80 100

x : age
Revised Oct.2017 Dr. Khaled El-Metwally, CU 22
Alternative Notation

A  ( x,  A ( x)) x U 
U : discrete universe A 
xi U
A ( xi ) / xi

U : continuous universe A    A ( x) / x
U

Note that  and integral signs stand for the union of membership grades;
“ / ” stands for a marker and does not imply division.

Revised Oct.2017 Dr. Khaled El-Metwally, CU 23


Membership Functions (MF’s)
• A fuzzy set is completely characterized
by a membership function.
– a subjective measure.
– not a probability measure.

“tall” in Asia
Membership

1
value

“tall” in USA

“tall” in NBA
0
5’10” height

Revised Oct.2017 Dr. Khaled El-Metwally, CU 24


Fuzzy Partition
• Fuzzy partitions formed by the linguistic
values “young”, “middle aged”, and “old”:

Revised Oct.2017 Dr. Khaled El-Metwally, CU 25


Introduction to Fuzzy Set Theory

2- MF Formulation

Revised Oct.2017 Dr. Khaled El-Metwally, CU 26


MF Formulation
  xa cx 
• Triangular MF trimf ( x; a, b, c)  max  min  , ,0
  b  a c  b  

  xa d x 
• Trapezoidal MF trapmf ( x; a, b, c, d )  max  min  ,1, , 0 
  b  a d  c  

2
1  x c 
  
• Gaussian MF gaussmf (x ;  , c )  e 2  

1
• Generalized bell MF gbellmf ( x; a, b, c) 
xc
2b

1
a

Revised Oct.2017 Dr. Khaled El-Metwally, CU 27


MF Formulation

Revised Oct.2017 Dr. Khaled El-Metwally, CU 28


The Generalized Bell Function
1
gbellmf ( x; a, b, c) 
xc
2b

1
cross points a

Slope =-b/2a
1
MF
0.5

0
x
core

2a width

-cut

support
Revised Oct.2017 Dr. Khaled El-Metwally, CU 29
Manipulating Parameter of the
Generalized Bell Function
1
gbellmf ( x; a, b, c) 
xc
2b

1
a

Revised Oct.2017 Dr. Khaled El-Metwally, CU 30


Sigmoid MF
1
sigmf ( x; a, c) 
1  e  a ( x c )

Extensions:
Abs. difference
of two sig. MF

Product
of two sig. MF

Revised Oct.2017 Dr. Khaled El-Metwally, CU 31


L-R MF  cx
 FL    , x  c
  
LR ( x; c,  ,  )  
F  x  c  , x  c
R  

   

Example: FL ( x)  max(0,1  x 2 )

FR ( x)  exp  x  3

c=65 c=25
=60 =10
=10 =40

Revised Oct.2017 Dr. Khaled El-Metwally, CU 32


More Terminologies Fuzzy
singletons

• Normality 1

(x)
– core non-empty
• Fuzzy singleton 0
– support one single point Small Medium Big
• Fuzzy numbers
– fuzzy set on real line R that satisfies convexity and
normality
• Symmetricity 1

(x)
 A (c  x)   A (c  x), x U
0
• Open left or right, closed height
1
lim  A ( x)  1, lim  A ( x)  0
(x)
x  x 
0 age
Revised Oct.2017 Dr. Khaled El-Metwally, CU 33
Introduction to Fuzzy Set Theory

3- Set Operations

Revised Oct.2017 Dr. Khaled El-Metwally, CU 34


Set-Theoretic Operations

• Subset
A B

A  B   A ( x)  B ( x), x U
A

• Complement
A  U  A   A ( x )  1   A ( x)
A B
A B
• Union
C  A  B  C ( x)  max(  A ( x), B ( x))   A ( x)  B ( x)

• Intersection
C  A  B  C ( x)  min(  A ( x), B ( x))   A ( x)  B ( x)

Revised Oct.2017 Dr. Khaled El-Metwally, CU 35


Properties
Involution A A De Morgan’s laws
A B  B  A A B  A  B
Commutativity
A B  B  A
A B  A  B
 A  B  C  A   B  C 
Associativity
 A  B  C  A   B  C 
A   B  C    A  B   A  C 
Distributivity
A   B  C    A  B   A  C 
A A  A The following properties are
Idempotence
A A  A invalid for fuzzy sets:
A   A  B  A The laws of contradiction
Absorption
A   A  B  A A A  
The laws of excluded middle
A A U
Revised Oct.2017 Dr. Khaled El-Metwally, CU 36
Now Compare
Conventional Logic Operation Fuzzy Logic Operation
T-Norm
0.2 0.2
0 0 Min
AND 0.7
1
T-CoNorm
0 1 0.2 0.7
OR Max
1 0.7

0 0.8
1 NOT 0.2 1-

Revised Oct.2017 Dr. Khaled El-Metwally, CU 37


Generalized Union/Intersection
• Generalized Intersection

T-norm
• Generalized Union

T-conorm
Revised Oct.2017 Dr. Khaled El-Metwally, CU 38
Examples: T-Norm & T-Conorm
• Minimum/Maximum:
T (a, b)  min(a, b)  a  b
S (a, b)  max(a, b)  a  b

• Lukasiewicz:
T (a, b)  max(a  b 1,0)  LAND(a, b)
S (a, b)  min(a  b,1)  LOR(a, b)

• Probabilistic:
T (a, b)  ab  PAND(a, b)
S (a, b)  a  b  ab  POR(a, b)
Revised Oct.2017 Dr. Khaled El-Metwally, CU 39
Introduction to Fuzzy Set Theory

4- Extension Principle

Revised Oct.2017 Dr. Khaled El-Metwally, CU 40


Functions Applied to Crisp Sets
y y = f(x)

B  f ( A)
B

x
B(y) A
A(x)

Revised Oct.2017 Dr. Khaled El-Metwally, CU 41


Functions Applied to Fuzzy Sets
y y = f(x)

B
B  f ( A)
x
B(y)
A(x)
A
x

Revised Oct.2017 Dr. Khaled El-Metwally, CU 42


Functions Applied to Fuzzy Sets

y y = f(x)

B
B  f ( A)
x
B(y)
A(x)
A
x

Revised Oct.2017 Dr. Khaled El-Metwally, CU 43


The Extension Principle
Assume a fuzzy set A and a function f.
How does the fuzzy set f(A) look like?

y y = f(x)  B ( y )   f ( A) ( y )
B  max  ( x )
1 A
x f ( y)

x
 sup  A ( x)
B(y) x  f 1 ( y )
A(x)
A
Revised Oct.2017 x 44
Dr. Khaled El-Metwally, CU
Extension Principle
A is a fuzzy set on X :
A   A ( x1 ) / x1   A ( x2 ) / x2   A ( xn ) / xn
The image of A under f( ) is a fuzzy set B:
B   B ( y1 ) / y1   B ( y2 ) / y2     B ( yn ) / yn
where yi = f(xi), i = 1 to n.

If f( ) is a many-to-one mapping, then


 B ( y )  max  A ( x )
1
x f ( y)

Revised Oct.2017 Dr. Khaled El-Metwally, CU 46


Introduction to Fuzzy Set Theory

5-Fuzzy Relations

Revised Oct.2017 Dr. Khaled El-Metwally, CU 47


Binary Relation (R)
b1
a1
b2
A a2
a3
b3 B
b4
a4 b5

R  A B
Revised Oct.2017 Dr. Khaled El-Metwally, CU 48
Binary Relation (R)
R  A B
b1
a1
b2
A a2
a3
b3 B
b4
a4 b5

1 0 1 0 0 a1 Rb1 a1 Rb3 a2 Rb5


0 1 
0 0 0 (a1 , b1 ), (a1 , b3 ), (a2 , b5 ) 
MR   R 
1 0 0 1 0  3 1
( a , b ), ( a3 , b4 ), ( a4 , b2 
)
 
0 1 0 0 0 a3 Rb1 a3 Rb4 a4 Rb2
49
The Real-Life Relation
• x is close to y
– x and y are numbers
• x depends on y
– x and y are events
• x and y look alike
– x and y are persons or objects
• If x is large, then y is small
– x is an observed reading and y is a
corresponding action

Revised Oct.2017 Dr. Khaled El-Metwally, CU 50


Fuzzy Relations

A fuzzy relation R is a 2D MF:

R   ( x, y), R ( x, y)  | ( x, y)  X  Y 

Revised Oct.2017 Dr. Khaled El-Metwally, CU 51


Example (Approximate Equal)
R   ( x, y), R ( x, y)  | ( x, y)  X  Y 

X  Y  U  {1, 2,3, 4,5}

 1 0.8 0.3 0 0 
1 u v  0 0.8 1 0.8 0.3 0 
  
0.8 u  v  1 M R   0.3 0.8 1 0.8 0.3
 R (u, v)  
0.3 u  v  2  
0 otherwise  0 0.3 0.8 1 0.8
 0 0 0.3 0.8 1 

Revised Oct.2017 Dr. Khaled El-Metwally, CU 52


Max-Min Composition
X Y Z
R: fuzzy relation defined on X and Y.

S: fuzzy relation defined on Y and Z.


R。S: the composition of R and S.
A fuzzy relation defined on X and Z.

R S (x, z)  max y min  R ( x, y), S ( y, z) 


  y  R ( x, y)  S ( y, z ) 

Revised Oct.2017 Dr. Khaled El-Metwally, CU 53


Example
S R (x, y)  max v min  R ( x, v), S (v, y) 

R a b c d S   
1 0.1 0.2 0.0 1.0 a 0.9 0.0 0.3
2 0.3 0.3 0.0 0.2 b 0.2 1.0 0.8
3 0.8 0.9 1.0 0.4 c 0.8 0.0 0.7
0.1 0.2 0.0 1.0
d 0.4 0.2 0.3
min 0.9 0.2 0.8 0.4
max 0.1 0.2 0.0 0.4

R S   
1 0.4 0.2 0.3
2 0.3 0.3 0.3
3 0.8 0.9 0.8
Revised Oct.2017 Dr. Khaled El-Metwally, CU 54
Max-min composition is not mathematically tractable,
therefore other compositions such as max-product
composition have been suggested.

Max-Product Composition
X Y Z R: fuzzy relation defined on X and Y.

S: fuzzy relation defined on Y and Z.


R。S: the composition of R and S.
A fuzzy relation defined on X and Z.

R S (x, z)  max y  R ( x, y) S ( y, z) 

Revised Oct.2017 Dr. Khaled El-Metwally, CU 55


Projection
Dimension Reduction

R
RY   R  Y  RX   R  X 

Revised Oct.2017 Dr. Khaled El-Metwally, CU 56


Projection
R
Dimension Reduction
RY   R  Y  RX   R  X 

RY   R  Y  RX   R  X 

  max R ( x, y) / y   maxR ( x, y) / x
Y x X y

R ( y)  max R ( x, y) R ( x)  max R ( x, y)
X
Y y
x

Revised Oct.2017 Dr. Khaled El-Metwally, CU 57


Cylindrical Extension
Dimension Expansion
A : a fuzzy set in X.
C(A) = [AXY] : cylindrical extension of A.
C ( A)    A ( x) | ( x, y) C ( A) ( x, y)   A ( x)
X Y

Revised Oct.2017 Dr. Khaled El-Metwally, CU 58


Introduction to Fuzzy Set Theory

6- Linguistic Variables

Revised Oct.2017 Dr. Khaled El-Metwally, CU 59


Linguistic Variables
• Linguistic variable is “a variable whose
values are words or sentences in a
natural or artificial language”.

• Each linguistic variable may be assigned


one or more linguistic values, which are
in turn connected to a numeric value
through the mechanism of membership
functions.

Revised Oct.2017 Dr. Khaled El-Metwally, CU 60


Motivation
• Conventional techniques for system
analysis are intrinsically unsuited for
dealing with systems based on human
judgment, perception & emotion.

Revised Oct.2017 Dr. Khaled El-Metwally, CU 61


Example
if temperature is cold and oil is cheap

then heating is high

Revised Oct.2017 Dr. Khaled El-Metwally, CU 62


Example
Linguistic Linguistic Linguistic Linguistic
Variable Value Variable Value

if temperature is cold and oil is cheap


cold cheap
high

then heating is high


Linguistic Linguistic
Variable Value

Revised Oct.2017 Dr. Khaled El-Metwally, CU 63


Definition [Zadeh 1973]
A linguistic variable is characterized by a quintuple

 x, T ( x),U , G, M 
Name

Term Set
Universe
Syntactic Rule
Semantic Rule

Revised Oct.2017 Dr. Khaled El-Metwally, CU 64


Example
A linguistic variable is characterized by a quintuple

 x, T ( x),U , G, M 
age
Example semantic rule:
𝑇 𝑎𝑔𝑒 = {𝑜𝑙𝑑, 𝑣𝑒𝑟𝑦 𝑜𝑙𝑑, 𝑦𝑜𝑢𝑛𝑔, 𝑞𝑢𝑖𝑡𝑒 𝑦𝑜𝑢𝑛𝑔, }
M (old)   u, old (u)  u [0,100]

 0 u  [0,50]

 1
old (u )     u  50 2 
[0, 100]  1     u  [50,100]
 
  5  

Revised Oct.2017 Dr. Khaled El-Metwally, CU 65


Example
Linguistic Variable : temperature
Linguistics Terms (Fuzzy Sets) : {cold, warm, hot}

(x)
cold warm hot
1

20 60 x

Revised Oct.2017 Dr. Khaled El-Metwally, CU 66


Hedges & Linguistic Values (Terms)

Extremely old

More or less old

Not young and Not old

Young but not too Young

Revised Oct.2017
complv.m
Dr. Khaled El-Metwally, CU 67
Operations on Linguistic Values (Hedges )
Concentration: CON ( A)  A2

Dilation: DIL( A)  A0.5


Contrast  2 A2 , 0   A ( x )  0.5
INT ( A)  
intensification:   2( A ) 2
, 0.5   A ( x )  1

Revised Oct.2017 intensif.m


Dr. Khaled El-Metwally, CU 68
Introduction to Fuzzy Set Theory

7- Fuzzy Rules

Revised Oct.2017 Dr. Khaled El-Metwally, CU 69


Fuzzy If-Than Rules

A  B  If x is A then y is B.
antecedent consequence
or or
premise conclusion

Revised Oct.2017 Dr. Khaled El-Metwally, CU 70


Examples

A  B  If x is A then y is B.
 If pressure is high, then volume is small.

 If the road is slippery, then driving is dangerous.

 If a tomato is red, then it is ripe.

 If the speed is high, then apply the brake a little.

Revised Oct.2017 Dr. Khaled El-Metwally, CU 71


Fuzzy Rules as Relations

A  B  If x is A then y is B.
R
A fuzzy rule can be defined as a
binary relation with MF R  x, y    AB  x, y 
Depends on how
to interpret A  B

Revised Oct.2017 Dr. Khaled El-Metwally, CU 72


Interpretations of A  B
R  x, y    AB  x, y   ?

A coupled with B A entails B


y y

B B

xx xx
A A
Revised Oct.2017 Dr. Khaled El-Metwally, CU 73
Interpretations of A  B
R  x, y    AB  x, y   ?

A coupled with B A coupled with (A andBB)


A Bentails
y y
R  AB
B   B  A ( x)* B ( y) /( x, y)
X Y

t-norm
xx xx
A A
Revised Oct.2017 Dr. Khaled El-Metwally, CU 74
Interpretations of A  B
R  x, y    AB  x, y   ?

A coupled with B A coupled with (A andBB)


A Bentails
y y
R  AB
B   B  A ( x)* B ( y) /( x, y)
X Y

E.g.,
xx x
R  x, y   min   A ( x), B ( y)x
A A
Revised Oct.2017 Dr. Khaled El-Metwally, CU 75
Introduction to
Fuzzy Set Theory
8- Fuzzy Reasoning

Revised Oct.2017 Dr. Khaled El-Metwally, CU 78


Generalized Modus Ponens

Single rule with single antecedent

Rule: if x is A then y is B
Fact: x is A’
Conclusion: y is B’

Revised Oct.2017 Dr. Khaled El-Metwally, CU 79


Fuzzy Reasoning
Single Rule with Single Antecedent

Rule: if x is A then y is B
Fact: x is A’

Conclusion: y is B’

 ( x) A  ( y) B
A’

x y
Revised Oct.2017 Dr. Khaled El-Metwally, CU 80
Fuzzy Reasoning
Single Rule with Single Antecedent
R  ( x, y)   ( x)  B ( y)
A
Max-Min Composition

Rule: if x is A then y is B
B ( y)  max x min   A ( x), R ( x, y) 
Fact: x is A’
  x   A ( x)  R ( x, y) 
  x   A ( x)   A ( x)  B ( y) 
Conclusion: y is B’

  x   A ( x)   A ( x)   B ( y)
Firing Strength
Firing Strength

 ( x) A  ( y) B
A’

B
x y
Revised Oct.2017 Dr. Khaled El-Metwally, CU 81
Fuzzy Reasoning
Single Rule with Single Antecedent
R ( x, y)   A ( x)  B ( y)
Max-Min Composition
Rule: if x is A then y is B
B ( y)  max x min   A ( x), R ( x, y) 
Fact: x is A’
  x   A ( x)  R ( x, y) 
  x   A ( x)   A ( x)  B ( y) 
Conclusion: y is B’

  x   A ( x)   A ( x)   B ( y)

B  A ( A  B)
 ( x) A  ( y) B
A’

B
x y
Revised Oct.2017 Dr. Khaled El-Metwally, CU 82
Summary
Single rule with Single antecedent

 B ( y)   AR ( x, y)  [ A ( x)   R ( x, y)]


x

B  A  R  A  ( A  B)

 B ( y)  [  A ( x)   A ( x)]   B ( y)
x

 B ( y )  w   B ( y )

Firing Strength
Revised Oct.2017 Dr. Khaled El-Metwally, CU 83
Fuzzy Reasoning
Single Rule with Multiple Antecedents

Rule: if x is A and y is B then z is C

Fact: x is A’ and y is B’
Conclusion: z is C’

Revised Oct.2017 Dr. Khaled El-Metwally, CU 84


Fuzzy Reasoning
Single Rule with Multiple Antecedents

Rule: if x is A and y is B then z is C

Fact: x is A’ and y is B’
Conclusion: z is C’
 ( x)  ( y)  ( z)
A A’
B’ B C

x y z
Revised Oct.2017 Dr. Khaled El-Metwally, CU 85
R  A B  C
Fuzzy Reasoning
Rule: if x is A and y is B then z is C
 ( x, y, z)    ( x, y, z)
Single
Fact: Rule
x is A’ and y is B’with Multiple Antecedents R AB C

Conclusion: z is C’
  A ( x)  B ( y)  C ( z)

Max-Min Composition
C ( z )  max x, y min   A, B ( x, y), R ( x, y, z) 
  x, y   A, B ( x, y)  R ( x, y, z ) 
  x, y   A ( x)  B ( y)   A ( x)  B ( y)  C ( z) 
  x   A ( x)   A ( x)    y  B ( y)  B ( y)   C ( z)

Firing Strength
 ( x)  ( y)  ( z)
A A’
B’ B C

C
x y z
Revised Oct.2017 Dr. Khaled El-Metwally, CU 86
R  A B  C
Fuzzy Reasoning
Rule: if x is A and y is B then z is C
 ( x, y, z)    ( x, y, z)
Single
Fact: Rule
x is A’ and y is B’with Multiple Antecedents R AB C

Conclusion: z is C’
  A ( x)  B ( y)  C ( z)

Max-Min Composition
C ( z )  max x, y min   A, B ( x, y), R ( x, y, z) 
  x, y   A, B ( x, y)  R ( x, y, z ) 

C   A  B   A  B  C 
     ( x )   ( y )   ( x)   ( y )   ( z ) 
x, y A B A B C

  x   A ( x)   A ( x)    y  B ( y)  B ( y)   C ( z)

Firing Strength
 ( x)  ( y)  ( z)
A A’
B’ B C

C
Revised Oct.2017 x Dr. Khaled El-Metwally, CU y z
87
Fuzzy Reasoning
Multiple Rules with Multiple Antecedents

Rule1: if x is A1 and y is B1 then z is C1


Rule2: if x is A2 and y is B2 then z is C2
Fact: x is A’ and y is B’
Conclusion: z is C’

Revised Oct.2017 Dr. Khaled El-Metwally, CU 88


Fuzzy Reasoning
Multiple Rules with Multiple Antecedents
Rule1: if x is A1 and y is B1 then z is C1
Rule2: if x is A2 and y is B2 then z is C2
Fact: x is A’ and y is B’
Conclusion: z is C’

 ( x)  ( y)  ( z) C1
A’ A1 B1 B’

x y z
 ( x)  ( y)  ( z)
A’ A2 B2 B’ C2

x y z

Revised Oct.2017 Dr. Khaled El-Metwally, CU 89


Fuzzy Reasoning
Multiple Rules with Multiple Antecedents
Rule1: if x is A1 and y is B1 then z is C1
Rule2: if x is A2 and y is B2 then z is C2
Fact: x is A’ and y is B’
Conclusion: z is C’
Max-Min Composition
 ( x)  ( y)  ( z) C1
A’ A1 B1 B’
C1
x y z
 ( x)  ( y)  ( z)
A’ A2 B2 B’ C2
C2
x y z

Max
C   A  B   R1  R2   ( z)
  A  B  R1    A  B  R2  C  C1  C2

 C1  C2
Revised Oct.2017 Dr. Khaled El-Metwally, CU z
Summary
Single rule with multiple antecedent

Rm ( A, B, C )  A  B  C  A  B  C

Rm ( A, B, C )  
X Y  Z
A ( x)  B ( y )  C ( y ) /( x, y, z )

C  ( A  B)  ( A  B  C )
C ( z )   [  A ( x)   B ( y)   A ( x)   B ( y )  C ( z )]
x, y

C ( z )  [  A ( x)   A ( x)]  [  B ( y )   B ( y )]  C ( z )
x y

C ( z )  w1  w2  C ( z )
Firing Strength
Revised Oct.2017 Dr. Khaled El-Metwally, CU 91
Introduction to Fuzzy Control Systems

1- Basic Structure of Fuzzy Systems

Revised Oct.2017 Dr. Khaled El-Metwally, CU 92


Basic Structure of Fuzzy Systems

X  ( X) Inference  ( Y) Y
Fuzzifier Defuzzifier
Engine

Fuzzy
Knowledge
Base

Revised Oct.2017 Dr. Khaled El-Metwally, CU 93


Fuzzifier
X  ( X) Inference  ( Y) Y
Fuzzifier
Fuzzifier Defuzzifier
Engine

Fuzzy
Knowledge
Base

Converts the crisp input to a linguistic variable using the membership


functions stored in the fuzzy knowledge base.

Revised Oct.2017 Dr. Khaled El-Metwally, CU 94


Defuzzifier
X  ( X) Inference  ( Y) Y
Fuzzifier Defuzzifier
Defuzzifier
Engine

Fuzzy
Knowledge
Base

Converts the fuzzy output of the inference engine to crisp using


membership functions analogous to the ones used by the fuzzifier.

Revised Oct.2017 Dr. Khaled El-Metwally, CU 95


Fuzzy Knowledge Base
X  ( X) Inference  ( Y) Y
Fuzzifier Defuzzifier
Engine

Fuzzy
Fuzzy
Knowledg
Knowledge
eBase
Base

Information storage for


1. Linguistic variables definitions.
2. Fuzzy rules.

Revised Oct.2017 Dr. Khaled El-Metwally, CU 96


Basic Operations in a Fuzzy Logic
System

Knowledge Base
Data base Rule base Data base

Crisp Fuzzification Fuzzy Inference Fuzzy Defuzzification Crisp

Revised Oct.2017 Dr. Khaled El-Metwally, CU 97


Introduction to Fuzzy Control Systems

2- Fuzzy Inference

Revised Oct.2017 Dr. Khaled El-Metwally, CU 98


Types of Inference
1. Mamadani Fuzzy Model
2. Sugeno Fuzzy Model
3. Tsukamoto Fuzzy Model

Revised Oct.2017 Dr. Khaled El-Metwally, CU 99


1- Fuzzy inference Mamadani
• One of the most commonly used fuzzy inference
technique is the so-called Mamdani method. In
1975, Professor Ebrahim Mamdani of London
University built one of the first fuzzy systems to
control a steam engine and boiler combination.
He applied a set of fuzzy rules supplied by
experienced human operators.

Revised Oct.2017 Dr. Khaled El-Metwally, CU 100


Mamdani fuzzy inference
 The Mamdani-style fuzzy inference process is
performed in four steps:
 fuzzification of the input variables,
 rule evaluation;
 aggregation of the rule outputs, and finally
 defuzzification.

Revised Oct.2017 Dr. Khaled El-Metwally, CU 101


Fuzzy Inference System
Rule 1
w1 fuzzy
x is A1 y is B1
Fuzzy Or Crisp
Crisp Rule 2 fuzzy
fuzzy y
x
w2
x is A2 y is B2 Aggregator Defuzzifier

Rule r fuzzy

wr
x is Ar y is Br

Revised Oct.2017 Dr. Khaled El-Metwally, CU 102


Mamadani FIS
• Fuzzy reasoning
• Rule base
If X is A1 and Y is B1 then Z is C1
If X is A2 and Y is B2 then Z is C2

A1 B1 C1
w1
Z
X Y
A2 B2 C2
w2

Z
X Y
x=3 y=2
Min

C’
Revised Oct.2017 Dr. Khaled El-Metwally, CU Z 103
z COA
Defuzzification

*

Largest of Max.
Smallest of Max.

Mean of Max. Centroid of Area/Gravity

Bisector of Area

Revised Oct.2017 Dr. Khaled El-Metwally, CU 104


Mamadani Eample 1

• Single input single output rule base

If X is Small then Y is Small


If X is Medium then Y is Medium
If X is Large then Y is Large

Revised Oct.2017 Dr. Khaled El-Metwally, CU 105


Mamadani Eample 1
small medium large
Membership Grades

10

0.5
8

0
-10 -5 0 5 10
X 6

Y
small medium large
Membership Grades

1 4

0.5 2

0 0
0 2 4 6 8 10 -10 -5 0 5 10
Revised Oct.2017 Y Dr. Khaled El-Metwally, CU X 106
Mamadani Eample 1

• Two input single output rule base

If X is Small then Y is Small


If X is Medium then Y is Medium
If X is Large then Y is Large

Revised Oct.2017 Dr. Khaled El-Metwally, CU 107


Mamadani Example 2
Membership Grades Membership Grades Membership Grades

small large
1

0.5

0
-5 0 5
X
small large
1
2
0.5
0

Z
0 -2
-5 0 5
Y
large negative small negative small positive large positive 5
1
5
0
0
0.5 Y -5 -5 X

0
-5 0 5
Revised Oct.2017 Dr. Khaled El-Metwally, CU 108
Z
2-Sugeno fuzzy inference
 Mamdani-style inference, as we have just seen,
requires us to find the centroid of a two-dimensional
shape by integrating across a continuously varying
function. In general, this process is not
computationally efficient.
 Michio Sugeno suggested to use a single spike, a
singleton, as the membership function of the rule
consequent. A singleton, or more precisely a fuzzy
singleton, is a fuzzy set with a membership function
that is unity at a single particular point on the
universe of discourse and zero everywhere else.
Revised Oct.2017 Dr. Khaled El-Metwally, CU 109
Sugeno-style fuzzy inference is very similar to the
Mamdani method. Sugeno changed only a rule
consequent. Instead of a fuzzy set, he used a
mathematical function of the input variable. The
format of the Sugeno-style fuzzy rule is
IF x is A
AND y is B
THEN z is f (x, y)
where x, y and z are linguistic variables; A and B
are fuzzy sets on universe of discourses X and Y,
respectively; and f (x, y) is a mathematical
function.

Revised Oct.2017 Dr. Khaled El-Metwally, CU 110


The most commonly used zero-order Sugeno fuzzy
model applies fuzzy rules in the following form:
IF x is A
AND y is B
THEN z is k
where k is a constant.

In this case, the output of each fuzzy rule is constant. All


consequent membership functions are represented by
singleton spikes.

Revised Oct.2017 Dr. Khaled El-Metwally, CU 111


First-Order Sugeno FIS
• Rule base
If X is A1 and Y is B1 then Z = p1*x + q1*y + r1
If X is A2 and Y is B2 then Z = p2*x + q2*y + r2
• Fuzzy reasoning
A1 B1 z1 =
w1 p1*x+q1*y+r1

X Y
A2 B2 z2 =
w2 p2*x+q2*y+r2

X Y w1*z1+w2*z2
x=3 y=2 z=
Min w1+w2

Revised Oct.2017 Dr. Khaled El-Metwally, CU 112


Sugeno Example 1

Revised Oct.2017 Dr. Khaled El-Metwally, CU 113


Sugeno Example 1
(a) Antecedent MFs for Crisp Rules (b) Overall I/O Curve for Crisp Rules
8
Membership Grades small medium large
1
6
0.8
0.6 4

Y
0.4
2
0.2
0 0
-10 -5 0 5 10 -10 -5 0 5 10
X X
(c) Antecedent MFs for Fuzzy Rules (d) Overall I/O Curve for Fuzzy Rules
8
small medium large
Membership Grades

1
6
0.8
0.6 Y 4
0.4
2
0.2
0 0
-10 -5 0 5 10 -10 -5 0 5 10
X X
Revised Oct.2017 Dr. Khaled El-Metwally, CU 114
Sugeno Example 2

Revised Oct.2017 Dr. Khaled El-Metwally, CU 115


Sugeno Example 2
Membership Grades

Small Large
1

0.5

0
-5 0 5
X
Membership Grades

Small Large
1

0.5

0
-5 0 5
Y

Revised Oct.2017 Dr. Khaled El-Metwally, CU 116


3- TSUKAMOTO FIS
• Rule base
If X is A1 and Y is B1 then Z is C1
If X is A2 and Y is B2 then Z is C2

A1 B1 C1
w1
Z
X Y z1

A2 B2 C2
w2

Z
X Y z2
x=3 y=2
Min
w1*z1+w2*z2
z=
w1+w2
Revised Oct.2017 Dr. Khaled El-Metwally, CU 117
Tsukamoto Example

Revised Oct.2017 Dr. Khaled El-Metwally, CU 118


Tsukamoto Example
(a) Antecedent MFs (b) Consequent MFs

small medium large


Membership Grades

Membership Grades
1 1

0.5 0.5 C1 C2 C3

0 0
-10 -5 0 5 10 0 5 10
X Y
(c) Each Rule's Output (d) Overall Input-Output Curve

10 10
Y

5 5

0 0
-10
Revised Oct.2017 -5 0 5 10 -10 CU
Dr. Khaled El-Metwally, -5 0 5 10 119
X X
Fuzzy Reasoning: MATLAB Demo
• >> ruleview mam21

Revised Oct.2017 Dr. Khaled El-Metwally, CU 120