# 2. Introduction to fuzzy logic

Document Sample

```					 Fuzzy Sets and Fuzzy Logic
Fuzzy Graphs
Fuzzy Associative Memory

2. Introduction to fuzzy logic

Philippe De Wilde

Department of Computer Science
Heriot-Watt University
Edinburgh

Vloeberghs Leerstoel 2010

Philippe De Wilde   2. Introduction to fuzzy logic
Fuzzy Sets and Fuzzy Logic
Fuzzy Graphs
Fuzzy Associative Memory

Outline

1   Fuzzy Sets and Fuzzy Logic

2   Fuzzy Graphs

3   Fuzzy Associative Memory

Philippe De Wilde   2. Introduction to fuzzy logic
Fuzzy Sets and Fuzzy Logic
Fuzzy Graphs
Fuzzy Associative Memory

Six Lectures

1. History of decision making under uncertainty. Game:
repeated prisoner’s dilemma.
2. Introduction to fuzzy logic. Game: rock, scissors, paper.
3. Financial markets and fuzzy games. Game: fuzzy
chess.
4. Coupled networks in the brain. Game: Monty Hall’s
dilemma.
5. Neuroeconomics. Game: ultimatum game.
6. The AI of deviations of rationality.

Philippe De Wilde   2. Introduction to fuzzy logic
Fuzzy Sets and Fuzzy Logic
Fuzzy Graphs
Fuzzy Associative Memory

Linguistic Variables

Philippe De Wilde   2. Introduction to fuzzy logic
Fuzzy Sets and Fuzzy Logic
Fuzzy Graphs
Fuzzy Associative Memory

Membership Function

membership

1

fast

0
30 60 90 120 speed

µfast (speed),    µA (x).

Philippe De Wilde   2. Introduction to fuzzy logic
Fuzzy Sets and Fuzzy Logic
Fuzzy Graphs
Fuzzy Associative Memory

Membership Function Deﬁnition

Deﬁnition (Universe of discourse)
The universe of discourse is a set X , discrete ({x1 , . . . , xn }), or
continuous (union of intervals on the real line).

Deﬁnition (Membership Function)
A membership function is a function µA : X → [0, 1].

Deﬁnition (Fuzzy Set)
A fuzzy set is deﬁned by a membership function, it consists of
some elements x of a universe of discourse X together with
their membership values (or degrees) µa (x).

Philippe De Wilde   2. Introduction to fuzzy logic
Fuzzy Sets and Fuzzy Logic
Fuzzy Graphs
Fuzzy Associative Memory

Basic Logic Operations

Deﬁnition (AND)
µA∩B (x) = min(µA (x), µB (x)),             ∀x ∈ X .

Deﬁnition (OR)
µA∪B (x) = max(µA (x), µB (x)),             ∀x ∈ X .

Deﬁnition (NOT, optional)
µ¬A (x) = 1 − µA (x),       ∀x ∈ X .

Philippe De Wilde    2. Introduction to fuzzy logic
Fuzzy Sets and Fuzzy Logic
Fuzzy Graphs
Fuzzy Associative Memory

Extension Principle

A function transforming a set into another set will transform a
membership function into another membership function, using
the extension principle.
Deﬁnition (Extension Principle)
If f : X → Y is a function transforming universe of discourse X
into Y , then fuzzy set µA (x) is transformed into µB (y ):

maxy =f (x) µa (x) if f −1 (y ) = ∅,
µB (y ) =
0                  otherwise.

Philippe De Wilde   2. Introduction to fuzzy logic
Fuzzy Sets and Fuzzy Logic
Fuzzy Graphs
Fuzzy Associative Memory

Example of Extension Principle

y = x2

The extension principle is powerful, and can be used to create
fuzzy arithmetic.

Philippe De Wilde   2. Introduction to fuzzy logic
Fuzzy Sets and Fuzzy Logic
Fuzzy Graphs
Fuzzy Associative Memory

Fuzzy Numbers

µ10(x)

x
0
10

Philippe De Wilde   2. Introduction to fuzzy logic
Fuzzy Sets and Fuzzy Logic
Fuzzy Graphs
Fuzzy Associative Memory

Decision Making under Fuzziness

Deﬁnition
Let X be a set of options. A fuzzy goal is a fuzzy set
µG (x), x ∈ X . A fuzzy constraint is a fuzzy set µC (x), x ∈ X .

A fuzzy decision is a fuzzy set µD (x), x ∈ X , with

µD (x) = min(µG (x), µC (x)).

A crisp decision x ∗ can be derived from a fuzzy decision by
defuzziﬁcation:
x ∗ = arg max µD (x).
x∈X

There are several ways to defuzzify, for example the centre of
gravity of the area under the curve.
Philippe De Wilde     2. Introduction to fuzzy logic
Fuzzy Sets and Fuzzy Logic
Fuzzy Graphs
Fuzzy Associative Memory

Example of Decision Making

µG(x)
µC(x)

x
X*
x ∗ is the decision, subject to constraints C and goal G.

Philippe De Wilde   2. Introduction to fuzzy logic
Fuzzy Sets and Fuzzy Logic
Fuzzy Graphs
Fuzzy Associative Memory

Uncertainty of a Functional Dependency
Uncertainty can be represented by additive noise, e.g.
y = x 2 + ξ,
with ξ a random variable.
The noise can also be on the parameters of the functional
relationship, e.g.
y = x (2+ξ) ,
or
y = ξx 2 .

where the curve of a function becomes a union of squares,
and each point in the union belongs to the function to a
certain degree. This is the fuzzy graph.
Philippe De Wilde   2. Introduction to fuzzy logic
Fuzzy Sets and Fuzzy Logic
Fuzzy Graphs
Fuzzy Associative Memory

Fuzzy Graph

Philippe De Wilde   2. Introduction to fuzzy logic
Fuzzy Sets and Fuzzy Logic
Fuzzy Graphs
Fuzzy Associative Memory

Union of Cartesian Products

The fuzzy graph is a union: (A1 × B1 ) ∪ (A2 × B2 ) ∪ . . . (An × Bn ).
Deﬁnition (Fuzzy graph)
If X and Y are universes of discourse, f ∗ : X → Y is a fuzzy
graph iff
n
f∗ =    i=1 Ai   × Bi ,
µf ∗ (u, v ) = maxi min(µAi (u), µBi (v )),                u ∈ X, v ∈ Y.

max and min come from (u is in A1 AND v is in B1 ), OR (u is in
A2 AND v is in B2 ), OR ...

Philippe De Wilde   2. Introduction to fuzzy logic
Fuzzy Sets and Fuzzy Logic
Fuzzy Graphs
Fuzzy Associative Memory

Fuzzy Graph as a Set of Rules

e.g. f ∗ represents:
If u is small then v is large
else (or) if u is medium then v is medium
else if u is large then v is small.
If u is A1 then v is B1
else if u is A2 then v is B2
else if u is A3 then v is B3 .
Bi can coincide with Bj , but the Ai need to be different, just
as f(x) needs to be unique for a function.
Fuzzy probability distributions are possible!

Philippe De Wilde   2. Introduction to fuzzy logic
Fuzzy Sets and Fuzzy Logic
Fuzzy Graphs
Fuzzy Associative Memory

Intersection of Two Fuzzy Graphs

Equivalent of solving two simultaneous equations.

Philippe De Wilde   2. Introduction to fuzzy logic
Fuzzy Sets and Fuzzy Logic
Fuzzy Graphs
Fuzzy Associative Memory

Inversion of a Fuzzy Graph

If a fuzzy set B is given, ﬁnd the fuzzy set A corresponding with
it according to f ∗ .
Minimum and maximum of a fuzzy graph can also be deﬁned.

Philippe De Wilde   2. Introduction to fuzzy logic
Fuzzy Sets and Fuzzy Logic
Fuzzy Graphs
Fuzzy Associative Memory

Fuzzy Control: Rules for Stopping a Car

1 input, 1 rule, 1 output
If you go too fast, brake hard.
1 input, 2 rules, 1 output
If you go too fast, brake hard, or, if you go fast, brake.
2 inputs, 4 rules, 1 output
If you go too fast and the wall is very close, brake hard, or
If you go fast and the wall is very close, brake, or
If you go too fast and the wall is close, brake, or
If you go fast and the wall is close, slow down.

Philippe De Wilde   2. Introduction to fuzzy logic
Fuzzy Sets and Fuzzy Logic
Fuzzy Graphs
Fuzzy Associative Memory

Fuzzy Associative Memory

too fast               fast
very close     brake hard             brake
close          brake                  slow down
µ2 µ2 µ 2 . . .
1    2    3
µ1
1   µ11 µ12 µ13 . . .
µ1
2   µ21 µ22 µ23 . . .
µ1
3   µ31 µ32 µ33 . . .
.
.     .
.    .
.    .
.   ..
.     .    .    .      .
That’s how an expert lists the rules she uses.

Philippe De Wilde    2. Introduction to fuzzy logic
Fuzzy Sets and Fuzzy Logic
Fuzzy Graphs
Fuzzy Associative Memory

2 Inputs Fire Rules

2 inputs x 1 and x 2
x 1 belongs to the input membership functions µ1 , µ1 , µ1 , . . .
1 2 3
to degrees µ1 (x 1 ), µ1 (x 1 ), µ1 (x 1 ), . . ..
1         2          3
x 2 belongs to the input membership functions µ2 , µ2 , µ2 , . . .
1 2 3
to degrees µ2 (x 2 ), µ2 (x 2 ), µ2 (x 2 ), . . ..
1         2          3
output membership function µij ﬁres at degree
min[µ1 (x 1 ), µ2 (x 2 )], using min because of the ’and’ in the
i        j
rules.
output membership function µij is truncated at
min[µ1 (x 1 ), µ2 (x 2 )].
i          j

Philippe De Wilde   2. Introduction to fuzzy logic
Fuzzy Sets and Fuzzy Logic
Fuzzy Graphs
Fuzzy Associative Memory

Truncated Output Membership Function

µij(z)

min[µi1(x1),µj2(x2)]

z

truncation
= min µij (z), min[µ1 (x 1 ), µ2 (x 2 )]
i          j

= min µij (z), µ1 (x 1 ), µ2 (x 2 )
i          j

Philippe De Wilde      2. Introduction to fuzzy logic
Fuzzy Sets and Fuzzy Logic
Fuzzy Graphs
Fuzzy Associative Memory

Combination of all Output Membership Functions
Max, because a collection of rules is combined with ’or’.
maxi,j min µij (z), µ1 (x 1 ), µ2 (x 2 )
i          j
Sum can be used instead of max.

z
Philippe De Wilde   2. Introduction to fuzzy logic
Fuzzy Sets and Fuzzy Logic
Fuzzy Graphs
Fuzzy Associative Memory

Defuzziﬁcation using Centre of Gravity

f (z) = maxi,j min µij (z), µ1 (x 1 ), µ2 (x 2 )
i          j
∞
−∞ zf (z)dz
Centre of gravity y =             ∞
−∞ f (z)dz

y is the defuzziﬁed output, the control

Philippe De Wilde   2. Introduction to fuzzy logic
Fuzzy Sets and Fuzzy Logic
Fuzzy Graphs
Fuzzy Associative Memory

Applications in automotive, process control, consumer
electronics, defence
Abe Mamdani

Philippe De Wilde   2. Introduction to fuzzy logic
Fuzzy Sets and Fuzzy Logic
Fuzzy Graphs
Fuzzy Associative Memory

Summary

Membership functions deﬁne fuzzy sets.
Fuzzy graphs express relationships between linguistic
variables, a collection of fuzzy if-then-else rules.
Fuzzy inference uses fuzzy associative memory, and
defuzziﬁcation.

Next
game theory
ﬁnancial markets
fuzzy games

Philippe De Wilde   2. Introduction to fuzzy logic

Further Reading and Picture Credits I

Fuzzy Logic, Neural Networks, and Soft Computing.
Communications of the ACM, 37(3):77–84, 1994.

Philippe De Wilde   2. Introduction to fuzzy logic

```
DOCUMENT INFO
Shared By:
Categories:
Stats:
 views: 52 posted: 3/15/2010 language: English pages: 27