You are on page 1of 186

Rule based systems

(fuzzy systems)
Topics to be covered

Introduction

Fuzzy set theory

Fuzzy rules and fuzzy reasoning

Fuzzy inference systems


Introduction to MATLAB Fuzzy logic tool box

Fuzzy decision making (not prepared yet)

2
References
1. Fuzzy Logic Toolbox. For use with Matlb. Users guide.
Ver. 2
2. J. S. R. Jang “Neuro Fuzzy and Soft Computing. A
comprehensive approach to Learning and Machine Intelligence
3. Fuzzy sets and system; Theory and applications
ebook
4. Leonid Reznik " Fuzzy controllers”, ebook
5. Jan Jantzen ,’'Foundations of Fuzzy Control’’, 2007 John Wiley &
Sons Ltd, ebook
6. Kevin M. Passino,“Fuzzy Control “, ebook
7. S. N. Sivanandam, et, al ‘’Introduction to
Fuzzy Logic using MATLAB” ebook
(numerical Exs)
8. S. Sumathi and Surekha P. (Computational 3
Intelligence Paradigms :Theory and Application
What Is Fuzzy Logic?
❑ Humans are more efficient in dealing with
fuzzy data than computers (e.g crossing a
busy road).
❑ Fuzzy logic is used to convey the human
capability of handling fuzzy information to
the computer
❑ It is a mathematical tool to capture and
handle the fuzzy data that is used in the
natural language

4
What Is Fuzzy Logic?

Significance of Precision in the Real World

A 400 kg mass is
approaching Look out
your head at 50
m/sec !!

5
Precise man Fuzzy man
6
What Is Fuzzy Logic?
Some pearls of folk wisdom
Don’t be penny wise and pound foolish

Don’t lose the sight of the forest for a


tree

7
Types and Modeling of Uncertainties

• Probabilities can be defined for an event


that can be repeated again and again*
• Fuzzy membership (degree of confidence)
can defined for any event. the event need
not be repeated(*)

8
Types and Modeling of Uncertainties

• Stochastic uncertainties: (E.g the probability of


hitting a target is 0.75)
• lexical uncertainties:Examples include the
expressions like
– *Healthy man.
– * Depressed patient.
– *Hot weather.
• Stochastic uncertainties modeled by probabilities
• Lexical uncertainties modeled by fuzzy sets
What Is Fuzzy Logic?
-The Big Picture-
FL maps an input space to an output space using a list
of if-then rules
A Specific Example
The General Case
Input Output
Input Output
If service is poor then tip is cheep
If service is good then tip is
average
Rules If service is excellent then tip is
generous

service tip
Input Output (interpreted as) ( is assigned
Terms Terms to be )
poor cheep
good
average
excellent
generous 10
What Is Fuzzy Logic?
-Linguistic Rules,Variables and values
Rules
If service is poor then tip is cheep
If service is good then tip is average
If service is excellent then tip is
generous
Input Linguistic Output
Linguistic
Values Linguistic Values
Linguistic
variable
variable
Linguistic Rules of a fuzzy systems are the laws it
execute
Linguistic variables defines a concept of our everyday
language
Linguistic values describe the characteristic of the Linguistic 11
variables
The root and development of fuzzy logic
• Fuzzy set thory was introduced by Professor Lotfi Zadeh
(USA) in 1965. as an extension of the classical set thory
• 1972 First working group on fuzzy systems in Japan by
Toshiro Terano
• 1973 Paper about fuzzy algorithms by Zadeh (USA)
• 1974 Steam engine control by Ebrahim Mamdani (UK)
• Too many events, inventions and projects to mention till
1991
• After 1991 fuzzy technology came out of scientific
laboratories and became an industrial tool.
• In the last two decades, the fuzzy sets theory has
established itself as a new methodology for dealing with
any sort of ambiguity and uncertainty.
12
What are the main areas of fuzzy logic
applications?
The following list includes just a small number of successful projects
and is intended to demonstrate a huge diversity of possible
applications.

❖ Automatic control of dam gates for hydroelectric power plants (Tokyo


Electric Power.)
❖ Simplified control of robots (Hirota, Fuji Electric, Toshiba, Omron)
❖ Camera-aiming for the telecast of sporting events (Omron)
❖ Efficient and stable control of car engines (Nissan)
❖ Cruise-control for automobiles (Nissan, Subaru)
❖ Automatic transmission of automobiles (see next slide)
❖ Substitution of an expert for the assessment of stock exchange activities
(Yamaichi, Hitachi)
❖ Optimised planning of bus timetables (Toshiba, Nippon-System, Keihan-
Express)
❖ Archiving system for documents (Mitsubishi Elec.)
❖ Prediction system for early recognition of earthquakes (Seismology Bureau
of Metrology, Japan)
14
1996 Saturn SL1 and Mitsubishi Galant ES and LS are equipped with
fuzzy controlled automatic transmission

15
Applications cont.
❖ Medicine technology: cancer diagnosis (Kawasaki
Medical School)
❖ Automatic motor-control for vacuum cleaners with a
recognition of a surface condition and a degree of soiling
(Matsushita)

During the ‘fuzzy’ revolution, the fuzzy technology


was introduced not only to a world of complex
industrial projects, but to simple everyday home
appliances: next are some examples

16
17
18
…. Applications.Medical
applications review…..
• The possibility of applying fuzzy set theory to biological and medical sciences was
first discussed by Zadeh
• Fuzzy clustering algorithms have been used in the classification of:
– EEG (com) patterns (Adey,1972; Larsen et al., 1972)
– ECG patterns (Albin, 1975),
– of hypertension (Fordon and Fu, 1976),
– of abdominal diseases (Bezdek and Castelaz),
– of chromosomes (Lee, 1975), and
– of leukocytes (E.T. Lee 1973). com
• Models of neurons based on fuzzy automata are described in Lee and Lee (1974)
and Butnariu (1977).
• Sanchez has studied the representation of medical knowledge by means of fuzzy
relations) for the purpose of automated diagnosis.
• Sanchez and Sambuc presented an application to diagnosis in thyroid pathology
• Wechsler has described a medical expert system based on fuzzy concepts.
• Lastly, Malvache and Vidal (1974) have developed a fuzzy model of visual perception.
Fuzzy Set Theory

20
Outline
Fuzzy sets:
o Basic Definitions and Terminology
o MF formulation and parameterization
Set theoretic operations
o Union
o Intersection
o Complement
o Others

21
Fuzzy Sets
• A classical set X is a collection of definite,
distinguishable objects of our intuition that can be
members of
treated as a whole. The objects are the X
• A crisp (classical) set is a set for which each
value either is or is not contained in the set.
• For a fuzzy set, every value has a membership
value, and so is a member to some extent.
• Themembership value defines the extent to
which a variable is a member of a fuzzy set.
• The membership value is from 0 (not at all a
member of the set) to 1.
22
Fuzzy
Conventional (Boolean) Set
Set
Theory
159.9cm
148cm 140c
170cm m 180cm
190c 160c
180c
190cm
m m
160cm m
“Tall Man ”
Fuzzy Set Theory
145cm

