Fuzzy Logic
Fuzzy Logic
Fuzzy Logic
Budditha Hettige
Slow
Fast
Speed = 0
Speed = 1
bool speed;
get the speed
if ( speed == 0) {
// speed is slow
}
else {
// speed is fast
}
FUZZY LOGIC REPRESENTATION
Slowest
For every problem
[ 0.0 0.25 ]
must represent in
terms of fuzzy sets.
Slow
What are fuzzy [ 0.25 0.50 ]
sets?
Fast
[ 0.50 0.75 ]
Fastest
[ 0.75 1.00 ]
FUZZY LOGIC REPRESENTATION
CONT.
True
HOT
False
0
80F Temperature
Fuzzy values
DOM
Degree of
Membership
Young Middle Old
1
0.5
0
25 40 55 Age
Fuzzy Relations Matrices
Example: Color-Ripeness relation for tomatoes
green 1 0.5 0
Red 0 0.2 1
Where is Fuzzy Logic used?
Fuzzy logic is used directly in very few
applications.
Fuzzy Input
Fuzzy Output
Crisp Output
Building Fuzzy Systems
Fuzzification
Inference
Composition
Defuzzification
Fuzzification
Establishes the fact base of the fuzzy system. It identifies the
input and output of the system, defines appropriate IF THEN
rules, and uses raw data to derive a membership function.
Consider an air conditioning system that determine the best
circulation level by sampling temperature and moisture levels.
The inputs are the current temperature and moisture level.
The fuzzy system outputs the best air circulation level: none,
low, or high. The following fuzzy rules are used:
1. If the room is hot, circulate the air a lot.
2. If the room is cool, do not circulate the air.
3. If the room is cool and moist, circulate the air slightly.
A knowledge engineer determines membership functions that map
temperatures to fuzzy values and map moisture measurements to fuzzy
values.
Inference
Evaluates all rules and determines their truth values.
If an input does not precisely correspond to an IF
THEN rule, partial matching of the input data is used
to interpolate an answer.
Continuing the example, suppose that the system has
measured temperature and moisture levels and mapped them
to the fuzzy values of .7 and .1 respectively. The system now
infers the truth of each fuzzy rule. To do this a simple method
called MAX-MIN is used. This method sets the fuzzy value of
the THEN clause to the fuzzy value of the IF clause. Thus, the
method infers fuzzy values of 0.7, 0.1, and 0.1 for rules 1, 2,
and 3 respectively.
Composition
Combines all fuzzy conclusions obtained by inference
into a single conclusion. Since different fuzzy rules
might have different conclusions, consider all rules.
Continuing the example, each inference suggests a different
action
rule 1 suggests a "high" circulation level
rule 2 suggests turning off air circulation
rule 3 suggests a "low" circulation level.
A simple MAX-MIN method of selection is used where the
maximum fuzzy value of the inferences is used as the final
conclusion. So, composition selects a fuzzy value of 0.7 since
this was the highest fuzzy value associated with the inference
conclusions.
Defuzzification
Convert the fuzzy value obtained from composition
into a crisp value. This process is often complex
since the fuzzy set might not translate directly into a
crisp value.Defuzzification is necessary, since
controllers of physical systems require discrete
signals.
Continuing the example, composition outputs a fuzzy value of
0.7. This imprecise value is not directly useful since the air
circulation levels are none, low, and high. The
defuzzification process converts the fuzzy output of 0.7 into
one of the air circulation levels. In this case it is clear that a
fuzzy output of 0.7 indicates that the circulation should be set
to high.
Defuzzification
There are many defuzzification methods. Two of the
more common techniques are the centroid and
maximum methods.
In the centroid method, the crisp value of the output
variable is computed by finding the variable value of
the center of gravity of the membership function for
the fuzzy value.
In the maximum method, one of the variable values
at which the fuzzy subset has its maximum truth
value is chosen as the crisp value for the output
variable.
Examples
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
1
Low High
0.61
0.39
0
t
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
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.
Control System
Based on rules of logic obtained from train
drivers so as to model real human
decisions as closely as possible