You are on page 1of 51

Fuzzy Logic Theory

Dr. Xiao-Zhi Gao Department of Electrical Engineering Helsinki University of Technology gao@cc.hut.fi

Page 1

Institute of Intelligent Power Electronics IPE

Outline
Fuzzy set theory
Basic concepts in fuzzy sets Operations on fuzzy sets

Fuzzy rules and reasoning Fuzzy inference systems


Mamdani fuzzy systems Sugeno fuzzy systems

Page 2

Institute of Intelligent Power Electronics IPE

Primer of Fuzzy Sets


From classical crisp sets to fuzzy sets
Change of range of membership functions

Notions of fuzzy sets


Representation, support, cut, convexity ...

Fuzzy set operations


Intersection, union, complement, etc. Share almost the same mathematics foundamentals with those of classical sets
Page 3 Institute of Intelligent Power Electronics IPE

Basics of Fuzzy Sets


Classical sets
two-value membership functions An element either belongs to or does not belong to a given classical set (sharp boundary)

Fuzzy sets

Extend the degrees of membership: {0,1} [0,1] An element partially belongs to and partially does not belong to a given fuzzy set Smooth and Gradual boundary Assignment of membership functions is subjective

Membership functions

Page 4

Institute of Intelligent Power Electronics IPE

Father of Fuzzy Logic: Lotfi A. Zadeh


Lotfi Asker Zadeh is a Professor in the Graduate School, Computer Science Division, Department of EECS, University of California, Berkeley. In addition, he is serving as the Director of BISC (Berkeley Initiative in Soft Computing). http://en.wikipedia.org/wiki/Lotfi_Asker_Zadeh http://www-bisc.cs.berkeley.edu/

Page 5

Institute of Intelligent Power Electronics IPE

Four Typical Membership Functions


(a) Triangular MF 1.2 1.2 (b) Trapezoidal MF

Membership Grades

0.8 0.6 0.4 0.2 0 0 20 40 60 80 100

Membership Grades

1 0.8 0.6 0.4 0.2 0 0 20 40 60 80 100

(c) Gaussian MF 1.2 1.2

(d) Generalized Bell MF

Membership Grades

0.8 0.6 0.4 0.2 0 0 20 40 60 80 100

Membership Grades

1 0.8 0.6 0.4 0.2 0 0 20 40 60 80 100

Page 6

Institute of Intelligent Power Electronics IPE

Definitions in Fuzzy Sets


Supports A ( x) > 0 Core A ( x) = 1 Crossover points A ( x) = 0.5 Height max[ A ( x) ] Fuzzy singleton
A fuzzy singleton is a crisp set A fuzzy set that has only one element x0 A ( x0 ) = 1
Page 7 Institute of Intelligent Power Electronics IPE

Definitions in Fuzzy Sets

Fuzzy Singleton

Page 8

Institute of Intelligent Power Electronics IPE

Representations of Membership Functions


Discrete Fuzzy Sets
Universe of discourse is discrete

Continuous Fuzzy Sets


Universe of discourse is continuous

Page 9

Institute of Intelligent Power Electronics IPE

Discrete and Continuous Fuzzy Sets


(a) MF on a Discrete Universe 1.2

Membership Grades

1 0.8 0.6 0.4 0.2 0 0 1 2 3 X = Number of Children 4 5 6

(b) MF on a Continuous Universe 1.2

Membership Grades

1 0.8 0.6 0.4 0.2 0 0 10 20 30 40 50 X = Age 60 70 80 90 100

Page 10

Institute of Intelligent Power Electronics IPE

Cuts of Fuzzy Sets


(a constant) cut of a fuzzy set is a
crisp set Strong

core( A) = A1
Page 11

Aa = {x A (x) > } support( A) = A0


Institute of Intelligent Power Electronics IPE

Aa = {x A (x) }

cuts

Resolution Principle
A fuzzy membership function can be expressed in terms of the characteristic functions of its cuts

A ( x) = max min[ , A ]

An example of decomposing a fuzzy set with discrete objects


