0% found this document useful (0 votes)
72 views

Module-2

Uploaded by

Rebekah Rose
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
72 views

Module-2

Uploaded by

Rebekah Rose
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 225

A7710-Soft Computing

Dr. Tanusree Dutta


Department of Computer Science and Engineering (AI and ML)
Vardhaman College of Engineering (Autonomous), Shamshabad
Hyderabad

A7710-Soft Computing
Fuzzy logic

A7710-Soft Computing
What is Fuzzy logic?

• Fuzzy logic is a mathematical language to express something.


• This means it has grammar, syntax, semantic like a language for
communication.

• There are some other mathematical languages also known

• Relational algebra (operations on sets)


• Boolean algebra (operations on Boolean variables)
• Predicate logic (operations on well formed formulae (wff), also
called predicate propositions)

• Fuzzy logic deals with Fuzzy set.


AA
brief history
Brief of of
History Fuzzy Logic
Fuzzy Logic

First time introduced by Lotfi Abdelli Zadeh (1965), University of


California, Berkley, USA (1965).

Soft Computing Applications


A brief history of Fuzzy logic

Dictionary meaning of fuzzy is not clear, noisy etc.


Example: Is the picture on this slide is fuzzy?

Antonym of fuzzy is crisp


Example: Are the chips crisp?
1

Soft Computing Applications


Example : Fuzzy logic vs. Crisp logic

Yes or No
Crisp answer
True or False

Banana Yes

Orange
Crisp
A fruit
Apple
No
Grapes

Is the fruit
citrus?

Soft Computing Applications


Example : Fuzzy logic vs. Crisp logic

May be

May not be

Fuzzy answer Absolutely

Partially

etc

Soft Computing Applications


Example : Fuzzy logic vs. Crisp logic

Score

99
Extremely honest
• Mr. A

• Ms. B
Very honest 75
• Mrs. C
Fuzzy
• Mr. D 55
Honest at times

• Mrs. E

Extremely dishonest 35
Is the person
honest?

Soft Computing Applications


World is fuzzy!

Our world is better


described with
fuzzily!

Soft Computing Applications


Concept of fuzzy system

Fuzzy element(s)

Fuzzy set(s)
I
N
P Fuzzy rule(s)
U
T
Fuzzy implication(s)
(Inferences)
O
U
T
Fuzzy system P
U
T

Soft Computing Applications


Concept of fuzzy set
To understand the concept of fuzzy set it is better, if we first clear our
idea of crisp set.
U = The entire population of India.
F = All Female population = { f1, f2, f3, ... , fL }
M = All Male population = { m1, m2, m3, ... , mN }

Universe of discourse U

Here, All are the sets of finite numbers of individuals.


Such a set is called crisp set.
Soft Computing Applications
Example of fuzzy set

Let us discuss about fuzzy set.


X = All students in CSM.
S = All sincere students.
S = { (s, g) | s ∈ X } and g(s) is a measurement of sincereness of
the student s.
Example:
S = { (Abir, 0.8), (Amir, 0.7), (Salma, 0.1), (Sita, 0.9) } etc.

Soft Computing Applications


Fuzzy set vs. Crisp set

Crisp Set Fuzzy Set


1. S = { s | s ∈ X } 1. F = (s, µ) | s ∈ X and
µ(s) is the degree of s.
2. It is a collection of el- 2. It is collection of or-
ements. dered pairs.
3. Inclusion of an el- 3. Inclusion of an el-
ement s ∈ X into S is ement s ∈ X into F is
crisp, that is, has strict fuzzy, that is, if present,
boundary yes or no. then with a degree of
membership.

Soft Computing Applications


Fuzzy set vs. Crisp set
Note: A crisp set is a fuzzy set, but, a fuzzy set is not necessarily a
crisp set.
Example:
H = { (h1, 1), (h2, 1), ... , (hL, 1) }
Person = { (p1, 1), (p2, 0), ... , (pN , 1) }
In case of a crisp set, the elements are with extreme values of degree
of membership namely either 1 or 0.

How to decide the degree of memberships of elements in a fuzzy set?

City Switzerla London Thailand Ireland China India


nd
DoM 0.95 0.90 0.80 0.01 0.65 0.75
How the country of comfort can be
judged? A6560-Soft Computing
Soft Computing Applications
Example: Course evaluation in a crisp way

1 EX = Marks ≥ 90
2 A = 80 ≤ Marks < 90
B = 70 ≤ Marks < 80
C = 60 ≤ Marks < 70
5 D = 50 ≤ Marks < 60
6 P = 35 ≤ Marks < 50
7 F = Marks < 35

Soft Computing Applications


Example: Course evaluation in a crisp way

F P D C B A EX
1

0
35 50 60 70 80 90 100

Soft Computing Applications


Example: Course evaluation in a fuzzy way

F P D C B A EX
1

0
35 50 60 70 80 90 100

Soft Computing Applications


Few examples of fuzzy set

High Temperature

Low Pressure

Color of Apple

Sweetness of Orange

Weight of Mango

Note: Degree of membership values lie in the range [0...1].

Soft Computing Applications


Some basic terminologies and notations

Definition 1: Membership function (and Fuzzy set)


If X is a universe of discourse and x ∈ X, then a fuzzy set A in X is
defined as a set of ordered pairs, that is
A = {(x, µA(x))|x ∈ X } where µA(x) is called the membership function
for the fuzzy set A.

Note:
µA(x) map each element of X onto a membership grade (or
membership value) between 0 and 1 (both inclusive).

Question:
How (and who) decides µA(x) for a Fuzzy set A in X ?

Soft Computing Applications


Example:
X = All cities in India

A = City of comfort

A={(New Delhi, 0.7), (Bangalore, 0.9), (Chennai, 0.8), (Hyderabad,


0.6), (Kolkata, 0.5)}

Soft Computing Applications


Membership function with discrete membership
values

The membership values may be of discrete values.

Soft Computing Applications


Membership function with discrete membership values

Either elements or their membership values (or both) also may be of


discrete values.

A ={(0,0.1),(1,0.30),(2,0.78)……(10,0.1)}

1.0
0.8
0.6 Note : X = discrete value
µ

0.4

0.2
How you measure happiness ??
0 2 4 6 8 10

Number of children (X)

A = “Happy family”

Soft Computing Applications


Membership function with continuous membership values

1.0
 B (x) = 1
 x −50 
4
0.8
1+ 
0.6  10 

0.4

0.2

0 50 100
B

Age (X)
Note : x = real value
B = “Middle aged” = R+

Soft Computing Applications


Fuzzy terminologies: Support

Support: The support of a fuzzy set A is the set of all points x ∈ X


such that µA (x) > 0

Soft Computing Applications


Fuzzy terminologies: Core

Core: The core of a fuzzy set A is the set of all points x in X such that
µA (x) = 1

core (A) = {x | µA(x) = 1}

1.0
µ

0.5

Soft Computing Applications


Fuzzy terminologies: Normality

Normality : A fuzzy set A is a normal if its core is non-empty. In other


words, we can always find a point x ∈ X such that µA(x) = 1.

1.0

Soft Computing Applications


Fuzzy terminologies: Crossover points

Crossover point : A crossover point of a fuzzy set A is a point x ∈ X


at which µA (x) = 0.5. That is
Crossover (A) = {x |µA(x) = 0.5}.

Soft Computing Applications


Fuzzy terminologies: Fuzzy Singleton

Fuzzy Singleton : A fuzzy set whose support is a single point in X


with µA(x) = 1 is called a fuzzy singleton. That is
|A| = { x | µA (x) = 1} .

Soft Computing Applications


Fuzzy terminologies: α-cut and strong α-cut

α-cut and strong α-cut :

The α-cut of a fuzzy set A is a crisp set defined by

Aα = { x | µA (x) ≥ α }

Strong α-cut is defined similarly :

Aα ’ = { x | µA (x) > α }

Note : Support(A) = A0’ and Core(A) = A1.

Soft Computing Applications


Fuzzy terminologies: Convexity
Convexity : A fuzzy set A is convex if and only if for any x1 and x2 ∈ X
and any λ ∈ [0,1]

µA (λx1 + (1 -λ)x2) ≥ min(µA(x1), µA(x2))

Note :
• A is convex if all its α- level sets are convex.
• Convexity (Aα) =⇒ Aα is composed of a single line segment only.
Membership function is Non-convex
convex Membership function

1.0 1.0

Soft Computing Applications


Fuzzy terminologies: Bandwidth

Bandwidth :

For a normal and convex fuzzy set, the bandwidth (or width) is defined
as the distance the two unique crossover points:
Bandwidth(A) = | x1 - x2 |
where µA(x1) = µA(x2) = 0.5

Soft Computing Applications


Fuzzy terminologies: Symmetry

Symmetry :

A fuzzy set A is symmetric if its membership function around a certain


point x = c, namely µA(x + c) = µA(x - c) for all x ∈ X.

Soft Computing Applications


Fuzzy terminologies: Open and Closed
A fuzzy set A is
Open left
If limx→−∞ µA (x) = 1 and limx→ +∞ µA (x) = 0
Open right:
If limx→−∞µA(x) = 0 and limx→+∞ µA(x) = 1
Closed
If : limx→−∞ µA (x) = limx → +∞ µA (x) = 0

Open left Open right


Closed

Soft Computing Applications


Fuzzy vs. Probability

Fuzzy : When we say about certainty of a thing

Example: A patient come to the doctor and he has to diagnose so that


medicine can be prescribed.
Doctor prescribed a medicine with certainty 60% that the patient is
suffering from flue. So, the disease will be cured with certainty of 60%
and uncertainty 40%. Here, in stead of flue, other diseases with some
other certainties may be.

Probability: When we say about the chance of an event to occur

Example: India will win the T20 tournament with a chance 60% means
that out of 100 matches, India own 60 matches.

Soft Computing Applications


Prediction vs. Forecasting

The Fuzzy vs. Probability is analogical to Prediction vs. Forecasting

Prediction : When you start guessing about things.

Forecasting : When you take the information from the past job and
apply it to new job.

The main difference:


Prediction is based on the best guess from experiences.
Forecasting is based on data you have actually recorded and packed
from previous job.

Soft Computing Applications


