Vous êtes sur la page 1sur 26

SKEM 4173 Artificial Intelligence

Chapter 2 Part 2
Fuzzy Logic Control

Dr. Mohamad Hafis Izran B Ishak


CMED
Faculty of Electrical Engineering
Universiti Teknologi Malaysia
hafis@fke.utm.my

Topic 2: Fuzzy Logic Control


(9 hours) 3 weeks
Fuzzy sets and fuzzy systems
Definitions, fuzzy set operations,
fuzzy relations & fuzzy reasoning
Fuzzy logic control systems &
applications
Components of FLCS, design of FLCS
During Class

One/Two students will be called to:


Introduce yourself
Your name/family etc.
Your academic background
Your hometown/country
Your experience with any AI machine(s)
What your expectation from this course
Talk about 5 minutes.
Extra bonus marks will be given
Any volunteer for today?

Fuzzy Set
Operations
Basic Fuzzy Set Operations
The use of fuzzy sets provides a basis for the
systematic manipulation of vague and imprecise
concepts using fuzzy set operations performed by
manipulating the membership functions.

Let A and B be two point-valued fuzzy sets in U with


membership functions mA and mB, respectively as
given in the next page.

3
Consider these two fuzzy sets:

mA mB
A B

u u

How do you perform an operation of one


fuzzy set to another?

Fuzzy Set Operations

Equality
Two fuzzy sets A and B are equal if they are defined on the
same universe and the membership function is the same for
both, that is:

A B iff m A u m B u u U

Union
The union of two fuzzy sets A and B is the fuzzy set
whose membership function is given by: A B
m A B u maxm A u , m B u u U

5
Fuzzy Set Operations

Intersection
The intersection of two fuzzy sets A and B is the fuzzy set
whose membership function is given by:

m A B u minm A u , m B u u U

A B

Fuzzy Set Operations

Subset

A B iff m A (u ) m B (u ) u U

Draw the graph showing subset


Complement
The complement of a (normalized) fuzzy set A
with membership function mA is defined as the
fuzzy set on the same universe with membership Not A
function:
A
m A ' u 1 m A u u U

7
Fuzzy Set Operations

1.2.3 Fuzzy Set Operations


for Modifying Membership Functions
The shape of membership functions of fuzzy sets can be
changed.
This can be done by using specific operations.

Power
If p is a positive number and A is a fuzzy set with membership
function mA(u), then A on power p, denoted by Ap, is defined as:


