You are on page 1of 31

Intelligent Control

1
Lecturer: VU VAN PHONG

Dr. Van-Phong Vu-Department of Automatic Control


2

 Instructor: Dr. Vu Van Phong


 Email: phongvv@hcmute.edu.vn
 Websites: https://phongvuac.wixsite.com/vuphong/

Dr. Van-Phong Vu-Department of Automatic Control


3

Chapter 6: Fuzzy Inference


Engine

Dr. Van-Phong Vu-Department of Automatic Control


From WJ Wang

4 What is the Fuzzy inference engine


 Fuzzy inference engine is a fuzzy rule base that is composed of
numerous “IF-THEN” rules.
 When a given input goes into the rule base, an output is derived via
some operations.
 In this chapter, several topics are presented.
How to transform IF-THEN rules into a “operation system” ?
How to derive the system’s output ?

Dr. Van-Phong Vu-Department of Automatic Control


From WJ Wang

 Assume Cartesian product X  X 1  X 2 X n represents the


universal set of n fuzzy sets

 A fuzzy rule base is composed of l fuzzy rules given by


IF x1 is A1l , AND x2 is A2l ,..., AND xn is Anl , THEN y is B l
(9.1)
where Ail and B l denote the fuzzy sets of each linguistic
variable.
From WJ Wang

6
Example: Let x1 and x2 be the two inputs of a water-
heater and y is the output. Suppose x1  X 1  [0 C, 30 C]
and x2  X 2  [0, 10] , respectively, represent temperature of
inlet water and firepower of fuel gas. Define two fuzzy sets,
Low and High, on the universal set X 1 ; two fuzzy sets, Weak
and Strong, on X 2. We present four rules as follows.

R (1) : IF x1 is Low AND x2 is Weak , THEN y is Cold .


R ( 2 ) : IF x1 is Low AND x2 is Strong , THEN y is Warm .

R ( 3) : IF x1 is High AND x2 is Weak , THEN y is Hot.

R ( 4 ) : IF x1 is High AND x2 is Strong , THEN y is Very Hot .


From WJ Wang

7
Properties

 Complete: For every input x  X , there exists at least one rule


R (l ) Ail ( xi )  0, i  1, 2,..., n.
is fired , such that
Otherwise, FP1(x)=0, such that the input is not handled at
all 。

 Consistent: The situation “For two rules having the same fuzzy
proposition FP1 of input, they have different propositions FP2
of consequent part” does not occur.

 Continuous: For any two adjacent rules, FP2 must have


overlap part.
From WJ Wang

Suppose that the fuzzy rule base are composed of m rules, in


() ( )
which R is given by R : IF... , THEN ... ,   1, 2,..., m

 Antecedent part (FP1)


(9.2)
IF x1 is A AND x2 is A

1

2

 Consequent part (FP2)


(9.3)
THEN y is B 

(9.4)
From WJ Wang

IF-THEN (Fuzzy implication) is a Fuzzy Relation.


(9.5)
R () is considered as the fuzzy relation defined in X  Y. Thus,
R ( )  A1  A2  B 
Moreover, it could be extended into
R ( )  A1  A2   An  B1  B2   Bk

Suppose there are m rules, the combination result is


m 
Q  R Q
( )
M
1

Mandani Cobination
10


 
𝑨 ′
Fuzzy
 
𝑩
Inference
Engine

 
= Q

Dr. Van-Phong Vu-Department of Automatic Control


List m fuzzy rules
11

Find the fuzzy relation of each rule


R ()  A1  A2   An  B1  B2   Bk

Method 1:
m 
Q  R ( )  QM
1

 
= Q
Dr. Van-Phong Vu-Department of Automatic Control
List m fuzzy rules
12

Find the fuzzy relation of each rule


R ()  A1  A2   An  B1  B2   Bk

Method 2:
Find output of each rules
B  A  R ( ) ,   1, 2,..., m.

m
B  B
1
Dr. Van-Phong Vu-Department of Automatic Control
From WJ Wang

 Consider the fuzzy rules


13
IF x1 is A1 AND x2 is A2 THEN y is B 
 Minimum Inference Engine ( standard intersection, Mamdani Min
Implication) (Max-Min)
m
B( y )  max[ max ( A( x)  A1 ( x1 )  A2 ( x2 )  B  ( y ) )]
1 x

 Product Inference Engine ( Product intersection, Mamdani Product


Implication) (Max-Product)

m
B( y )  max[ max ( A( x)  A1 ( x1 )  A2 ( x2 )  B  ( y ) )]
1 x

Dr. Van-Phong Vu-Department of Automatic Control


14
When the input is a singleton, the implication could be
simplified.

Definition of a singleton fuzzy set:


