0% found this document useful (0 votes)
149 views104 pages

Lecture 4&5

This document discusses fuzzy rules and fuzzy reasoning, which are important concepts in fuzzy inference systems. Fuzzy inference systems have been successfully applied to applications such as automatic control, expert systems, and pattern recognition. The key concepts covered include the extension principle, fuzzy relations, fuzzy if-then rules, and fuzzy reasoning using the compositional rule of inference and max-min composition of fuzzy relations. Examples are provided to illustrate these fundamental fuzzy logic concepts and their applications in fuzzy systems.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
149 views104 pages

Lecture 4&5

This document discusses fuzzy rules and fuzzy reasoning, which are important concepts in fuzzy inference systems. Fuzzy inference systems have been successfully applied to applications such as automatic control, expert systems, and pattern recognition. The key concepts covered include the extension principle, fuzzy relations, fuzzy if-then rules, and fuzzy reasoning using the compositional rule of inference and max-min composition of fuzzy relations. Examples are provided to illustrate these fundamental fuzzy logic concepts and their applications in fuzzy systems.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 104

In the Name of God

Lectures 4&5: Fuzzy Rules


and Fuzzy Reasoning
Outline

▫ Extension principle
▫ Fuzzy relations
▫ Fuzzy if-then rules
▫ Compositional rule of inference
▫ Fuzzy reasoning
Whyy fuzzyy rules?

▫ Fuzzyy rules and fuzzy y reasoning


g are the
backbone of fuzzy inference systems
▫ Fuzzy inference systems are the most important
modeling
d li ttooll iin thi
this fifield
ld
▫ They have been successfully applied to many
applications such as
 automatic control
 expert systems
 pattern recognition
 data classification
 …
Extension Principle

▫ It provides g general procedure for extendingg crisp


domains of mathematical expressions to fuzzy
domains
▫ it generalizes
li point-to-point
i tt i t mapping
i off a function
f ti
f(.) to a mapping between fuzzy sets
Extension Principle

A is a fuzzy set on X :
A   A ( x1 ) / x1   A ( x 2 ) / x 2    A ( x n ) / x n

The image of A under f(.) is a fuzzy set B:


B  f ( A )   B ( x1 ) / y1   B ( x 2 ) / y 2     B ( x n ) / y n
where yi = f(xi), i = 1 to n.

If f(.) is a many-to-one mapping, then


 B ( y )  m ax  A ( x )
11
x f ( y)

Note that f(.) is a function from X to Y


An example

▫ Let:
▫ and
▫ Upon applying the extension principle, We have :
An example with continuous universe

▫ Let:

▫ and

▫ It is many-to-one mapping for x in the range [-1,2]


▫ So,
So the membership grades for y in the range
[-1,0] should be obtained by obtaining the
maximums
▫ This causes discontinuity in the membership
function of B
An example with continuous universe

MAX
General definition
• Suppose f is a mapping from n-D product space
X1×…×Xn to a single universe Y such that f(x1,…,xn) = y
• There is a fuzzy set Ai in each Xi
• Each element in an input vector (x1,…,xxn) occurs
simultaneously, which implies AND operator
• The membership grade of fuzzy set B induced by the
mapping f should be the minimum of the membership
graded of fuzzy set Ai’s.
General definition
• The extension principle implies that fuzzy set B induced
by the mapping f is defined by

• Note that this assumes that y = f(x1,…,xn) is a crisp


function.
• In case where f is a fuzzy function
function, we can employ the
compositional rule of inference (we will see it later on)
Example

• Let:
A ( x )  0.5 /  1  0.8 / 1
B ( x )  0.3 /  1  1 / 0  0.7 / 1
• and:
f : X *X  X, f ( x1, x 2)  x1. x 2
• applying the extension principle (by applying the
product instead of min):
f ( A, B)  0.15 /1  0.5 / 0  0.35 / 1  0.24 / 1  0.8 / 0  0.56 /1
 (0.35  0.24) / 1  (0.5  0.8) / 0  (0.15  0.56) /1
 0.35
0 35 / 1  00.88 / 0  0.56
0 56 /1
Crisp Relations

• Crisp relation:
▫ A crisp relation represents the presence or absence of
association, interaction or interconnectedness between the
elements of two or more sets.

