Professional Documents
Culture Documents
Fuzzy Logic
Fuzzy Tutorial
Contents
Recap
Example: Air Conditioner
Example: Cart Pole Problem
Case Study: Building a Fuzzy Expert System
Summary
Recap
Process of developing a fuzzy expert system:
Recap
Operation of a fuzzy expert system:
0< (T)<1 0 Y* N N N N
5 Y Y N N N
10 N Y N N N
12.5 N Y* N N N
15 N Y N N N (T)=1
17.5 N N Y* N N
20 N N N Y N
22.5 N N N Y* N
25 N N N Y N
27.5 N N N N Y
30 N N N N Y*
(T)=0
1 1
0.9 0.9
0.8 0.8 Cold
Cold
Truth Value
Truth Value
0.7 0.7
0.6 0.6 Cool
Cool
0.5 0.5 Pleasent
Pleasent
0.4 0.4
0.3 0.3
Warm
Warm
0.2 0.2 Hot
Hot
0.1 0.1
0 0
0 0 5 5 1010 15
15 20
20 2525 3030
Temperature
Temperature Degrees
Degrees CC
10th October 2006 Bogdan L. Vrusias 2006 7
AI CS364
Fuzzy Logic
10 Y N N N N
20 Y Y N N N
30 N Y* N N N
40 N Y N N N
50 N N Y* N N
60 N N N Y N
70 N N N Y* N
80 N N N Y Y
90 N N N N Y
100 N N N N Y*
1
0.8 MINIMAL
Truth Value
0.6 SLOW
MEDIUM
0.4
FAST
0.2 BLAST
0
0 10 20 30 40 50 60 70 80 90 100
Speed
Consider a temperature of 16oC, use the system to compute the optimal fan
speed.
Fuzzification
Inference
Composition
Defuzzification
0 0.3 0.4 0 0
0 0.125 0 0 0
= 45.54rpm
m
w
g
w ns nm ns ps
az nb nm ns az ps pm pb
ps ns ps pm
pm nm
pb nb ns
nb: negative big, nm: negative medium, ns: negative small az: approximately zero
ps: positive small, pm: positive medium, pb: positive big
IF is negative medium
AND w is approximately zero
THEN F is negative medium
10th October 2006 Bogdan L. Vrusias 2006 19
AI CS364
Fuzzy Logic
(w)=1 if
w
w (w)=1 if
w
w=
(w)=0 if
w
Consider the case when the input variables are: = 50, = -5.
Use the rule base, execute each of the four tasks to compute the force
F necessary to balance the pole using the Centre of Gravity in the
Defuzzification task.
IF is pm AND is az THEN F is pm
IF is pb AND is az THEN F is pb
1
1
1/22.5 = /17.5
: pm = 0.78
22.5 45 50 67.5 45 50 67.5
1
1/22.5 = /5
: pb
= 0.22
45 50 67.5
1
w: az 1/11.25 = /6.25
-11.25 -5 0 10
= 0.56
1. IF is pm AND is az THEN F is pm
2. IF is pb AND is az THEN F is pb
The two premises in RULE 2 are conjunctive
minimum of the two: min{0.22, 0.56} = 0.22
ps
pb
Defuzzification
3 0.2 (4 5 6) 0.56 (7 8) 0.22
SoG =
CoG = 5.30
0.2 0.56 0.56 0.56 0.22 0.22
A service centre keeps spare parts and repairs failed ones. A customer
brings a failed item and receives a spare of the same type. Failed
parts are repaired, placed on the shelf, and thus become spares.
There are four main linguistic variables: average waiting time (mean
delay) m, repair utilisation factor of the service centre p, number of
servers s, and initial number of spare parts n.
Degree of
Membership
1.0
0.8 VS S M
0.6
0.4
0.2
0.0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Mean Delay (normalised)
Degree of
Membership
1.0
0.8 S M L
0.6
0.4
0.2
0.0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Number of Servers (normalised)
Degree of
Membership
1.0
0.8 L M H
0.6
0.4
0.2
0.0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Repair Utilisation Factor
Degree of
Membership
1.0
0.8 VS S RS M RL L VL
0.6
0.4
0.2
0.0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Number of Spares (normalised)
To accomplish this task, we might ask the expert to describe how the
problem can be solved using the fuzzy linguistic variables defined
previously.
s = number
of servers
m = delay
10th October 2006 Bogdan L. Vrusias 2006 34
AI CS364
Fuzzy Logic
S S VS VS
M
VS S M
s
m
L S S VS
M VS VS VS
S VS VS VS
L
VS S M
m
10th October 2006 Bogdan L. Vrusias 2006 37
AI CS364
Fuzzy Logic
The last, and the most laborious, task is to evaluate and tune the
system. We want to see whether our fuzzy system meets the
requirements specified at the beginning.
The Fuzzy Logic Toolbox can generate surface to help us analyse the
systems performance.
0.6
number_of_spares
0.5
0.4
0.3
0.2
0
0.2 1
0.8
0.4 0.6
0.4
0.6 0.2
mean_delay 0 utilisation_factor
0.35
number_of_spares
0.3
0.25
0.2
0.15
0.2 1
0.8
0.4 0.6
0.4
0.6 0.2
mean_delay 0 number_of_servers
0.5
0.4
number_of_spares
0.3
0.2
0.2 1
0.8
0.4 0.6
0.4
0.6 0.2
mean_delay 0 utilisation_factor
However, even now, the expert might not be satisfied with the system
performance.
Degree of
Membership
1.0
0.8 S RS M RL L
0.6
0.4
0.2
0.0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Number of Servers (normalised)
s RS S VS VS
L S S VS S S VS VS
M
VS S M
RL S S VS
m
M VS VS VS
RS VS VS VS
S VS VS VS
L
VS S M
m
10th October 2006 Bogdan L. Vrusias 2006 45
AI CS364
Fuzzy Logic
0.35
0.3
number_of_spares
0.25
0.2
0.15
0.2 1
0.8
0.4 0.6
0.4
0.6 0.2
mean_delay 0 number_of_servers
0.5
0.4
number_of_spares
0.3
0.2
0.2 1
0.8
0.4 0.6
0.4
0.6 0.2
mean_delay 0 utilisation_factor
2. Review the fuzzy sets, and if required define additional sets on the
universe of discourse. The use of wide fuzzy sets may cause the fuzzy
system to perform roughly.
6. Adjust the rule execution weights. Most fuzzy logic tools allow
control of the importance of rules by changing a weight multiplier.
7. Revise shapes of the fuzzy sets. In most cases, fuzzy systems are
highly tolerant of a shape approximation.
Summary
Process of developing a fuzzy expert system