Você está na página 1de 41

Fuzzy Sets and Fuzzy Logic

Applications

1
Example

2
Fuzzification
 Two Inputs (x, y) and one output (z)
 Membership functions:
low(t) = 1 - ( t / 10 )
high(t) = t / 10

0.68
Low High

0.32
0
Crisp Inputs X=0.32 Y=0.61 t

3
Low(x) = 0.68, High(x) = 0.32, Low(y) = 0.39, High(y) = 0.61
Create rule base
 Rule 1: If x is low AND y is low Then z is high

 Rule 2: If x is low AND y is high Then z is low

 Rule 3: If x is high AND y is low Then z is low

 Rule 4: If x is high AND y is high Then z is high


4
Inference
 Rule1: low(x)=0.68, low(y)=0.39 => Rule strength
high(z)=MIN(0.68,0.39)=0.39

 Rule2: low(x)=0.68, high(y)=0.61 =>


low(z)=MIN(0.68,0.61)=0.61

 Rule3: high(x)=0.32, low(y)=0.39 =>


low(z)=MIN(0.32,0.39)=0.32

 Rule4: high(x)=0.32, high(y)=0.61 =>


high(z)=MIN(0.32,0.61)=0.32
5
Composition
•Low(z) = MAX(rule2, rule3) = MAX(0.61, 0.32) = 0.61
•High(z) = MAX(rule1, rule4) = MAX(0.39, 0.32) = 0.39

1
Low High

0.61

0.39

0
t 6
Defuzzification Max

 tf (t )dt
 Center of Gravity C Min
Max

 f (t )dt
Min
1
Low High

Center of Gravity
0.61

0.39

0
t
Crisp output 7
A Real Fuzzy Logic System
 The subway in Sendai, Japan uses a fuzzy
logic control system developed by Serji
Yasunobu of Hitachi.
 It took 8 years to complete and was finally put
into use in 1987.

8
Control System
 Based on rules of logic obtained from train
drivers so as to model real human decisions
as closely as possible

 Task: Controls the speed at which the train


takes curves as well as the acceleration and
braking systems of the train

9

 The results of the fuzzy logic controller for the
Sendai subway are excellent!!
 The train movement is smoother than most
other trains
 Even the skilled human operators who
sometimes run the train cannot beat the
automated system in terms of smoothness or
accuracy of stopping
10
Fuzzy Logic
Interpretation Domain  Fuzzy Sets

u _Fast u _Dangerous
0 0
0 0
10 0.01
10 0.05
20 0.02
20 0.1
30 0.05
30 0.15
40 0.1
40 0.2
50 0.4
50 0.3
60 0.8
60 0.7
70 0.9 70 1
80 1 80 1

Fuzzy set Fast Fuzzy set Dangerous

11
Fuzzy logic proposition: X is fast or Y is dangerous

0 10 20 30 40 50 60 70 80

0 0 0.05 0.1 0.15 0.2 0.3 0.7 1 1

10 0.01 0.05 0.1 0.15 0.2 0.3 0.7 1 1

20 0.02 0.05 0.1 0.15 0.2 0.3 0.7 1 1

30 0.05 0.05 0.1 0.15 0.2 0.3 0.7 1 1

40 0.1 0.1 0.1 0.15 0.2 0.3 0.7 1 1

50 0.4 0.4 0.4 0.4 0.4 0.4 0.7 1 1

60 0.8 0.8 0.8 0.8 0.8 0.8 0.8 1 1

70 0.9 0.9 0.9 0.9 0.9 0.9 0.9 1 1

80 1 1 1 1 1 1 1 1 1

12
Homework:

Find the following fuzzy logic propositions:

- X is fast and Y is dangerous

- If X is fast then Y is dangerous

13
Example II

if temperature is cold and oil is cheap

then heating is high

14
Example II
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
15
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
16
Example
A linguistic variable is characterized by a quintuple

age
 x, T ( x),U , G, M 
Example semantic rule:
old, very old, not so old, 
 