150cm
Container boundaries that include 148cm
or exclude elements 170cm 180cm

190cm
160cm

More-or-Less” Rather Than “ 145cm “Tall Man ”


” ! “Either-Or
No clearly defined boundaries 23
Fuzzy Sets

• Sets with fuzzy boundaries


A = Set of tall people

Crisp set Fuzzy set


1. A 1. A
0 0.
9
. Membershi
5 p
function

160 Heights 16 18 Heights


cm [ cm] 0 0 [ cm]

24
Membership Functions (MFs)
• Characteristics of MFs:
– Subjective measures
– Not probability functions
MF Is “tall” in
s Asia

.
8
. Is “tall” in the
5 US
is“tall” in
. NBA
1
160 Height
cm s

25
Fuzzy Sets
• Formal definition:
A fuzzy set A in X is expressed as a set of
ordered pairs:

Membershi Universe or
Fuzzy
p universe of
set
function discourse
(MF)
• A fuzzy set is totally characterized by a membership
function (MF).
• MF maps each element of X to a membership grade
(or value) beteewn 0 and one 26
Fuzzy Sets with Discrete Universes
• Fuzzy set C = “desirable city to live in”
X = {Khartoum, Cairo, Meca,} discrete and
nonordered UOD
C = {(Me, 0.9), (Kh, 0.8), (Ca, 0.6)}
• Fuzzy set A = “preferred number of children”
X = {0, 1, 2, 3, 4, 5, 6} (discrete ordered UOD)
A = {(0, .1), (1, .3), (2, .7), (3, 1), (4, .6), (5, .2), (6, .1)}

27
Fuzzy Sets with Cont. Universes

• Fuzzy set B = “about 50 years old”


X = Set of positive real numbers (continuous)
B = {(x, μB(x)) | x in X}

28
Alternative Notation

• A fuzzy set A can be alternatively denoted


as follows:
X is
discrete

X is continuous

Note that Σ and integral signs stand for the union of


membership grades; “/” stands for a marker and does
not imply division.

29
Alternative Notation Example

• The fuzzy set of C in the previous


example can be expressed as:
C=0.9/Me+0.8/Kh+0.6/Ca
the set A as:
A=0.1/0+0.3/1+0.7/2+1/3+0.7/4+0.3/5+0.1/6
And the set B as:

30
Fuzzy Partition
• In practice when the UOD X is continuous, we
usually partition it into several fuzzy sets
• Fuzzy sets used for partitioning are called
linguistic values, e.g. {“young”, “middle aged”,
and “old”}:

lingmf.
31
m
More Definitions and Terminology

• Support
▪ α-cut, strong α-cut
• Convexity
• Core
• Bandwidth
• Normality
• Symmetricity
• Crossover points
• Fuzzy singleton

32
MF Terminology
M
F
1

.
5
α
0
Cor X
e
Crossover
points
α - cut

Suppor
t

33
M
F
1

.
5
α
0
Cor X
e
Crossover
points
α - cut
Suppor
t
Def: Support
The support S(A) of a fuzzy set A is the crisp set of all
the elements of the universal set (UOD) for which
membership function has non-zero value
S (A) = { u ∈ U/ μ A( u ) > 0 }

34
M
F
1

.
5
α
0 Cor X
e
Crossover
points
α - cut
Suppor
t
Def: α – cut (or α lvel) set
The set of elements that belong to the fuzzy set A at least to the
degree α is called the α-level-set or α-cut-set

By the way, what do you think, either an α-level-set is crisp or fuzzy?


As it includes just elements without their membership degrees, it is crisp.
Strong α – cut is defined by
35
M
F
1

.
5
α
0
Cor X
e
Crossover
points
α - cut
Suppor
t

Def: Crossover point


The element of the universal set, for which the
membership function has the value of 0.5, is
called a crossover point.

36
Fuzzy Inference
Systems

quiz
1. Consider the two fuzzy set:

1. Write down a mathematical formula for the membership functions in


figure below MF (x )
Μ(x))
1

2. Consider the two fuzzy set:


e -3
1 2 3 5 7 x X
0 1 2 3 5 7
1. Support of each.
2. Core of each
3. 0.5-cut of each.
4. Union
5. Intersection
M
F
1

.
5
α
0
Cor X
e
Crossover
points
α - cut
Suppor
t
Def: Core:
Is the set of all elements x in X that belong to the fuzzy set A such
that μA(x)=1:

38
MF Terminology cont..

Definition Normality
A fuzzy set is normal if its core is nonempty. In
other words, we can always find a point x ε X such
that μA(x)=1

Definition Height of a fuzzy set


The height of a fuzzy set A, hgt(A) is given by a
supremum of the membership function over all
u∈U
hgt(A) = sup U μA( u )
(Supremum in this definition means the highest
possible (or almost possible) degree.)
39
MF Terminology cont..
Definition Singleton
Is a fuzzy set whose support is a single point in X
with μA(x)=1

0.5

45 Age

Core and Support

Fig: fuzzy singleton “45 year old”

40
Convexity of Fuzzy Sets
• A fuzzy set A is convex if for any λ in [0,
1],

Alternatively, A is convex if all its α-cuts are


convex.

convexmf. Condition is not


m satisfied 41
MF Terminology cont..

Definition Bandwidth:
for a Normal and Convex Fuzzy Set the bandwidth or width is
the distance between the two unique crossover point

42
MF Terminology cont..

Definition: Symmetry:
A Fuzzy Set is symmetric if its MF is symmetric
around a certain point x=c, namely

43
Formulation of Commonly Used MFs
MFs of one dimension
• Triangular MF: is specified by three parameters{ a,b ,c} as
follows:
Line eqn: y=y1+m(x-x1)

Matlab code
x = 0:100;
mf = trimf (x, [20, 60, 80]);
plot(x, mf);
axis([-inf inf 0 1.2]);
ylabel('Membership Grades');
title ('Triangular MF');

44
Formulation of Commonly Used MF
MFs of one dimension
• Trapezoidal MF: is specified by four parameters{ a,b ,c,d } as
follows:

Matlab code
x = 0:100;
mf = trapmf(x, [10, 20, 60, 95]);
plot(x, mf);
axis([-inf inf 0 1.2]);
ylabel('Membership Grades');
title(' Trapezoidal MF');

45
Formulation of Commonly Used MF
MFs of one dimension
• Smooth Trapezoidal MF: is specified by four parameters{ a,
b ,c,d } as follows:

d
b c
a

46
Formulation of Commonly Used MF
MFs of one dimension
• Gaussian MF: is specified by two parameters {c , σ } as follows:

Matlab code
clear; clc;
x = 0:100;
mf = gaussmf(x, [20 50]);
plot(x, mf);
%axis([-inf inf 0 1.2]);
ylabel('Membership Grades');
title(' Gaussian MF');