▫ Characteristic function of a relation:


Crisp Relations (Example)
( )
Fuzzyy Relations
• Binary fuzzy relations are fuzzy sets in X×Y mapping
each element in X×Y to a membership grade between 0
and 1
• Unary fuzzy relations are fuzzy sets with 1D MFs
• Binary fuzzy relations are fuzzy sets with 2D MFs
• Many applications including fuzzy control and decision
making
• Let us be restricted to binary fuzzy relations
Fuzzyy Relations
• A fuzzy relation is a fuzzy set defined on the Cartesian
product of crisp sets A1, A2, ..., An where tuples (x1, x2, ...,
xn) may have varying degrees of membership within the
relation.
• The membership grade indicates the strength of the
relation present between the elements of the tuple.
 R : A1  A2  ...  An  [0,1]
R  (( x1 , x2 ,..., xn ),  R ) |  R ( x1 , x2 ,..., xn )  0, x1  A1 , x2  A2 ,..., xn  An 
Fuzzy Relations

A fuzzy relation R is a 2D MF:


R  {(( x , y ),  R ( x , y ))| ( x , y )  X  Y }

Example:
p

It is
i better
b tt tto show
h th
the ffuzzy relation
l ti as a relation
l ti matrix:
t i
Fuzzy Relations
• Example. The relation y >> x can be defined as:
µ (y
(y-x)
x)
R

 0 x  y;

 R ( x, y )   1
x  y.
1  100( y  x) 2
y-x

• "x is A" AND "x is B" = "x is (A AND B)”


x is A"
"x A OR "xx is B"
B = "xx is (A OR B)”
B)

x x
"x is A" AND "y is B" = "(x,y) is A  B”
"x is A" OR "y is B" = "(x,y) is A  Y  X  B"
x x
A
A

B B
y y
Fuzzy Relations

Other common examples are:


• x is
i close
l to
t y (x
( andd y are numbers)
b )
• x depends on y (x and y are events)
• x and y look alike ((x,, and y are persons
p or objects)
j )
• If x is large, then y is small (x is an observed reading
and y is a corresponding action)
Fuzzy Relations (Example)
Fuzzy Relations
• Representations of binary relation
▫ Membership matrices
▫ Sagittal diagram
Fuzzy Relations

• The reverse of a fuzzy relation:

• For example:

0.3 0.2 
0.3 0 0.6
R   0 1   R 1  R T  
 0.2 1 0.4 
0.6 0.4
Fuzzy relation on a single set

• Representations of binary relations R(X,X):


Domain and range of fuzzy relation

• Domain: dom ( R ) ( x)  max


yB
 R ( x, y )
• Range: ran ( R ) ( y )  max  R ( x, y )
x A

dom ( R ) ( x1 )  1.0
dom ( R ) ( x2 )  0.4
dom ( R ) ( x3 )  1.0
dom ( R ) ( x4 )  1.0
dom ( R ) ( x5 )  0.5
dom ( R ) ( x6 )  0.2
More on fuzzy relations

• Various important types of binary fuzzy relations


are distinguished on the basis of three different
characteristic properties: reflexivity, symmetry,
and transitivity
transitivity.
• A fuzzy relation R(X,X) is reflexive if and only if
R  x, x   1 for all x  X
More on fuzzy relations

• A fuzzy relation R(X,X) is symmetric if and only if


 R  x, y    R  y , x  for all x  X
• If it is not satisfied for some x,yx yX,
X then the
relation is called asymmetric. If the equality is not
satisfied for all members of the support of the
relation, then the relation is called antisymmetric.
If above equation is not satisfied for all x,yX,
then R(XR(X,X)
X) is called strictly antisymmetric.
antisymmetric
More on fuzzy relations