0.1 0.2 0.3 A= , , 1 2 3
Page 12 Institute of Intelligent Power Electronics IPE

Resolution Principle
1 1 1 A0.1 = + + 1 2 3 1 1 A0.2 = + 2 3 1 A0.3 = 3 0.1 0.1 0.1 + 0.1A0.1 = + 1 2 3 0.2 0.2 + 0.2 A0.2 = 3 2 0.3 0.3 A0.3 = 3 0.1 max(0.1,0.2) max(0.1,0.2,0.3) 0.1 0.2 0.3 A= + + + = + 1 2 3 1 2 3
Page 13 Institute of Intelligent Power Electronics IPE

Resolution Principle
Resolution Principle 1.2 1

0.8
Membership Grades

0.6

0.4

0.2

10

20

30

40

50 x

60

70

80

90

100

Page 14

Institute of Intelligent Power Electronics IPE

Extension Principle
Extending crisp domains of mathematical expressions to fuzzy domains Suppose f is a function mapping from X to Y, and A is a fuzzy set:
A=

A ( x1 )
x1

A ( x2 )
x2

+L+

A ( xn )
xn

we have image of A under f:


B = f ( A) =

A ( x1 )
f ( x1 )

A ( x2 )
f ( x2 )

+L+

A ( xn )
f ( xn )

Page 15

Institute of Intelligent Power Electronics IPE

Extension Principle
An example of extension principle
0 . 1 0 .4 0 .8 0 . 9 0 . 3 A= + + + + 2 1 0 1 2
f ( x) = x 2 3

0.1 0.4 0.8 0.9 0.3 B= + + + + 1 2 3 2 1 0.8 (0.4 0.9) (0.1 0.3) = + + 3 2 1 0.8 0.9 0.3 = + + 3 2 1
Page 16 Institute of Intelligent Power Electronics IPE

Extension Principle

Page 17

Institute of Intelligent Power Electronics IPE

Convex Fuzzy Sets


Convexity of fuzzy sets

where x1 and x2 are two arbitrary elements in A, and is an arbitrary constant

Page 18

Institute of Intelligent Power Electronics IPE

Convex and Nonconvex Fuzzy Membership Functions


(a) Two Convex Fuzzy Sets 1.2

Membership Grades

1 0.8 0.6 0.4 0.2 0

(b) A Nonconvex Fuzzy Set 1.2

Membership Grades

1 0.8 0.6 0.4 0.2 0

Page 19

Institute of Intelligent Power Electronics IPE

Operations on Fuzzy Sets


Intersection

Union

Complement

Page 20

Institute of Intelligent Power Electronics IPE

Operations on Fuzzy Sets


(a) Fuzzy Sets A and B 1.2 A 1 B 1 0.8 0.6 0.4 0.2 0 1.2 (b) Fuzzy Set "not A"

A and B

0.8 0.6 0.4 0.2 0

A
(d) Fuzzy Set "A AND B"

(c) Fuzzy Set "A OR B" 1.2 1.2 1 0.8 0.6 0.4 0.2 0

A U B

1 0.8 0.6 0.4 0.2 0

A I B

Page 21

Institute of Intelligent Power Electronics IPE

Operations on Fuzzy Sets


Subset Equality

A B and B A

Page 22

Institute of Intelligent Power Electronics IPE

Concept of A B
A Is Contained in B 1.2 1 B

0.8

Membership Grades

0.6

0.4

0.2

Page 23

Institute of Intelligent Power Electronics IPE

Linguistic Variables
Modeling of human thinking
Numerical values are not sufficient Linguistic variables exist in real world e.g, chatting with a stranger on the phone
Estimation of your partners age: (40? probability of 40? About middle-aged?)

Linguistic variables are characterized by linguistic values (Age:[Young, Old, Very Old, etc.]) Linguistic values are described by their fuzzy membership functions
Page 24 Institute of Intelligent Power Electronics IPE

Membership Functions For Linguistic Values Young, Middle Aged, and Old
1.2 Young Middle Aged Old 1

Age: Linguistic Variable

Membership Grades

0.8

0.6

