Logica Difusa: Principios
y Aplicaciones
Amaury Caballero, Ph. D., P.E
Universidad Internacional de
la Florida
Email: [email protected]
Principle of Incompatibility
As the complexity of a system increases, our ability to
make precise and yet significant statements about its
behavior diminishes until a threshold is reached beyond
which precision and significance become almost
mutually exclusive characteristics.
Fuzzy Logic
Fuzzy logic may be viewed as a bridge between the
extensively wide gap between the precision crisp
logic and the imprecision of both real world and
human interpretation.
Prof. Zadeh
As its name implies, the theory of fuzzy sets is,
basically, a theory of graded concepts - a theory in
which everything is a matter of degree or, to put it
figuratively, everything has elasticity.
H.J. Zimmermann
Fuzzy Logic
A technology which enhances model-based system
designs using both intuition and engineering
heuristics.
Decisions based on degree of truth
A new paradigm of systems engineering which
helps achieve robust & fault-tolerant systems
An efficient way of designing, optimizing &
maintaining highly complex systems transparently
Fuzzy Logic
The center of the fuzzy modeling is the idea of linguistic
variables.
Example:
If project duration is long, the completion risk
is increased.
The engine temperature is hot.
A cruise missile has a long range at a high speed.
If you are tall, you are quite likely heavy.
Tom is rather tall but Judy is short.
Disposable incomes in the middle tax payer is
adequate.
That project requires a large manpower
commitment.
Fuzzy Logic
Example: For the fuzzy variable tall of men, the degrees
of membership depend on their heights.
Height Degree of membership
50 0.0
54 0.08
58 0.32
60 0.50
64 0.82
68 0.98
70 1.00
The variable tall is defined by the range of values for
heights (50, 54, ..., 70) and the degrees of membership
(0.00, 0.08, ..., 1.00).
tall: heights [0, 1]
Heights is the domain of tall, and [0, 1] the range.
Types of Uncertainty
Probabilistic uncertainty
Linguistic uncertainty
example: rolling a dice
examples: low price, tall people, young age
Informational uncertainty
example: credit worthiness, honesty
Fuzzy vs. Probability
Probabilistic Reasoning
There is an 75% chance that Betty is old.
Betty is either old or not old (the law of the excluded
middle).
Fuzzy Reasoning
Betty's degree of membership within the set of old people
is 0.75.
Betty is like an old person, but could also have some
characteristics of a young person.
Fuzzy vs Probability
Crisp Facts distinct boundaries
Fuzzy Facts imprecise boundaries
Probability incomplete facts
Example: Scout reporting an enemy
Two tanks at grid NV 54 (Crisp)
A few tanks at grid NV 54 (Fuzzy)
There might be 2 tanks at grid NV 54
(Probabilistic)
What is Fuzzy Logic?
It is a multi-valued Boolean logic.
It uses rule-based control.
It is based on a form of Artificial Intelligence.
It uses human intuition for control.
What is Fuzzy Logic?
Fuzzy logic methodology is basically characterized by
three traits:
(1) It does not consider whether something is true
or false, but rather how true it is.
(2) Because its similar to human reasoning, its
implementation tends to be based on natural
language.
(3) Its flexible and can model complex, nonlinear
systems by using imprecise information.
Fuzzy Logic - What is it NOT?
Not the solution to ALL problems. Some problems
are better solved with conventional methods.
When should Fuzzy Logic be used?
If no adequate mathematical model for a given
problem can be easily found.
If non-linearity, time-constraints or multiple
parameters exist.
If engineering know-how about the given problem
is available or can be acquired during the design
process.
When should not Fuzzy Logic be used?
When the problem can be easily solved using
conventional control techniques, such as a PID
controller.
When there is a simple, clear-defined and fast-tosolve mathematical model for the given problem
available.
When the problem cannot be solved at all. There
are some problems with which even fuzzy logic
can not help you.
Why Fuzzy Logic?
Precision is not truth.
Henri Matisse
So far as the laws of mathematics refer to reality,
they are not certain. And so far as they are certain,
they do not refer to reality.
Albert Einstein
As complexity rises, precise statements lose meaning
and meaningful statements lose precision.
Lotfi Zadeh
Why Fuzzy Logic?
Human knowledge is fuzzy: expressed in Fuzzy
Linguistic Terms - young, old, big, cheap are fuzzy
words
Temperature is expressed as cold, warm or hot. No
quantitative meaning.
The world is Not binary: gradual transitions &
ambiguities at the boundaries
Why Use Fuzzy Logic?
No complex mathematical models for system
development
Simpler and more effective implementation
More descriptive
Higher fault-tolerance and a better trade-off
between system robustness and system sensitivity
Why Reluctance in Use of Fuzzy Logic?
Engineers are trained using precise mathematics
Most of us are more comfortable with the Law
of the Excluded Middle
every proposition must either be True or False
Not enough software people are in charge of
engineering projects
Why Reluctance in Use of Fuzzy
Logic?
Fuzzy theory is wrong, wrong and pernicious. What
we need is more logical thinking, not less. The danger
of fuzzy logic is that it will encourage the sort of
imprecise thinking that has brought us so much
trouble. Fuzzy logic is the cocaine of science.
Professor William Kahan
University of California at Berkeley
pernicious =
1 highly injurious or destructive: deadly
2 exceedingly harmful.
Fuzzy Logic Applications
(1) Automotive
(a) fuzzy engine control
(b) fuzzy cruise control
(c) fuzzy anti-lock
braking systems
(d) fuzzy transmission
systems
(2) Appliances
(a) washing machines
(b) air conditioners
(c) cameras
(d) VCRs
(e) microwave ovens
Fuzzy Logic Applications
(3) Industries
(a) chemical plants
(b) nuclear power plants
(c) elevators
(d) motor control
(e) water quality control
(f) automatic train
operation systems
(4) Aerospace
(a) flexible wing control
(b) jet engine failure
diagnostics
(c) spacecraft
positioning control
Blood Pressure Measurement with Fuzzy Logic
ReliOn's automatic wrist blood
pressure monitor features both
fuzzy logic inflation and
controlled deflation to give you
the most constant and exact
rates of pressure.
It also features a large screen
That simultaneously displays
systolic, diastolic and pulse
readings, an easy to-use, one
button design, and a memory
that recalls up to 30 readings.
Rice Cooker with Fuzzy Logic
Zojirushi Neuro-Fuzzy Logic Rice
Cooker make perfect rice with Zojirushi's
rice cooker using its advanced neuro-fuzzy
logic technology brown rice, sushi rice,
sweet rice and mixed rice are just a few of
the options.
A timer can be set up to 12 hours in advance
and a start stop melody signal will let you
know when your rice is done.
A reheating and extended keep-warm cycle
allow you to prepare up to 5.5 cups of your
rice ahead of time and serve later.
Retractable cord for easy storage.
Washer with Fuzzy Logic
Fuzzy Camera
Growing Interest in Fuzzy Control?
It is a new technology and can be used to avoid
patent-claims of similar solutions for technical
problems, which are based on a different technique.
In Japan, fuzzy is wanted by consumers, since it
represents high-tech. In this case fuzzy techniques
are mostly used as a marketing tool.
Growing Interest in Fuzzy Control?
The development of fuzzy controllers is easier to
learn and requires less skilled personnel than that of
conventional controllers. This results in cheaper
productions.
Fuzzy controllers provide more robustness than
conventional control.
Fuzzy controllers are more appropriate to control
non-linear processes.
Example: Fuzzy Temperature Control
Fuzzy Temperature Control
If Room Temperature is Cold then Fan Speed is Slow
If Room Temperature is Warm then Fan Speed is
Medium
If Room Temperature is Hot then Fan Speed is Fast
Note the
overlapping
of fuzzy
subsets again it leads
to smooth
approximation
of the function
between the
Fan Speed &
Temperature
Calculation of the output:
After the fuzzy modeling is done there is an operation phase:
Calculate the Fan Speed when Room Temperature = 22 0C .
NOTE! 22 0C belongs to the Subsets Warm and Hot
Fuzzification and Inference
If Room Temperature is Warm Then Fan Speed is Medium
Fuzzification and Inference
If Room Temperature is Hot then Fan Speed is Fast
The question now is: What is the output value?
Defuzzification
The Result of the Fuzzy
Inference is a Fuzzy Subset
Composed of the Slices of
Fan Speed: Medium (green)
and Fast (red)
How to Find a Crisp (for the
real world application useful)
Value?
One out of several different
methods is to find the
Centroid of Area to Obtain a
Crisp Output
Example of Crisp Operations
Fuzzy Sets Notation
A notation convention for fuzzy sets
when the universe of discourse, X, is
discrete
and finite, is as follows for a fuzzy set A:
Discrete:
Analogous
Fuzzy Sets Operations
Fuzzy Union
Fuzzy Intersection (Conjunction)
Fuzzy Complement
Fuzzy max-min Composition
Suppose R is a fuzzy relation on the
Cartesian space X x Y, S is a fuzzy
relation on Y x Z, and T is a fuzzy
relation on X x Z; then fuzzy max
min composition is defined in terms
of the set-theoretic notation and
membership function-theoretic
notation in the following manner:
Fuzzy max-product Composition
Other Forms of the Composition
Operation
Fuzzy Sets
Fuzzy set theory is a generalization of classical set
theory a generalization that deals excellently with
imprecision.
The power of fuzzy logic is that it enables you to
accurately describe a process or behavior without
using mathematics.
Fuzzy Sets
Classical set theory: An object is either in or not in
the set.
Fuzzy set theory
Cant talk about non-sharp distinctions
An object is in a set by matter of degree
membership h = 1.0 in the set
membership h = 0.0 not in the set
0.0 < membership h < 1.0
partially in the set
Fuzzy sets have a smooth boundary
Not completely in or out
Crisp Sets and Fuzzy Sets
Classical Sets
a set of patients with high
fever
36.4oC
40.6oC
39.1oC
41.5oC
37.0oC
a set of patients without
high fever
38.8oC
37.3oC
universe of discourse
Fuzzy Sets
a fuzzy set of patients with
high fever
36.4oC
41.5oC
37.0oC
40.6oC
39.1oC
a fuzzy set of patients
without high fever
37.3oC
universe of discourse
Fuzzy Sets
Shade of Gray
1
0.8
0.5
.6
0.7
0.55
0.7
0.6
0.5
0.2
0.65
0.5
0.65
0.4
0.4
0.8
0.9
1.0
Degree of being
round (roundness)
Fuzzy Sets
The basic idea of the fuzzy set theory is that an element
belongs to a fuzzy set with a certain degree of
membership, with fuzzy boundaries
A proposition is neither true nor false, but may be partly
true (or partly false) to any degree. This degree is
usually taken as a real number in the interval [0,1]
Fuzzy logic is an extension of classic two-valued logic
the truth value of a sentence is not restricted to true or
false.
Fuzzy Sets
(x)
X
Fuzzy Subset A
1
0
Crisp Subset A
Fuzziness
Fuzziness
Typical functions that can be used to represent a fuzzy set are
sigmoid, gaussian and pi. However, these functions increase
the time of computation. Therefore, in practice, most
applications represent fuzzy subsets by linear fit functions.
Fuzzy Sets
A linguistic variable is a fuzzy variable.
For example, the statement John is tall implies that the
linguistic variable John takes the linguistic value tall.
The range of possible values of a linguistic variable
represents the universe of discourse of that variable.
For example, the universe of discourse of the linguistic
variable speed might have the range between 0 and 220
km/h and may include such fuzzy subsets as very slow,
slow, medium, fast, and very fast.
Fuzzy Sets
A fuzzy set has a membership function that allows
various degrees of membership for the elements of a
given set.
The membership function may be defined in terms
of discrete values, or more commonly by a graph.
When membership function is described by an
analytic expression, we can just use the membership
function to describe the fuzzy subset.
Fuzzy Sets
Classical Logic
Fuzzy Logic
Element x belongs to set A
or it does not:
h(x){0,1}
Element x belongs to set A
with a certain degree of
membership:
h(x)[0,1]
hA(x)
1
hA(x)
A=young
x [years]
A=young
x [years]
Example: Crisp set Tall
Fuzzy sets and concepts are commonly used in natural
language
John is tall
Dan is smart
Alex is happy
The class is hot
The crisp set Tall can be defined as {x | height x > 1.8
meters}. But what about a person with a height = 1.79
meters? What about 1.78 meters? What about 1.52
meters?
Example: Fuzzy set Tall
In a fuzzy set a person with a height of 1.8 meters
would be considered tall to a high degree.
A person with a height of 1.7 meters would be
considered tall to
a lesser degree etc.
The function can change
for basketball players,
women, children etc.
Fuzzy Sets
The x-axis represents the universe of discourse the
range of all possible values applicable to a chosen
variable.
The y-axis represents the membership value of the
fuzzy set.
Fuzzy Sets
crisp
and fuzzy subsets defined on the universe
Degree of
Membership
1.0
Crisp Sets
Short
0.8
Short
Tall
Tall Men
Average
0.6
0.4
0.2
0.0
150
160
170
180
190
200
210
Height, cm
Degree of
Membership
1.0
Fuzzy Sets
0.8
Short
0.6
Tall
Average
0.4
Tall
0.2
0.0
150
160
170
180
190
200
210
Fuzzy Set
Fuzzy sets : young, middle aged and old
Mid
Age
A2
Young
A1
Membership
20
35
Old
A3
45
60
Age
80
Fuzzy Sets
Membership
Variables whose states are defined by linguistic
concepts like low, medium, high.
These linguistic concepts are fuzzy sets themselves.
Very
Low
Low Medium High
Very
high
Temperature
Trapezoidal membership functions
Linguistic
variable
temperature
Linguistic
terms
cold
...
agreeable
...
hot
membership-functions
1
0
Temperature [oC]
Fuzzy Sets
A fuzzy subset has a membership function that
allows various degrees of membership for the
elements of a given set.
The membership function may be defined in terms
of discrete values, or more commonly by a graph.
Fuzzy Sets
If X is the universe of discourse with element x, then a
fuzzy subset, denoted by A, on X is a set of ordered pairs
such that
A {(x, hA(x))| xX}
where hA(x) is the membership function of x in A and
is defined by hA: X [0, 1]
Elements with zero membership are usually not listed.
Fuzzy Sets
If the universe of discourse X is discrete and finite,
X = {x1, x2, , xn}, there are three different ways to
describe the fuzzy subset A.
(a) A = hA(x1)/x1 + hA(x2)/x2 + + hA(xn)/xn
(b) A = {(x1, hA(x1)), (x2, hA(x2)), , (xn, hA(xn))}
(c) A = {hA(x1), hA(x2), , hA(xn)}
If the universe of discourse X is continuous, we can
represent the fuzzy subset A by
A xX [hA(x)/x]
Fuzzy Sets
Since all information contained in a fuzzy subset can be
described by its membership function, it is useful to
develop a lexicon of terms to describe various special
features of this function.
Fuzzy Sets
Core
h(x)
1.0
Support
The core of a fuzzy subset A
is defined as that region of
the universe that is
characterized by full
membership in A.
Boundary
Core(A) = {x| hA(x) = 1, xX}
Fuzzy Sets
Core
h(x)
1.0
Support
Boundary
The support (or domain) of
a fuzzy subset A, Supp(A),
is a crisp set of all xX
such that hA(x)>0.
Supp(A) = {x| hA(x)>0, xX}
Fuzzy Sets
Core
h(x)
1.0
Support
Boundary
Example: Let X = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} and
A = {(1, 0), (2, 0.1), (3, 0.2), (4, 0.5), (5, 0.3), (6, 0.1),
(7, 0), (8, 0), (9, 0), (10, 0)}.
Supp(A) = {2, 3, 4, 5, 6}
Fuzzy Sets
Core
h(x)
1.0
Support
Boundary
The boundary of a fuzzy subset
A is defined as that region of
the universe containing
elements that have a nonzero
membership but not complete
membership.
Boundary(A) = {x| 0 <hA(x)< 1, xX}
Fuzzy Sets
The height of a fuzzy subset A is the maximum value
of the membership function, i.e.,
height(A) = max{hA(x)}.
A fuzzy subset A is normal if and only if
supx[hA(x)] = 1,
that is, the supreme of hA(x) over X is unity.
A fuzzy subset is subnormal if it is not normal.
Fuzzy Sets
Membership functions can be symmetrical or
asymmetrical.
They are typically defined on one dimensional universe,
but they certainly can be described on multidimensional universe.
For high dimensions, the membership functions become
hypersurfaces.
Fuzzy Sets
A fuzzy subset A is empty if and only if hA(x) = 0,
xX, and universal if and only if hA(x) = 1, xX.
A fuzzy number is a fuzzy subset of the universe of a
numerical number.
(1) A fuzzy real number is a fuzzy subset of the
domain of real numbers.
(2) A fuzzy integer is a fuzzy subset of the domain
of integers.
Fuzzy Sets
Example: Let A = integers close to ten; then we may
write
A = 0.1/7 + 0.5/8 + 0.8/9 + 1/10 + 0.8/11 + 0.5/12
+ 0.2/13
Standard Membership Functions
In fuzzy control mainly used: - L-, - and functions, defined by straight line segments.
: U [ 0, 1] ( )
u
0
(u ; , ) ( u ) / ( ) u
1
u
Standard Membership Functions
L : U [0, 1] ( )
u
1
L(u ; , ) ( u ) /( ) u
0
u
:U [0, 1] ( )
0
(u ) / ( )
(u ; , , )
( u) / ( )
0
u<
u
u
u >
Standard Membership Functions
:U [0, 1] ( )
u
0
(u ) / ( ) u
u
(u ; , , , ) 1
( u) / ( ) u
0
u
Standard Membership Functions
Sometimes
Z-type
S-type
left shoulder
right shoulder
Standard Membership Functions
singleton!?
Popular Types of Membership Functions
Trapezoid: <a,b,c,d>
Gaussian: N(m,s)
h(x)
1
h(x)
1
d x
Triangular: <a,b,b,d>
h(x)
1
0
Singleton: (a,1) and (b,0.5)
h(x)
1
Hedges
One thing that makes fuzzy systems
useful is the ability to define
"hedges," or descriptive modifiers, to
represent fuzzy values. This keeps
the operations of fuzzy logic closer to
natural language and allows us to
generate fuzzy statements through
mathematical calculations.
Use of Hedges
Defining hedges and the operations
that use them is a subjective
process, and it can vary from project
to project. But the system lets us use
operators and produce compound
results using the same formal
methods as classic logic.
Example
Let's change the statement
"Company A is old" to "Company A is
very old." Here we're using "very" as
a hedge or descriptor, and this
particular hedge is often defined as
equivalent to the square of the base
value. Therefore if OLD(Company A)
= 0.90,
then VERY OLD(Company A) = 0.81.
Graphical Representation
Fuzzy Set
Usefulness of fuzzy sets depends on our capability
to construct appropriate membership functions for
various given concepts in various contexts.
Constructing meaningful membership functions is a
difficult problem.
Fuzzification
Fuzzification
The process of fuzzification transforms a set (fuzzy or
crisp) to an approximating set that is more fuzzy.
This process is a generation of the dilation operation.
The essence of the fuzzification process is point
fuzzification. Point fuzzification transforms a singleton
set {1/u} in X to a fuzzy set that varies around u.
The symbol is used to denote a fuzzifier.
Clipping Method
Scaling Method
Combining Fuzzy Conclusions
Example: Air Flow Mixing System for Room
Temperature Control
Input and Output Membership
Functions
Defuzzification
Defuzzification
Max-membership principle Also known as the height method, this scheme is limited to
peaked output functions. This method is given by the algebraic
expression
hC ( z*) hC ( z )
zZ
h
1
z*
Defuzzification
Centroid method This procedure (also known as center of gravity) is the most
prevalent and physically appealing of all the defuzzification
method and is given by the algebraic expression
hC ( z ) zdz
z*
hC ( z)dz
zZ
h
1
z*
Defuzzification
Weighted average method This method is only valid for symmetrical output membership
functions. This is given by the algebraic expression
hC ( z ) z
z*
hC ( z )
This method is formed by weighting each membership function
in the output by its respective maximum membership value.
h
z*
.9
.5
a (0.5) b(0.9)
0.5 0.9
Defuzzification
Mean-max membership This method (also called middle-of-maxima) is closely related
to the max-membership principle, except that the locations of
the maximum membership can be non-unique. This is given by
the algebraic expression
z*
ab
2
h
1
Defuzzification
Center of Sums This method is faster than many defuzzification methods that
are presently in used. This process involves the algebraic sum
of individual output fuzzy sets, say C1 and C2, instead of their
union. This is given by the algebraic expression
z*
n
z
[
k 1 hCk ( z )]dz
n
[
k 1 hCk ( z )]dz
One drawback to this method ls that
the intersecting areas are added
twice.
Defuzzification
Center of largest area
If the output fuzzy set has at least two convex subregions, then
the center of gravity of the convex fuzzy subregion with the
largest area is used to obtain the defuzzified value z* of the
output. This is given by the algebraic expression
zhC ( z )dz
z*
hC ( z )dz
m
where Cm is the convex subregion that has the largest area
making up Ck.
Fuzzy Logic Application
101
Fuzzy Processing
102
Output Membership Functions
103
Rules
104
Rule Strength
105
Output Membership Function
106