Vous êtes sur la page 1sur 84

0-0

Fuzzy logic
Gy orgy Schuster
2009. szeptember 30.
Institute of Measurement and Automation
Kand o K alm an Faculty of Electrical Engineering Budapest Tech
schuster.gyorgy@kvk.bmf.hu
0-1
1. Introduction
Fuzzy logic invented by Lofti A. Zadeh in the middle of sixtieth. It is
a special way to describe uncertain or very complex systems.
Those systems cannot be handled by classical logic, which re-
quires deep understanding of the given system.
The following features caracterize fuzzy logic:
exact reasoning is considered as a limiting case of approxi-
mative reasoning,
everything is a matter of degree,
knowledge is viewed as a collection of elastic or fuzzy const-
raint on a collection of variables,
inference is process of propagation of elastic constraints,
0-2
Two important remarks:
Fuzzy systems are suitable for uncertain or approximate rea-
soning. Especially for those systems that are difcult to desc-
ribe mathematically.
Fuzzy logic makes possible decision making based on uncer-
tain or incomplete information.
0-3
2. Fuzzy set and fuzzy logic
In case of classical set theory an element can be inside or outside
of the given set A X.
This can be described by its characteristic function

A
: X {0, 1}, where:
zero value can be considered as false,
one value can be considered as true.
In case of fuzzy logic characteristic function is the following

A
: X [0, 1], where:
zero represents complete non-membership,
one value represents complete membership.
0-4
This gure helps to understand the previous denition.
0-5
At this point should be clear that a fuzzy set is determined by
the set of tuples
A = {(x, (x))|x X}.
If X is a discrete nite set the following description can be used
(following Zadeh):
A = (x
1
)/x
1
+ +(x
n
)/x
n
,
or a more compact way:
n

i=1

i
(x
i
)/x
i
.
0-6
Example:
A = 0.2/0 + 0.6/1 + 0.8/2 + 1/3 + 0.6/4 + 0.1/5
0-7
Make fuzzy thinking more familiar:
We try to describe the optimal bath water temperature:
0-8
3. Features of fuzzy sets
Denition: A fuzzy subset A of X is called normal if there exists an
x X where
A
(x) = 1. In opposite case A is subnormal.
Denition: Support of A fuzzy set is the classical subset of X where
the membership value of A is greater than zero.
supp(A) = {x X|
A
(x) > 0}
0-9
Denition: -cut of A fuzzy set of X is the classical subset on X
where
A
(x) is greater than or equal to .
[A]