Young, Middle Aged, and Old: Linguistic Values

0.4

0.2

10

20

30

40 X = Age

50

60

70

80

90

Page 25

Institute of Intelligent Power Electronics IPE

Membership Functions For Primary and Composite Linguistic Values


(a) Primary Linguistic Values 1

Membership Grades

0.8 0.6 0.4 0.2 0

Young

Old

10

20

30

40

50 X = age

60

70

80

90

100

(b) Composite Linguistic Values 1

Extremely Old = Old4

Membership Grades

0.8 0.6 0.4 Young but Not Too Young

Not Young and Not Old

Extremely Old More or Less Old

0.2 0

10

20

30

40

50 X = age

60

70

80

90

100

Page 26

Institute of Intelligent Power Electronics IPE

Fuzzy IF-THEN Rules


A fuzzy IF-THEN rule is expressed as
IF x is A THEN y is B
Premise Part Consequent Part

A and B are fuzzy membership functions

A fuzzy IF-THEN rule associates fuzzy input and output membership functions
Page 27 Institute of Intelligent Power Electronics IPE

Fuzzy Reasoning
Fuzzy reasoning derives conclusions based on given fuzzy IF-THEN rules and known facts
An example:
Given a fuzzy rule: IF bath is very hot THEN add a lot of cold water Known fact: bath is a little hot Conclusion: how much cold water should be added?
Page 28 Institute of Intelligent Power Electronics IPE

Fuzzy Reasoning
Premise 1: IF X is A THEN Y is B Premise 2: IF X is A Conclusion: THEN Y is B
First, measure the similarity between A and Second, project this similarity to B

There are a few composition operations used in fuzzy reasoning procedure


Max-Min is most widely employed
Page 29 Institute of Intelligent Power Electronics IPE

Fuzzy Reasoning for Single Rule with Single Antecedent

Intersection

IF X is A THEN Y is B Known Fact: X is A


Institute of Intelligent Power Electronics IPE

Page 30

Fuzzy Reasoning for Single Rule with Multiple Antecedents

IF X is A and Y is B THEN Z is C Known Facts: X is Aand Y is B


Page 31

w=min(w1, w2) or w=w1*w2

Institute of Intelligent Power Electronics IPE

Fuzzy Reasoning For Multiple Rules with Multiple Antecedents

Aggregation
Known Facts: X is A Y is B
Page 32

If X is A1 and Y is B1 Then Z is C1 If X is A2 and Y is B2 Then Z is C2

Institute of Intelligent Power Electronics IPE

Fuzzy Logic Systems


Fuzzification Interface Crisp Input Fuzzy Input Rules Fuzzy Rule Base Inference Engine Fuzzy Output Defuzzification Interface Crisp Output

Mamdani and Sugeno Fuzzy Inference Systems


Page 33 Institute of Intelligent Power Electronics IPE

Fuzzification
Converts a crisp value (from sensors, devices, measurement meters, etc.) into a fuzzy value A crisp value = A fuzzy singleton (no fuzziness is introduced)
A ( x)

x0: Crisp Value

A ( x)

Fuzzy singleton x0

Page 34

Institute of Intelligent Power Electronics IPE

Mamdani Fuzzy Inference Systems


Mamdani fuzzy inference systems
IF x is A THEN y is B

Both premise and consequent parts consist of fuzzy membership functions Max-Min composition can be applied in fuzzy reasoning procedure

Page 35

Institute of Intelligent Power Electronics IPE

Mamdani Fuzzy Inference Systems

If X is A1 and Y is B1 THEN Z is C1 If X is A2 and Y is B2 THEN Z is C2

x and y are two input values

Page 36

Institute of Intelligent Power Electronics IPE

Defuzzification Methods

Page 37

Institute of Intelligent Power Electronics IPE

Defuzzification Methods
Centroid of Area (COA)
Z* = COA

i=1 n i=1

(xi )x i (x i )

where

* COA

is a crisp output

Bisector of Area (BOA)

i=1

(xi ) =

j=M +1

(x j)

where Z* sec t = xM is a crisp output Bi