A p ( x, m A ( x)) ( x, ( m A ( x)) p
p

8

Fuzzy Set Operations


Concentration
A fuzzy set A can be concentrated by modifying its
membership function so as to accentuate the
membership of the higher membership elements.

m CON A u m A u 2 u U

mA

1
A
CON(A)

0
Note: This operation is unique with fuzzy sets only. If this operation is carried out with a crisp set, it results in no
change.
9
Fuzzy Set Operations

Dilation
A fuzzy set A can be dilated by modifying its membership
function to increase the importance of lower membership
elements.

m DIL A u m A u 0.5 u U

mA

1
DIL(A)
A

0
Note: These operations are unique with fuzzy sets only. If they are carried out with crisp sets, they result in no
change.
10

Fuzzy Set Operations

Intensification
This operation moves the normalized fuzzy set closer to
being crisp, by enhancing the membership value of those
elements whose membership was above 0.5 and
diminishing that of those elements with membership below
0.5.

2m A u 2 for 0 m A u 0.5
m INT A U
1 21 m A u for 0.5 m A u 1
2

mA

1
A INT(A)

11
Exercise 4a

Consider the fuzzy set A:


A={(1,0.1), (2,0.8), (3,1), (4,0.2),
(5, 0.5)}
Solve:
o A3
o CON(A)
o DIL(A)
o INT(A)
Draw graphs showing the
operations
12

Exercise 4a

13
Fuzzy Set Operations

Exercise 4b
For the fuzzy set with the following membership
function (take the elements of the universe of
discourse to be 0, 0.5, 1, 1.5 and 2), find and draw
the graphs of
CON(A)
DIL(A)
u for 0 u 1
m A (u )
2 u for 1 u 2

14

Fuzzy Set Operations

Exercise 4b

15
Fuzzy Set Operations

Some Advanced Fuzzy Set Operations


Algebraic product
The algebraic product of two fuzzy sets A and B is the
multiplication of the membership functions which is given by:

m AB u m A u m B u u U

Algebraic sum
The algebraic sum of two fuzzy sets A and B is also known as
probabilistic sum and is given by the following expression:

m A B u m A u m B u - m A u m B u u U

16

Fuzzy Set Operations

Exercise 5

Consider the fuzzy sets A and B where:


A={(x1, 0.2), (x2, 0.4), (x3, 1), (x4, 0.3), (x5, 0.1)}
B={(x1, 0.1), (x2, 0.3), (x3, 0.6), (x4, 0.4)}

Solve:
algebraic product
algebraic sum.
17
Fuzzy Set Operations

A U A
identity
A A
A
Properties
A U U
of
A B B A
Algebraic commutativity
A B B A
product
and sum ( A B) C A ( B C )
associativity
( A B) C A ( B C )
A B A B
De Morgan' s law
A B A B
18

Fuzzy Set Operations

Bounded product
The bounded product of two fuzzy sets A and B with membership
functions is the fuzzy set whose membership function is given by:

m AB u max 0, m A u m B u 1 u U

Bounded sum
The bounded sum of two fuzzy sets A and B with membership
functions and is the fuzzy set whose membership function is
given by:

m A B u min1, m A u m B u u U

where + is the arithmetic sum operator.

19
Fuzzy Set Operations

Drastic product
The drastic product of two fuzzy sets A and B with membership
function and is the fuzzy set whose membership function is
given by:

m A u for m B u 1

m A B u m B u for m A u 1
0 for m A u , m B u 1

20

Exercise 6:

Consider the fuzzy sets A and B where:

A={(x1, 0.2), (x2, 0.3), (x3, 1), (x4, 0.5), (x5, 0.1), }
B={(x1, 0.0), (x2, 0.3), (x3, 0.6), (x4, 0.7), (x5, 0.9)}

Perform the following on A and B:


(1). Algebraic product
(2). Algebraic sum
(3). Bounded product
(4). Bounded sum
(5). Drastic product

21
m AB u max 0, m A u m B u 1 u U

A={(x1, 0.2), (x2, 0.3), (x3, 1), (x4, 0.5), (x5, 0.1)}
B={(x1, 0.0), (x2, 0.3), (x3, 0.6), (x4, 0.7), (x5, 0.9)}

m A u for m B u 1

m A B u m B u for m A u 1
0 for m A u , m B u 1

22

Fuzzy Set Operations


Table of Summary of Fuzzy Set Operators
Fuzzy set operations Operator expressions

Equality A u B u u U
Union A B u max A u , B u for all u U
Intersection A B u min A u , B u for all u U
Complement A u 1 A u u U
Normalization NORM A u A u / max A u u U
CON A u A u
2
Concentration u U
DIL A u A u
0.5
Dilation u U
2u A u for 0 m A u 0.5
2

Intensification u INT A u
1 21 u A u for 0.5 u A u 1
2

Algebraic product u A B u u A u u B u for all u U


Bounded sum u A B u min1, u A u u B u for all u U
Bounded product u A B u max0, u A u u B u 1 for all u U
u A u for u B u 1

Drastic product u A B u u B u for u A u 1
0 for u A u , uB u 1
Algebraic Sum
Algebraic Sum m A B u m A u m B u - m A u m B u u U

23
Fuzzy Relations

Fuzzy Relations

Cartesian Products
Fuzzy Relations
Compositional Operators

24

Fuzzy Relations

Cartesian Products
What are Cartesian products?
Cartesian product is used to define a relation between
two or more sets (be it crisp or fuzzy).
Suppose A and B are two crisp sets. The Cartesian product
of A and B is denoted A B and is defined as:

A B ( a, b) | a A, b B

where (a,b) is an ordered pair.


Hence, if A has m elements and B has n elements, there
will be m x n elements in AxB.

25
Fuzzy Relations

Example (Crisp Set):

A={0,1}, B={a,b,c}
AB={(0,a),(0,b),(0,c),(1,a),(1,b),(1,c
)}
BA={(a,0),(b,0),(c,0),(a,1),(b,1),(c,1
)}
AA={(0,0),(0,1),(1,0),(1,1)}

26

Cartesian Product
The Cartesian product of 2
universes: X Y x, y | x X , y Y
Complete
relationship
The strength of the
relationship between
1, x, y X Y
ordered pairs of elements c X Y x, y
in each universe is 0, x, y X Y
measured by the
characteristic function,
denoted as c psi. No
relationship

R X Y
27
Fuzzy Relations

Example 3
Person-Sport Relation (Non-fuzzy relation)
Consider 2 sets as follows:
A={Ahmad, Bala, Chong}
B={Football, Hockey, Badminton, Tennis}

The cartesian product of sets A and B is the set containing 3x4=12


elements such that:
{(Ahmad, Football), (Ahmad, Hockey), Ahmad, Badminton), ..,
(Chong, Tennis)}