Fuzzy Membership Functions

Soft Computing Applications


Fuzzy membership functions
A fuzzy set is completely characterized by its membership function
(sometimes abbreviated as MF and denoted as µ ). So, it would be
important to learn how a membership function can be expressed
(mathematically or otherwise).
Note: A membership function can be on
(a) a discrete universe of discourse and
(b) a continuous universe of discourse.
Example:

1.0 1.0
0.8 0.8
µA

µB
0.6 0.6
0.4 0.4
0.2 0.2

0 2 4 6 8 10 0 10 20 30 40 50 60

Number of children (X) Age (X)

A = Fuzzy set of “Happy family” B = “Young age”

Soft Computing Applications


Fuzzy membership functions
So, membership function on a discrete universe of course is trivial.
However, a membership function on a continuous universe of
discourse needs a special attention.
Following figures shows a typical examples of membership functions.

µ
µ

x x x

< triangular > < trapezoidal > < curve >


µ

x x

< non-uniform > < non-uniform >

Soft Computing Applications


Fuzzy MFs : Formulation and parameterization
In the following, we try to parameterize the different MFs on a
continuous universe of discourse.
Triangular MFs : A triangular MF is specified by three parameters
{ a,b,c} and can be formulated as follows.

0 if x ≤ a
x−a if a ≤ x ≤ b
triangle(x ; a, b ,c ) = b−a
(1)
c−x
c−b
if b ≤ x ≤ c
0 if c ≤ x

1.0

a b c

Soft Computing Applications


Fuzzy MFs: Trapezoidal
A trapezoidal MF is specified by four parameters {a, b, c, d} and can
be defined as follows:

1 if x ≤ a
x−a if a ≤ x ≤ b
b−a
trapeziod(x; a,b,c,d) = 1 if b ≤ x ≤ c (2)
d−x
d−c if c ≤ x ≤ d
0 if d ≤ x

1.0

a b c d
A6560-Soft Computing
Soft Computing Applications
Fuzzy MFs: Gaussian

A Gaussian MF is specified by two parameters {c, σ} and can be


defined as below:

gaussian(x;c,σ) =e —2( ) 2.
1 x−c
σ

c
0.1
0.1c 0.9c

Soft Computing Applications


Fuzzy MFs: Generalized bell

It is also called Cauchy MF. A generalized bell MF is specified by three


parameters {a, b, c } and is defined as:

bell(x; a, b, c)= 1+| x−1 c |2b


a

b
Slope at x =
2a
b
Slope at y = −
b 2a
x y

c-a c c+a

Soft Computing Applications


Example: Generalized bell MFs

1
Example: µ(x)= 1+x 2 ;
a = b = 1 and c = 0;

1.0

-1 0 1

Soft Computing Applications


Generalized bell MFs: Different shapes

Changing a Changing b

Changing a
Changing a and b

Soft Computing Applications


Fuzzy MFs: Sigmoidal MFs

Parameters: {a, c } ; where c = crossover point and a = slope at c;


1
Sigmoid(x;a,c)=
1+e− [ x− c ]
a

1.0

Slope = a
0.5

Soft Computing Applications


Fuzzy MFs : Example

Example : Consider the following grading system for a course.

Excellent = Marks ≤ 90
Very good = 75 ≤ Marks ≤ 90
Good = 60 ≤ Marks ≤ 75
Average = 50 ≤ Marks ≤ 60
Poor = 35 ≤ Marks ≤ 50
Bad= Marks ≤ 35

Soft Computing Applications


Grading System

A fuzzy implementation will look like the following.

Bad poor Average Good Very Good Excellent

1
.8
.6
.4
.2
0
10 20 30 40 50 60 70 80 90
marks

You can decide a standard fuzzy MF for each of the fuzzy garde.
Operations on Fuzzy Sets

Soft Computing Applications


Basic fuzzy set operations: Union

Union (A ∪B):

µA∪B (x) = max{ µA (x), µB (x)}

Example:
A = {(x 1, 0.5), (x2, 0.1), (x3, 0.4)} and
B = {(x 1, 0.2), (x2, 0.3), (x3, 0.5)};
C = A ∪B = { (x1, 0.5), (x2, 0.3), (x3, 0.5)}

µA µA
µB µB
µ µAUB

a p x b q c a p x b q c

Soft Computing Applications


Basic fuzzy set operations: Intersection

Intersection (A ∩B):

µA∩B (x) = min{ µA (x), µB (x)}

Example:
A = {(x 1, 0.5), (x2, 0.1), (x3, 0.4)} and
B = {(x 1, 0.2), (x2, 0.3), (x3, 0.5)};
C = A ∩B = { (x1, 0.2), (x2, 0.1), (x3, 0.4)}

µA
µB
µ
µAᴖB

a p x b q c a p x b q c

Soft Computing Applications


Basic fuzzy set operations: Complement

Complement (AC ):

µAAC (x) = 1-µA (x)

Example:
A = {(x 1, 0.5), (x2, 0.1), (x3, 0.4)}
C = AC = {(x 1, 0.5), (x2, 0.9), (x3, 0.6)}

µA µA
1.0 µA’

p x q p x q

Soft Computing Applications


Basic fuzzy set operations: Products

Algebric product or Vector product (A•B):

µA•B (x) = µA (x) • µB (x)

Scalar product (α × A):

µαA (x) = α ·µA (x)

Soft Computing Applications


Basic fuzzy set operations: Sum and Difference

Sum (A + B):

µA+B (x) = µA (x) + µB (x) − µA (x) ·µB (x)

Difference (A − B = A ∩BC ):

µA−B (x) = µA∩BC (x)

Disjunctive sum: A ⊕ B = (AC ∩B) ∪(A ∩BC ))

Bounded Sum: | A(x) ⊕ B(x) |

µ|A(x)⊕B(x)| = min{ 1, µA (x) + µB (x)}

Bounded Difference: | A(x) g B(x) |

µ|A(x)g B(x)| = max{ 0, µA (x) + µB (x) − 1}

Soft Computing Applications


Basic fuzzy set operations: Equality and Power

Equality (A = B):

µA (x) = µB (x)

Power of a fuzzy set Aα:

µAα (x) = { µA (x)} α

If α < 1, then it is called dilation


If α > 1, then it is called concentration

Soft Computing Applications


Basic fuzzy set operations: Cartesian product

Caretsian Product (A × B):

µA×B (x,y) = min{ µA (x),µB (y)

Example 3:
A(x) = {(x 1, 0.2), (x2, 0.3), (x3, 0.5), (x4, 0.6)}
B(y) = {(y 1, 0.8), (y2, 0.6), (y3, 0.3)}
y1 y2 y3
x1 0.2 0.2 0.2
0.3 0.3 0.3
A × B = min{ µA (x), µB (y)} =
x2
x3 0 .5 0.5 0.3
x4 0.6 0.6 0.3

Soft Computing Applications


Properties of fuzzy sets

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)

Soft Computing Applications


Properties of fuzzy sets
Idempotence :
A ∪A = A
A ∩A =
∅ A ∪∅=
A A ∩∅
=∅
Transitivity :
If A ⊆ B,B ⊆ C then A ⊆ C
Involution :
(Ac ) c = A

De Morgan’s law :
(A ∩B) c = Ac ∪Bc
(A ∪B) c = Ac ∩Bc

Soft Computing Applications


Few Illustrations on Fuzzy Sets

Soft Computing Applications


Example 1: Fuzzy Set Operations

Let A and B are two fuzzy sets defined over a universe of discourse X
with membership functions µA(x ) and µB (x ), respectively. Two MFs
µA(x) and µB (x ) are shown graphically.
µA(x)

a1 a2 a3 a4 µB(x) b1 a1=b2 a2=b3 a4


x x

Soft Computing Applications


Example 1: Plotting two sets on the same graph

Let’s plot the two membership functions on the same graph

µB µA
µ

b1 a1 a2 b4 a3 a4
x

Soft Computing Applications


Example 1: Union and Intersection
The plots of union A ∪B and intersection A ∩B are shown in the
following.

µB µA

b1 a1 a2 b4 a3 a4
x
AB ( )x

AB ( )x
a2 b4
b1 a1 a2 a3 a4
x
x

Soft Computing Applications


Example 1: Intersection

The plots of union µA¯(x ) of the fuzzy set A is shown in the following.

 ( )x
A ( )x

A
a b a b
x x

Soft Computing Applications


Fuzzy set operations: Practice

Consider the following two fuzzy sets A and B defined over a universe
of discourse [0,5] of real numbers with their membership functions

µA (x) = x
1+x and µB (x) = 2−x

Determine the membership functions of the following and draw them


graphically.

i. A , B
ii. A ∪B
iii. A ∩B
iv.(A ∪ B) c [Hint: Use De’ Morgan law]

Soft Computing Applications


Example 2: A real-life example
Two fuzzy sets A and B with membership functions µA(x) and µB (x ),
respectively defined as below.
A = Cold climate with µA (x) as the MF.
B = Hot climate with µB (x) as the M.F.

µA µB
1.0

0.5
µ

-15 -10 -5 0 5 10 15 20 25 30 35 40 45
50
x

Here, X being the universe of discourse representing entire range of


temperatures.

Soft Computing Applications


Example 2: A real-life example

What are the fuzzy sets representing the following?


1 Not cold climate
2 Not hold climate

3 Extreme climate

4 Pleasant climate

Note: Note that ”Not cold climate” /= ”Hot climate” and vice-versa.

Soft Computing Applications


Example 2 : A real-life example
Answer would be the following.
1 Not cold climate
A with 1 − µA (x) as the MF.
2 Not hot climate
B with 1 − µB (x) as the MF.
3 Extreme climate
A ∪B with µA∪B (x ) = max(µA(x), µB (x )) as the MF.
4 Pleasant climate
A ∩B with µA∩B (x ) = min(µA(x), µB (x )) as the MF.
The plot of the MFs of A ∪B and A ∩B are shown in the following.
Extreme climate Pleasant climate
1.0
µA µB
1.0
AB

0.

AB
5
µ

- -
15 10 -5 0 5 10 15 20 25 30 35 40 45 50
5 15 25 5 25
x
x x

Soft Computing Applications