Page 38 Institute of Intelligent Power Electronics IPE

Defuzzification Methods
Mean of Maximum (MOM)
Z
* i

* MOM

x* i
i

where A (x ) reaches maximal values of A (x)

MOM could generatate wrong discrete outputs in certain cases Different defuzzification methods may have similar performances [Lee 88]
Page 39 Institute of Intelligent Power Electronics IPE

Mamdani Fuzzy Model: An Example


A Two-Input and Single-Output Mamdani fuzzy logic system with four rules
IF X is small and Y is small THEN Z is large negative IF X is small and Y is large THEN Z is small negative IF X is large and Y is small THEN Z is small positive IF X is large and Y is large THEN Z is large positive

Page 40

Institute of Intelligent Power Electronics IPE

Fuzzy Input and Output Membership Functions


Membership Grades
1 small large 0.5 0 -5 -4 -3 small -2 -1 0 X 1 2 3 large 4 5

Membership Grades

0.5

0 -5

-4 large negative

-3

-2

-1

0 Y

4 large positive

Membership Grades

small negative

small positive

0.5

0 -5

-4

-3

-2

-1

0 Z

Page 41

Institute of Intelligent Power Electronics IPE

Mamdani Input/Output Surface


3 2 1
Z

0 -1 -2 -3 5 5 0 0 -5 -5

Nonlinear Input/Output Surface

Page 42

Institute of Intelligent Power Electronics IPE

Sugeno Fuzzy Inference Systems


Sugeno fuzzy inference systems
IF x is A THEN y = f(x)

Only premise part employs fuzzy membership functions Consequent output is a function of input variables
First order = linear consequent part Higher orders = nonlinear consequent part
Page 43 Institute of Intelligent Power Electronics IPE

Sugeno Fuzzy Inference Systems

If X is A1 and Y is B1 THEN Z = p1x+q1y+c1 If X is A2 and Y is B2 THEN Z = p2x+q2y+c2


Z: Output

First Order Sugeno Inference System


Page 44 Institute of Intelligent Power Electronics IPE

Sugeno Fuzzy Inference Systems


Advantages:
No defuzzification method is needed Easy to analyze
linear with respect to consequent parameters (only first order consequent part case)

Disadvantages
Difficult to interpret practical meanings of consequent part
Page 45 Institute of Intelligent Power Electronics IPE

Sugeno Fuzzy Model: An Example


A Two-Input and Single-Output Sugeno fuzzy logic system with four rules
IF X is small and Y is small THEN z = -x+y+1 IF X is small and Y is large THEN z = -y+3 IF X is large and Y is small THEN z = -x+3 IF X is large and Y is large THEN z = -x+y+2

Page 46

Institute of Intelligent Power Electronics IPE

Fuzzy Input Membership Functions


1.2 Small Large

Membership Grades

1 0.8 0.6 0.4 0.2 0 -5 -4 -3 -2 -1 0 X 1 2 3 4 5

1.2 Small Large

Membership Grades

1 0.8 0.6 0.4 0.2 0 -5 -4 -3 -2 -1 0 Y 1 2 3 4 5

Page 47

Institute of Intelligent Power Electronics IPE

Sugeno Input/Output Surface


10 8 6
Z

4 2 0 -2 5 5 0 0 -5 -5

Nonlinear Input/Output Surface

Page 48

Institute of Intelligent Power Electronics IPE

Diagram of A Fuzzy Logic System

Page 49

Institute of Intelligent Power Electronics IPE

Conclusions
Background knowledge of fuzzy sets is introduced Concept of fuzzy sets is basically a natural generalization of classical sets Fuzzy sets have some characteristics different from classical sets Fuzzy inference systems are used to model human thinking
Page 50 Institute of Intelligent Power Electronics IPE

Conclusions
Two fuzzy logic systems: Mamdani and Sugeno types Engineering potential is more important than pure theoretical research Applications of fuzzy logic and fusion with neural networks will be discussed later
Fuzzy control and fuzzy signal filtering Fuzzy neural networks
Page 51 Institute of Intelligent Power Electronics IPE

You might also like