• A fuzzy relation R(X,X) is transitive (or, more


specifically, max-min transitive if and only if
 R  x, z   max min   R  x, y  ,  R  y, z   for all  x, z   X 2
yY

• If this is not true for some members of X, R(X,X)


is called nontransitive.
nontransitive If the inequality of above
equation does not hold for all (x,z)X2, then
R(X X) is called antitransitive.
R(X,X) antitransitive
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

 R  R ( x , z )  m ax
1 2
m in[[  R1 ( x , y ),  R 2 ( y , z )]
y

  [  R1 ( x , y )   R 2 ( y , z )]
y
• Properties:
• Associativity: R  (S  T )  ( R  S )  T

• Distributivity over union: R  (S  T )  ( R  S ) ( R  T )

• Week distributivityy over intersection: R  (S  T )  ( R  S ) ( R  T )

• Monotonicity: S  T  (R  S)  (R T )
Max-Min Composition

• The max-min composition


p is associative and its inverse
is equal to the reverse composition of the inverse
relations.

• However, it is not commutative.


Example

• For example:
Max-Min Composition

• R1 and R2 are expressed as relation matrices


• The calculation of R1 o R2 is almost the same as matrix
multiplication, except that × and + are replaced by ˄
and ˅,
˅ respectively.
respectively
• For this reason, the max-min composition is also called
max-min product
• Although max-min composition is widely used, it is not
easy to approach mathematically
• To have better mathematical tractability
tractability, max-product
max product
composition can be alternatively used
Max-product Composition

• Max-product
Max product composition:
 R  R ( x, z )  max[  R ( x, y ). R ( y, z )]
1 2 1 2
y

 [  R1 ( x, y ). R2 ( y, z )]
y
• In general, we have max-*
max composition:
 R  R ( x , z )   [  R ( x , y ) *  R ( y , z )]
1 2 1 2
y

• where * is a T-norm operator.


Example

• Let

• and
Example

x y z

0.9
1 0.4  a
02
0.2
0.2
 R  R (2, a )  0.7 (max-min composition) 2  b
1 2
0.5
 R  R (2, a )  0.63 (max-product composition) 0.8
1 2
3 
0.9 0.7


Linguistic Variables (detailed description)

• A numerical variables takes numerical values:


Age = 65
• A linguistic variables takes linguistic values:
Age
g is old
• A linguistic value is a fuzzy set.
• A linguistic variable is characterized by (x, T(x), X, M)
• x: the name of the variable
• T(x): the term set of x, that is the set of all linguistic
values or linguistic terms
• X:
X the
th universe
i off discourse
di
• M: the semantic rule that associates with each linguistic
value A its meaning M(A), where M(A) denotes a fuzzy
set in X
Linguistic Variables (detailed description)

• T(age) = {young, not young, very young, middle aged,


not middle aged, old, not old, very old, more or less old,
not very young and not very old}
• The semantic rule defines the MFs
Linguistic
g Values ((Terms))
Linguistic
g Variable Modifiers

• Modifiers (hedges) are words like "extremely", "very"


which changes the predicate.
• For example, "It is cold today" becomes "It is very cold
today .
today“
• Some possible implementations of modifiers are: Very,
somewhat, Not, positively, etc.
• CONcentration and DILution –transform original
membership function µ(x)  µn(x), n > 1 (concentration)
and n < 1 (dilution).
Operations on Linguistic
g Values
Concentration: CON ( A)  A2

Dilation: D IL ( A )  A 0 .5

NOT, AND, OR:


Constructing
g composite
p linguistic
g terms
• Let us suppose the X as [0,100] and define the MFs of
old and young as

• Composite
C it MF
MFs can b
be constructed
t t d as
Operations on Linguistic
g Values
Contrast intensification:
 2A2 , 0  A (x)  0.5
INT ( A)  
 2(A)2
, 0.5  A (x)  1
Linguistic Variable Modifiers

• Examples: VERY (µ2(x)), EXTREMELY (µ3(x)),


SOMEWHAT, MORE OR LESS (µ0.5 0 5(x))

µ (temperature)
cold
ld

1 not cold
cold
co d
somewhat
very cold cold

temperature
Linguistic Variable Modifiers

 n  ( x ); x A
n

• INTensify 
y – µint((x)) =
1 n ( x ); x A
 n

Aa = {x| µ(x)  a} is the a-cut of µ(x).


• For example, let n = 2, a = 0.5. The fuzzy sets Tall
and POSITIVELY Tall are illustrated below:

positively tall
1

tall
0.5
Linguistic
g Variable Modifiers
• AROUND, ABOUT, APPROXIMATE – Broaden µ(x).
( )
• BELOW, ABOVE – (see illustration below)

below tall tall above tall tall


1 1

0.5 0.5
about tall

tall tall
Orthogonality
• A term set T = t1,…,tn for a linguistic variable x on the
universe X is orthogonal if:

• where ti’s are convex and normal fuzzy sets defined on


X that make up T
If-Then
Fuzzy If Then Rules
• Many y of fuzzy
y applications
pp are based on fuzzyy
if-then rules
• It expresses what happen if a fuzzy set is true
• The fuzzy sets and fuzzy rules combine to form
a fuzzy system.
• For
F example: l automatic
t ti control
t l
Fuzzyy Rules
• Human knowledge builds fuzzy rules.
▫ Consider the decision to bring an umbrella to work
under the following circumstances:
 70% chance of rain rain.
 An umbrella keeps you dry.
 If it rains you will get wet.
 If you get wet
wet, you will be uncomfortable at work
work.
 If you have an umbrella you will be dry.
▫ Through this knowledge, you reason to bring an
umbrella
b ll tto work.
k
▫ The knowledge of the percentage of rain and what an
umbrella
u b e a is
s used for
o led
ed you to make
a e rules
u es tthat
at gu
guided
ded
you through your reasoning.
If-Then
Fuzzy If Then Rules
• General format:

If x is A then y is B

• Examples:
▫ If pressure is high, then volume is small.
▫ If the road is slippery, then driving is dangerous.
▫ If a tomato
t t is
i red,
d then
th it isi ripe.
i
▫ If the speed is high, then apply the brake a little.
If-Then
Fuzzy If Then Rules

Two ways to interpret “If


If x is A then y is B
B”::

A coupled with B A entails B


y y

B B

x x
A A
If-Then
Fuzzy If Then Rules
• Two ways to interpret “If x is A then y is B”:
▫ A coupled with B: (A and B)
~
R  A  B  A  B   A( x)B( y)|( x, y)
▫ A entails B: (not A or B)
 Material
ate a implication:
p cat o
 Propositional calculus:
 Extended propositional calculus:
 Generalization of modus ponens:

where
If-Then
Fuzzy If Then Rules
• Although the four formulas are different, they all reduced to
the family identity A B == ̚ AUB when A and B are
propositions in the sense of two-valued (0 or 1) logic
• Based on various fuzzy T-norm and T-conorm (S-norm),
we may have the following for R = A  B

• where f, called the fuzzy implication function, performs the


rule task
If-Then
Fuzzy If Then Rules (coupled)
• Mamdani type (min product):

• Larsen type
yp ((algebraic
g p
product):
)

• Bounded product:

• Drastic product:
If-Then
Fuzzy If Then Rules
• Fuzzy implication function:
 R ( x , y )  f (  A ( x ),
)  B ( y ))  f ( a , b )
• A coupled with B
If-Then
Fuzzy If Then Rules (entails)
• Zadeh’s arithmetic rule:

• Zadeh’s max-min rule :

• Boolean fuzzy
f implication:

• Goguen’s fuzzy implication (algebraic product for T-norm):


If-Then
Fuzzy If Then Rules

A entails B
Fuzzyy reasoning
g

• Fuzzy reasoning (or approximate reasoning)


is an inference procedure
• It derives conclusions from a set of fuzzyy if-
then rules and known facts
Compositional Rule of Inference

• p
Similar idea was used for max-min operation
• Suppose we have a curve y = f(x)
• When we are given x = a, then we can infer that y = b = f(a)
• A generalization
li i would ld b
be allowing
ll i a to b be an interval
i l and
d
f(x) to be an interval-values function
• We should first construct cylindrical extension of a and
then find its intersection I with the interval-values curve
• The projection of I onto the y-axis yields the interval y = b
Compositional Rule of Inference

• Derivation of y = b from x = a and y = f(x):


y y

b b

y = f(x)
f( ) y = f(x)

a x x
a
a and b: points a and b: intervals
y = f(x) : a curve y = f(x) : an interval-valued
function
Compositional Rule of Inference

• Going g one step p further f is a fuzzyy relation on X×Y and A is


a fuzzy set of X
• We would like to find the resulting fuzzy set B
• c(A)
(A) iis a cylindrical
li d i l extension
t i withith b
base A
• The intersection of c(A) and f forms I
• By projecting I = c(A)Ոf onto the y-axis,
y axis, y is inferred as a
fuzzy set B on the y-axis
Compositional Rule of Inference

• Let μA , μc(A) , μB and μf be the MFs of A,, c(A),


( ), B,, and f
• μc(A) is related to μA through

• Then,
h

• By projecting c(A)Ոf onto the y-axis, we have

• If both A and f have finite universe of discourse, the above


formula reduces to the min-max
min max composition
• B is represented as
Compositional Rule of Inference

• a is a fuzzy
y set and y = f(x)
( ) is a fuzzy
y relation:
Fuzzyy reasoning
g

• The basic rule of inference is modus p ponens


• We can infer the truth of B from the truth of A and the
implication A  B
• wouldld lik
like tto fifind
d th
the resulting
lti ffuzzy sett B
• Example:
• A: the apple is red
• B: the apple is ripe
• If it is true that “the apple is red”, it is also true that “the
apple l iis ripe”
i ”
Fuzzyy Reasoning
g
Fact: x is A’
Rule:
R l if x is i A,
A then
th y is i B
--------------------------------------------------
Conclusion: y is B’ B

where A’ is close to A and B’ is close to B.


When A, B, A’, and B’ are fuzzy sets of appropriate
universe, the inference procedure is called
approximate reasoning (or fuzzy reasoning
reasoning, or
generalized modus ponens (GMP))
Defintion of fuzzyy reasoning
g

• Let A,, A’ and B be fuzzy y sets of X,, X’ and Y,, respectively


p y
• Assume A  B is expressed as a fuzzy relation R on X×Y
• Then, the fuzzy set B induced by “x is A” and the fuzzy rule
“if x is
i A,
A then
th y iis B” iis d
defined
fi d b by

• Or equivalently
Fuzzyy Reasoning
g

• Single
g rule with single
g antecedent
Fact: x is A’
Rule: if x is A, then y is B
--------------------------------------------------
Conclusion: y is B’
• Graphic
G hi R Representation:
t ti
A’ A B
w

X Y
A’
B’

X Y
x is A’ y is B’
Fuzzyy Reasoning
g
• In this case, we have (assuming ˄ for the relation A  B)

• Indeed
Indeed,
• first we find the degree of match w as the maximum of
μA’(x)˄μA(x)
• Then,, the MF of resulting
g B’ is equal
q to the MF of B clipped
pp
by w
• Note that w represents a measure of degree of belief for
the antecedent part of a rule
• This measure gets propagated by the ifif-then
then rules and the
resulting degree of belief of MS for the consequent part (B’)
should be no greater than w
Fuzzyy Reasoning
g
• Single rule with multiple antecedent
Fact: x is A’ and y is B’
Rule: if x is A and y is B, then z is C
---------------------------------------------------------
Conclusion: z is C’
• Graphic
p Representation:
p
A’ A B’ B T-norm C2
w

Z
X Y
A’ B’
C’
C
Z
x is A’ X y is B’ Y z is C’
Fuzzyy Reasoning
g
• Based on Mamdani’s rule:

• The resulting C’
C is expressed as

• Thus,
Fuzzyy Reasoning
g
• w1 and w2 are the maxima of the MFs of AՈA’ and BՈB’
• w1 denotes the degree of compatibility between A and A’
• w1 and w2 is called the firing strength or degree of
fulfillment of the fuzzy rule
Fuzzyy Reasoning
g
• Decomposition method for calculating C’

• Proof
Fuzzyy Reasoning
g

• Multiple
p rules with multiple
p antecedent
Fact: x is A’ and y is B’
Rule 1: if x is A1 and y is B1 then z is C1
Rule 2: if x is A2 and y is B2 then z is C2
-------------------------------------------------------
C
Conclusion:
l i z is
i C’

• Graphic Representation: (next slide)


Fuzzyy Reasoning
g

• Graphics
p p
representation:
A’ A1 B’ B1 C1
w1
Z
X Y
A’ A2 B’ B2 C2
w2

Z
X Y
T norm
T-norm
A’ B’
C’
Z
x is A’ X y is B’ Y z is C’
Four steps
p of fuzzy
y reasoning
g
• Degrees of compatibility:
▫ Compare the known facts with the antecedents of fuzzy
rule to find the degree of compatibility with respect to each
antecedent MF
• Firing strength:
▫ Combine degree of compatibility with respect to antecedent
MFs in a rule using g fuzzy
y AND or OR operators
p to form a
firing strength that indicates the degree to which the
antecedent part of the rule is satisfied
Four steps
p of fuzzy
y reasoning
g
• Qualified (induced) MFs:
▫ Apply the firing strength to the consequent MF of a rule to
generate a qualified consequent MF
• Overall output MF:
▫ Aggregate all the qualified consequent MFs to obtain an
overall output MF
Example
p
• Comparing crisp logic inference and fuzzy logic inference
Crisp
C i Ali is
i 22 years old
ld
logic Dina is 3 years older than Ali .
Dina is (22 + 3) years old

Translation –
Age(Ali) = 22; (Age(Dina),Age(Ali)) = Age(Dina)–Age(Ali) = 3;
Age(Dina) = Age(Ali) + 3 = 22 + 3 = 25

Fuzzy Ali is Young


logic Dina is much older than Ali .
Dina is (Young o Much
Much_older)
older)
Translation –
Age(Ali) = Young (Young is a fuzzy set); Age(Dina),Age(Ali)) =
M h ld (a
Much_older ( relation);
l ti ) AAge(Dina)
(Di ) = YYoung o Much_older
M h ld – a
composite relation!
Example
p
• µAge(Dina)(x) =  {µyoung(y)  µmuch_older(x,y) }
The universe
ni erse of discourse
disco rse (s(support)
pport) is "Age"
which may be quantified into several
overlapping
pp g fuzzy y ((sub)sets:
) Young,g, Mid-age,g ,
Old with the following definitions:
µ(Age) Young Mid-age Old