=
_
_
_
{x X|
A
(x) if > 0
cl(supp(A)) if = 0
0-10
Denition: A fuzzy set is a singleton if its support is one point on X.
0-11
4. Operation on fuzzy sets
Denition: The intersection of A and B fuzzy sets is dened as
(A B)(x) = min{A(x), B(x)}, x X
0-12
Denition: The union of A and B fuzzy sets is dened as
(A B)(x) = max{A(x), B(x)}, x X
0-13
Denition: The complement of A fuzzy set is dened as
(A)(x) = 1 A(x), x X
0-14
Denition: A mapping T : [0, 1] [0, 1] [0, 1] is a triangular norm
(or t-norm) if it satises the following properties:
Symmetricity:
T(x, y) = T(x, y), x, y [0, 1]
Associativity:
T(x, T(y, z)) = T(T(x, y), z), x, y, z [0, 1]
Monotonicity:
T(x, y) T(x

, y

), if x x

and x y

, x, y, x

, y

[0, 1]
One identity:
T(x, 1) = x, x, y [0, 1]
0-15
Minimum:
T
min
(x, y) = min(x, y)
0-16
Lukasiewicz:
T
L
(x, y) = max(x +y 1, 0)
0-17
Product:
T
P
(x, y) = xy
0-18
Denition: A mapping S : [0, 1]

[0, 1] [0, 1] is triangular conorm


(t-conorm or s-norm) if satises the following properties:
Symmetricity:
S(x, y) = S(y, x), x, y [0, 1]
Associativity:
S(x, S(y, z)) = S(S(x, y), z), x, y, z [0, 1]
Monotonicity:
S(x, y) S(x

, y

), if x x

and x y

, x, y, x

, y

[0, 1]
Zero identity:
S(x, 0) = x, x, y [0, 1]
If T is a t-norm we can obtain the appropriate t-conorm:
S(x, y) = 1 T(1 x, 1 y).
0-19
Maximum:
S
max
(x, y) = max(x, y)
0-20
Lukasiewicz:
S
L
(x, y) = min(x +y, 1)
0-21
Probabilistic:
S
P
(x, y) = x +y xy
0-22
5. Fuzzy numbers and fuzzy arithmetic
Denition: A fuzzy number A is a fuzzy set of the real line if it is
normal, convex and it has bounded support.
Denition: A quasi fuzzy number A is a fuzzy set of the real line if
it is normal, convex and its membership function satises the
following conditions:
lim
x

A
(x) = 0, lim
x

A
(x) = 0
Family of fuzzy numbers is denoted by F
0-23
Denition: A fuzzy set A is a triangular fuzzy number if it has a
point-like peak (called often centre) and > 0 left and > 0
right width. Its membership function can be described by
the following form:

A
(x) =
_

_
1
a x

if a x a
1
x a

if a x a +
0 otherwise
Often used notation is A = (a, , ).
0-24
Denition: A fuzzy set A is a trapezoidal fuzzy number if it has a
maximum interval [a, b] (called often tolerance interval or
core) and > 0 left and > 0 right width. Its membership
function can be described by the following form:

A
(x) =
_

_
1
a x

if a x a
1 if a x b
1
x b

if a x a +
0 otherwise
Often used notation is A = (a, b, , ).
0-25
Denition: Any fuzzy number A F can be described by the
form:

A
(x) =
_

_
L
_
ax

_
if x [a , a]
1 if x [a, b]
R
_
xb

_
if x [b, b +]
0 otherwise
, where
L : [0, 1] [0, 1],
R : [0, 1] [0, 1]
Family of so called LR type fuzzy number denoted by F
LR
.
A fuzzy number A F
LR
is referred by A(a, b, , )
LR
.
0-26
Fuzzy arithmetic
We need some notation to handle phenomenons related to
fuzzy arithmetic. Those are:
[A]

is the left side of -cut of A fuzzy number.


[A]

+
is the right side of -cut of A fuzzy number.
As for these we can describe [A]

=
_
[A]

, [A]

.
To handle fuzzy arithmetic we have to apply the rules of inter-
val arithmetic. That means we will apply interval arithmetic on
-cuts and as the result of these operation we can put together
the resulting fuzzy number.
0-27
Scalar multiplication:
[k A

] =
_
min{k[A]

, k[A]

+
}, max{k A

, k A

+
}

k R
Standard addition:
[A+B]

=
_
[A]

+ [B]

, [A]

+
+ [B]

In case of triangular fuzzy numbers A(a


A
,
A
,
A
), B(a
B
,
B
,
B
) the
result is C = A+B, where C(a
A
+a
B
,
A
+
B
,
A
+
B
).
0-28
Subtraction:
[AB]

=
_
[A]

[B]

, [A]

+
[B]

Remark:
we can consider the subtraction as an addition where B is mul-
tiplied by 1.
Multiplication:
In case of multiplication we apply -cuts to obtain the result.
[A B]

= min{[A]

[B]

, [A]

[B]

+
, [A]

+
[B]

, [A]

+
[B]

+
}
[AB]

+
= max{[A]

[B]

, [A]

[B]

+
, [A]

+
[B]

, [A]

+
[B]

+
}
If we have triangular or trapezoid fuzzy numbers where the
, slops are linear the resulting fuzzy number wont have linear
slops. In this case we can use the resulting fuzzy number accura-
tely or we have the opportunity to simplify the result to triangular
fuzzy number described by its core and its support.
0-29
Division:
_
A
B
_

=
_
min
_
[A]

[B]

,
[A]

[B]

+
,
[A]

+
[B]

,
[A]

+
[B]

+
_
, max
_
[A]

[B]

,
[A]

[B]

+
,
[A]

+
[B]

,
[A]

+
[B]

+
__
0 / supp{B}
Similar to the multiplication division cannot keep slope linearity,
eighter.
0-30
6. The extension principle
The extension principle allows us to extend any point operation
applying on fuzzy sets.
Denition: [Zadeh] Assume X and Y are crisp sets and let f be a
mapping from X to Y .
f : X Y
Such that each x X, f(x) = y Y . Assume A is a fuzzy
subset of X and using the extension principle, we can dene
f(A) is a fuzzy subset of Y such that
f(A)(y) =
_
_
_
sup
xf
1
(y)
A(x) if f
1
(y) =
0 otherwise
where f1(y) = {x X|f(x) = y}.
0-31
As you can see in the picture f function is a strictly increasing.
If f is strictly increasing or strictly decreasing
f(A)(y) =
_
A(f
1
(y)) if Range(f)
0 otherwise
where Range(f) = {y Y |x X}.
0-32
In this case f(x) function is not strict increasing or decreasing
therefor a problem has emerged during mapping. At this point
we should using the supremum operation to avoid ambiguity.
0-33
If we want to get more accurate result of f mapping than in
the previous examples we can use again interval arithmetic.
Let A is a fuzzy number (for sake of simplicity) and f a continu-
ous function f : X X. Then we can apply the formula
[f(A)]

= f([A]

), where [f(A)]

= {f(x)|x [A]

}.
Let A and B be fuzzy numbers and f : X X X be a conti-
nuous function. Then
[f(A, B)]

= f([A]

, [B]

) and
f([A]

, [B]

) = {f(x
1
, x
2
)|x
1
[A]

, x
2
[B]

}.
0-34
Example: Fuzzy minimum
f
min
(A, B) min{[A]

, [B]

} =
_
min{[A]

, [B]

}, min{[A]

+
, [B]

+
}

where A, B F
0-35
7. Fuzzy relation
Denition: Let X
1
, X
2
, . . . , X
n
be classical sets. Subsets of their Car-
tesian product X
1
X
2
X
n
are called n-ary relations.
If X
1
= X
2
= = X
n
and X
n
is called n-ary relation in
X. Let is a binary relation in . Its characteristic function is
dened as

(x, y) =
_
1 if (x, y)
0 otherwise
Denition: Assume X, Y / . Fuzzy relation is a fuzzy subset of
XY or (XY ). If X = Y is called binary fuzzy relation.
0-36
Example:
Assume X = Y = {1, 2, 3, 4}. The chosen relation is the so called
approximately equal, which can be dened as
(1, 1) = (2, 2) = (3, 3) = (4, 4) = 1
(1, 2) = (2, 1) = (2, 3) = (3, 2) = (3, 4) = (4, 3) = 0.7
(1, 3) = (3, 1) = (2, 4) = (4, 2) = 0.3
(1, 4) = (4, 1) = 0.1
The membership function of is

x,y
=
_

_
1 if x = y
0.7 if |x y| = 1
0.3 if |x y| = 2
0.1 if |x y| = 3
or
_
_
_
_
1 0.7 0.3 0.1
0.7 1 0.7 0.3
0.3 0.7 1 0.7
0.1 0.3 0.7 1
_
_
_
_
0-37
Operation on fuzzy relations
We apply all the known operations on fuzzy relation we used
on normal (one-dimensional) fuzzy sets.
Example:
We have the previous fuzzy relation of approximately equal.
Let us dene another one x is approximately greater than y fuzzy
relation. And we need the x is approximately greater than or
equal to y fuzzy relation.
In case of normal sets the result can be obtained by a union
operation. In this case we can use the maximum operation as
union.
0-38
(x = y) =
_
_
_
_
1 0.7 0.3 0.1
0.7 1 0.7 0.3
0.3 0.7 1 0.7
0.1 0.3 0.7 1
_
_
_
_
(x > y) =
_
_
_
_
0.7 0.3 0.1 0
1 0.7 0.3 0.1
1 1 0.7 0.3
1 1 1 0.7
_
_
_
_
(x y) =
_
_
_
_
1 0.7 0.3 0.1
1 1 0.7 0.3
1 1 1 0.7
1 1 1 1
_
_
_
_
If it is needed we can apply any other T or S norm as intersec-
tion or union operation.
0-39
Thanks to the fact that fuzzy relations more than one dimensi-
onal there can be more operations.
Denition: Cartesian product of two fuzzy sets A F(X) and B
F(Y) can be dened as
(AB)(x, y) = min{A(x), B(y)}, (x, y) X Y.
Considering this A B, A F(X), B F(Y ) is a binary fuzzy
relation.
0-40
If we have a binary fuzzy relation we can obtain the projection
on each base set.

X
(x) = sup
y
{(AB)(x, y)|y Y }

Y
(y) = sup
x
{(AB)(x, y)|x X}
0-41
Max-min composition
Let us consider two fuzzy relations = x is considerable smaller
than y and = y is almost equal to z.
(x, y) =
_
_
0.8 1 1
0.4 0.8 1
0 0.4 0.8
_
_
and (y, z) =
_
_
1 0.8 0.4
0.8 1 0.8
0.4 0.8 1
_
_
We want the fuzzy relation between x and z. To obtain this
result we should apply the so called max-min composition.
Denition: Consider two fuzzy relations. Let F(X Y ) and
F(Y Z). The max-min composition of , is denoted by
dened as
(x, y) = max min{(x, y), (y, z)}
0-42
Example:
( )
1 1
= max
_
min(
1 1
,
1 1
), min(
1 2
,
2 1
), min(
1 3
,
2 1
)
_
=
= max
_
min(0.8, 1), min(1, 0.8), min(1, 0.4)
_
= 0.8
And the resulting fuzzy relation is
( )(x, y) =
_
_
0.8 1 1
0.8 1 1
0.4 0.8 0.8
_
_
In this case we applied max and min functions to obtain the
result. At this point we should mention that we are allowed to
replace max operation to any known s and min function any
known t norm.
0-43
8. Fuzzy measure
Denition: Fuzzy measure can be considered as generalisation of
the classical probability measure. A fuzzy measure g over
a set X (the universe of discourse with the subsets E, F, ...)
dened as g : P(X) [0, 1] and satises the following condi-
tions:
1 When E is the empty set then g(E) = 0.
2 When E is a subset of F, then g(E) g(F).
3 For every sequence (A
i
P(X))|i N) of subsets of X,
if eighter A
1
A
2
. . . or A
1
A
2
. . .
lim
i
g(A
i
) = g( lim
i
A
i
).
A fuzzy measure g is called normalised if g(X) = 1.
0-44
There is some interpretation of fuzzy measure, but only neces-
sity and possibility measures is discussed here.
Fuzzy number can also be considered as possibility distribution.
If A F is fuzzy number and x is a real number then A(x) can
be considered as the degree of possibility of the statement x is A.
0-45
Let A, B F be fuzzy numbers where A = (a, ) and B = (b, ).
The possibility measure of the statement A B is the following
Pos[A B] =
_

