Fuzzy Logic
Fuzzy Logic
Fuzzy Logic
Fuzzy Logic
Fuzzy Logic 2
AI CS289
Fuzzy Logic
Contents
AI CS289
Fuzzy Logic
The classical set theory developed in the late 19th century by Georg
Cantor describes how crisp sets can interact. These interactions are
called operations.
These properties and operations are the basis on which the fuzzy sets
are used to deal with uncertainty on the one hand and to represent
knowledge on the other.
AI CS289
Fuzzy Logic
AI CS289
Fuzzy Logic
B
A
AA
Complement
Containment
Intersection
09th October 2006
AA
Union
AI CS289
Fuzzy Logic
Complement
A(x) = 1 A(x)
AI CS289
Fuzzy Logic
Containment
Similar to a Chinese box, a set can contain other sets. The smaller set
is called the subset. For example, the set of tall men contains all tall
men; very tall men is a subset of tall men. However, the tall men set is
just a subset of the set of men. In crisp sets, all elements of a subset
entirely belong to a larger set. In fuzzy sets, however, each element
can belong less to the subset than to the larger set. Elements of the
fuzzy subset have smaller memberships in it than in the larger set.
AI CS289
Fuzzy Logic
Intersection
AI CS289
Fuzzy Logic
Union
The union of two crisp sets consists of every element that falls into
either set. For example, the union of tall men and fat men contains all
men who are tall OR fat.
In fuzzy sets, the union is the reverse of the intersection. That is, the
union is the largest membership value of the element in either set.
The fuzzy operation for forming the union of two fuzzy sets A and B
on universe X can be given as:
AB(x) = max [A(x), B(x)] = A(x) B(x),
where xX
AI CS289
Fuzzy Logic
(x)
(x)
B
A
A
0
1
x
Not A
Complement
0
Containment
(x)
(x )
0
1
B
A
x
AB
0
09th October 2006
Intersection
1
x
AB
Union
x
10
AI CS289
Fuzzy Logic
11
AI CS289
Fuzzy Logic
Equality
12
AI CS289
Fuzzy Logic
Inclusion
Inclusion of one fuzzy set into another fuzzy set. Fuzzy set A X is
included in (is a subset of) another fuzzy set, B X:
A(x) B(x), xX
Consider X = {1, 2, 3} and sets A and B
A = 0.3/1 + 0.5/2 + 1/3;
B = 0.5/1 + 0.55/2 + 1/3
then A is a subset of B, or A B
13
AI CS289
Fuzzy Logic
Cardinality
Cardinality of a non-fuzzy set, Z, is the number of elements in Z. BUT
the cardinality of a fuzzy set A, the so-called SIGMA COUNT, is
expressed as a SUM of the values of the membership function of A,
A(x):
cardA = A(x1) + A(x2) + A(xn) =
(x ),
A
for i=1..n
14
AI CS289
Fuzzy Logic
15
AI CS289
Fuzzy Logic
Alpha-cut
An -cut or -level set of a fuzzy set A X is an ORDINARY SET A
X, such that:
A={A(x), xX}.
Consider X = {1, 2, 3} and set A
A = 0.3/1 + 0.5/2 + 1/3
then A0.5 = {2, 3}, ..fuzzy set which has membership
function >= 0.5
A0.1 = {1, 2, 3},.fuzzy set which has memebership function is >=0.1
A1 = {3}.fuzzy set which has membership function is >=1
09th October 2006
16
AI CS289
Fuzzy Logic
All crisp subsets except for the null set are normal. In fuzzy set theory,
the concept of nullness essentially generalises to subnormality.
17
AI CS289
Fuzzy Logic
18
AI CS289
Fuzzy Logic
aA = {aA(x), xX}
Let a =0.5, and
A = {0.5/a, 0.3/b, 0.2/c, 1/d}
then
Aa = {0.25/a, 0.15/b, 0.1/c, 0.5/d}
Aa = {A(x)a, xX}
Let a =2, and
A = {0.5/a, 0.3/b, 0.2/c, 1/d}
then
Aa = {0.25/a, 0.09/b, 0.04/c, 1/d}
19
AI CS289
Fuzzy Logic
20
AI CS289
Fuzzy Logic
Support:
supp(A) = {a, b, c, d }
supp(B) = {a, b, c, d, e }
Core:
core(A) = {a}
core(B) = {o}
Cardinality:
card(A) = 1+0.3+0.2+0.8+0 = 2.3
card(B) = 0.6+0.9+0.1+0.3+0.2 = 2.1
21
AI CS289
Fuzzy Logic
Complement:
A = {1/a, 0.3/b, 0.2/c 0.8/d, 0/e}
A = {0/a, 0.7/b, 0.8/c 0.2/d, 1/e}
Union:
Intersection:
22
AI CS289
Fuzzy Logic
aA:
for a=0.5
aA = {0.5/a, 0.15/b, 0.1/c, 0.4/d, 0/e}
Aa:
for a=2
Aa = {1/a, 0.09/b, 0.04/c, 0.64/d, 0/e}
a-cut:
A0.2 = {a, b, c, d}
A0.3 = {a, b, d}
A0.8 = {a, d}
A1 = {a}
23
AI CS289
Fuzzy Logic
Fuzzy Rules
In 1973, Lotfi Zadeh published his second most influential paper. This
paper outlined a new approach to analysis of complex systems, in
which Zadeh suggested capturing human knowledge in fuzzy rules.
x
y
is A
is B
24
AI CS289
Fuzzy Logic
Rule: 2
IF
speed is < 40
THEN stopping_distance is short
The variable speed can have any numerical value between 0 and 220
km/h, but the linguistic variable stopping_distance can take either
value long or short. In other words, classical rules are expressed in the
black-and-white language of Boolean logic.
25
AI CS289
Fuzzy Logic
Rule: 2
IF
speed is slow
THEN stopping_distance is short
In fuzzy rules, the linguistic variable speed also has the range (the
universe of discourse) between 0 and 220 km/h, but this range
includes fuzzy sets, such as slow, medium and fast. The universe of
discourse of the linguistic variable stopping_distance can be between 0
and 300 m and may include such fuzzy sets as short, medium and
long.
26
AI CS289
Fuzzy Logic
In a fuzzy system, all rules fire to some extent, or in other words they
fire partially. If the antecedent is true to some degree of membership,
then the consequent is also true to that same degree.
27
AI CS289
Fuzzy Logic
These fuzzy sets provide the basis for a weight estimation model. The
model is based on a relationship between a mans height and his
weight:
IF
height is tall
THEN weight is heavy
Degree of
Membership
1.0
0.8
Degree of
Membership
1.0
Heavy men
0.8
Tall men
0.6
0.6
0.4
0.4
0.2
0.2
0.0
160
0.0
180
190
200
70
Height, cm
09th October 2006
80
100
120
Weight, kg
28
AI CS289
Fuzzy Logic
Degree of
Membership
1.0
Degree of
Membership
1.0
Tall men
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
0.0
0.0
160
180
190
200
Height, cm
Heavy men
70
80
100
120
Weight, kg
29
AI CS289
Fuzzy Logic
The consequent of a fuzzy rule can also include multiple parts, for
instance:
IF
temperature is hot
THEN
hot_water is reduced;
cold_water is increased
09th October 2006
30
AI CS289
Fuzzy Logic
31
AI CS289
Fuzzy Logic
THEN
SPEED is MINIMAL
THEN
SPEED is SLOW
RULE 2:
IF TEMP is COOL
RULE 3:
IF TEMP is PLEASANT
THEN
SPEED is MEDIUM
RULE 4:
IF TEMP is WARM
THEN
SPEED is FAST
THEN
SPEED is BLAST
RULE 5:
IF TEMP is HOT
09th October 2006
32
AI CS289
Fuzzy Logic
Temp
(0C).
where:
Y : temp value belongs to the set
(0<A(x)<1)
Y* : temp value is the ideal member to
the set (A(x)=1)
N : temp value is not a member of the
set (A(x)=0)
COLD
COOL
PLEASANT
WARM
HOT
Y*
10
12.5
Y*
15
17.5
Y*
20
22.5
Y*
25
27.5
30
Y*
33
AI CS289
Fuzzy Logic
Rev/sec
(RPM)
MINIMAL
SLOW
MEDIUM
FAST
BLAST
Y*
10
20
30
Y*
40
50
Y*
60
70
Y*
80
90
100
Y*
34
AI CS289
Fuzzy Logic
COLD:
for 0 t 10
SLOW:
for 0 t 12.5
for 12.5 t 17.5
COLD(t) = t / 10 + 1
SLOW(t) = t / 12.5
SLOW(t) = t / 5 + 3.5
35
AI CS289
Fuzzy Logic
36
AI CS289
Fuzzy Logic
MINIMAL:
for 0 v 30
SLOW:
for 10 v 30
for 30 v 50
COLD(t) = v / 30 + 1
SLOW(t) = v / 20 0.5
SLOW(t) = v / 20 + 2.5
37
AI CS289
Fuzzy Logic
38
AI CS289
Fuzzy Logic
Exercises
For
A = {0.2/a, 0.4/b, 1/c, 0.8/d, 0/e}
B = {0/a, 0.9/b, 0.3/c, 0.2/d, 0.1/e}
Draw the Fuzzy Graph of A and B
Then, calculate the following:
- Support, Core, Cardinality, and Complement for A and B
independently
- Union and Intersection of A and B
- the new set C, if C = A2
- the new set D, if D = 0.5B
- the new set E, for an alpha cut at A0.5
39
AI CS289
Fuzzy Logic
Solutions
A = {0.2/a, 0.4/b, 1/c, 0.8/d, 0/e}
B = {0/a, 0.9/b, 0.3/c, 0.2/d, 0.1/e}
Support
Supp(A) = {a, b, c, d}
Supp(B) = {b, c, d, e}
Core
Core(A) = {c}
Core(B) = {}
Cardinality
Card(A) = 0.2 + 0.4 + 1 + 0.8 + 0 = 2.4
Card(B) = 0 + 0.9 + 0.3 + 0.2 + 0.1 = 1.5
Complement
Comp(A) = {0.8/a, 0.6/b, 0/c, 0.2/d, 1/e}
Comp(B) = {1/a, 0.1/b, 0.7/c, 0.8/d, 0.9/e}
09th October 2006
40
AI CS289
Fuzzy Logic
Solutions
A = {0.2/a, 0.4/b, 1/c, 0.8/d, 0/e}
B = {0/a, 0.9/b, 0.3/c, 0.2/d, 0.1/e}
Union
AB = {0.2/a, 0.9/b, 1/c, 0.8/d, 0.1/e}
Intersection
AB = {0/a, 0.4/b, 0.3/c, 0.2/d, 0/e}
C=A2
C = {0.04/a, 0.16/b, 1/c, 0.64/d, 0/e}
D = 0.5B
D = {0/a, 0.45/b, 0.15/c, 0.1/d, 0.05/e}
E = A0.5
E = {c, d}
09th October 2006
41
AI CS289
Fuzzy Logic
Closing
Questions???
Remarks???
Comments!!!
Evaluation!
42