5 20 35 50 Age
Example
p
• Much_older is a relation which is defined as:
 1 x  y  20,
1
µmuch_older(x,y) =  20 ( x  y) 0  x  y  20,

 0 x  y.
µ (x,y)
much_older

40
30
20
x
10

40 y
30
20
10
0
Example
p
• For each fixed x, find
µAge(Dina)(x) = max(min(µyoung(y),µmuch_older(x,y)):
µ (x)
Age(Dana)
1.0

0.8

0.6

0.4

0.2

0
0 5 10 15 20 25 30 35 40 45
x
Example:
p control
Example:
p fuzzy
y control
Example:
p fuzzy
y control

Crisp
Crisp Inference Defuzzilier Values
Values Fuzzifier
Engine

Membership Functions

Fuzzy (IF THEN) Rules


Fuzzy Variables
Linguistic Variables
Example:
p fuzzy
y control
IF x1 is A1i AND x2 is A2i THEN y i is B i , for i  1, 2,..., l

For example, Mamdani rule (we will see in the next chapter !):

Fuzzy
X (real number) Value Fuzzy AND/OR DOF
Fuzzifier Values

C
Connectives
ti
Membership
Functions
Method of
Defuzzification
Y Y1
Fuzzy Y2
Output (Fuzzy set) Defuzzifier Defuzzified
Value output
Bl k
Block
Yn (real number)
Example: fuzzy control

IF theta is POS
ZERO
AND theta_dot is POS NEG POS

THEN force is NEG


Change
Detectors

theta Fuzzifier
((POS)) Output Center of Gravity
Block force
theta_dot Fuzzifier
AND (NEG)
(NEG) D f
Defuzzifier
ifi
Output

Rule #2 force

Rule #3 force
Example:
p Robot obstacle avoidance

Angle of sensor i w
Distance to obstacle v
(
(measureddbby sensor i)

Fuzzy-Logic-Controller

1

2
Example:
p Robot obstacle avoidance

Membership Functions:
Close Near Far Neg Zero Pos

a) Distance measured by sensor b) Angle of sensor (th)