_
1 if a a
1
a b
+
otherwise
0 if a b + +
The necessity measure the same statement can be dened as
Nes[A B] = 1 Pos[A B].
In other words for this case
Nes[A B] =
_

_
1 if a b
b a
+
if a < b, A B =
0 otherwise
0-46
0-47
0-48
Since Nes[A B] = 1 Pos[A B].
0-49
9. Linguistic variables
To describe vague, incomplete or imprecise information we can
use fuzzy sets to present linguistic variables.
Denition: A linguistic variable is characterised by a quintuple
(x, T(x), U, G, M)
where
x is the name of the given variable,
T(x) is the term set of x,
U is the universe of disclosure,
G is the syntactic rule for generating the names of values,
M is a semantic rule for associating with each value its me-
aning.
0-50
Example:
categories of human age with linguistic variables.
0-51
Another example:
a typical fuzzy partition with linguistic variables.
0-52
10. Fuzzy decision
Let us consider the following situation. We have a crane and a
payload. Our task is to deliver the payload to the target location
as quick as it possible without hitting the wall.
This task is not to difcult to a well-trained crane operator, but
it could be quite difcult if tradition control systems are applied.
In this situation we have two input values, those are:
is the angle between the rope and the perpendicular direction,
d is the distance from the wall.
And we have only one output value the power (intensity of
current) of the crane motor.
Fuzzy logic offers us a reasonable solution. The question is how?
0-53
Crane control situation
0-54
Structure of a MISO fuzzy decision machine
0-55
The input values enter the system at fuzzycation unit. Its task
is to convert a point like crisp input value into a fuzzy quantity.
The most widespread solution is that each input value convert
to a singleton, of which support is the current measured input va-
lue.
If an input value has some uncertainty and this uncertainty is
known or well-estimated the support of the fuzzyed input will be
as wide as the given uncertainty.
0-56
After fuzzycation the fuzzy input values enter the decision ma-
chine, of which structure depends on the applied inference me-
chanism.
The fuzzy decision is based on the fuzzy if-then rule base. And
the structure of the rule base depends on the applied decision.
We will deal with the following decision methods:
Zadeh,
MMG, PMG, PSG, Mizumoto,
Tsukamoto,
Dombi.
. . .
0-57
Zadehs decision
Zadehs rule base is a fuzzy relation, which describes the con-
nection between the input and output sides.
0-58
The fuzzy input is expanded at right angles to the input axis
0-59
The expanded fuzzy input is combined by minimum operation
with the fuzzy rule base.
The obtained fuzzy relation is projected to the output axis. This
is the so called fuzzy output.
But crisp output is needed. One of the ways to get it the centre
of gravity is calculated to the horizontal output axis.
0-60
Zadehs decision is very handy if we have a single-input single-
output (SISO) system.
If we have multi-input multi-output (MISO) system with n input
variables the rule base will be n + 1-ary fuzzy relation. It is difcult
to handle.
Another problem is the memory demand is growing exponen-
tially by the number of input values.
0-61
To solve these problems some other decision methods have
been developed, those are:
minimum-maximum-gravity (MMG) Mamdani,
product-maximum-gravity (PMG),
product-sum-gravity (PSG) Larsen,
Mizumoto,
Tsukamoto
0-62
MMG decision (SISO)
There are two fuzzy clusters, an input and an output ones.
Each rule in the input cluster are assigned to each rule in the out-
put cluster, i.e. A in the input cluster is assigned to A in the
output cluster.
The fuzzyed input value is singleton.
Input singleton hits the given rules at the ring level. The assig-
ned output rule is combined with this level by minimum operation.
The resulting output rules are put together by maximum ope-
ration, which is resulting the fuzzy decision.
To get crisp decision centre of gravity of the fuzzy result is cal-
culated onto the horizontal axis.
0-63
0-64
PMG decision
The only difference is compared to the Mamdani decision that
minimum operation is replaced by production.
0-65
PSG decision
Minimum operation is replaced by production. Maximum ope-
ration is replace by addition.
Thanks to these replacements we can precalculate the area
and centre of gravity of the output rules of which area is modied
by ring level production. The decision procedure can be much
faster than the previous MMG and PMG methods.
0-66
Mizumoto decision
The output fuzzy rules are replaced by singletons. This makes
the decision much simpler. But we lose some exibilities.
0-67
Tsukamoto decision
The input rule must be monotonic function. The assigned out-
put rule must be strict monotonic function.
The input singleton hits the input rule at the high of the ring
level. This value hit point of output rule will be projected onto the
output domain.
This decision is very simple, but we need more rules to describe
conventional fuzzy decision.
0-68
Dombi decision
Dombis decision is based on sigmoid function. Actually it has
a good solution for the difcult problem of large clusters.
Sigmoid function:
(x) =
1
1 +e
(xa)
,
0-69
(x) =
1
1 +e
(xa)
,
(x) as the function of where (a = 5)
a is location of the inection point,
the steepness of (x) at a.
0-70
Sigmoid functions are applied as fuzzy sets. The only problem
with these they are S or type functions, similar to the functi-
ons applied in case of Tsukamoto method.
Considering this at least two sigmoids should be applied to
describe a conventional fuzzy rule.
0-71
In this case the given input value cut all the rules at certain
levels.
These levels are called weights. These will be used for the the
decision.
0-72
As for Dombi the output universe contains two sigmoid functi-
ons.
Their features are modied by the weight factors given by input
sigmoid.
Output sigmoid combined by a well-chosen t-norm i.e. mini-
mum operation.
The crisp decision is the maximumlocation of the resulting fuzzy
set.
0-73
Let us mark the left side input rule sigmoid functions (x)
IL
i
and
right side ones
IR
i
.
(x)
IR
i
=
1
1 +e