G(age)  more or less young,  M (old)   u, old (u )  u  [0,100]
quite young, very young 
 
 0 u  [0,50]
 1
old (u )     u  50 2 
[0, 100]  1   5   u  [50,100]
    
17
Example II
Linguistic Variable : temperature
Linguistics Terms (Fuzzy Sets) : {cold, warm, hot}

(x)
cold warm hot
1

20 60 x
18
Classical Implication

AB

A  B A
T
B
T
A  B
T
A
1
B
1
A  B
1
T F F 1 0 0
F T T 0 1 1
F F T 0 0 1
19
AB
AB
A B
1 1 1
1 0 0
1  A ( x)   B ( y ) 0 1 1
 AB ( x, y)   0 0 1
B ( y) otherwise

A  B A
1
B
1
A  B
1
1 0 0
AB ( x, y)  max 1  A ( x), B ( x)  0 1 1
0 0 1 20
A B AB
1 1 1
Modus Ponens 1 0 0
0 1 1
0 0 1

AB A  B If A then B
 A  A  A is true
B B B is true

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

22
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.


23
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
24
R  x, y   AB  x, y   ?

Interpretations of A  B

A coupled with B A entails B


y y

B B

xx xx
A A 25
R  x, y   AB  x, y   ?

Interpretations of A  B

A coupled with B A entails B


y y

B B

xx xx
A 26
R  x, y   AB  x, y   ?

Interpretations of A  B
A entails B (not A or B)
A coupled with B
• Material implication
A entails B
y y
R  A  B  A  B
• Propositional calculus
R  A  B  A  ( A  B)
B
• Extended propositional calculus B
R  A  B  (A  B)  B
• Generalization of modus ponens
xx xx
1  A ( x)   B ( y )
R ( x, y)  
B ( yA
) otherwise A 27
R  x, y   AB  x, y   ?

Interpretations of A  B
A entails B (not A or B)
• Material implication

R  A  B  A  B R ( x, y)  max 1   A ( x), B ( x) 
• Propositional calculus
R  A  B  A  ( A  B) R ( x, y)  max 1   A ( x), min   A ( x), B ( x)  
• Extended propositional calculus
R  A  B  (A  B)  B R ( x, y)  max 1  max   A ( x), B ( x)  , B ( x) 
• Generalization of modus ponens

1  A ( x)   B ( y )
R ( x, y)  
B ( y) otherwise 28
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’
29
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)  ( y)
A A’ B

30

x y
R ( x, y)   A ( x)  B ( y)

Fuzzy Reasoning
Single Rule with Single Antecedent
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)  ( y)
A A’ B

B 31

x y
R ( x, y)   A ( x)  B ( y)

Fuzzy Reasoning
Single Rule with Single Antecedent
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)  ( y)
A A’ B

B 32

x y
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

33
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

34

x y z
R  A B  C
Rule: if x is A and y is B then z is C

Fact: x is A’ and y is B’ R ( x, y, z)   ABC ( x, y, z)


Fuzzy Reasoning
Conclusion: z is C’
  Antecedents
Single Rule with Multiple ( x)   ( y )   ( z ) A B C

Max-Min Composition
C  ( y )  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 35

x y z
R  A B  C
Rule: if x is A and y is B then z is C

Fact: x is A’ and y is B’ R ( x, y, z)   ABC ( x, y, z)


Fuzzy Reasoning
Conclusion: z is C’
  Antecedents
Single Rule with Multiple ( x)   ( y )   ( z ) A B C

Max-Min Composition
C  ( y )  max x , y min   A, B ( x, y ),  R ( x, y, z ) 
  x , y   A, B ( x, y )   R ( x, y, z ) 
C   A
 ( x
)  B y)
(
x, y   (
A  
x) A ( y)  Bz)  C 
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 36

x y z
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’

37
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’

Fuzzy Reasoning
Multiple Rules with Multiple Antecedents
 ( x)  ( y)  ( z) C1
A’ A1 B1 B’

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

x y z

38
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’
Fuzzy Reasoning
Multiple Rules with Multiple Antecedents
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 39

z
40
41

Você também pode gostar