Suppose R is the relation showing who plays which sports such


that:
Ahmad: Hockey, Badminton
Bala: Football, Badminton
Chong: Hockey, Tennis
28

This can be represented either in tabular form:

F H B T
Ahmad x x
Bala x x
Chong x x

or diagram form below:


R Football
Ahmad
Hockey
Bala
Badminton
Chong
Tennis

The cartesian product AxB includes all the possible relations from A
to B and other lesser relation is considered a subset of the cartesian
product.

29
Cardinality of Crisp Relations
In mathematics, the cardinality of a set is a measure of the
"number of elements of the set".
Suppose n elements of universe X are related to m elements of
universe Y.
Then, nX is the cardinality of X and nY is the cardinality of Y.
Thus, if R is the relation between the universes of X and Y,
then the cardinality of R is:

n X Y n X nY
The cardinality of the power set, P(X x Y), describing R is:

n P X Y 2 n X nY
30

Fuzzy Relations

Fuzzy Relations
In fuzzy relations, the strength of an r-ary
relation between ordered pairs of r universes
is measured with a membership function,
expressing various degrees of strength of the
relation on the unit interval [0,1],
mR(x1, x2,, xn)[0,1]

31
Fuzzy Relations

Defining Fuzzy Relations using Cartesian Product

The cartesian product between two fuzzy sets A and B


results in a fuzzy relation R which is contained within
the full Cartesian product space:
AB=R XY
where the fuzzy relation R has membership function
mR(x,y)= mAB(x,y)=min{mA(x), mB(y)}

32

Fuzzy Relations

Example 4a:

Given two fuzzy sets A (ambient temperature) and B


(near optimum pressure), determine the relation R,
defined on the Cartesian product of the universes of A
and B.
0.2 0.5 1 0.3 0.9
A , , , B ,
x1 x2 x3 y1 y2

0.2 0.2
R 0.3 0.5
0.3 0.9
33
Fuzzy Relations

Example 4b
Person-Sport Relation (Fuzzy relation)
From Example 3, suppose the relation does not simply state either
yes(1) or no(0) but a more natural degree of association to each
pair is given.

For example a relation matrix as follows is given:

F H B T
Ahmad 0 0.8 0.7 0
Bala 1.0 0 0.3 0
Chong 0 0.9 0 0.6

34

A fuzzy graph showing the (Person, Sport) relation is shown below:

Football
Ahmad 0.8 1.0
Hockey
Bala 0.7 0.9
Badminton
Chong 0.3
Tennis
0.6

35
Operations on Fuzzy Relations
Suppose R and S are fuzzy relations on Cartesian space
X x Y, then the following operations apply
(similar to operations on Fuzzy sets):

Union: R S x, y maxm R x, y , m S x, y

Intersection: R S x, y minm R x, y , m S x, y

Complement: R x, y 1 m R x, y

Containment: R S R x, y mS x , y

36

Properties of Fuzzy Relations

All these properties hold for fuzzy relations:


Commutativity
Associativity
Distributivity
Involution
Idempotency
De Morgans laws
Except
Excluded Middle laws R R E
And Law of Contradiction
R R
37
Exercise 6
Unlike Crisp Sets, the Excluded Middle
Laws and the Laws of Contradiction do not
hold for Fuzzy Relations or Fuzzy Sets, why
is this so?

A A X
Crisp Sets
A A

Fuzzy Sets or RR E
Fuzzy Relations RR
PROOF USING GRAPHS OF MEMBERSHIP FUNCTIONS
38

Exercise 6
Ex.:
Not R

Fuzzy Sets or RR E
Fuzzy Relations RR

PROOF USING GRAPHS OF MEMBERSHIP FUNCTIONS


39
COMPOSITIONAL OPERATORS

Let the relation R:XY and the relation S:Y Z share


a common universe Y.
The relation T:X Z can be expressed in terms of R
and S using the composition operation, denoted by,