(d)
Zero VSlow Slow Fast Neg SNeg Zero SPos Pos

c) Forward velocity (V) d) Angular Velocity (W)


Example:
p Robot obstacle avoidance

Fuzzy rules for the ith sensor:


1."IF distancei is Close And anglei is Pos Then V Is VSlow W is Neg "
2."IF distancei is Close And anglei is Zero Then V Is Zero W is Neg "
3."IF
3. IF distancei is Close And anglei is Neg Then V Is VSlow W Is Pos "
4."IF distancei is Near And anglei is Pos Then V Is Slow W Is SNeg"
5."IF distancei is Near And anglei is Zero Then V Is VSlow W Is SNeg"
6."IF distancei is Near And angle
g i is Neg g Then V Is Slow W Is Spos"
p
7."IF distancei is Far And anglei is Pos Then V Is Fast W Is Zero"
8."IF distancei is Far And anglei is Zero Then V Is Fast W Is Zero"
9."IF distancei is Far And anglei is Neg Then V Is Fast W Is Zero"
Example:
p Inverted Pendulum

e
e
CONTROLLER
de/dt

U
I e  VL sin e  HL cos e
w V  mg   mL ( e sin e  e 2 cos e )
H  mw  mL
L ( e cos e  e 2 sin
i e)
This can be hard.
U  H  Mw 
Defining
g the Linguistic
g Variables