1 , if x  ( x1 , x2* )  X (it is two dim space);
A( x)  A(x1 , x2 )= 
0 , otherwise.

1
A

X

x
15

m
(9.11)  B( y )  max [ A1 ( x1 )  A2 ( x2 )  B  ( y )]
1

m
(9.10)  B( y )  max [ A1 ( x1 )  A2 ( x2 )  B  ( y )]
1

Dr. Van-Phong Vu-Department of Automatic Control


16
Example 1: There is only one fuzzy rule in the rule base
represented by
IF x1 is A1 AND x2 is A2 , THEN y is B

1  x1  1 , if 0  x  2;
A1 ( x1 )  
0, otherwise.

1  x2  2 , if 1  x  3;
A2 ( x2 )  
0, otherwise.
1  y , if - 1  y  1;
B( y )  
0, otherwise.
17
For input is singleton

1, x 
 ( x 
, x 
2 )  (0.5,0.15);
A( x )  
 1

0, otherwise.

Find output=?? (Max-Min and Max-Product)

Dr. Van-Phong Vu-Department of Automatic Control


18
Max-Min
B ( y )
(9.17)  B( y )  0.5  B( y )  Fig. 9.4(c)
-1 0 +1

Max-Product
(9.16)  B( y )  0.5  0.5  B( y )  0.25 B( y )
B ( y )
1
 (1  y ),  1  y  1
 4
0, -1 0 +1
Dr. Van-Phong Vu-Department of Automatic Control
19
Example 2: Two fuzzy rules in the fuzzy rule base.

R (1) : IF x1 is A11 AND x2 is A21 , THEN y is B1


R ( 2 ) : IF x1 is A12 AND x2 is A22 , THEN y is B 2

In Rule 2:
1  x1  0.5 , if - 0.5  x  1.5;
A ( x1 )  
1
2

0, otherwise.
1  x2  1.5 , if 0.5  x  2.5;
A ( x2 )  
2
2
0, otherwise.

1  y  1 , if  2  y  0;
B ( y)  
2

0, otherwise.
20
For input is singleton

1, x   ( x1 , x2 )  (0.3, 1.3)


A( x )  

0, otherwise

Find output=?? (Max-Min and Max-Product)

Dr. Van-Phong Vu-Department of Automatic Control


21
 B ( y )  max ( A11 (0.3)  A21 (1.3)  B 1 ( y ) ,

A12 (0.3)  A22 (1.3)  B 2 ( y ))  max (0.3  B1 ( y ), 0.8  B 2 ( y ))

B2 B1
0.8

0.3 B ( y )
y
-2 -1 0 1
Fig. 9.6b
22
 B ( y )  max (0.3  0.3  B 1 ( y ), 0.8  0.8  B 2 ( y ))

 max ( 0.09 B1 ( y ), 0.64 B 2 ( y ))

B2 B1

0.64
0.64

0.09

-2 -1 0 1
Fig. 9.6a
23
Example 3: There is only one rule in the fuzzy rule base.

If x1 is A1 AND x2 is A2 , THEN y is B

where
x1 , x2  X  {a, , b, c} and
y  Y  {a, b, c}

A1 ,0.4  0.9  1
a b c

A2  0.3  0.9  0.4


a b c

B  0.5  0.6  0.2


a b c
24
Input is A1  0.6  0.5 ,  0.3 A2  0.2  0.4  0.9
a b c a b c

Please final output . B (max-min)

Sol :

B( y )  max [ A( x)  A1 ( x1 )  A2 ( x2 )  B ( y )]


x

B( y )  max max{ A1( x1 )  A2 ( x2 )  A1 ( x1 )  A2 ( x2 )  B( y )}


x1 x2               
33   x  333 R
25

B ( y )  [max ( A1( x1 )  A1 ( x1 ))]  [max ( A2 ( x2 )  A2 ( x 2 ))]  B( y )


x1 x2

 [max (0.4  0.5  0.3 )]  [max (0.2  0.4  0.4 )]


x1 a b c x2 a b c

 (0.5  0.6  0.2 )  0.5  0.4  (0.5  0.6  0.2 )


a b c a b c

 0.4  0.4  0.2


a b c
26
Input is fuzzy set

m m
B( y )   B ( y )   {[max ( A1( x1 )  A1 ( x1 ))]
x1
1 1

 [max ( A2 ( x2 )  A2 ( x2 ))]  B  ( y )}


x2 (9.26)

A1 A11 A2 A21 B1

R1
27

A1 A12 A2 A22


B2
R2

B
B1  B 2  max( B1 , B 2 )  B 
 Max-Min
 Max-Prod
30

Thanks for Listening

Dr. Van-Phong Vu-Department of Automatic Control


31

Dr. Van-Phong Vu-Department of Automatic Control

You might also like