47
Formulation of Commonly Used MF
MFs of one dimension
• Generalized bell MF: is specified by three parameters {a, b, c } as follows:

Matlab code
clear; clc;
x = 0:100;
mf = gbellmf (x, [20, 4, 50]);
plot (x, mf);
axis([-inf inf 0 1.2]);
Ylabel ('Membership Grades');
title(' Generalized Bell MF');

48
--------Generalized bell MF:
• Effects of the parameters

b
a

49
Matlab code
x = (-10:0.4:10)'; a = 5;
b = 2; b = 2;
c = 0; mf1 = gbellmf(x, [a, b, -5]);
mf1 = gbellmf(x, [2, b, c]); mf2 = gbellmf(x, [a, b, 0]);
mf2 = gbellmf(x, [4, b, c]); mf3 = gbellmf(x, [a, b, 5]);
mf3 = gbellmf(x, [6, b, c]); mf = [mf1 mf2 mf3];
mf = [mf1 mf2 mf3]; subplot(223); plot(x, mf); title('(c)
subplot(221); plot(x, mf); title('(a) Changing ''c''');
Changing ''a'''); axis([-inf inf 0 1.2]);
axis([-inf inf 0 1.2]);
c = 0;
a = 5; mf1 = gbellmf(x, [4, 4, c]);
c = 0; mf2 = gbellmf(x, [6, 6, c]);
mf1 = gbellmf(x, [a, 1, c]); mf3 = gbellmf(x, [8, 8, c]);
mf2 = gbellmf(x, [a, 2, c]); mf = [mf1 mf2 mf3];
mf3 = gbellmf(x, [a, 4, c]); subplot(224); plot(x, mf); title('(d)
mf = [mf1 mf2 mf3]; Changing ''a'' and ''b''');
subplot(222); plot(x, mf); title('(b) axis([-inf inf 0 1.2]);
Changing ''b''');
axis([-inf inf 0 1.2]);

50
Commonly Used MFs
• Sigmoidal MF: is defined by:
Where a controls the slope at x=c

51
Formulation of Commonly Used MF
MFs of one dimension
• Sigmoidal MF: Matlab code used for last fig:
x = (-10:0.4:10)'; subplot(223); plot(x, y1, x, y3);
y1 = sigmf (x, [1, -5]); text(-4, 0.7, 'y1'); text(5, 0.7, 'y3');
y2 = sigmf (x, [2, 5]); axis([-inf inf 0 1.2]);
y3 = sigmf (x, [-2, 5]); title ('(c) y1 = sig(x;1,-5); y3 = sig(x;
-2,5)');
subplot(221); plot (x, y1, x, y2);
text(-5, 0.9, 'y1'); text(4, 0.6, 'y2'); subplot(224); plot(x, y1.*y3);
axis([-inf inf 0 1.2]); axis([-inf inf 0 1.2]);
title ('(a) y1 = sig(x;1,-5); y2 = title ('(d) y1*y3');
sig(x;2,5)');

subplot(222); plot(x, y1-y2);


axis([-inf inf 0 1.2]);
title ('(b) |y1 - y2|');

52
Cylindrical Extension
MF of two dimensions
• MFs with two inputs (each from different UOD)
is referred to as two-dimensional MFs
• One natural way to extend one-dimensional
MFs to two-dimensional MFs is viacylindrical
extension , defined next:
• If A is a fuzzy set in X, then the cylindrical
extension in the Cartesian space is a fuzzy set
defined by:

* 53
Cylindrical Extension
MF of two dimensions

Matlab code : cyl_ext.m

54
Matlab code for the previous fig

% Illustration of cylindrical extension of fuzzy sets


% J.-S. Roger Jang, 1993

xx = (0:1:20)';
yy = (0:1:20)';

bell_x = gbellmf(xx, [4, 2, 10]);


[x,y] = meshgrid(bell_x, yy);

subplot(221); plot(xx, bell_x);


xlabel('X'); ylabel('Membership Grades');
title('(a) Base Fuzzy Set A');
set(gca, 'xticklabels', []);

subplot(222); mesh(xx, yy, x);


view(-20, 30);
xlabel('X'); ylabel('y'); zlabel('Membership Grades');
set(gca, 'box', 'on');
set(gca, 'xticklabels', []); set(gca, 'yticklabels', []);
title('(b) Cylindrical Extension of A');
Fuzzy set theory
Set theoretic operations:
• The basic operations are:
❖ Union
❖ Intersection
❖ Complement
Before introducing these three operations, first we shall define the
notion ofcontainment which plays a central role in both
ordinary and fuzzy sets
Def: Containment or Subset:
Fuzzy set A is contained in B (or,,equivalently A is subset of B or A
is smaller than or equal to B) if and only if

In symbols:

56
Set Theoretic Operations
illustration of the Subset concept

Matlab file :subset.m

x = 0:100;
B = gbellmf(x, [30, 2, 50]);
A = 0.9*gaussmf(x, [15, 60]);
plot(x, A, x, B);
axis([-inf inf 0 1.2]);
title('A Is Contained in B');
ylabel('Membership Grades');
%Set (gca, 'xticklabels', []);
text(25, 1.0, 'B');
text(42, 0.75, 'A');

57
Set-Theoretic Operations
Union:( disjunction)

Or alternatively, defined as algebraic sum

Intersection( or conjunction):

Or alternatively, defined as algebraic product

com

Complement:
This corresponds
to the logical NOT
58
operation.
More on Fuzzy Intersection and Fuzzy Union
:
Fuzzy intersection:
The intersection of two sets A and B is, in general,
specified by a function T: [0,1]* [0,1] [0,1] which
aggregates two membership grades as follows

Where is known as triangular norm (T-norm) operator


• T Norm :is a two place function T(.,.) satisfying the following
basic requirements:

• Basic requirements of T-Norm:


– Boundary: T(0, 0) = 0, T(a, 1) = T(1, a) = a
– Monotonicity: T(a, b) < T(c, d) if a < c and b < d
– Commutativity: T(a, b) = T(b, a)
– Associativity: T(a, T(b, c)) = T(T(a, b), c)

* 59
T-Norm examples

• Four examples ( page 37 Jang):


– Minimum: Tm(a, b) =min (a,b) ( we already know)
– Algebraic product: T a(a, b) =ab ( we already know)
– Bounded product: T b (a, b)=max (0,(a+b-1))
– Drastic product: T d(a, b)= a if b=1
=b if a=1
=0 if both a and b<1
Fuzzy Union: T-conorm or S-norm(
)
• A T-conorm is a two place function S(.,.) satisfying
the following basic requirements:
o Boundary: S(1, 1) = 1, S(a, 0) = S(0, a) = a
o Monotonicity: S(a, b) < S(c, d) if a < c and b < d
o Commutativity(‫)اﻋﻜﺲ‬: S(a, b) = S(b, a)
o Associativity: S(a, S(b, c)) = S(S(a, b), c)
• Four examples if (page 38 Jang):
o Maximum: Sm(a, b) =max (a,b) =a v b (already we
know)
o Algebraic sum: Sa(a, b) =a+b- ab (already we know)
o Bounded sum: S b (a, b) = min (1,(a+b))
o Drastic sum: Sd (a, b)=a if b=o;
=b if a =0 ;
* =1 if both a and b >0 61
Generalized DeMorgan’s Law
• T-norms and T-conorms are duals which support
the generalization of DeMorgan’s law:
❖ T(a, b) = N(S(N(a), N(b)))
❖ S(a, b) = N(T(N(a), N(b)))
or

Tm(a, S m(a,
b) b)
Ta(a, b) S a(a, b)
* Tb(a, b) S b(a, b) 62
clear subplot(224); plot (x, min(A,B));
x = (0:1:100)'; Set (gca, 'xticklabels', []);
A = gbellmf(x, [20, 4, 40]); axis([-inf inf 0 1.2]);
B = gaussmf(x, [ 20, 70]); Title ('(d) Fuzzy Set "A AND B"');

subplot(221); plot(x, A, x, B);


%set(gca, 'xticklabels', []);
axis([-inf inf 0 1.2]);
title('(a) Fuzzy Sets A and B');
text(40, 1.1, 'A');
text(70, 1.1, 'B');

subplot(222); plot(x, 1-A);


%set(gca, 'xticklabels', []);
axis([-inf inf 0 1.2]);
title('(b) Fuzzy Set "not A"');
subplot(223); plot(x, max(A,B));
%set(gca, 'xticklabels', []);
axis([-inf inf 0 1.2]);
title('(c) Fuzzy Set "A OR B"');
%---
63
----Set-Theoretic Operations
Cartesian product and Cartesian co-product:
• Let A and B be fuzzy sets in X and Y, respectively.
TheCartesian product of A and B denoted by
is a fuzzy set in the product space with the
MF

▪ Similarly ,the Cartesian Co-product of A and B


denoted by A+B is a fuzzy with the MF

64
Example [2]
Assume
• A={(1,0), (2,.5),(3,1)}
• B={(1,1), (2,.5),(3,0)}
• A ×B can be arranged as a two-dimensional fuzzy set :

A × B={((1,1),0), ((1,2),0),( (1,3),0) ((2,1),0.5),


((2,2),0.5), ((2,3),0),( (3,1),1), ((3,2),0.5) ((3,3),0)}

65
Example

CW find the Cartesian co product


66
--Set-Theoretic Operations [Rajesekaran ch6]

• Product of a two fuzzy sets


• Equality
• Product of a fuzzy set with a crisp number
• Power of a fuzzy set
• Difference
• Disjunctive sum

67
Product of a two fuzzy sets

The product of two fuzzy sets A and B is a new set A .B whose MF is


defined as

Example

Find A.B

Solution

68
Equality:
two fuzzy sets A and B are said to beequal A=B if

Example

69
Product of a fuzzy set with a crisp number
Multiplying a fuzzy set A by a crisp number a results in a new fuzzy set a.A with
the MF :

Example

70
Power of a fuzzy set
α
the α power of a fuzzy set A is a new set A with the MF :

Example

71
Difference
Difference of two fuzzy sets A and B is a new set A-B defined as:

Example

Find A-B
Solution

72
Disjunctive sum
The disjunctive sum of two fuzzy sets A and B is a new set
defined as:

Example

Find
Solution

73
Properties of the fuzzy sets[3]
• The properties of the classical set also suits for the
properties of the fuzzy sets. The important properties of
fuzzy set includes:
• Commutativity(‫)اﻟﻌﻜﺴﯿﺔ‬
A∪B = B∪A, A∩B = B∩A
• Associativity
A∪ (B∪C) = (A∪B) ∪C, A∩ (B∩C) = (A∩B )∩C
• Distributivity
A∪ (B∩C) = (A∪B) ∩ (A∪C),
A∩ (B∪C) = (A∩B) ∪ (A∩C).
74
Properties of the fuzzy sets[3]
• Idem potency (the same power)
A∪A = A, A∩A = A.
• Identity
A∪ φ = A and A∩X = A ,A∩ φ = φ and A∪ X = X.
where
Φ is the empty set (the degree of membership of all its elements is
zero)
• Transitivity
If A⊂B⊂C then A⊂C
• Involution (double complement)
.

75
Set Theoretic Operations
Example
Consider the universe U and the two sets A(u) and B(u) in the
following table .Determine :

U 0 1 2 3 4 5 6 7 8 9 comment

A(u) 0 0 0.1 0.2 0.3 0.8 0.9 1 1 1

B(u) 1 1 0.9 0.8 0.7 0.5 0.4 0.2 0.2 0

1 1 0.9 0.8 0.7 0.8 0.9 1 1 1 Max(A,B)

0 0 0.1 0.2 0.3 0.5 0.4 0.2 0.2 0 min(A,B)

1 1 0.9 0.8 0.7 0.2 0.1 0 0 0 1-A


76
Example
Consider two fuzzy sets A and B. Find Complement, Union, Intersection

Solution

Complement

Union Max is
used

CW: solve using other S-Norms 77


…….Solution

intersection
min is
used

CW: repeat using other T Norms

Four examples (page 37 Jang):


Minimum: Tm(a, b) =min (a,b) ( we already know)
Algebraic product: Ta(a, b) =ab ( we already know)
Bounded product: Tb(a, b)=max (0,(a+b-1))
Drastic product: Td(a, b)= a if b=1
=b if a=1
=0 if both a and b<1

78
Fuzzy rules and fuzzy
reasoning

79
Topics to be covered

• Introduction
• Extension principle of fuzzy sets
• Fuzzy relations
o def
o Projection of fuzzy relations
o Cylindrical extension of fuzzy relations
o Composition of fuzzy relations
o Fuzzy max-min and
o max-product composition operation
• Fuzzy if-then rules
– Linguistic variable ,values, and, modifiers
– Fuzzy if- then rule base

• Fuzzy (or approximate) reasoning


o Compositional rule of inference
o Fuzzy implication relations
o Fuzzy reasoning
• Single rule with single antecedent
• Single rule with multiple antecedent 80
• Introduction
o Fuzzy reasoning is concerned with obtaining conclusions from a set
of rules and given facts
o It is the process by which a possibly imprecise conclusion is deduced
from a collection of imprecise premises.

o Fuzzy rules and fuzzy reasoning are the backbone of fuzzy


inference systems, which are the most important modelling
tools based on fuzzy set theory. They have been successfully
applied to a wide range of areas such as:
❖ Automatic control
❖ Expert systems
❖ Pattern recognition
❖ Time series prediction
❖ Classification 81
Objective

The objective of this lecture and the next lecture is:


1. To introduce the concepts of the extension principle and the fuzzy
relation, which expand the notion and applicability of the fuzzy sets
introduced previously
2. To present the definition of linguistic variable and how to use them
in the fuzzy rules
3. To know how to interpret fuzzy rules as appropriate fuzzy relation
4. To introduce different fuzzy reasoning schemes based on the
concept of compositional rule of inference
Extension principle
• The extension principle is one of the fundamentals of
fuzzy sets theory
• It represent a mean to get a fuzzy model for a variable if
we know the fuzzy model for another variable and the
functional relationship between them.
• For example, we know that the voltage across a resistor is
connected to the current with the formula: I = V/R . We
want to know how our information about the voltage,
expressed as a fuzzy set, can be used to get a model for
the current .

83
What do we need this extension principle
for?
• It gives us the rule of how to calculate an
output of a fuzzy system
• If we know the structure of the system,
containing algebraic and logical blocks,
and the system inputs are fuzzy. On the
basis of this principle we can determine
.
the outputs of the system.

84
Extension Principle
Suppose that

A is a fuzzy set on X
:

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

where yi = f(x i), i = 1 to n.

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

* 85
Example: Application of the extension principle
to fuzzy sets with discrete UOD
Let A = 0.3/–2+ 0.4/–1 +0.8/0 +1/1+0.7/2}
and y = f (u) = u 2. (many to one mapping)
-2 4
-1
0 1
1
2 0

Then
B = 0.3/4+ 0.4/1+ 0.8/0+ 1/1, 0.7/ 4
= (0.3V0.7)/4+(0.4v1)/1+0.8/0
=0.7/4+ 1/1 +0.8/0

86
Crisp relation
Crisp relation determine the relation between the elements of two crisp
sets and is defined by

Where:
1 means complete relation and
0 means no relation

Ex:
X={1,2} Y={A,B}
The Cartesian space is

When the sets are finite the relation is represented by a matrix R


called the relation matrix

87
----Crisp relation

For the sets X,Y a relation may be:

And this means that:


• The elements 1 and A are not related
• The elements 1 and B are related
• The elements 2 and A are related
• The elements 2 and B are not related

88
Composition of crisp relation

• X, Y, Z are universal sets


• Let R be a relation between X and Y
• Let S be a relation between Y and Z
• Let T be a relation between X and Z
• If we know R and S. can we find T?
• The answer is yes: and it can be done
using a knowledge inference methods
known as composition
89
Composition of crisp relation
The best known compositing operations are:

Max-min composition:

Max- product

Example

Using Max-min
composition:

90
Using Max-product
composition:

Comment: for crisp relation the two composition


methods give the same result

91
Composition example()
Given
y1 y2 y3 y4 z1 z2
y1 0 1
R= x1 1 0 1 0 S=
y2 0 0
x2 0 0 0 1 y3 0 1
x3 0 0 0 0 y4 0 0

Find
Max z1 z2
R*C
Answer
x1 0 1
T=
x2 0 0

x3 0 0
92
Fuzzy Relations

• A fuzzy relation R is a 2D MF:

• Examples:
– x is close to y (x and y are numbers)
– x depends on y (x and y are events)
– x and y look alike (x, and y are persons or
objects)
– If x is large, then y is small (x is an observed
reading and Y is a corresponding action)*

* 93
Ex 3.3 [6]

• Let X=Y=R+ (+ive real line)and R=“ y is much greater than


x” . The mf of the fuzzy relation can be subjectively defined as

▪ If X={3,4,5} and Y={3,4,5,6,7} then the fuzzy relation R in a matrix format


is:

94
Projection of fuzzy relations
• For a fuzzy relation R(x,y), the projection on X denoted by R1 is
given by:

Example
X projection

▪ Similarly the projection on Y denoted by R2 is given by:

Example

95
2D MF Projection
Two-dimensional Projection Projection
MF onto X onto Y

project.
* m 96
Cylindrical extension of fuzzy relations
• Cylindrical extension from an x projection is done by filling all the
columns of the matrix by the x projection

Cylindrical
X projection ext

▪ Cylindrical extension from a Y projection is done by filling all the rows


of the matrix by the Y projection

97
Composition

• Fuzzy relations in different product spaces can be


combined through composition operation to infer a new
relation (knowledge inference)
• The best known composition operations are:
• Max-min composition
• Max- product

• The max-min composition of two fuzzy relations


R1 (defined on X and Y) and R2 (defined on Y and
Z) is

* 98
Example 1:
let R1=‘ x is relevant to y’’
let R2=‘ y is relevant to z’’
Find the relation R3= ‘’x is relevant to z’’ using max-min
composition

Solution

Row1,col1
Row1,col2

Row2,col1
Row2,col2

99
Example 2

100
Example 3:
let R1=‘ x is relevant to y’’. let R2=‘ y is relevant to z’’
Find the relation R3= ‘’x is relevant to z’’ using max-min composition

solution From Row2 of R1 ,col1 of R2

Similarly we can find the other entries of R3

R3 =
function : max_star.m
0.7000 0.5000
0.7000 0.6000
0.6000 0.3000
101
Max-product Composition

• Max-product composition:

* 102
Example 4:
let R1=‘ x is relevant to y’’. let R2=‘ y is relevant to z’’
Find the relation R3= ‘’x is relevant to z’’ using max-product composition

solution From Row2 of R1 ,col1 of R2

Similarly we can find the other entries of R3

R3 =
function : max_star.m
0.4900 0.3000
0.6300 0.4800
0.5400 0.2400
103
104
105
0.
6

0.42
106
Linguistic variables and hedges
Linguistic Variable
• A linguistic variable is one
with a value that is a natural
language expression
referring to some quantity
of interest.
• So the value of the linguistic
variable is a word? or a
word sentence. This is the
main difference between a
linguistic variable and a
numerical one.

107
Linguistic variable and values
Linguistc var Age [year] height

values Young , old , very old Short ,medium. tall…

Dynamic range [0 100] [3 7 ] ,[in feet]

MFs μshort …’….


μyoung, μold …

108
Linguistic variables and hedges
Linguistic Variable
❑ Generally, a linguistic variable is a composite term u =
u1, u2, ....,un which is a concatenation(‫)اﻟﺳﻠﺳﻠﺔ‬of atomic
terms u1, u2, ...,un
❑ atomic terms can be divided into four categories:
o primary terms , which are the labels of specified
fuzzy subsets of the universe of discourse (e.g. small
and big);
o Connectives: AND, OR and the negation NOT;
o hedges: such as VERY, MOST, RATHER,
SLIGHTLY, MORE OR LESS, etc.;
o markers such as parenthesis.

109
Linguistic variables and hedges
primary terms
• A primary term is actually just a name or a label of a fuzzy
set. It usually describes the word which is used by experts
to express their opinion about the value of one of the
object characteristics, e.g old, large, fast, etc.

110
Linguistic variables and hedges
connectives
• The connectives (AND, OR, and NOT) realise the
operations of intersections, union, complement considered
earlier.
• Example :How can we express
• slow or medium,
• not fast and medium ?

111
Linguistic variables and hedges
hedges( modifiers)

• Hedges are used to produce a larger set of values


for a linguistic variable from a small collection of
primary terms through the processes of
intensification or concentration, dilation and
fuzzification.
• For example, the operator v‘ ery’ is usually defined
as a concentration operator as:
very u = u2 This is one way not always
• This operator can also be composed with itself,
thus:
very (very u) = (very u) 2 = u 4
112
Linguistic variables and hedges
hedges ( modifiers)
• Hedges (example): The composite term ‘very
old’ can be obtained from the term old as
very old = old 2

113
Example : consider a fuzzy set

Another example

Extremely A = A 3

114
Linguistic variables and hedges
hedges

• The inverse hedge, which ‘fuzzifies’ the term and


expands the width of the corresponding
this hedge can be named as
membership function.
‘more or less’.
• more or less u = u ½

• We can define different mathematical models for


the same hedgeCan it be, for example,
• more or less u = u
Another example 0.4

115
Fuzzy rules

• For computational purpose ,fuzzy information


can be represented in terms of a rule base
which is a collection (or a set) of rules:
• Fuzzy rule base can be represented in different
format:
– Antecedent –consequent format:
Eg
R1:If x is A1 then y is B1
R2:If x is A2 then y is B2
❑ This is also known as if –then format

116
Fuzzy rules
– Relational format: eg
Error change- in error output

N N NB

N z NM

N p z

117
Fuzzy rules

– Tabular linguistic format:


eg
Change in error

N Z P

Error N z NS Z

Z NS Z PS

P Z PS PB

118
Fuzzy rules

❖ Tabular numeric -linguistic format:


eg Change in error

-1 0 1

Error -1 0 -1 0

0 -1 0 1

1 0 1 2

119
Properties of Set of Rules

❑ The properties for the sets of rules are

o Completeness,
o Consistency,
o Continuity, and
o Interaction.

120
a) Completeness
A set of IF–THEN rules is complete if any
combination of input values result in an appropriate
output value.
b) Consistency
A set of IF–THEN rules is inconsistent if there are two
rules with the same rules-antecedent but different
rule-consequents.
c) Continuity
A set of IF–THEN rules is continuous if it does not have neighboring rules with
output fuzzy sets that have empty intersection.

121
Lecture

Fuzzy rules and fuzzy


reasoning (cont)

122
quiz
• Let A = {0.3/–2+ 0.4/–1 +0.8/0 +1/1+0.7/2} be a
set in U
and
• Find B in Y ?

123
Topics

• Compositional rule of inference


• Fuzzy implication relations
• Fuzzy reasoning
• Single rule with single antecedent
• Single rule with multiple antecedent
• Multiple rules rule

124
Compositional rule of inference
Compositional rule of inference plays the key
role in fuzzy reasoning
This concept (by zadeh) is not a new concept and we
used same idea in fuzzy relations. Moreover the
extension principle is a special case of the
compositional rule of inference.
It is a generalization of the following familiar notion:

125
Compositional Rule of Inference
• Derivation of y = b from x = a and y = f(x)
y y
com

b b

y= y=
f(x) 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 126
Compositional Rule of Inference
• a is a fuzzy set and y = f(x) is a fuzzy relation:

See comm

* cri. 127
Step 1: cylindrical extension of A

Step 2: find the intersection between C(A) and the relation F:

Step 3: projection of the intersection into y axis:

This formula reduces to the max-min composition if A and F


have finite universes. Conventionally B is represented as:

This is known as compositional rule of inference


Fuzzy reasoning
• The basic rule of inference in two valued logic is modes pones (MP).
(Latin for "the way that affirms by affirming"; )) also known as
forward chaining
• According to MP we can infer the truth a proposition B from
the truth of A and the implication A B
• Example : if A is identified with “ tomato is red” and B with
“ tomato is ripe” , then if its true that the tomato is red then
its also true that tomato is ripe .
• This concept is illustrated as follows:

Rule: if x is A then y is B
Fact: x is A

Consequent (Conclusion): y is B
Generalized modus ponens (GMP):
in much human reasoning MP is employed in an
approximate manner. For example if we have the
previous rule and we know that “the tomato is more
or les red, then we can infer that “the tomato is more or
les ripe. This is written as:

Rule: if x is A then y is B
Fact: x is A’

Consequent (Conclusion): y is B’
Where A’ is close to A and B’ is close to B

When A’ , A, B and B’ are fuzzy sets the foregoing inference


procedure is known as fuzzy reasoning or approximate reasoning
of GMP
Formalization of the fuzzy reasoning procedure

• Using the composition rule of inference we can formulate the


fuzzy reasoning procedure as the following definition:

Def: Approximate (or fuzzy) reasoning


Let A, A’ and B be fuzzy sets of X, X, and Y, respectively. Assume
that the fuzzy rule (implication) is expressed as a fuzzy relation
R on then the fuzzy set B’ induced by “x is A’ “ and the fuzzy
rule “if x is A then y is B” defined by:

(1)
Implication
or equivalently; relation
(2)

I.e B’ can be inferred using a composition between A’ and the


implication relation

Implication relation: the appropriate fuzzy relation that is used


to represent the fuzzy rule is known as the implication relation.
How to find the Implication relation ?

There are various kinds of implication method (or implication functions).


Some of theses functions are listed below

Mamdani

Mamdani

Lukasiewicz

zadeh

kleene=-Dienes

Ref : introduction to fuzzy sets, fuzzy logic and fuzzy control-p82


Composition Method
• Following are the different rules for the fuzzy compositional operation
▪ Max-Min

▪ Max-Product

▪ Min-Max
▪ Max-Max

▪ Min-Min

Although , there are several implication methods and several


composition methods, the most popular are Mamdani’s
implication and the max-min composition

133
Case :Single rule with single antecedent

Rule: if x is A then y is B
Fact: x is A’
Conclusion: y is B’
This is the simplest case and the formula is available in eqn (1)

(1)

Using Mamdani implication eqn(1) can


be simplified to

In other words, first we find the degree of match and w.


then B’ is equal to B clipped by w
* 134
Graphical representation

A’ A B
w

X Y
A’
B

X Y
x is A’ y is
B’

* 135
Example Given the fuzzy rule

R1: if x is A then y is B , where

Infer B’ given the fact that


x is A’ , where

Solution
Using Mamdani implication
The implication relation is:
0. 0. 0.
BY EXTION-ROW TO CLM
2
0. 2
0. 2
0.
5 5 4
0. 0. 0.
6 7 4
Using Max-Min composition

0. 0. 0.
5 5 4
136
---
or

---
or
Cylindrical extension of A’ :

(1)

Projection of (1) into y


gives B,
HW Compute using various inference mechanism

Max -product

Min- Max

Min- Min
Max -Max

138
Example 2:

Rule :if temperature is HOT then fan should run FAST


Fact : temperature is moderately HOT
Find the set moderately FAST (MF)

Given:

The temperature is expressed in o F and the speed in 1000 rpm

Solution: Using Madmani implication, the relational matrix is

1 2 3 4
70 0.3 0.4 0.4 0.4 Using Max-Min compositional rule
80 0.3 0.5 0.6 0.6
90 0.3 0.5 0.7 0.8
10 0.3 0.5 0.7 0.9 Two other approaches
0 to be worked in the class
139
2 nd approach:

Y projection
1 2 3 4
70 0.3 0.4 0.4 0.4
80 0.3 0.5 0.6 0.6
90 0.3 0.5 0.7 0.8
10 0.3 0.5 0.7 0.9
0
3 nd approach:
Case: Single rule with multiple antecedent

Rule: if x is A and y is B then z is C


Fact: x is A’ and y is B’
Conclusion: z is C’
• Graphic Representation:
A’ A B B T-norm C
’ w 2

Z
X Y
A’ B
’ C

Z
x is A’ X y is Y z is
*
B’ C’ 141
In this case the rule can be represented by ternary relation

The resulting C’ is expressed as

This can be reduced to [Jang page 67]

Firing
Where strength

W is called degree of compatibility (or matching)


Case: Multiple rules with multiple antecedent
Rule 1: if x is A1 and y is B 1 then z is C1
Rule 2: if x is A2 and y is B 2 then z is C2
Fact: x is A’ and y is B’
Conclusion: z is C’
• Graphic Representation: (next slide)

* 143
• Graphics representation:

A’ A B B C
1 ’ 1 1
w
1
Z
X Y
A’ A B B C
2 ’ 2 w
2
2

Z
X Y
T-norm
A’ B
’ C
’ Z
x is A’ X y is Y z is
B’ C’

* 144
Example : Multiple rule with single antecedent

Rule 1:if height is TALL then speed is HIGH

Rule 2:if height is MEDIUM then speed is MODIRATE


where

Given

Find S3 =(above normal speed)


Solution:
Using Madmani implication, the relational matrices are

145
s1 s2

H1 H2

146
Lecture
Fuzzy Inference Systems

Stop 29/02/2012
Fuzzy Inference
Systems

quiz
1. Consider the two fuzzy set:

1. Write down a mathematical formula for the membership functions in


figure below MF (x )
Μ(x))
1

2. Consider the two fuzzy set:


e -3
1 2 3 5 7 x X
0 1 2 3 5 7
1. Support of each.
2. Core of each
3. 0.5-cut of each.
4. Union
5. Intersection
Outline
❖ Introduction
❖ Mamdani fuzzy inference systems
❖ Takagi Sugeno fuzzy inference systems
❖ Simplified Fuzzy System
❖ introd
❖ Case Studies
Fuzzy Inference Systems
❑ What is a fuzzy inference system (FIS)?
A nonlinear mapping that derives its output
based on fuzzy reasoning and a set of fuzzy if-
then rules. The domain and range of the
mapping could be fuzzy sets or points in a
multidimensional spaces.
❑ FIS is also known as:
o Fuzzy models
o Fuzzy associate memory
o Fuzzy-rule-based systems
o Fuzzy expert systems
Fuzzy Inference Systems

Schematic diagram
Rulebase
Database
(Fuzzy
(MFs)
rules)
inpu outpu
t Fuzzy reasoning t
Mamdani fuzzy inference systems

• The most commonly used fuzzy inference


technique is the so-called Mamdani method.
• In 1975, Professor Ebrahim Mamdani of
London University built one of the first
fuzzy systems to control a steam engine and
boiler combination.
• He applied a set of fuzzy rules supplied by
experienced human operators.
Mamdani fuzzy inference systems

❑ Mamdami system employ fuzzy sets in its consequent part. E .g

If pressure is high then volume is small


high smal
l

● The Mamdani-style fuzzy inference process is performed in four steps:

1. Fuzzification of the input variables,


2. Rule evaluation;
3. Aggregation of the rule outputs, and finally
4. Defuzzification.
Example: We examine a simple two-input one-
output problem that includes three rules:
Rule: 1 Rule: 1
IF x is A3 IF project_funding is adequate
OR y is B1 OR project_staffing is small
THEN z is C1 THEN risk is low
Rule: 2 Rule: 2
IF x is A2 IF project_funding is marginal
AND y is B2 AND project_staffing is large
THEN z is C2 THEN risk is normal
Rule: 3 Rule: 3
IF x is A1 IF project_funding is inadequate
THEN z is C3 THEN risk is high
Step 1: Fuzzification
The first step is to take the crisp inputs, x1
and y1 (project funding and project staffing),
and determine the degree to which these
inputs belong to each of the appropriate
fuzzy sets.

project project
Step 2: Rule Evaluation
(matching)
• Take the fuzzified inputs, μ (x1) = 0.5, μ
A1 A2

(x1 ) = 0.2, μ (y1 ) = 0.1 and μ (y 1) = 0.7


B1 B2

• apply them to the antecedents of the fuzzy


rules.
• If a given fuzzy rule has multiple
antecedents, the fuzzy operator (AND or
OR) is used to obtain a single number that
represents the result of the antecedent
evaluation. This number (the truth value
or firing strength) is then applied to the
consequent membership function.
To evaluate the disjunction of the rule
antecedents, we use the OR fuzzy operation.
Typically, fuzzy expert systems make use of
the classical fuzzy operation union:
μA∪B(x) = max [μ A(x), μB(x)]

Similarly, in order to evaluate the


conjunction of the rule antecedents, we
apply the AND fuzzy operation
intersection:
μA∩B(x) = min [μ A(x), μB(x)]
Mamdani-style rule evaluation
• Now the result of the antecedent evaluation
can be applied to the membership function
of the consequent.
• The most common method of correlating
the rule consequent with the truth value of
the rule antecedent is to cut the consequent
membership function at the level of the
antecedent truth.
• This method is called clipping. Since the
top of the membership function is sliced,
the clipped fuzzy set loses some
information. However, clipping is still
often preferred because it involves less
complex and faster mathematics, and
● While clipping is a frequently used method,
scaling offers a better approach for
preserving the original shape of the fuzzy
set.
● The original membership function of the
rule consequent is adjusted by multiplying
all its membership degrees by the truth
value of the rule antecedent.
● This method, which generally loses less
information, can be very useful in fuzzy
expert systems.
Clipped and scaled membership
functions
Step 3: Aggregation of the rule
outputs
• Aggregation is the process of unification of
the outputs of all rules.
• We take the membership functions of all rule
consequents previously clipped or scaled and
combine them into a single fuzzy set.
• The input of the aggregation process is the
list of clipped or scaled consequent
membership functions, and the output is one
fuzzy set for each output variable.
Aggregation of the rule outputs
Step 4: Defuzzification
The last step in the fuzzy inference process is
defuzzification.
Fuzziness helps us to evaluate the rules, but the final
output, in some applications, is required to be a a crisp
number.
The input for the defuzzification process is the aggregate
output fuzzy set and the output is a single number.
Defuzzification operates on the implied fuzzy sets
produced by the inference mechanism and combines
their effects to provide the “most certain” output
The most popular defuzzification methods are:

o Centre of Gravity method (COG) (centriod)


o Centre Average
COG (centroid) technique:
● It finds the point where a vertical line
would slice the aggregate set into two equal
masses. Mathematically this centre of
gravity (COG) can be expressed as:
● Centroid defuzzification method finds a
point representing the centre of gravity of
the fuzzy set, A, on the interval, ab.
● A reasonable estimate can be obtained by
calculating it over a sample of points.
Centre of gravity (COG):
COG Defuzzification Example
Suppose that the implied fuzzy sets of a two rule system are as shown below

0.25
0.75

The COG method computes ucrisp to be

Where bi is the centre of the ith implied fuzzy set and


denote the area under the membership function μ(i).

For this example b1 = 0.0 and b2 = −10

168
….Example
• For the case where we have symmetric triangular output membership
functions that peak at one and have a base width ofw , simple geometry
can be used to show that the area under a triangle “chopped off” at a
h is given by:
height of

Usin
g

169
COG Defuzzification Example2
• Consider the last example but with product implication. The
implied fuzzy sets are now as shown below

170
Centre Average Defuzzification:

❖ in this method the firing strength is used


instead of the implied fuzzy set area (since the
area is proportional to it)
❖ The centre average method computes ucrisp
as follows:

Where μpremise(i) and is the firing strength of the i th rule and b i is

the centre of the ith

171
Example (centre average ):

Suppose that the implied fuzzy sets of a two rule system are as shown below

0.25
0.75
Example1 (Mamdani FIS): A FIS has two inputs (x and
y) and one output (u). These fuzzy variables are defined by
the following membership functions:
N Z P

50 100 x, y, u
0
And the control strategy is represented by the
following rule base
R1 If x is N and y is N Then u is N
R2 If x is Z and y is Z Then u is Z
R3 If x is P and y is P Then u is P

❖ If at a certain time the inputs are found to be : x=y =25. Calculate


the FIS output (crisp) using:
• Min for the AND
• Min implication
• COG defuzzification
173
Solution: N Z P

1. Fuzzification: μ x(25) 1 0.5 0


Μy(25) 1 0.5 0

2. Firing strength (using min for


AND)
R1

R2

R3

3. Implication
R1:

And this implied fuzzy set is given by the following figure


174
0 50 u
The area of this implied fuzzy set is A1=50

R2:

And this implied fuzzy set is given by the following figure

0 50 100 u
The area of this implied fuzzy set
isR3 is off

4. Defuzzification (using COG)

175
Example2 ( Mamdani inference)[3.2.1[2 ]]
Take the inference in the next Figure where the input and output
membership functions are smooth trapezoidal defined by.

μNeg = μSTrapezoid(x;−100,−100,−60, 0)
μZero = μSTrapezoid(x;−90,−20, 20, 90)
μPos = μSTrapezoid(x;0,60,100, 100)
where

Compute the crisp output if the crisp input is x=-50 using:


• Min for implication
• COGS (centre of gravity for singleton) defuzzification
• Discrete output UOD defined by the vector u = [−100 − 50 0 50
100]
176
x U

177
solution
Inserting u for x the discrete conclusion term set is represented by three
vectors

Neg = [1 0.93 0 0 0]

Zero = [0 0.61 1 0.61 0]

Pos = [0 0 0 0.93 1]

Step1: Fuzzification and matching (firing strength):


R1:the firing strength is α 1 = μNeg (-50)=Neg(2) = 0.93
R2: α2 = μzero(-50)=Zero(2) = 0.61
R3: α2 = μpos(-50)=Pos(2) = 0.0 Only two rules are on

178
Step 2: implication :
using minimum implication the implied fuzzy sets for the three rules are:

μ1= min(α1, Neg) = [0.93 0.93 0.0 0 0]


μ2= min(α2, Zero) = [0 0.61 0.61 0.61 0]
μ3= min(α3, pos) = [0 0 0 0 0]
Step 3: aggregation: Accumulation using max down each column yields the
conclusion vector

μc= [0.93 0.93 0.61 0.61 0]


Step 4: Defuzzification: using COGS

HW : Repeat using product implication

179
Takagi-Sugeno (T S) FIS type:

• Takagi-Sugeno (T S) type: is a special case of


what known as functional FIS. For the functional
fuzzy system, theformat of the fuzzy is:
IF x is A AND y is B THEN z is f Functional
(x, y) FIS

g( )can be any function


In the case where f is a linear combination of x and y, e.g

• Rule base
If X is A 1 and Y is B 1 then Z = p1*x + q 1*y + r 1
If X is A 2 and Y is B 2 then Z = p2*x + q 2*y + r 2 T-S FIS

(where the p i ,,q i and ri are real numbers) the functional fuzzy
system is referred to as a “Takagi-Sugeno fuzzy system.”
180
---Takagi-Sugeno (T S) FIS type:

• Rule base
If X is A 1 and Y is B 1 then Z = p1*x + q 1*y + r 1
If X is A 2 and Y is B 2 then Z = p2*x + q 2*y + r 2
• Fuzzy reasoning
A B z1 =
1 1 w
1 p1*x+q1*y+r
1

X Y
A B z2 =
2 2 w p2*x+q2*y+r
2 2

X Y w1*z1+w2*z
x= y= z= 2
3 2 Π w1+w
2
Example. We illustrate Sugeno’s reasoning method by the following
simple example

where the membership functions SMALL and BIG are defined


by

Suppose we have the inputs x 0 = 3 and y0 = 3. What is the output of the


system?

182
solution
The firing level of the first rule
is

the individual output of the first rule is z1 = x0 − y 0 = 3 − 3 = 0.

The firing level of the second rule is

α2
the individual output of the second rule is z2 = x0 + y0 = 3+3 = 6.

The firing level of the third rule is

α3
the individual output of the third rule is z3 = x0 +2y0 = 3+6 = 9.

The system output, z0, is computed from the equation

183
Mamdani VS Sugeno

● Mamdani method is widely accepted for


capturing expert knowledge. It allows us
to describe the expertise in more intuitive,
more human-like manner. However,
Mamdani-type fuzzy inference entails a
substantial computational burden.
● On the other hand, Sugeno method is
computationally effective and works well
with optimization and adaptive techniques,
which makes it very attractive in control
problems, particularly for dynamic
Simplified fuzzy reasoning

In this context, the word simplified means that the


individual rule outputs are given by crisp numbers, and
therefore, we can use their weighted sum (where the
weights are the firing strengths of the corresponding
rules) to obtain the overall system output:

185
Case Studies

You might also like