• Variables for e, de/dt, U.


• Seven values for each linguistic variable
(N
(Negative
ti L Large, Al
Almostt Z
Zero, P
Positive
iti S Small)
ll)
• Must choose scale appropriately. (E.g., for e,
a=pi/4
a pi/4 is a reasonable choice.)

NL NM NS AZ PS PM PL

-a -2a/3 -a/3 0 a/3 2a/3 a


Fuzzification

• Account for uncertainty in measurement.


• Measurement (x) is converted to fuzzy set
A(x). (This is a different set for each x).
• For some controllers, this is skipped.

A( )
A(x) Chosen based on A( )
A(x)
uncertainty in
measurement
x x
  No fuzzification
Inference Rules
e

NM NS AZ PS PM
NS NS AZ IInterior
i
de/dt values
AZ NM AZ PM U

PS AZ PS
• These seven rules handle many cases.
• “If angle is PS and rate of change is NS, then
drive applied to vehicle is AZ.”
Mamdani Inference (will see soon!)

• For each rule of form


“If X is A,, then Y is B,”
, (A,
( , B are fuzzyy sets))
• Input A’ and output B’ are fuzzy sets (or real
numbers).
B’(x) = min(r, B(x))
where r  max(A A' )
• Then to collect output of all rules, take fuzzy
union.
Mamdani Inference

Rule 1

Rule 2

A’
Given Fact Conclusion
Mamdani Inference

Rule 1

Rule 2

Given Fact Conclusion


Defuzzification ((will see soon!))

• Result of inference is a fuzzy set on the


possible actions.
• Need a crisp decision to actually perform.
• Many methods of converting.
• Center of mass method:
Example: Greenhouse climate control
by Anantharaman Sriraman (2003)
Inputs:
• Difference in temperature between inside greenhouse & optimum
must be maintained in greenhouse [-10
[ 10 to +10 ºC]
• Difference in temperature between outside greenhouse & optimum
must be maintained in greenhouse [-20 to +20 ºC]
• Difference in R-Humidity between inside greenhouse & optimum
must be maintained in ggreenhouse [[0 to 100 %]]
• Difference in R-Humidity between outside greenhouse & optimum
must be maintained in greenhouse [0 to 100 %]
• Sunlight incident on the greenhouse roof [0 to 20 W/m2]
• Seasonal Cloudiness which reduces the sun’s radiation [0 to 100 %]
• Wind speed [0 to 100 mph]
• Wind direction with respect to the direction of the ventilation system
of the greenhouse
• Measurement error of the sensing system (-4 to 4)
• Change in Error of the measurement of the sensing system ((-11 to 1)
Outputs:
• Thermal system (0 to 100 %)
• Ventilation & humidification system (0 to 100 %)
• Thermal shade system (0 to 100 %)
• CO2 generation system (0 to 100 %)
• Forced ventilation system (0 to 100 %)
• Performance of the system (0 to 100 %)
Input Membership Function
Input Membership Function
Input Membership Function
Output Membership Function
Output Membership Function
Rules-1
Rules-2
Rules-3 & 4
Rules 5 & 6
Reading
g

• JJ-S
S R Jang and C T Sun,
C-T Sun Neuro Fuzzy
Neuro-Fuzzy
and Soft Computing, Prentice Hall, 1997
(Chapter 3)
3).

You might also like