handling uncertainty using fuzzy logicpkalra/siv895/old/fuzzy.pdf · fuzzy logic with engineering...
TRANSCRIPT
Handling Uncertainty using
FUZZY LOGIC
Conventional (Boolean) Set Theory:
Fuzzy Set Theory
© INFORM 1990-1998 Slide 3
“Strong Fever”
40.1°C
42°C
41.4°C
39.3°C
38.7°C
37.2°C
38°C
Fuzzy Set Theory:
40.1°C
42°C
41.4°C
39.3°C
38.7°C
37.2°C
38°C
“More-or-Less” Rather Than “Either-Or” !
“Strong Fever”
Fuzzy Variable: Old
1
030 50
Age
75 90
Membership
μ(25)= 0
(33)= 0.15
μ(38)= 0.4
μ(44)= 0.7
μ(72)= 1.0
Crisp Logic vs Fuzzy Logic
Crisp logic needs hard decisions
Fuzzy Logic deals with “membership in group” functions
Probability and Possibility One cupboard A contains a number of bottles, some
containing water, and others containing undesirable products. The label on one of the bottle reads,
“ Probability of water being good is 0.93”.
Another cupboard B contains water from various sources, like mineral water, tap water, rain water, pond water, drain water etc. The label on one of the bottle reads,
“ Possibility of water being good is 0.8”.
Which one would you prefer to open for drinking?
Fuzzy Logic deals with Possibility measures.
Possibility indicates the extent of belief.
First proposed by Lufti Zadeh.
Lots of applications:
Digital cameras
Camcorders
Washing machines
Braking systems (trains)
Process control
Image processing
Control of automatic exposure in video cameras,
humidity in a clean room,
air conditioning systems,
washing machine timing,
microwave ovens,
vacuum cleaners.
Continuous Fuzzy sets
Discrete Fuzzy set
x = { 0/0, 0.2/1, 0.4/2, 1/ 3, 0.9/4, 0.3/5, 0.1/6 }
Membership function Crisp set representation
Characteristic function
if
if
Fuzzy set representation Membership function
if x is totally in A
if x is not in A
If x is partly in A
( ) : 0,1Af x X
1,( )
0Af x
x A
x A
( ) 1
( ) 0
0 ( ) 1
A
A
A
x
x
x
Fuzzy set theory basicsFuzzy set operators:
EqualityA = BA (x) = B (x) for all x X
ComplementA’A’ (x) = 1 - A(x) for all x X
ContainmentA BA (x) B (x) for all x X
Fuzzy set theory basicsFuzzy set operators:
UnionA BA B (x) = max(A (x), B (x)) for all x X
IntersectionA BA B (x) = min(A (x), B (x)) for all x X
T-norms & co-normsIntersection of two fuzzy sets
t-norm properties:
If b1 < b2, then
Basic t-norms:
Standard intersection -
Bounded sum -
Algebraic product -
( , )
( ,1) ( )
( , ) ( , )
z T a b
T a T a
T a b T a b
1 2( , ) ( , )T a b T a b
( , ) min( , )
( , ) max(0, 1)
( , )
m
b
p
T a b a b
T a b a b
T a b ab
Example fuzzy set operations
15
A’
A B A B
A B
A
Well known Membership Functions
A given value could have number of possibilities
X has following possibilities
possibility(low) = 0.8
possibility(medium) = 0.4
all others possibilities (high, V.high) = 0
Fuzzy Relations
Generalizes classical relation into one that allows partial membership
Describes a relationship that holds between two or more objects
Example: a fuzzy relation “Friend” describe the degree of friendship between two person (in contrast to either being friend or not being friend in classical relation!)
Fuzzy Logic:Intelligence, Control, and Information, J. Yen and R. Langari, PrenticeHall
Fuzzy Relations
A fuzzy relation is a mapping from the Cartesian space X x Y to the interval [0,1], where the strength of the mapping is expressed by the membership function of the relation (x,y)
The “strength” of the relation between ordered pairs of the two universes is measured with a membership function expressing various “degree” of strength [0,1]
Fuzzy Logic with Engineering Applications: Timothy J. Ross, McGraw-Hill
˜ R
R~
Fuzzy Cartesian Product
Let
be a fuzzy set on universe X, and
be a fuzzy set on universe Y, then
Where the fuzzy relation R has membership function
Fuzzy Logic with Engineering Applications: Timothy J. Ross, McGraw-Hill
˜ A ˜ B ˜ R X Y
R (x, y) A x B
(x, y) min( A (x), B
(y))
˜ A ˜ B
Fuzzy Cartesian Product: ExampleLet
defined on a universe of three discrete temperatures, X = {x1,x2,x3}, and
defined on a universe of two discrete pressures, Y = {y1,y2}
Fuzzy set represents the “ambient” temperature and
Fuzzy set the “near optimum” pressure for a certain heat exchanger, and the Cartesian product might represent the conditions (temperature-pressure pairs) of the exchanger that are associated with “efficient”operations. For example, let
Fuzzy Logic with Engineering Applications: Timothy J. Ross, McGraw-Hill
˜ A
˜ B ˜ A ˜ B
˜ A 0.2
x10.5
x21
x3and
˜ B 0.3
y10.9
y2
} ˜ A ˜ B ˜ R
x1
x2
x3
0.2 0.2
0.3 0.5
0.3 0.9
y1 y2
Fuzzy CompositionSuppose
is a fuzzy relation on the Cartesian space X x Y,
is a fuzzy relation on the Cartesian space Y x Z, and
is a fuzzy relation on the Cartesian space X x Z; then fuzzy max-min and fuzzy max-product composition are defined as
Fuzzy Logic with Engineering Applications: Timothy J. Ross, McGraw-Hill
˜ R ˜ S ˜ T
˜ T ˜ R S
maxmin
T (x,z)
yY( R (x,y) S
(y,z))
max product
T (x,z)
yY(
R (x,y)
S (y, z))
Max-Min Composition The max-min composition of two fuzzy relations R1
(defined on X and Y) and R2 (defined on Y and Z) is
Properties:
Associativity:
Distributive over union:
)],(),([),(2121
zyyxzx RRy
RR
R S T R S R T ( ) ( ) ( )
R S T R S T ( ) ( )
Fuzzy Composition: Example (max-min)
Fuzzy Logic with Engineering Applications: Timothy J. Ross, McGraw-Hill
X {x1, x2},
T (x1,z1)
yY( R (x1,y) S
(y,z1))
max[min( 0.7,0.9),min(0.5, 0.1)]
0.7
Y {y1, y2},and Z {z1,z2, z3}
Consider the following fuzzy relations:
˜ R x1
x2
0.7 0.5
0.8 0.4
y1 y2
and ˜ S y1
y2
0.9 0.6 0.5
0.1 0.7 0.5
z1 z2 z3
Using max-min composition,
} ˜ T x1
x2
0.7 0.6 0.5
0.8 0.6 0.4
z1 z2 z3
Max-Product Composition The max-product composition of two fuzzy relations R1
(defined on X and Y) and R2 (defined on Y and Z) is
Properties:
Associativity:
Distributive over union:
)],(),([),(2121
zyyxzx RRy
RR
R S T R S R T ( ) ( ) ( )
R S T R S T ( ) ( )
Fuzzy Composition: Example (max-Prod)
Fuzzy Logic with Engineering Applications: Timothy J. Ross, McGraw-Hill
X {x1, x2},
T (x2, z2 )
yY( R (x2 , y) S
(y, z2))
max[( 0.8,0.6),(0.4, 0.7)]
0.48
Y {y1, y2},and Z {z1,z2, z3}
Consider the following fuzzy relations:
˜ R x1
x2
0.7 0.5
0.8 0.4
y1 y2
and ˜ S y1
y2
0.9 0.6 0.5
0.1 0.7 0.5
z1 z2 z3
Using max-product composition,
} ˜ T x1
x2
.63 .42 .25
.72 .48 .20
z1 z2 z3
Application: Fuzzy Relation Petite
Fuzzy Logic:Intelligence, Control, and Information, J. Yen and R. Langari, PrenticeHall
Fuzzy Relation Petite defines the degree by which a person with
a specific height and weight is considered petite. Suppose the
range of the height and the weight of interest to us are {5’, 5’1”,
5’2”, 5’3”, 5’4”,5’5”,5’6”}, and {90, 95,100, 105, 110, 115, 120,
125} (in lb). We can express the fuzzy relation in a matrix form as
shown below:
˜ P
5'
5'1"
5' 2"
5' 3"
5' 4"
5' 5"
5' 6"
1 1 1 1 1 1 .5 .2
1 1 1 1 1 .9 .3 .1
1 1 1 1 1 .7 .1 0
1 1 1 1 .5 .3 0 0
.8 .6 .4 .2 0 0 0 0
.6 .4 .2 0 0 0 0 0
0 0 0 0 0 0 0 0
90 95 100 105 110 115 120 125
Fuzzy Logic:Intelligence, Control, and Information, J. Yen and R. Langari, PrenticeHall
˜ P
5'
5'1"
5' 2"
5' 3"
5' 4"
5' 5"
5' 6"
1 1 1 1 1 1 .5 .2
1 1 1 1 1 .9 .3 .1
1 1 1 1 1 .7 .1 0
1 1 1 1 .5 .3 0 0
.8 .6 .4 .2 0 0 0 0
.6 .4 .2 0 0 0 0 0
0 0 0 0 0 0 0 0
90 95 100 105 110 115 120 125
Once we define the petite fuzzy relation, we can answer two
kinds of questions:
• What is the degree that a female with a specific height and a specific
weight is considered to be petite?
• What is the possibility that a petite person has a specific pair of height
and weight measures? (fuzzy relation becomes a possibility
distribution)
Application: Fuzzy Relation Petite
Fuzzy Logic:Intelligence, Control, and Information, J. Yen and R. Langari, PrenticeHall
Given a two-dimensional fuzzy relation and the possible values
of one variable, infer the possible values of the other variable
using similar fuzzy composition as described earlier.
Definition: Let X and Y be the universes of discourse for
variables x and y, respectively, and xi and yj be elements of X
and Y. Let R be a fuzzy relation that maps X x Y to [0,1] and
the possibility distribution of X is known to be Px(xi). The
compositional rule of inference infers the possibility distribution
of Y as follows:
max-min composition:
max-product composition:
PY(yj ) maxx i
(min(PX (xi),PR (xi , yj)))
PY(yj ) maxx i
(PX (xi) PR(xi , yj ))
Application: Fuzzy Relation Petite
Fuzzy Logic:Intelligence, Control, and Information, J. Yen and R. Langari, PrenticeHall
Problem: We may wish to know the possible weight of a petite
female who is about 5’4”.
Assume About 5’4” is defined as
About-5’4” = {0/5’, 0/5’1”, 0.4/5’2”, 0.8/5’3”, 1/5’4”, 0.8/5’5”, 0.4/5’6”}
Using max-min compositional, we can find the weight possibility
distribution of a petite person about 5’4” tall:
Pweight
(90) (0 1) (0 1) (.41) (.81) (1 .8) (.8 .6) (.4 0)
0.8
˜ P
5'
5'1"
5' 2"
5' 3"
5' 4"
5' 5"
5' 6"
1 1 1 1 1 1 .5 .2
1 1 1 1 1 .9 .3 .1
1 1 1 1 1 .7 .1 0
1 1 1 1 .5 .3 0 0
.8 .6 .4 .2 0 0 0 0
.6 .4 .2 0 0 0 0 0
0 0 0 0 0 0 0 0
90 95 100 105 110 115 120 125
Similarly, we can compute the possibility
degree for other weights. The final result is
Pweight {0.8 /90,0.8 /95,0.8 /100,0.8/105,0.5 /110,0.4 /115, 0.1/120,0 /125}
Fuzzy Inference Systems Fuzzy logical operations
Fuzzy rules
Fuzzification
Implication
Aggregation
Defuzzification
Fuzzifier Inference Engine De-fuzzification
FuzzyKnowledge base
input output
Fuzzifier
Converts the crisp input to a linguistic variable using the membership functions stored in the fuzzy knowledge base.
Inference Engine Using If-Then type fuzzy rules converts the fuzzy input to
the fuzzy output.
COMPOSITIONAL RULE OFINFERENCE
In order to draw conclusions from a set of rules (rule base) one needs a mechanism that can produce an output from a collection of rules. This is done using the compositional rule of inference.
B’= A’ o R
“o“ is the composition operator. The inference procedure is called “compositional rule of inference”.
The inference mechanism is determined by two factors:
1. Implication operators: Mamdani: min
Larsen: algebraic product
2. Composition operators: Mamdani: max-min
Larsen: max-product
35
Rule Evaluation
distance
small
o.55
Clipping approach (others are possible):
Clip the fuzzy set for “slow” (the consequent) at the height given by our belief in the premises (0.55)
We will then consider the clipped AREA (orange) when making our final decision
Rationale: if belief in premises is low, clipped area will be very smallBut if belief is high it will be close to the whole unclipped area
acceleration
slow
36
Rule Evaluation
Distance is not growing, then keep present acceleration
delta
=
0.75
acceleration
slow present fast fastestbrake
37
Rule Evaluation
Distance is not growing, then keep present acceleration
delta
=
0.75
acceleration
present
38
Rule Aggregation
acceleration
present
acceleration
slow
From distanceFrom delta (distance change)
To make a final decision: From each rule we haveObtained a clipped area. But in the end we want a singleNumber output: our desired acceleration
Washing Machine
INPUT:
Load (Quantity)
small, medium, large
Fabric Softness:
Hard, Not so Hard, Soft, Not so soft
OUTPUT: (Wash Cycle)
Light, Normal, Strong
If
Laundry quantity is large (Fuzzy)
then
wash cycle is strong (Fuzzy)
Washing Machine1
0.6
0.3
1
0
Small Medium Large
Laundry Quantity
Light Normal Strong
.
Wash Cycle
If Laundry quantity is large (Fuzzy) then wash cycle is strong (Fuzzy)
Washing machine needs a NON-fuzzy information.
Rule 1: If Laundry quantity is LARGE and
Laundry softness is HARD then wash cycle is
strong.
Rule 2: If Laundry quantity is MEDIUM and
Laundry softness is NOT SO HARD then wash
cycle is normal.
All rules in rule base get fired
Washing Machine
0.6
0.3
1
0
Small Medium Large
Laundry Quantity
Light Normal Strong
1
0
Hard N.H N.S Soft
Laundry Softness
0.2
.75
Wash Cycle
Rule 1: If Laundry quantity is LARGE and Laundry softness is HARD then wash cycle is strong.
Rule 2: If Laundry quantity is MEDIUM and Laundry softness is NOT SO HARD then wash cycle is normal.
44
Summary: If-Then rules1. Fuzzify inputs:
Determine the degree of membership for all terms in the
premise.
If there is one term then this is the degree of support for
the consequence.
2. Apply fuzzy operator:
If there are multiple parts, apply logical operators to
determine the degree of support for the rule.
45
Summary: If-Then rules3. Apply implication method:
Use degree of support for rule to shape output fuzzy set of
the consequence.
How do we then combine several rules?
46
Multiple rules We aggregate the outputs into a single fuzzy set which
combines their decisions.
The input to aggregation is the list of truncated fuzzy sets and the output is a single fuzzy set for each variable.
Aggregation rules: max, sum, etc.
As long as it is commutative then the order of rule exec is irrelevant.
47
Defuzzify the output Take a fuzzy set and produce a single crisp number that
represents the set.
Practical when making a decision, taking an action etc.
Center of gravity
Defuzzification
Center of Gravity
Low High
1
0
0.61
0.39
tCrisp output
Max
Min
Max
Min
dttf
dtttf
C
)(
)(
Center of Gravity
Sugeno Fuzzy Models
Also known as TSK fuzzy model
Takagi, Sugeno & Kang, 1985
Goal: Generation of fuzzy rules from a given input-output data
set.
Fuzzy Rules of TSK Model:
If x is A and y is B then z = f(x, y)
Fuzzy Sets Crisp Function
Examples
R1: if X is small and Y is small then z = x +y +1
R2: if X is small and Y is large then z = y +3
R3: if X is large and Y is small then z = x +3
R4: if X is large and Y is large then z = x + y + 2
51
Issues with Fuzzy logic How to determine the membership functions? Usually
requires fine-tuning of parameters
How to generate Fuzzy rules?
3 input variables, each can take 4 possible linguistic values
GA can help