IR
i
(xa
IR
i
)
, and (x)
IL
i
=
1
1 +e

IL
i
(xb
IR
i
)
,
And parameters of the output sigmoids are

R
=
1

i
w
IR
i

IR
i
, and
L
=
1

i
w
IL
i

IL
i
And a or b parameters can be calculated by
a =

i
w
IR
i
a
IR
i
and b =

i
w
IL
i
b
IL
i
Remark: parameters as well as a or b parameters have physi-
cal dimensions. That can cause some problems.
0-74
To solve physical dimension problem and simplify the the cal-
culation we have modied Dombis method in the following way:
We left out of consideration the and a or b parameters of
input clusters in the decision. All we apply is the weight pa-
rameters.
We dont use output function. We generate the the crisp
output value based on weight factors.
The modied algorithm is the following:
1. left side function weight are summed w
L
=

i
w
IL
i
,
2. right side function weight are summed w
R
=

i
w
IR
i
,
3. calculate the average of the calculated weights o
c
=
w
L
+w
r
2
.
This is the crisp decision.
0-75
Simulation of inverted pendulum using simplied Dombi me-
thod
0-76
Angle input rules of the pendulum
We apply as input value to prepare stable control solution.
The input cluster resembles angle input cluster.
The weight factors of angular speed are added to left and
right output w values in rational way.
0-77
The result of simulation
0-78
Decisions in case of multiply inputs
Consider the crane control situation.
There are two input values
the angle of the crane rope,
d the distance measured from the target location.
0-79
Fuzzy clusters
Input clusters: angle of rope, distance from target.
Output cluster: power of the crane motor.
0-80
If - then rule base
If distance is F and angle is NB then let power be SP or
if distance is F and angle is SP then let power be BP or
if distance is F and angle is Z then let power be BP or
.
.
.
if distance is M and angle is BP then let power be BP or
.
.
.
if distance is N and angle is BN then let power be BN or
if distance is N and angle is Z then let power be Z.
0-81
Fuzzy Association Map
FAM is a very handy way to set up fuzzy if-then rule base. Lin-
guistic terms of input variables are on the edges of the chart.
Associated output variables can be found inside of the chart.
0-82
0-83

Vous aimerez peut-être aussi