T=R o S
o is the compositional operator.
This operator is composed of at least 2 basic fuzzy
set operations.
Some examples are: max-min, max-max, min-max,
etc.
40

POPULAR COMPOSITIONAL OPERATORS


Max-min operation In fuzzy logic
control application,
T=RS Max-min and Max-
mT(x,z) = Max {Min [mR(x,y), mS(y,z)]} product
composition
operations are the
Max-product operation most commonly and
frequently used
T=RS because of their
computational
m T (x,z) = Max [mR(x,y) . mS(y,z)] simplicity and
efficiency.

41
Others:
Max-bounded sum.
Max-bounded product.
Max-drastic product.
Max-algebraic sum.
Max-Max.
Min-Max.
Etc.

42

Fuzzy Reasoning

Example 5
Max-min based compositional operation

The composition operator plays an important role in


establishing the fuzzy relation equation for a fuzzy
knowledge base. Basically, the composition operation
is the net effect of applying one relation after another. It
is defined in most application, using max-min as
follows.

Let P and Q be defined as :


0.1 0.5 0.3 0.6 0.8
P 0.6 Q 0.7
0.9 0.5 0.4

Then the relation, R, can be obtained using the max-min


compositional operations:
0.1 0.5 0.3 0.6 0.8 R 11 R 12 R 13
R P Q 0.6 0.7 R
0.9 0.5 0.4 21 R 22 R 23

43
where:

R11 maxmin0.1,0.3, min0.5,0.7


max0.1,0.5
0.5

R12 maxmin0.1,0.6, min0.5,0.5


max0.1,0.5
0.5

R13 maxmin0.1,0.8, min0.5,0.4


max0.1,0.4
0.4
R21 maxmin0.6,0.3, min0.9,0.7
max0.3,0.7
0.7
R22 maxmin0.6,0.6, min0.9,0.5
max0.6,0.5
0.6

R23 maxmin0.6,0.8, min0.9,0.4


max0.6,0.4
0.6

44

Example 6
Assume in a university, for the field of AI, there are four courses offered:

1. Fuzzy Theory (FT).


2. Fuzzy Control (FC).
3. Neural Networks (NN).
4. Expert Systems (ES).

Three students are planning to take these course based on their different
preferences for theory, application, hardware and programming. Each of
these courses contains parts of the four properties as described.

The students are: 1. Ali.


2. Bala.
3. Chin.

45
Objective of Exercise: Show that the
composition of fuzzy relations can help
these students in their decision making.

There are three different sets: X, Y, and Z.


Let.
Set of Students: X = {Ali, Bala, Chin}.
Set of Properties: Y = {Th, Ap, Hw,
Pg} = {theory,
application, hardware, prog}.
Set of Courses: Z = {FT, FC, NN, ES}.
={fuzzy theory, fuzzy control, neural networks
and expert system}.

46

Based on facts, assume the


student's interest is represented by
the fuzzy relation P(X,Y):
Interest, P(X,Y) =
Th Ap Hw Pg
Ali 0.2 1 0.8 0.1
Bala 1 0.1 0 0.5
Chin 0.5 0.9 0.5 1

47
The properties of the courses are indicated by
the following fuzzy relation Q(Y,Z):

Properties, Q(Y,Z) =
FT FC NN ES
Th 1 0.5 0.6 0.1
Ap 0.2 1 0.8 0.8
Hw 0 0.3 0.7 0
Pg 0.1 0.5 0.8 1

48

Question

Develop the max-min composition


of the two fuzzy relations of P(X,Y)
and Q(Y,Z), where this can help the
students to choose the proper
courses.
Also solve the problem using Max-
product composition.

49
Using max-min approach:
Thus, P o Q =
FT FC NN ES

Ali

Chin
Bala

Ayu
Chin

Conclusion,
1. Ali should choose
........................................
2. Bala should choose
........................................
3. Chin should choose
........................................
50

RESULTS OF FUZZY INFERENCE


By using max min we get:
FT FC NN ES
Ali 0.2 1.0 0.8 0.8
Bala 1.0 0.5 0.6 0.5
Chin 0.5 0.9 0.8 1.0

By using max product, we get:


FT FC NN ES
Ali 0.2 1.0 0.8 0.8
Bala 1.0 0.5 0.6 0.5
Chin 0.5 0.9 0.8 1.0

51

Vous aimerez peut-être aussi