Generation of MFs
Given a membership function of a fuzzy set representing a linguistic
hedge, we can derive many more MFs representing several other
linguistic hedges using the concept of Concentration and Dilation.
Concentration:
Ak = [µA (x)]k ; k > 1

Dilation:
Ak = [µA (x)]k ; k < 1
Example : Age = { Young, Middle-aged, Old }
Thus, corresponding to Young, we have : Not young, Very young, Not
very young and so on.
Similarly, with Old we can have : old, very old, very very old, extremely
old etc.
Thus, Extremely old = (((old) 2 ) 2 ) 2 and so on
Or, More or less old = A0.5 = (old) 0.5
Soft Computing Applications
Linguistic variables and values

Young Middle-Aged Old

Very Old


Very young

0 30 60 100

X = Age

µyoung (x ) = bell(x, 20, 2, 0) = 1


x )4
1+( 20

µold (x) = bell(x,30,3,100) = 1


100 ) 6
1+( x−30

µmiddle−aged = bell(x,30,60,50)
Not young = µyoung (x) = 1 − µyoung (x)
Young but not too young = µyoung (x) ∩µyoung (x)
Soft Computing Applications
Questions??

Soft Computing Applications


Thank you

Soft Computing Applications


A7710-Soft Computing

A7710-Soft Computing
Fuzzy Relations
Crisp relations

To understand the fuzzy relations, it is better to discuss first crisp


relation.
Suppose, A and B are two (crisp) sets. Then Cartesian product
denoted as A × B is a collection of order pairs, such that
A × B = { (a,b)|a ∈ A and b ∈ B}

Note :
(1) A × B /= B × A
(2) |A × B| = |A| × |B|
(3)A × B provides a mapping from a ∈ A to b ∈ B.

The mapping so mentioned is called a relation.

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 3 / 64


Crisp relations
Example 1:
Consider the two crisp sets A and B as given below. A ={ 1, 2, 3, 4}
B = {3, 5, 7 }.
Then, A × B = {(1, 3), (1, 5), (1, 7), (2, 3), (2, 5), (2, 7), (3, 3), (3, 5),
(3,7),(4,3),(4,5),(4,7)}
Let us define a relation R as R = {(a, b)|b = a + 1, (a, b) ∈ A × B }
Then, R = { (2,3),(4,5)} in this case.
We can represent the relation R in a matrix form as follows.

3 5 7
1 0 0 0
2 1 0 0
R=
3 0 0 0
4 0 1 0

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 4 / 64


Operations on crisp relations
Suppose, R(x, y) and S(x, y) are the two relations define over two
crisp sets x ∈ A and y ∈ B
Union:

R(x,y) ∪ S(x,y) = max(R(x,y),S(x,y));

Intersection:

R(x,y) ∩ S(x,y) = min(R(x,y),S(x,y));

Complement:

R(x,y) = 1 − R(x,y)

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 5 / 64


Example: Operations on crisp relations

Example:
Suppose, R(x, y) and S(x, y) are the two relations define over two
crisp sets x ∈ A and y ∈ B
0 1 0 0 1 0 0 0
0 0 1 0 0 1 0 0
R= and S = ;
0 0 0 1 0 0 1 0
0 0 0 0 0 0 0 1
Find the following:
1 R ∪S
2 R ∩S
3 R

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 6 / 64


Composition of two crisp relations

Given R is a relation on X ,Y and S is another relation on Y ,Z .


Then R ◦S is called a composition of relation on X and Z which is
defined as follows.

R ◦S = {(x, z)|(x, y) ∈ R and (y, z) ∈ S and ∀y∈ Y }

Max-Min Composition
Given the two relation matrices R and S, the max-min composition is
defined as T = R ◦S ;

T (x, z) = max{min{R(x, y), S(y, z) and ∀y∈ Y } }

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 7 / 64


Composition: Composition
Example:
Given
X = {1, 3, 5}; Y = {1, 3, 5}; R = {(x, y)|y = x + 2}; S = {(x, y)|x < y}
Here, R and S is on X × Y .
Thus, we have
R = { (1,3),(3,5)}
S = { (1,3),(1,5),(3,5)}
1 3 5 1 3 5
1 0 1 0 1 0 1 1
R= 3 0 0 1 and S= 3 0 0 1
5 0 0 0 5 0 0 0
1 3 5
1 0 0 1
Using max-min composition R ◦S= 3 0 0 0
5 0 0 0
Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 8 / 64
Fuzzy relations
Fuzzy relation is a fuzzy set defined on the Cartesian product of
crisp set X1, X2, ...,Xn
Here, n-tuples (x1, x2, ...,xn) may have varying degree of
memberships within the relationship.
The membership values indicate the strength of the relation
between the tuples.
Example:
X = { typhoid, viral, cold } and Y = { running nose, high temp,
shivering }
The fuzzy relation R is defined as

runningnose hightemperature shivering


typhoid 0.1 0.9 0.8
viral 0.2 0.9 0.7
cold 0.9 0.4 0.6
Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 9 / 64
Fuzzy Cartesian product

Suppose
A is a fuzzy set on the universe of discourse X with µA(x)|x ∈ X
B is a fuzzy set on the universe of discourse Y with µB (y )|y ∈ Y
Then R = A × B ⊂ X × Y ; where R has its membership function given
by µR (x,y) = µA×B (x,y) = min{ µA (x),µB (y)}
Example :
A = {(a 1, 0.2), (a2, 0.7), (a3, 0.4)}and B = {(b 1 , 0.5), (b2, 0.6)}
b1 b2
a1 0.2 0.2
R =A× B = a2 0.5 0.6
a3 0.4 0.4

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 10 / 64


Operations on Fuzzy relations
Let R and S be two fuzzy relations on A × B.
Union:

µR∪S (a,b) = max{ µR (a,b),µS (a,b)}

Intersection:

µR∩S (a,b) = min{ µR (a,b),µS (a,b)}


Complement:

µR (a,b) = 1 − µR (a,b)
Composition

T = R ◦S
µR◦S = maxy∈Y { min(µR (x,y),µS (y,z))}

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 11 / 64


Operations on Fuzzy relations: Examples
Example:
X = (x1, x2, x3); Y = (y1, y2); Z = (z1, z2, z3);
y1 y2
x1 0.5 0.1
R= x2 0.2 0.9
x3 0.8 0.6
z1 z2 z3
y1 0.6 0.4 0.7
S=
y2 0.5 0.8 0.9
z1 z2 z3

0.5 0.4 0.5


x1
R ◦S = x2 0 .5 0.8 0.9
x3 0.6 0.6 0.7
µR◦S (x1,y1) = max{ min(x1,y1),min(y1,z1), min(x1,y2),min(y2,z1)}
= max{min(0.5, 0.6), min(0.1, 0.5)} = max{0.5, 0.1} = 0.5 and so on.
Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 12 / 64
Fuzzy relation : An example

Consider the following two sets P and D, which represent a set of


paddy plants and a set of plant diseases. More precisely
P = {P1, P2, P3, P 4 } a set of four varieties of paddy plants
D = {D1, D2, D3, D 4 } of the four various diseases affecting the plants
In addition to these, also consider another set S = {S1, S2, S3, S 4 } be
the common symptoms of the diseases.
Let, R be a relation on P × D, representing which plant is susceptible
to which diseases, then R can be stated as
D1 D2 D3 D4
P1 0.6 0.6 0.9 0.8
P2 0.1 0.2 0.9 0.8
R=
P3 0.9 0.3 0.4 0.8
P4 0.9 0.8 0.4 0.2

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 13 / 64


Fuzzy relation : An example

Also, consider T be the another relation on D × S, which is given by


S1 S2 S3 S4
D1 0.1 0.2 0.7 0.9
D2 1.0 1.0 0.4 0.6
S=
D3 0.0 0.0 0.5 0.9
D4 0.9 1.0 0.8 0.2
Obtain the association of plants with the different symptoms of the
disease using max-min composition.
Hint: Find R ◦T , and verify that
S1 S2 S3 S4
P1 0.8 0.8 0.8 0.9
P2 0.8 0.8 0.8 0.9
R ◦S =
P3 0 .8 0.8 0.8 0.9
P4 0.8 0.8 0.7 0.9

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 14 / 64


Fuzzy relation : Another example
Let, R = x is relevant to y
and S = y is relevant to z
be two fuzzy relations defined on X × Y and Y × Z , respectively,
where X = {1, 2, 3} ,Y = {α, β, γ, δ} and Z = {a, b}.
Assume that R and S can be expressed with the following relation
matrices :
α β γ δ
1 0.1 0.3 0.5 0.7
R= 2 0.4 0.2 0.8 0.9 and
3 0.6 0.8 0.3 0.2
a b
α 0.9 0.1
β 0.2 0.3
S=
γ 0.5 0.6
δ 0.7 0.2
Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 15 / 64
Fuzzy relation : Another example
Now, we want to find R ◦S, which can be interpreted as a derived
fuzzy relation x is relevant to z.
Suppose, we are only interested in the degree of relevance between
2 ∈ X and a ∈ Z . Then, using max-min composition,
µR◦S (2, a) = max{(0.4 ∧0.9), (0.2 ∧0.2), (0.8 ∧0.5), (0.9 ∧0.7)}
= max{ 0.4,0.2,0.5,0.7} = 0.7
R s

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 16 / 64


2D Membership functions : Binary fuzzy relations

(Binary) fuzzy relations are fuzzy sets A × B which map each element
in A × B to a membership grade between 0 and 1 (both inclusive).
Note that a membership function of a binary fuzzy relation can be
depicted with a 3D plot.

 (x, y)

Important: Binary fuzzy relations are fuzzy sets with two dimensional
MFs and so on.

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 17 / 64


2D membership function : An example

Let, X = R+ = y (the positive real line)


and R = X × Y = ”y is much greater than x”
The membership function of µR (x, y) is defined as
(y−x)
µR (x,y) = 4 if y >x
0 if y≤x
Suppose, X = { 3,4,5} and Y = { 3,4,5,6,7} , then
3 4 5 6 7
3 0 0.25 0.5 0.75 1.0
R= 4 0 0 0.25 0.5 0.75
5 0 0 0 0.25 0.5

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 18 / 64


Problems to ponder:

How you can derive the following?


If x is A or y is B then z is C;
Given that
1 R1: If x is A then z is c [R1 ∈ A × C]
2 R2: If y is B then z is C [R2 ∈ B × C]

Hint:

You have given two relations R1 and R2.


Then, the required can be derived using the union operation of R1
and R2

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 19 / 64


Fuzzy Propositions
Two-valued logic vs. Multi-valued logic

The basic assumption upon which crisp logic is based - that every
proposition is either TRUE or FALSE.

The classical two-valued logic can be extended to multi-valued


logic.

As an example, three valued logic to denote true(1), false(0) and


indeterminacy ( 12).

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 21 / 64


Two-valued logic vs. Multi-valued logic

Different operations with three-valued logic can be extended as shown


in the following truth table:

a b ∧ ∨ ¬a =⇒ =
0 0 0 0 1 1 1
1 1 1
0 2 0 2 1 1 2
0 1 0 1 1 1 0
1 1 1 1 1
2 0 0 2 2 2 2
1 1 1 1 1 1
2 2 2 2 2 2 1
1 1 1 1
2 1 2 1 2 1 2
1 0 0 1 1 0 0
1 1 1 1
1 2 2 1 1 2 2
1 1 1 1 1 1 1

Fuzzy connectives used in the above table are:


AND (∧), OR (∨), NOT (¬), IMPLICATION (=⇒) and EQUAL (=).

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 22 / 64


Three-valued logic

Fuzzy connectives defined for such a three-valued logic better can be


stated as follows:

Symbol Connective Usage Definition


¬ NOT ¬P 1 − T (P)
∨ OR P∨Q max{T(P), T(Q) }
∧ AND P∧Q min{ T(P),T(Q) }
=⇒ IMPLICATION (P =⇒ Q) or max{(1 - T(P)),
(¬P ∨ Q) T(Q) }
= EQUALITY (P = Q) or 1 − |T (P) − T (Q)|
[(P =⇒ Q) ∧
(Q =⇒ P)]

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 23 / 64


Fuzzy proposition

Example 1:
P : Ram is honest

1 T(P) = 0.0 : Absolutely false


2 T(P) = 0.2 : Partially false
3 T(P) = 0.4 : May be false or not false
4 T(P) = 0.6 : May be true or not true
5 T(P) = 0.8 : Partially true
6 T(P) = 1.0 : Absolutely true.

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 24 / 64


Example 2 :Fuzzy proposition

P : Mary is efficient ; T(P) = 0.8;


Q : Ram is efficient ; T(Q) = 0.6

1 Mary is not efficient.


T (¬P) = 1 − T (P) = 0.2
2 Mary is efficient and so is Ram.
T (P ∧Q) = min{ T (P), T (Q)} = 0.6
3 Either Mary or Ram is efficient
T (P ∨Q) = maxT (P), T (Q) = 0.8
4 If Mary is efficient then so is Ram
T (P =⇒ Q) = max{ 1 − T (P), T (Q)} = 0.6

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 25 / 64


Fuzzy proposition vs. Crisp proposition

The fundamental difference between crisp (classical) proposition


and fuzzy propositions is in the range of their truth values.

While each classical proposition is required to be either true or


false, the truth or falsity of fuzzy proposition is a matter of degree.

The degree of truth of each fuzzy proposition is expressed by a


value in the interval [0,1] both inclusive.

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 26 / 64


Canonical representation of Fuzzy proposition
Suppose, X is a universe of discourse of five persons.
Intelligent of x ∈ X is a fuzzy set as defined below.

Intelligent: {(x 1, 0.3), (x2, 0.4), (x3, 0.1), (x4, 0.6), (x5, 0.9)}
We define a fuzzy proposition as follows:

P : x is intelligent
The canonical form of fuzzy proposition of this type, P is
expressed by the sentence P : v is F .
Predicate in terms of fuzzy set.
P : v is F ; where v is an element that takes values v from some
universal set V and F is a fuzzy set on V that represents a fuzzy
predicate.
In other words, given, a particular element v , this element belongs
to F with membership grade µF (v ).
Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 27 / 64
Graphical interpretation of fuzzy proposition

F ( )v

P: v is F
T(P)
T(P) = µF(v) for a v ε V

v V

For a given value v of variable V in proposition P, T(P) denotes the


degree of truth of proposition P.

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 28 / 64


Fuzzy Implications
Fuzzy rule

A fuzzy implication (also known as fuzzy If-Then rule, fuzzy rule,


or fuzzy conditional statement) assumes the form :

If x is A then y is B

where, A and B are two linguistic variables defined by fuzzy sets A


and B on the universe of discourses X and Y , respectively.

Often, x is A is called the antecedent or premise, while y is B is


called the consequence or conclusion.

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 30 / 64


Fuzzy implication : Example 1

If pressure is High then temperature is Low


If mango is Yellow then mango is Sweet else mango is Sour

If road is Good then driving is Smooth else traffic is High

The fuzzy implication is denoted as R : A → B

In essence, it represents a binary fuzzy relation R on the


(Cartesian) product of A × B

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 31 / 64


Fuzzy implication : Example 2

Suppose, P and T are two universes of discourses representing


pressure and temperature, respectively as follows.

P = { 1,2,3,4} and T ={ 10, 15, 20, 25, 30, 35, 40, 45, 50 }

Let the linguistic variable High temperature and Low pressure are
given as

THIGH =
{(20, 0.2), (25, 0.4), (30, 0.6), (35, 0.6), (40, 0.7), (45, 0.8), (50, 0.8)}

PLOW = (1,0.8),(2,0.8),(3,0.6),(4,0.4)

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 32 / 64


Fuzzy implications : Example 2

Then the fuzzy implication If temperature is High then pressure


is Low can be defined as
R : THIGH → PLOW
1 2 3 4
20 0.2 0.2 0.2 0.2
25 0.4 0.4 0.4 0.4
30 0.6 0.6 0.6 0.4
where, R = 35 0.6 0.6 0.6 0.4
40 0.7 0.7 0.6 0.4
45 0.8 0.8 0.6 0.4
50 0.8 0.8 0.6 0.4

Note : If temperature is 40 then what about low pressure?

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 33 / 64


Interpretation of fuzzy rules

In general, there are two ways to interpret the fuzzy rule A → B as


A coupled with B

A entails B

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 34 / 64


Interpretation as A coupled with B

R :A → B =A× B = X ×Y
µA (x) ∗ µB (y)| (x,y) ; where ∗ is called a
T-norm operator.

T-norm operator
The most frequently used T-norm operators are:
Minimum : Tmin (a,b) = min(a,b) = a ∧b
Algebric product : Tap (a,b) = ab
Bounded product : Tbp (a,b) = 0 ∨ (a + b − 1)
a if b=1
Drastic product : Tdp = b if a=1
0 if a,b < 1
Here, a = µA(x ) and b = µB (y ). T∗ is called the function of T-norm operator.

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 35 / 64


Interpretation as A coupled with B

Based on the T-norm operator as defined above, we can automatically


define the fuzzy rule R : A → B as a fuzzy set with two-dimentional MF:
µR (x, y) = f (µA(x), µB (y )) = f (a, b) with a=µA(x) , b=µB (y ), and f is
the fuzzy implication function.

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 36 / 64


Interpretation as A coupled with B

In the following, few implications of R : A → B

Min operator:

Rm = A × B = X ×Y
µA(x) ∧µB (y )| (x,y) or f min (a,b) = a ∧b
[Mamdani rule]

Algebric product operator



Rap = A × B = X ×Y µA (x).µB (y)| (x,y) or fap(a,b) = ab
[Larsen rule]

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 37 / 64


Product Operators

Bounded product operator



R
∫ bp = A × B = X ×Y A
µ (x) Ⓢ µB (y)| (x,y) =
X ×Y 0 ∨(µA (x) + µ B (y) − 1)| (x,y)
or fbp = 0 ∨(a + b − 1)

Drastic product∫ operator


Rdp = A × B = X ×Y µA(x)ˆ • µB(y)| (x,y)
a if b=1
or fdp (a,b) = b if a=1
0 if otherwise

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 38 / 64


Interpretation of A entails B

There are three main ways to interpret such implication:


Material implication :
R : A → B = Ā ∪ B

Propositional calculus :
R : A → B = Ā ∪ (A ∩ B)

Extended propositional calculus :


R : A → B = (Ā ∩ B̄) ∪ B

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 39 / 64


Interpretation of A entails B

With the above mentioned implications, there are a number of fuzzy


implication functions that are popularly followed in fuzzy rule-based
system.

Zadeh’s arithmetic rule :



Rza = A ¯ ∪B = 1 ∧(1 − µA (x) + µB (y))| (x,y)
X ×Y
or
fza (a,b) = 1 ∧(1 − a + b)

Zadeh’s max-min rule :



R =A¯ ∪ (A ∩ B) = (1 − µA(x)) ∨ (µA(x) ∧µB (y))| (x,y)
mm X ×Y
or
fmm (a,b) = (1 − a) ∨(a ∧ b)

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 40 / 64


Interpretation of A entails B

Boolean fuzzy rule



R =A ¯ ∪B = (1 − µA (x)) ∨µB (x)|
bf X ×Y (x,y)
or
fbf (a,b) = (1 − a) ∨b;

Goguen’s fuzzy rule:


∫ 1 if a≤ b
Rgf = X ×Y
µA(x) ∗ µB (y)| (x,y) where a ∗ b = b
a if a>b

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 41 / 64


Example: Zadeh’s Max-Min rule

If x is A then y is B with the implication of Zadeh’s max-min rule can


be written equivalently as :

Rmm = (A × B) ∪ (Ā × Y )

Here, Y is the universe of discourse with membership values for all


y ∈ Y is 1, that is , µY (y) = 1∀y ∈ Y .
Suppose X = {a, b, c, d} and Y = {1, 2, 3, 4}
and A = { (a,0.0),(b,0.8),(c,0.6),(d,1.0)}
B = {(1, 0.2), (2, 1.0), (3, 0.8), (4, 0.0)} are two fuzzy sets.

We are to determine Rmm = (A × B) ∪ (Ā × Y )

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 42 / 64


Example 3: Zadeh’s min-max rule:

The computation of Rmm = (A × B) ∪ (A¯× Y ) is as follows:


1 2 3 4
a 0 0 0 0
b 0.2 0.8 0.8 0
A× B = and
c 0.2 0.6 0.6 0
d 0.2 1.0 0.8 0

1 2 3 4
a 1 1 1 1
0.2 0.2 0.2 0.2
Ā × Y =
b
c 0.4 0.4 0.4 0.4
d 0 0 0 0

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 43 / 64


Example 3: Zadeh’s min-max rule:

Therefore,
1 2 3 4
a 1 1 1 1
0.2 0.8 0.8 0.2
Rmm = (A × B) ∪ (Ā × Y ) =
b
c 0.4 0.6 0.6 0.4
d 0.2 1.0 0.8 0

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 44 / 64


Example 3 :

X = { a,b,c,d}
Y = { 1,2,3,4}
Let, A = { (a,0.0),(b,0.8),(c,0.6),(d,1.0)}
B = { (1,0.2),(2,1.0),(3,0.8),(4,0.0)}
Determine the implication relation :
If x is A then y is B
1 2 3 4
a 0 0 0 0
b 0.2 0.8 0.8 0
Here, A × B =
c 0.2 0.6 0.6 0
d 0.2 1.0 0.8 0

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 45 / 64


Example 3 :

1 2 3 4
a 1 1 1 1
0.2 0.2 0.2 0.2
and Ā × Y =
b
c 0.4 0.4 0.4 0.4
d 0 0 0 0
1 2 3 4
a 1 1 1 1
Rmm = (A × B) ∪ (Ā × Y ) =
b 0.2 0. 0.8 0.2
c 8
d 0.4 0. 0.6 0.4
6
This R represents If x is A then y is B 0.2 1. 0.8 0
0

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 46 / 64


Example 3 :

IF x is A THEN y is B ELSE y is C.
The relation R is equivalent to

R = (A × B) ∪ (Ā × C)

The membership function of R is given by


µR (x, y) =max[min{µA(x), µB (y )}, min{µA¯ (x ), µC (y )]

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 47 / 64


Example 4:

X = { a,b,c,d}
Y = { 1,2,3,4}
A = { (a,0.0),(b,0.8),(c,0.6),(d,1.0)}
B = { (1,0.2),(2,1.0),(3,0.8),(4,0.0)}
C = { (1,0),(2,0.4),(3,1.0),(4,0.8)}
Determine the implication relation :
If x is A then y is B else y is C
1 2 3 4
a 0 0 0 0
b 0.2 0.8 0.8 0
Here, A × B =
c 0.2 0.6 0.6 0
d 0.2 1.0 0.8 0

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 48 / 64


Example 4:

1 2 3 4
b
a 00 0.2
0.4 0.2
1.0 0.2
0.8
and Ā × C =
c 0 0.4 0.4 0.4
d 0 0 0 0
1 2 3 4
a 0 0.4 1.0 0.8
b 0.2 0.8 0.8 0.2
R=
c 0.2 0.6 0.6 0.4
d 0.2 1.0 0.8 0

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 49 / 64


Interpretation of fuzzy implication
If x is A then y is B

{
If x is A then y is B else y is C

{ {

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 50 / 64


Fuzzy Inferences
Fuzzy inferences

Let’s start with propositional logic. We know the following in


propositional logic.

1 Modus Ponens : P,P =⇒ Q, ⇔Q

2 Modus Tollens : P =⇒ Q,¬Q ⇔ ,¬P

3 Chain rule : P =⇒ Q,Q =⇒ R ⇔ ,P =⇒ R

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 52 / 64


An example from propositional logic

Given

1 C ∨D

2 ∼ H =⇒ (A∧ ∼ B)

3 C ∨D =⇒∼ H

4 (A∧ ∼ B) =⇒ (R ∨S)

From the above can we infer R ∨S?

Similar concept is also followed in fuzzy logic to infer a fuzzy rule from
a set of given fuzzy rules (also called fuzzy rule base).

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 53 / 64


Inferring procedures in Fuzzy logic
Two important inferring procedures are used in fuzzy systems :

Generalized Modus Ponens (GMP)


If x is A Then y is B

x is A
— — — — — — — — — — — —

y is B

Generalized Modus Tollens (GMT)


If x is A Then y is B

y is B
— — — — — — — — — — — —

x is A

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 54 / 64


Fuzzy inferring procedures

′ ′
Here, A,B,A and B are fuzzy sets.
′ ′
To compute the membership function A and B the max-min
′ ′
composition of fuzzy sets B and A ,respectively with R(x, y)
(which is the known implication relation) is to be used.

Thus,
′ ′
B = A ◦R(x,y) µB (y) = max[min(µA′ (x),µR (x,y))]
′ ′
A = B ◦R(x,y) µA (x) = max[min(µB′ (y),µR (x,y))]

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 55 / 64


Generalized Modus Ponens
Generalized Modus Ponens (GMP)

P : If x is A then y is B

Let us consider two sets of variables x and y be


X = {x 1, x2, x 3 } and Y = {y 1, y 2 }, respectively.

Also, let us consider the following.


A = { (x1,0.5),(x2,1),(x3,0.6)}
B = { (y1,1),(y2,0.4)}

Then, given a fact expressed by the proposition x is A ,

where A = { (x1,0.6),(x2,0.9),(x3,0.7)}

derive a conclusion in the form y is B (using generalized modus
ponens (GMP)).
Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 56 / 64
Example: Generalized Modus Ponens

If x is A Then y is B

x is A
————————————–

y is B
′ ′
We are to find B = A ◦R(x, y) where R(x, y) = max{A × B, A × Y }
y1 y2 y1 y2
x1 0.5 0.4 x1 0.5 0.5
A× B = x2 1 0.4 and A × Y = x2 0 0
x3 0.6 0.4 x3 0.4 0.4

Note: For A × B, µA×B (x,y) = min(µA x,µB (y))

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 57 / 64


Example: Generalized Modus Ponens

y1 y2
x1 0.5 0.5
R(x,y) = (A × B) ∪ (A × y) = x2 1 0.4
x3 0.6 0.4

Now, A = { (x1,0.6),(x2 ,0.9),(x3,0.7)}
′ ′
Therefore, B = A ◦R(x,y) =
0.5 0.5
0.6 0.9 0.7 ◦ 1 0.4 = 0.9 0.5
0.6 0.4
′ ′
Thus we derive that y is B where B = {(y 1, 0.9), (y2, 0.5)}

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 58 / 64


Example: Generalized Modus Tollens

Generalized Modus Tollens (GMT)

P: If x is A Then y is B

Q: y is B
— — — — — — — — — — — — — —

x is A

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 59 / 64


Example: Generalized Modus Tollens

Let sets of variables x and y be X = {x 1, x2, x 3 } and y = {y 1, y 2 },


respectively.

Assume that a proposition If x is A Then y is B given where


A = {(x 1, 0.5), (x2, 1.0), (x3, 0.6)} and B = {(y 1, 0.6), (y2, 0.4)}

Assume now that a fact expressed by a proposition y is B is given



where B = { (y1,0.9),(y2,0.7)} .

From the above, we are to conclude that x is A . That is, we are to

determine A

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 60 / 64


Example: Generalized Modus Tollens

We first calculate R(x,y) = (A × B) ∪ (A × y)


y1 y2
x1 0.5 0.5
R(x,y) = x2 1 0.4
x3 0.6 0.4
′ ′
Next, we calculate A = B ◦R(x,y)
y1 y2
x1 0.5 0.5

A = 0.9 0.7 ◦ x 2 1 0.4 = 0.5 0.9 0.6
x3 0.6 0.4

Hence, we calculate that x is A where

A = [(x1,0.5),(x2,0.9),(x3,0.6)]

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 61 / 64


Practice

Apply the fuzzy GMP rule to deduce Rotation is quite slow

Given that :

If temperature is High then rotation is Slow.

temperature is Very High

Let,
X = {30, 40, 50, 60, 70, 80, 90, 100} be the set of temperatures.

Y = {10, 20, 30, 40, 50, 60} be the set of rotations per minute.

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 62 / 64


Practice
The fuzzy set High(H), Very High (VH), Slow(S) and Quite Slow (QS)
are given below.

H = { (70,1),(80,1),(90,0.3)}

VH = { (90,0.9),(100,1)}

S = { (30,0.8),(40,1.0),(50,0.6)}

QS = { (10,1),(20,0.8)}

1 If temperature is High then the rotation is Slow.

R = (H × S) ∪ (H × Y )

2 temperature is Very High

Thus, to deduce ”rotation is Quite Slow”, we make use the composition


rule QS = VH ◦R(x, y)
Debasis Samanta (IIT Kharagpur) Soft Computing Applications 15.01.2016 63 / 64
A7710-Soft Computing

A7710-Soft Computing
Defuzzification
What is defuzzification?

Defuzzification means the fuzzy to crisp conversion.

Example 1:
Suppose, THIGH denotes a fuzzy set representing temperature is
High.
THIGH is given as follows.
THIGH = (15,0.1), (20, 0.4), (25,0.45), (30,0.55), (35,0.65),
(40,0.7), (45,0.85),(50,0.9)

What is the crisp value that implies for the high temperature?

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 3 / 55


Example 2: Fuzzy to crisp

As an another example, let us consider a fuzzy set whose membership


finction is shown in the following figure.

 (x)

What is the crisp value of the fuzzy set in this case?

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 4 / 55


Example 3: Fuzzy to crisp
Now, consider the following two rules in the fuzzy rule base.

R1: If x is A then y is C
R2: If x is B then y is D
A pictorial representation of the above rule base is shown in the
following figures.

C
1.0 1.0
A B

 x’
 D

x y

What is the crisp value that can be inferred from the above rules given

an input say x ?
Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 5 / 55
Why defuzzification?

The fuzzy results generated can not be used in an application, where


decision has to be taken only on crisp values.

Example:

If THIGH then rotate RFIRST .

Here, may be input THIGH is fuzzy, but action rotate should be based
on the crisp value of RFIRST .

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 6 / 55


Generic structure of a Fuzzy system
Defuzzification
Techniques
Defuzzification methods

A number of defuzzification methods are known. Such as

1 Lambda-cut method

2 Weighted average method

3 Maxima methods

4 Centroid methods

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 9 / 55


Lambda-cut method
Lambda-cut method

Lmabda-cut method is applicable to derive crisp value of a fuzzy set or


relation. Thus

Lambda-cut method for fuzzy set

Lambda-cut method for fuzzy relation

In many literature, Lambda-cut method is also alternatively termed as


Alph-cut method.

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 11 / 55


Lamda-cut method for fuzzy set

1 In this method a fuzzy set A is transformed into a crisp set Aλ for a


given value of λ (0 ≤ λ ≤ 1)

2 In other-words, Aλ = { x|µA (x) ≥ λ}

3 That is, the value of Lambda-cut set Aλ is x, when the


membership value corresponding to x is greater than or equal to
the specified λ.

4 This Lambda-cut set Aλ is also called alpha-cut set.

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 12 / 55


Lambda-cut for a fuzzy set : Example

A1 = { (x1,0.9),(x2,0.5),(x3,0.2),(x4,0.3)}

Then A0.6 = {(x 1, 1), (x2, 0), (x3, 0), (x4, 0)} = {x 1 }

and

A2 = { (x1,0.1),(x2,0.5),(x3,0.8),(x4,0.7)}

A0.2 = { (x1,0),(x2,1),(x3,1),(x4,1)} = { x2,x3 ,x4}

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 13 / 55


Lambda-cut sets : Example
Two fuzzy sets P and Q are defined on x as follows.

µ(x) x1 x2 x3 x4 x5
P 0.1 0.2 0.7 0.5 0.4
Q 0.9 0.6 0.3 0.2 0.8

Find the following :

(a) P0.2, Q0.3

(b) (P ∪Q) 0.6

(c) (P ∪P) 0.8

(d) (P ∩Q) 0.4

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 14 / 55


Lambda-cut for a fuzzy relation

The Lambda-cut method for a fuzzy set can also be extended to fuzzy
relation also.
Example: For a fuzzy relation R
1 0.2 0.3
R = 0.5 0.9 0.6
0.4 0.8 0.7
We are to find λ-cut relations for the following values of
λ = 0,0.2,0.9,0.5
1 1 1 1 1 1
R0 = 1 1 1 and R0.2 = 1 1 1 and
1 1 1 1 1 1
1 0 0 1 0 0
R0.9 = 0 1 0 and R0.5 = 1 1 1
0 0 0 0 1 1

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 15 / 55


Some properties of λ-cut sets

If A and B are two fuzzy sets, defined with the same universe of
discourse, then

1 (A ∪B) λ = Aλ ∪Bλ

2 (A ∩B) λ = Aλ ∩Bλ

3 (A) λ /= Aλ except for value of λ = 0.5

4 For any λ ≤ α, where α varies between 0 and 1, it is true that


Aα ⊆ A λ , where the value of A0 will be the universe of discourse.

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 16 / 55


Some properties of λ-cut relations

If R and S are two fuzzy relations, defined with the same fuzzy sets
over the same universe of discourses, then

5 (R ∪S) λ = Rλ ∪Sλ

6 (R ∩S) λ = Rλ ∩Sλ

7 (R) λ /= R λ

8 For λ ≤ α, where α between 0 and 1 , then Rα ⊆ Rλ

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 17 / 55


Summary: Lambda-cut methods

Lambda-cut method converts a fuzzy set (or a fuzzy relation) into crisp
set (or relation).

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 18 / 55


Output of a Fuzzy System
Output of a fuzzy System

The output of a fuzzy system can be a single fuzzy set or union of two
or more fuzzy sets.

To understand the second concept, let us consider a fuzzy system with


n-rules.
R1: If x is A1 then y is B1
R2: If x is A2 then y is B2
........................................
........................................
Rn: If x is An then y is Bn
In this case, the output y for a given input x = x1 is possibly B =
B1 ∪B2 ∪.....Bn

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 20 / 55


Output fuzzy set : Illustration
Suppose, two rules R1 and R2 are given as follows:

1 R1: If x is A1 then y is C1
2 R2: If x is A2 then y is C2

Here, the output fuzzy set C = C1 ∪C2.


For instance, let us consider the following:

C2
1.0 1.0
A C1


B

0 1 2 3 4 5 6 0 1 2 3 4 5 6 7 8

x y
x1 x2 x3

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 21 / 55


Output fuzzy set : Illustration

The fuzzy output for x = x1 is shown below.

1.0 1.0
A C


B

0 1 2 3 4 5 6 0 1 2 3 4 5 6 7 8

x1 y
x
Fuzzy output for x = x1

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 22 / 55


Output fuzzy set : Illustration

The fuzzy output for x = x2 is shown below.

1.0 1.0
A

 C

B

0 1 2 3 4 5 6 0 1 2 3 4 5 6 7 8

x = x2 y
x
Fuzzy output for x = x2

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 23 / 55


Output fuzzy set : Illustration

The fuzzy output for x = x3 is shown below.

1.0 1.0
A
B  C

0 1 2 3 4 5 6 0 1 2 3 4 5 6 7 8
y
x = x3
x
Fuzzy output for x = x3

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 24 / 55


Defuzzification Methods
Following defuzzification methods are known to calculate crisp output
in the situations as discussed in the last few slides
Maxima Methods
1 Height method
2 First of maxima (FoM)
3 Last of maxima (LoM)
4 Mean of maxima(MoM)

Centroid methods
1 Center of gravity method (CoG)
2 Center of sum method (CoS)
3 Center of area method (CoA)

Weighted average method

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 25 / 55


Defuzzification Technique
Maxima Methods
Maxima methods
Following defuzzification methods are known to calculate crisp output.
Maxima Methods
1 Height method
2 First of maxima (FoM)
3 Last of maxima (LoM)
4 Mean of maxima(MoM)

Centroid methods
1 Center of gravity method (CoG)
2 Center of sum method (CoS)
3 Center of area method (CoA)

Weighted average method

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 27 / 55


Maxima method : Height method
This method is based on Max-membership principle, and defined as
follows.

µC (x ∗ ) ≥ µC (x) for all x ∈ X

c

Note:
1. Here, x ∗ is the height of the output fuzzy set C.
2. This method is applicable when height is unique.
Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 28 / 55
Maxima method : FoM

FoM: First of Maxima : x ∗ = min{ x|C(x) = maxw C{ w} }

c

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 29 / 55


Maxima method : LoM

LoM : Last of Maxima : x ∗ = max{ x|C(x) = maxw C{ w} }

c

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 30 / 55


Maxima method : MoM

Σ
(xi )
x∗ = xi ∈M
|M|

where, M = {x i |µ(xi ) = h(C)} where h(C) is the height of the fuzzy set
C

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 31 / 55


MoM : Example 1

Suppose, a fuzzy set Young is defined as follows:

Young = {(15,0.5), (20,0.8), (25,0.8), (30,0.5), (35,0.3) }

Then the crisp value of Young using MoM method is


x∗ = 20+25
2
= 22.5

Thus, a person of 22.5 years old is treated as young!

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 32 / 55


MoM : Example 2
What is the crisp value of the fuzzy set using MoM in the following
case?

c

x∗ = a+b
2

Note:
Thus, MoM is also synonymous to middle of maxima.
MoM is also general method of Height.
Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 33 / 55
Defuzzification Technique
Centroid Methods
Cenroid methods
Following defuzzification methods are known to calculate crisp output.
Maxima Methods
1 Height method
2 First of maxima (FoM)
3 Last of maxima (LoM)
4 Mean of maxima(MoM)

Centroid methods
1 Center of gravity method (CoG)
2 Center of sum method (CoS)
3 Center of area method (CoA)

Weighted average method

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 35 / 55


Centroid method : CoG
1 The basic principle in CoG method is to find the point x ∗ where a
vertical line would slice the aggregate into two equal masses.
2 Mathematically, the CoG can be expressed as follows :
,
x.µC (x)dx
x∗ = ,
µC (x)dx

3 Graphically,

Center of gravity

c

x*
x

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 36 / 55


Centroid method : CoG

Note:
1 x ∗ is the x-coordinate of center of gravity.

2 µC (x)dx denotes the area of the region bounded by the curve
µC .

3 If µC is defined with a discrete membership function, then CoG


can be stated as :
Σn
xi .µC (xi )
x∗ = Σi=1 ;
i=1 µC (xi )
n

4 Here, xi is a sample element and n represents the number of


samples in fuzzy set C.

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 37 / 55


CoG : A geometrical method of calculation
Steps:
1 Divide the entire region into a number of small regular regions
(e.g. triangles, trapizoid etc.)

A4
A3
A2
A1 A5
A6

x1 x2 x3 x4 x5 x6
x

2 Let Ai and xi denotes the area and c.g. of the i-th portion.
3 Then x ∗ according to CoG is
Σn
x∗ = i=1 xi .(Ai )
Σ n
i=1 Ai
where n is the number of smaller geometrical components.
Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 38 / 55
CoG: An example of integral method of calculation

c2
1.0 1.0
c1
0.7 0.7
c
 c 0.5
1
2

0.5

0 1 2 3 4 5 0 1 2 3 4 5 6
x x
C = C1  C 2
d e
1.0
b c
0.7
c
0.5
A1 A2 A3 A4 A5

f
a
0 1 2 2.7 3 4 5 6

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 39 / 55


CoG: An example of integral method of calculation

0.35x 0≤x <2


0.7 2 ≤ x < 2.7
µc (x) = x −2 2.7 ≤ x < 3
1 3≤x <4
(−0.5x + 3) 4≤x ≤6

For A1 : y − 0 = 0.7 (x
2
− 0), or y = 0.35x

For A2 : y = 0.7
For A3 : y − 0 = 1− 0 (x
3− 2
− 2), or y = x − 2
For, A4 : y = 1
For, A5 : y − 1 = 0− 1 (x
6− 4
− 4), or y = −0.5x + 3

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 40 / 55


CoG: An example of integral method of calculation

,
x.µ (x)dx
Thus, x ∗ = , c = N
µc (x)dx D

∫ ∫ ∫3 ∫
N = 02 0.35x 2dx + 22.7 0.7x 2dx + 2.7 (x 2 − 2x)dx + 34 xdx +
∫6
4
(−0.5x 2 + 3x)dx

= 10.98
∫2 ∫ 2.7 ∫3 ∫4 ∫6
D= 0
0.35xdx + 2
0.7xdx + 2.7
(x −2)dx + 3
dx + 4
(−0.5x +3)dx

= 3.445

Thus, x ∗ = 10.98
3.445
= 3.187

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 41 / 55


Centroid method : CoS
If the output fuzzy set C = C1 ∪C2 ∪....Cn , then the crisp value
according to CoS is defined as

Σn
x∗ = i=1 xi .Aci
Σn
i=1 Aci

Here, Aci denotes the area of the region bounded by the fuzzy set Ci
and xi is the geometric center of the area Aci .

Graphically,

c2
c3
c1
A2 A3
A1
5

x1 x2 x3

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 42 / 55


Centroid method : CoS

Note:

1 In CoG method, the overlapping area is counted once, whereas, in


CoS , the overlapping is counted twice or so.

2 In CoS, we use the center of area and hence, its name instead of
center of gravity as in CoG.

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 43 / 55


CoS: Example

Consider the three output fuzzy sets as shown in the following plots:

c 1 1.0
c 2
0.5 0.5
 c3 0.5
0.3
0.25 0.25 0.25

0 1 2 3 4 5 6 0 1 2 3 4 5 6 7 8 0 1 2 3 4 5 6 7 8
x x x

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 44 / 55


CoS: Example

c 1.0
c
1

0.5
2

0.5
c 3 0.5
0.3
0.25 0.25 0.25

0 1 2 3 4 5 6 0 1 2 3 4 5 6 7 8 0 1 2 3 4 5 6 7 8
x x x

In this case, we have


Ac1 = 1
2
× 0.3 × (3 + 5),x1 = 2.5
Ac2 = 1
2
× 0.5 × (4 + 2),x2 = 5
Ac3 = 1
2
× 1 × (3 + 1),x3 = 6.5
1
×0.3×(3+5)×2.5+ 12× 0 .5×(4+2)×5+ 12×1×(3 +1)×6.5
Thus, x ∗ = 2
1 = 5.00
2
×0.3×(3+5+ 12×0.5 ×(4+2)+ 12× 1 × (3+1)

Note:
The crisp value of C = C1 ∪C2 ∪C3 using CoG method can be found
to be calculated as x ∗ = 4.9
Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 45 / 55
Centroid method: Certer of largest area
If the fuzzy set has two subregions, then the center of gravity of the
subregion with the largest area can be used to calculate the
defuzzified value.
, ′
µ (x).x dx
Mathematically, x ∗ = , cm ;
µcm (x)dx

Here, Cm is the region with largest area, x is the center of gravity of
C m.
Graphically,

C1 C3
C2

Cm = C3 x'

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 46 / 55


Weighted Average
Method
Cenroid methods
Following defuzzification methods are known to calculate crisp output.
Maxima Methods
1 Height method
2 First of maxima (FoM)
3 Last of maxima (LoM)
4 Mean of maxima(MoM)

Centroid methods
1 Center of gravity method (CoG)
2 Center of sum method (CoS)
3 Center of area method (CoA)

Weighted average method

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 48 / 55


Weighted average method

1 This method is also alternatively called ”Sugeno defuzzification”


method.
2 The method can be used only for symmetrical output membership
functions.
3 The crisp value accroding to this method is
Σn
i=1 µC i (xi ).(xi )
x =

Σ
i=1 µC i (xi )
n

where, C1, C2, ...Cn are the output fuzzy sets and (xi ) is the value
where middle of the fuzzy set Ci is observed.

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 49 / 55


Weighted average method

Graphically,

k1 C3
k2 C1
C2
k3

x1 x2 x3

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 50 / 55


Exercise 1

Find the crisp value of the following using all defuzzified methods.

C2
1.0

C1
0.5

1 2 3 4 5 6

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 51 / 55


Exercise 1

Find the crisp value of the following using all defuzzified methods.

C2
1.0

C3
0.75

C1
0.5

1 2 3 4 5 6 7 8 9 10

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 52 / 55


Exercise 3

The membership function defining a student as Average, Good,


and Excellent denoted by respective membership functions are as
shown below.

Avg Good Excellent

1.0

0.5

6.0 6.5 7 7.5 8.0 8.5 9.0 10.0

Find the crisp value of ”Good Student”

Hint: Use CoG method to the portion ”Good” to calculate it.

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 53 / 55


Exercise 4

narrow wide
1.0

0.5

0.4

5 6 7 8 9 10

The width of a road as narrow and wide is defined by two fuzzy


sets, whose membership functions are plotted as shown above.

If a road with its degree of membership value is 0.4 then what will
be its width (in crisp) measure.

Hint: Use CoG method for the shadded region.

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 54 / 55


Exercise 5
The faulty measure of a circuit is defined fuzzily by three fuzzy
sets namely Faulty(F), Fault tolerant (FT) and Robust(R) defined
by three membership functions with number of faults occur as
universe of discourses and is shown below.
 (x)  (x)  (x)

1.0 1.0
1.0 1.0

0.75 0.75 0.75

0.5 0.5
0.5 0.5
0.3

0.25 0.25 0.25

0 1 2 3 4 5 6 7 8 9 10 x 0 1 2 3 4 5 6 7 8 9 10 x 0 1 2 3 4 5 6 7 8 9 10
x

Robust Fault tolerant Faulty

Reliability is measured as R∗ = F ∪FT ∪R.


With a certain observation in testing
(x,0.3) ∈ R,(x,0.5) ∈ FT ,(x,0.8) ∈ F .
Calculate the reliability measure in crisp value.
Calculate with 1) CoS 2) CoG .
Debasis Samanta (IIT Kharagpur) Soft Computing Applications 17.01.2016 55 / 55
Questions??
Thank you
A7710-Soft Computing

A7710-Soft Computing
Applications of Fuzzy Logic

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 23.01.2016 2 / 34


Fuzzy Systems : Fuzzy Logic Controller

Concept of fuzzy theory can be applied in many applications, such


as fuzzy reasoning, fuzzy clustering, fuzzy programming etc.

Out of all these applications, fuzzy reasoning, also called ”fuzzy


logic controller (FLC)” is an important application.

Fuzzy logic controllers are special expert systems. In general, a


FLC employs a knowledge base expressed in terms of a fuzzy
inference rules and a fuzzy inference engine to solve a problem.

We use FLC where an exact mathematical formulation of the


problem is not possible or very difficult.

These difficulties are due to non-linearities, time-varying nature of


the process, large unpredictable environment disturbances etc.

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 23.01.2016 3 / 34


Fuzzy Systems : Fuzzy Logic Controller
A general scheme of a fuzzy controller is shown in the following figure.

Fuzzy Controller
Defuzzification actions
module Input

Fuzzy rule Fuzzy inference Process to be


base engine controlled

Output
Fuzzification
module Conditions

Figure 1 Soft Computing Applications 23.01.2016 4 / 34


Fuzzy Systems : Fuzzy Logic Controller

A general fuzzy controller consists of four modules:


1 a fuzzy rule base,

2 a fuzzy inference engine,

3 a fuzzification module, and

4 a defuzzification module.

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 23.01.2016 5 / 34


Fuzzy Systems : Fuzzy Logic Controller
As shown in Figure 1, a fuzzy controller operates by repeating a cycle
of the following four steps :
1 Measurements (inputs) are taken of all variables that represent
relevant condition of controller process.
2 These measurements are converted into appropriate fuzzy sets to
express measurements uncertainties. This step is called
fuzzification.
3 The fuzzified measurements are then used by the inference
engine to evaluate the control rules stroed in the fuzzy rule base.
The result of this evaluation is a fuzzy set (or several fuzzy sets)
defined on the universe of possible actions.
4 This output fuzzy set is then converted into a single (crisp) value
(or a vector of values). This is the final step called defuzzification.
The defuzzified values represent actions to be taken by the fuzzy
contoller.
Debasis Samanta (IIT Kharagpur) Soft Computing Applications 23.01.2016 6 / 34
Fuzzy Systems : Fuzzy Logic Controller

There are two approaches of FLC known.

1 Mamdani approach

2 Takagi and sugeno’s approach

Mamdani approach follows linguistic fuzzy modeling and


chacterized by its high interpretability and low accuracy.
On the other hand, Takagi and Sugeno’s approach follows precise
fuzzy modeling and obtains high accuracy but at the cost of low
interpretabily.
We illustrate the above two approaches with two examples.

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 23.01.2016 7 / 34


Mamdani approach : Mobile Robot

Consider the control of navigation of a mobile robot in the


pressure of a number of moving objects.

To make the problem simple, consider only four moving objects,


each of equal size and moving with the same speed.

A typical scenario is shown in Figure 2.

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 23.01.2016 8 / 34


Mamdani approach : Mobile Robot

O2

O3

D

O1 O4

R S

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 23.01.2016 9 / 34


Mamdani approach : Mobile Robot

We consider two parameters : D, the distance from the robot to an


object and θthe angle of motion of an object with respect to the
robot.
The value of these parameters with respect to the most critical
object will decide an output called deviation (δ).

We assume the range of values of D is [0.1, .... 2.2] in meter and θ


is [-90, ... , 0, ... 90] in degree.

After identifying the relevant input and output variables of the


controller and their range of values, the Mamdani approach is to
select some meaningful states called ”linguistic states” for each
variable and express them by appropriate fuzzy sets.

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 23.01.2016 10 / 34


Linguistic States
For the current example, we consider the following linguistic states for
the three parameters.
Distance is represented using four linguistic states:
1 VN : Very Near
2 NR : Near
3 VF : Very Far
4 FR : Far
Angle (for both angular direction (θ) and deviation (δ)) are represented
using five linguistic states:
1 LT : Left
2 AL : Ahead Left
3 AA: Ahead
4 AR : Ahead Right
5 RT : Right
Debasis Samanta (IIT Kharagpur) Soft Computing Applications 23.01.2016 11 / 34
Linguistic States
Three different fuzzy sets for the three different parameters are given
below (Figure 3).

D 1.0
VN NR FR VF 1.0

0.0
1.04
0.1 0.8 1.5 2.2

Distance D in mt

 LT AL AA AR RT

LT AL AA AR RT
1.0 1.0

0.0 0.0
-90 -45 0 45 90 -90 -45 0 45 90

Angle ɵ in degree Deviation  in degree

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 23.01.2016 12 / 34


Fuzzy rule base

Once the fuzzy sets of all parameters are worked out, our next step in
FLC design is to decide fuzzy rule base of the FLC.
The rule base for the FLC of mobile robot is shown in the form of a
table below.

LT AL AA AR RT
VN AA AR AL AL AA
NR AA AA RT AA AA
FR AA AA AR AA AA
VF AA AA AA AA AA

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 23.01.2016 13 / 34


Fuzzy rule base for the mobile robot

Note that this rule base defines 20 rules for all possible instances.
These rules are simple rules and take in the following forms.

Rule 1: If (distance is VN ) and (angle is LT) Then (deviation is AA)


..
..
Rule 13: If (distance is FR ) and (angle is AA) Then (deviation is
AR)
..
..
Rule 20: Rule 1: If (distance is VF ) and (angle is RT) Then
(deviation is AA)

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 23.01.2016 14 / 34


Fuzzification of inputs

The next step is the fuzzification of inputs. Let us consider, at any


instante, the object O3 is critical to the Mobile Robot and distance
D = 1.04 m and angle θ= 30o (see Figure 2).

For this input, we are to decide the deviation δof the robot as
output.

From the given fuzzy sets and input parameters’ values, we say
that the distance D = 1.04m may be called as either NR (near) or
FR (far).

Similarly, the input angle θ= 30o can be declared as either AA


(ahead) or AR(ahead right).

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 23.01.2016 15 / 34


Fuzzification of inputs
Hence, we are to determine the membership values corresponding to
these values, which is as follows.
x = 1.04m
µ NR (x) = 0.6571
µ FR (x) = 0.3429
y = 30o
µ AA (y) = 0.3333
µ AR (y) = 0.6667

NR FR AA AR

1.0 1.0

0.0 0.0
0.1 0.8 1.5 2.2 0 45
-45 y
x
1.04 30

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 23.01.2016 16 / 34


Fuzzification of inputs
Hint : Use the principle of similarity. x = δ1
y δ2

NR FR AA AR

1.0 1.0

0.0 0.0
0.1 0.8 1.5 2.2 45
-45 0
y
x
1.04 30

Thus, x
1
= 1.5− 1.04 ,
1.5−0.8
that is, x = 0.6571

y
x
1
2

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 23.01.2016 17 / 34


Rule strength computation

There are many rules in the rule base and all rules may not be
applicable.
For the given x = 1.04 and θ= 30o , only following four rules out of 20
rules are firable.

R1: If (distance is NR) and (angle is AA) Then (deviation is RT)

R2: If (distance is NR) and (angle is AR) Then (deviation is AA)


R3: If (distance is FR) and (angle is AA) Then (deviation is AR)

R4: If (distance is FR) and (angle is AR) Then (deviation is AA)

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 23.01.2016 18 / 34


Rule strength computation

The strength (also called α values) of the firable rules are calculated as
follows.
α(R1) = min(µNR (x ), µ AA(y )) = min(0.6571, 0.3333) = 0.3333
α(R2) = min(µNR (x ), µAR (y )) = min(0.6571, 0.6667) = 0.6571

α(R3) = min(µFR (x ), µ AA(y )) = min(0.3429, 0.3333) = 0.3333

α(R4) = min(µFR (x ), µAR (y )) = min(0.3429, 0.6667) = 0.3429

In practice, all rules which are above certain threshold value of rule
strngth are selected for the output computation.

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 23.01.2016 19 / 34


Fuzzy output

The next step is to determine the fuzzified outputs corresponding to


each fired rules.
The working principle of doing this is first discussed and then we
illustrate with the running example.
Suppose, only two fuzzy rules, R1 and R2, for which we are to decide
fuzzy output.
R1: IF (s1 is A1) AND (s2 is B1) THEN (f is C1)

R2: IF (s1 is A2) AND (s2 is B2) THEN (f is C2)

Suppose, s1∗and s2∗are the inputs for fuzzy variables s1 and s2. µA1,
µA2, µ B1, µ B2, µ C1 and µ C2 are the membership values for different
fuzzy sets.

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 23.01.2016 20 / 34


Fuzzy output

The fuzzy output computation is graphically shows in the following


figure.

A1 B1 1C

A2 B2 C 2 C
Combine output

s1* s2*

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 23.01.2016 21 / 34


Fuzzy output

Note:

We take min of membership function values for each rule.

Output membership function is obtained by aggregating the


membership function of result of each rule.

Fuzzy output is nothing but fuzzy OR of all output of rules.

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 23.01.2016 22 / 34


Illustration : Mobile Robot
For four rules, we find the following results.
NR AA RT

1.0

R1 :

0.3333
0.0
0.8 1.5 0 45 45 90
NR AR
1.0 AA

R2 :

0.6571
0.0
0.8 1.5 0 45 -45 0 45

AA AR
1.0

R3 :

0.3333
0.0
0 45 90
0.8 1.5 0 45

1.0 AR AA

R4 :

0.3333
0.0
-45 0 45
0.8 1.5 0 45

D=1.04 Ɵ= 30

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 23.01.2016 23 / 34


Illustration : Mobile Robot

AA AR RT

0.6571 0.34 0.3333

-45 0 45 90

Aggregation of all results

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 23.01.2016 24 / 34


Defuzzification

The fuzzy output needs to be defuzzified and its crisp value has to be
determined for the output to take decision.

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 23.01.2016 25 / 34


Illustration : Mobile Robot
From the combined fuzzified output for all four fired rules, we get the
crisp value using Center of Sum method as follows.

v= 12.5×71+25×45+25.56×0+25.56×0 = 19.59
12.5+39.79+25+25.56

39.7/0
AA AR RT
1.0

0.5 A3

.6571 0.34 A2
A4 0.3333
A1

-45 0 45 90

25/45 12.5 / 71
25.56 / 0

Conclusion : Therefore, the robot should deviate by 19.58089 degree


towards the right with respect to the line joining to the move of direction
to avoid collision with the obstacle O3.

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 23.01.2016 26 / 34


Takagi and Sugeno’s approach
In this approach, a rule is composed of fuzzy antecedent and
functional consequent parts.
Thus, any i-th rule, in this approach is represented by
If (x1 is Ai1) and (x2 is Ai2) ...... and (xn is Ain)
Then, y i = ai0 + ai1x1 + ai2x2 + ... + ainxn
where, a0, a1, a2, ... an are the co-efficients.
The weight of i-th rule can be determined for a set of inputs x1, x2,
.... xn as follows.
w i = µ iA (x1 ) × µ iA (x2 ) × ..... × µ iA (xn )
1 2 n

where A1, A2, .... , An indicates membership function distributions


of the linguistic hedges used to represent the input variables and
µ denotes membership function value.
The combined
Σ action then can be obtained as
y = Σ ik w iy i ; where k denotes the total number of rules.
k
i wi
Debasis Samanta (IIT Kharagpur) Soft Computing Applications 23.01.2016 27 / 34
Illustration:

Consider two inputs I1 and I2. These two inputs have the following
linguistic states :

I1 : L(low), M(Medium), H(High)

I2 : NR(Near), FR (Far), VF(Very Far)

Note:

The rule base of such as system is decided by a maximum of


3 × 3 = 9 feasible rules.

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 23.01.2016 28 / 34


Illustration:

The output of any i-th rule can be expressed by the following.


y i = f (I 1, I 2) = ai I1 + bi I2 ; where, j,k = 1,2,3.
j k

Suppose : ai = 1, ai = 2, ai = 3 if I1 = L, M and H, respectively.


1 2 3

bi = 1, bi = 2, bi = 3 if I2 = NR, FR, and VF , respectively.


1 2 3

We have to calculate the output of FLC for I1 = 6.0 and I2 = 2.2

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 23.01.2016 29 / 34


Illustration:

Given the distribution functions for I1 and I2 as below.

I1 I 2
L M H NR FR VF
1.0 1.0

0.0 5.0 10.0 15.0 0.0 1.0 2.0 3.0


I1 I2

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 23.01.2016 30 / 34


Solution

a) The input I1 = 6.0 can be called either L or M. Similarly, the input


I2 = 2.2 can be declared either FR or VF.

b) Using the principal of similarity of triangle, we have the following.


µ L(I1) = 0.8
µ M (I1) = 0.2
µ FR (I2) = 0.8
µ VF (I2) = 0.2

c)For the input set, following four rules can be fired out of all 9 rules.
R1: I1 is L and I2 is FR
R2: I1 is L and I2 is VF
R3: I1 is M and I2 is FR
R4: I1 is M and I2 is VF

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 23.01.2016 31 / 34


Solution

d)Now, the weights for each of the above rules can be determined as
follows.
R1: w 1 = µ L × µ FR = 0.8 × 0.8 = 0.6
R2: w 2 = µ L × µ VF = 0.8 × 0.2 = 0.16
R3: w 3 = µ M × µ FR = 0.2 × 0.8 = 0.16
R4: w 4 = µ M × µ VF = 0.2 × 0.2 = 0.6
e)The functional consequent values for each rules can be calculated
as below.
y 1 = I1 + 2I2 = 6.0 + 2 × 2.2 = 10.4
y 2 = I1 + 3I2 = 6.0 + 3 × 2.2 = 12.6
y 3 = 2I1 + 2I2 = 2 × 6.0 + 2 × 2.2 = 16.4
y 4 = 2I1 + 3I2 = 2 × 6.0 + 3 × 2.2 = 18.6

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 23.01.2016 32 / 34


Solution

f) Therefore, the output y of the controller can be determined as


follows.
y = w y +w = 12.04
1 1 2 y 2 +w 3 y 3 +w 4 y 4
1 w +w +w +w
2 3 4

Debasis Samanta (IIT Kharagpur) Soft Computing Applications 23.01.2016 33 / 34


Questions??
Thank you

You might also like