You are on page 1of 66

RHN Fuzzy Logic

1
Fuzzy Logic


1. Introduction

These days one hears the name of fuzzy logic associated with many consumer goods.
You can find fuzzy logic in shower heads, cameras, washing machines, rice cookers,
vacuum cleaners, and just about everywhere. There even exists a toilet paper with
"Fuzzy Logic" printed on it! What is this logic? Is it different from mathematical logic?

Before we define what fuzzy logic is, we shall consider a few examples.

Suresh is a barber in a village. He shaves all those and only those who do not shave
themselves. Who shaves Suresh then? If he shaves himself, then he cannot do so. If he
does not shave himself, then he has to shave himself.

How about this simple statement,

I am a liar?

Am I? Do I belong to the set of liars? If I do, I am lying. Therefore, I am not a liar. If I do
not, then I am a liar and therefore the statement that I am a liar cannot be true.

Take a glass of milk. Add a spoonful of water. Is it still milk? Add one more spoonful.
How about now? Is it still milk? Go on adding water to the milk till the mixture is looks
like water. At what stage did the milk change to water?

At what age does one become old? Does oldness start at 50? At 40?

Day or night. When does the day change to night?

Guilty or not guilty. Can a person be guilty and not guilty at the same time?

The classical logic fails in every example above. There is an inadequacy in classical logic.

Philosophers and thinkers have been puzzled by the inadequacy of the classical logic in
dealing with situations as mentioned above. In the early 20th century, great philosopher
mathematician Bertrand Russell and others pondered over this dilemma and tried to
find an alternate explanation. In 1920, Polish logician Jan Lukasiewicz suggested an
alternate logic, which he called multivalued logic. He suggested that a statement can
have fractional truth values. Max Black, in 1937, defined what he called as vague sets, in
which elements can have partial membership. Unfortunately not many took him
seriously and any interest that the idea generated died down soon. Had Black succeeded
RHN Fuzzy Logic
2
in enthusing people to accept his sets then perhaps we would have been learning about
the vague sets rather than fuzzy sets.


Jan Lukasiewicz Lotfi Zadeh
(1878-1956) (1921-)

It was in 1965, Lotfi Zadeh, Chairman of the department of Electrical Engineering in the
University of California at Berkley published a paper in which he reintroduced the
concept of multivalued sets, but with a new and a catchy name Fuzzy Sets. Perhaps the
name did the trick. Even though the initial response was somewhat lukewarm, some
even termed it ridiculous, it generated interest among some. Zadeh himself was
convinced that his fuzzy sets would one day be reckoned to be a serious subject. But,
no one, not even Zadeh himself, would have dreamt that that it would soon take over
the consumer industry by storm. It has now found applications in almost every facet of
human activity.

The first practical application of fuzzy logic had to wait till 1974. Prof. Ibrahim Mamdani,
British researcher of Indian origin was working on a problem of controlling the speed of
a steam engine. Often engine speed would become very high and reach the
required value after a series of vibrations, or it would be too slow, taking a long time to


RHN Fuzzy Logic
3

reach the required speed. Prof. Mamdani had a brainstorm. He had heard of the new
logic proposed by Zadeh. He wondered if the solution to his problem could be found in
fuzzy logic. This was a bold move. He used a control device that used fuzzy logic rather
than conventional logic. It worked. The controller worked much better than they
expected. The steam engine speed reached the desired speed without any overshoot
and remained stable.

This opened the floodgates of the new applications.
When the westerners were skeptical, the Japanese and
Chinese were particularly interested in encashing the
potential of fuzzy logic. No wonder then today they are
in the forefront in this field which has turned out to be
a multibillion dollar industry. It is only recently that the
scientists in the west realized their folly and are trying
to catch up. The reason why people from East and Far
East had no difficulty in accepting the new logic is
perhaps their cultural upbringing. The Hindu and
Budhist philosophies accept the realities in between yes and no and in between the
true and false. They believe that a statement can be true to some extent and false to
some extent. Budhist symbol of yin-yang represents this belief.


There is a beautiful story connected with fuzzy logic in our puranas. The story goes like
this. There was this demon king by name Hiranyakashipu, who had developed a hatred
towards the Supreme Lord Vishnu. He wished gain mystical powers and to rule the
entire universe. To achieve his goal, he performed lengthy and an extremely tough tapas
to please the creator god, Brahma. Lord Brahma pleased with the kings tapas, offered
him a boon that he will personally make true anything he wishes for. The demon king
made a strange wish. And it was blindly granted by the Lord. As per this boon
Hiranyakashipu could not meet death from any of the living entities created, within any
residence or outside any residence, during the daytime or at night, on the ground or in the sky,
by any weapon, or by any human being or animal. Intoxicated by this security cover, he
turned out to be a huge menace to all. He started harassing everyone. Desperate

RHN Fuzzy Logic
4
demigods not being able to bear it anymore finally decided to appeal to the supreme
god, Lord Vishnu, who assured them that he will devise a plan to end this nuisance.
What he did was really interesting. He used fuzzy logic to kill Hiranyakashipu without
upsetting the boon, he appeared in the form of Narasimha, half-man and half-lion
(neither human, devine nor animal) at twilight ( neither day nor night), sat on the
threshold of a courtyard (neither indoors nor out) and put the demon on his thighs
(neither earth nor space) and killed him by disembowelling with his sharp nails not a
weapon. Poor king! Had he any knowledge of fuzzy logic he could have saved himself!

Japan sells fuzzy logic controlled cameras, washing machines and more. There are
already a number of successful fuzzy logic based commercial products, like traffic
controllers which regulate traffic according to its density , self-focussing cameras,
washing machines that fix the period of wash and the amount of water and soap to be
used depending on how dirty the clothes are, subway control systems.

Here, we should realize that the fuzzy logic is useful in situations where the behaviour of
the systems are imprecise and vague and in situations where an accurate and precise
solution is not required. There is a clear distinction between this and situations where
the data is not certain. Uncertainty and vagueness are not the same.


Crisp Sets and Fuzzy sets

A set is a collection of well-defined objects.

- A collection of positive integers less than 10
- A collection of students of Sir MVIT
- A collection of barbers

All the above are sets as the elements are well defined in each of them.

The first set is {1, 2, 3, 4, 5, 6, 7, 8, 9}. Let us call this set A.

2 e A, but 2.5 e A.

If X is the universal set of all real numbers then A is a subset of X. we write

A c X

We define a mapping _
A
(x) from the set A to a set B = {0, 1} where

_
A
(x) =

e
e
A x if
A x if
0
1

RHN Fuzzy Logic
5

Here, _
A
(x) is called the truth value or the membership value of x in A.

Consider a set A of all sports persons at Sir MVIT. Ram is a student of Sir MVIT. If Ram is
a sports person, then the membership value of Ram being in the set is 1; if not, it is 0.
Whether Ram belongs to the set or not is clearly defined. There is no ambiguity about it.
There is a sharp distinction between the members and non-members.

What about the collection of tall people? Is it a set? Is a tall person well-defined? Is a
person whose height is 1.8m tall? If so, what about Ram who is 1.79m tall? Is he tall?
The demarcation is not clear. We can say that Ram is tall to a certain degree. John who
is 1.75m tall is also tall but to a degree less than that of Ram. We shall assign numbers
between 0 and1 to Ram, John and others to specify to what degree they are tall. The
degree of tallness of Ram is, say, 0.9 and that of John is 0.7 and that of Salim who is
only 1.5m tall is

What about the collection of old people? Is a man who is above 60 years of age an old
man? If so, what about a man who is 59 years and 364 days old.

There is a law in almost all countries that anyone below 18 years of age is not allowed to
consume alcoholic drinks. What about the person who is 17 years 364.5 days old? Will
such a person be prosecuted if he takes a sip of beer?

We do understand the meaning of words like tall, old and young. However, there is no
clear-cut boundary to define a tall person, an old man or a young man. Therefore, the
collections of tall or old men are not sets in the conventional sense.

In fact in our everyday conversation, we are by nature imprecise and vague.
Nevertheless, we understand each other remarkably well. If I say that the girl across the
street is beautiful everyone understand what I mean. Words like tall, old, hot are vague
and subjective.


RHN Fuzzy Logic
6

We shall formally define a fuzzy set A as follows: A fuzzy set A in a universe X is a set of
ordered pairs {x,
A
(x)|x e X}, where
A
(x) is a function of x that maps x to the interval
[0, 1].
A
(x) is called the membership function and the value of membership function
for any particular x is called its membership value. An element belonging to the set can
be partially present in partially outside the set. When
A
(x) maps x to the endpoints 0
and 1 only then the set is a crisp set.

The puzzling situations mentioned earlier could be explained by this new concept. The
statement that I am a liar has a truth value of . It is both true and false at the same
time. A man just short of 175 cm is still tall but to a lesser degree. A 59 year old man is
old, but to a slightly less degree.
A fuzzy set A in a discrete and finite universe X is usually represented as

A=
)
`

+ +
1
1
2
2
1
1
) ( ) ( ) (
x
x
x
x
x
x
A A A

=
)
`

i i
i A
x
x ) (


or, alternately as

A = { } ) ( , ( ...., ), ( , ( ), ( , (
2 2 1 1 n A n A A
x x x x x x

A continuous fuzzy set A is represented as
}
x
x
A
) (
.

Now, consider the fuzzy set A of old people. If we agree that anyone older than 60
years as old, then the membership value of a person above 60 years is 1, while that of
a person below 60 years is less than 1. We can define the membership function of A as
follows:
RHN Fuzzy Logic
7

Fuzzy set representing old

>
< <
s
=
60 1
60 30 30 ) 30 (
30 0
) (
x if
x if x
x if
x
A

The graph of x against membership value of A is given above.

The membership value of a 50 year old man is 0.67 as seen in the figure.

The room temperature of 15
o
C (we shall call it cool) can be represented as a fuzzy set
whose members belong to the interval [10
o
, 20
o
] with their membership values as
shown in the figure below.


Fuzzy set representing cool


It is to be noted that a fuzzy set need not be triangular. It can be trapezium like, bell-
shaped, parabolic and so on.

10
o
15
o
20
o
x
A(x)


1

A
(x)

1
Age x 0 30 50 60
0.67
RHN Fuzzy Logic
8

Bell-shaped fuzzy set
For example,

old
(x) =
1
10
30
1 1

(

|
.
|

\
|
+
x
for 30 x 100

or,

old
(x) = 1 - exp
2
30
30
(

|
.
|

\
|

x


or any other convenient definition.



Trapezium- shaped fuzzy set
10
o
15
o
20
o
x
A(x)


1
10
o
15
o
20
o
x


A(x)


1
RHN Fuzzy Logic
9



Difference between a crisp set and a fuzzy set


Crisp set

Fuzzy set
Members are clearly defined Members are not clearly defined
Membership value of each element is 1 Membership values each element is any
number between 0 and 1
Boundary of the set is well-defined Boundary of the fuzzy set is not well-
defined.
Transition from one state to another is
abrupt
Transition from one set to another is
gradual
Excluded middles are valid.
A A X; A A u
Excluded middles are not valid.
A A = X; A A = u




If we call a room temperature of less than about 10
o
as very cool, that of about 20
o

as warm, that of about 25
o
hot and that of more than 30
o
as very hot, then the
fuzzy representation of these different fuzzy sets may be as follows:

A
(x)
1
10
o

Very Cool
15
o

Cool
20
o

Warm
25
o

Hot
30
o

Very Hot
RHN Fuzzy Logic
10
Membership Function

How are membership values assigned to the elements of a fuzzy set? A few methods
which are in vogue are

- Intuition
- Inference
- Rank ordering
- Neural networks
- Genetic algorithm
- Inductive reasoning
- Fuzzy statistics

In the first method, we use our intuition to assign membership values. For example the
number 3 can be represented as a fuzzy set. 3
)
`

+ + + +
4
0
5 . 3
5 .
3
1
5 . 2
5 .
2
0
.

Example.

1. Develop a reasonable membership function for the fuzzy set of old people.

>
s s

=
otherwise
x f or
x
x
x
ld
, 0
60 , 1
60 40 ,
20
60
) (
0







1
40 60 x
Membership function of old people
RHN Fuzzy Logic
11
2. Develop a reasonable membership function for a square, based on the geometric
properties of a rectangle.

We take L as the length of the longer side and l as that of the smaller side.




If l/L = 1 the rectangle is a square. We shall use exponential expression for the
membership function.

S
(x) =
2
) 1 ( 10
L
l
e



The fuzzy set of squares will be S =
)
`

+ + + +
1
1
8 . 0
67 . 0
6 . 0
2 . 0
4 . 0
02 . 0
2 . 0
0


3. Develop a membership function for each of the shapes, a rod, a cylinder and a disk
using the ratio of their heights to their diameter.

4. Develop a reasonable membership function for a circle. (Take the ratio of major and
minor axes of ellipses)

In the second method, we use deductive reasoning with the accumulated knowledge we
have. For example, we use the knowledge we have in geometry to assign membership
values to given triangles in the set of equilateral triangles, isosceles triangles, right
triangles etc.

Let A, B and C be the angles of a triangle x with A > B > C.

Let us define the membership values for triangles as follows

isoscles
(x) = 1 - ) , min(
60
1
C B B A
o



1

0 1 l/L
RHN Fuzzy Logic
12

right
(x) = 1 -
o
o
A 90
90
1

equilateral
(x) = 1 - ) (
180
1
C A
o


Example:

Find the membership values for the triangle, 80
o
, 75
o
, 25
o
for the trianglular shapes,
isosceles, right, isosceles right, equilateral and others.

A = 80
o
, B = 75
o
, C = 25
o

isoscles
(x) = 1 - ) 50 , 5 min(
60
1
o o
o
= 0.92

right
(x) = 1 -
o o
o
90 80
90
1
= 0.89

right & isosceles


(x) =
isoscles
(x)
right
(x) = 0.89

equilateral
(x) = 1 - 55
180
1

o
= 0.69

othersl
(x) = 1 -
isoscles
(x)
right
(x)
equilateral
(x) = 1 0.92 = 0.18

Rank Ordering

In this method, pairwise comparison of elements is used to estimate their membership
values. It could be by an opinion poll, survey or evaluation by experts. Let us take up an
example of an opinion poll among 100 people in Bangalore on their preferences among
several brands of motor cars that are in market.

25 of these 100 preferred M800 (M) over Swift (Sw). 23 preferred Indica (I), 40
preferred Alto (A) and 33 preferred Santro over Swift. Compared to M, the preferences
were 75-Sw, 52-I, 55-A and 62-Sn. Compared to I the preferences were 77-Sw, 48-M,
65-A and 50-Sn. Compared to A, they were 60-Sw, 45-M, 35-I and 49-Sn. Finally, when
compared to an Santro, the preferences were 67-Sw, 38-M, 50-I and 51-Sn. Using rank
ordering, plot the membership function of the most preferred car.

Let us first tabulate the data as follows.
RHN Fuzzy Logic
13

3
2
4
5
1
194
211
160
156
279
49 50 62 33
51 65 55 40
50 35 52 23
38 45 48 25
67 60 77 75
Rank Total
Sn
A
I
M
Sw
Sn A I M Sw



Therefore, the most preferred car =
)
`

+ + + +
800
56 . 57 . 7 . 76 . 1
M Indica Santro Alto Swift


In the neural network method a set of membership values are assumed initially, a
learning system is developed to test these values and improve them. This method
works very similar to how our brains work in deductive reasoning. A human brain
contains millions of neurons. Each neuron is made up of a branch called axon and
several protrusions called dendrites. Dendrites of neighbouring neurons join to form
what are known as synapses. Messages in the form of electrical impulses are received
by a neuron through them and after processing are passed on to the other neurons
through them. This system is made use of in determining the membership values.

Genetic algorithm method works somewhat similar to the process evolution that takes
place in nature. In the natural evolution, as propounded by Darwin only those species
which are capable of adapting themselves to the environment would survive, others
perish. In this method, different sets of values are assumed and are tested to check
which perform better. The ones which pass the test undergo mutation and then go
through the test again. This process is repeated till a satisfactory set of values are
obtained. The merit of this method is that the initial set of values is not restricted to a
small range. The initial values take care of all possibilities and all the values which are
not acceptable are rejected by setting up an algorithm to evaluate each membership
value.

Some Definitions
If the membership value of each element of the universal set X in a fuzzy set A is less
than or equal to its membership value in fuzzy set B then A is called a subset of B.

A _ B if
A
(x) s
B
(x) for each x e X.

The crisp set containing all those elements of A whose membership values are equal to
1 is called the core of A
Core of A { } 1 ) ( = x x
A

RHN Fuzzy Logic
14

The crisp set containing all those elements of A whose membership values are not 0 to
1 is called the support of A

Support of A { } 0 ) ( = x x
A



The crisp set containing all those elements of A whose membership values are greater
than 0 and less than 1 is called the boundaries of A

Boundaries of A { } 1 ) ( 0 < < x x
A


The largest membership value of A is called the height of A

A fuzzy set in which at least one element has the maximum possible membership value
is called a normal fuzzy set.

A fuzzy set in which membership values strictly monotonically increase or strictly
monotonically decrease or monotonically increase and then strictly monotonically
decrease with the increasing values of the elements of A is called a convex fuzzy set.





1

core
support
boundary boundary
x
RHN Fuzzy Logic
15

A fuzzy number

A normal convex fuzzy set having only one element with membership value equal to 1
is called a fuzzy number.

EXAMPLE: Are the following fuzzy sets fuzzy numbers?

1.

e
e
e
=
] 3 , 2 ( , 3
] 2 , 1 ( , 1
] 1 , 0 ( ,
) (
x x
x
x x
x
A
2.

>

+
s
|
.
|

\
|
+
= 5 ,
3
) 5 ( 2
1
1
5 ,
2
5
1
1
) (
2
x
x
x
x
x
B


Answers: 1. No. A is not fuzzy number. For, A is trapezium-like as shown in the figure.




2. Yes. B is shown below.

A
(x)

1
x
x


1

RHN Fuzzy Logic
16

Cardinality of a fuzzy set A in the universe X is defined as the sum of the membership
values of all elements in the set.
A ) (x
A
=
Relative Cardinality of A =
X
A
A =

For example, If X = {1, 2, 3, , 8} and A =
)
`

+ + + + +
7
2 .
6
3 .
5
1
4
9 .
3
6 .
2
4 .
, then

A = .4 + .6 + .9 + 1 + .3 + .2 = 3.4 and A = 3.4 / 8 = 0.425.



- cut of a Fuzzy Set

The crisp set containing all the elements of a fuzzy set A whose membership values are
greater than or equal to is called a -cut of A.

A

={x /
A
(x) > }

The crisp set containing all the elements of a fuzzy set A whose membership values are
greater than is called a strong -cut of A.

A

+
={x /
A
(x) > }






A
(x)

1






1
5 x
RHN Fuzzy Logic
17
Example:

1. Find the -cuts and strong -cuts of the fuzzy set

A =
)
`

+ + + + +
7
9 .
6
5 .
5
1
4
1 .
3
9 .
2
5 .
for = .1, .5, .7 and .9

A
.1
= {2, 3, 4, 5, 6, 7}; A
.5
= {2, 3, 5, 6, 7}; A
.7
= {3, 5, 7}; A
.9
= {3, 5, 7}
A
.1
+
= {2, 3, 5, 6, 7}; A
.5
+
= {3, 5, 7}; A
.7
+
= {3, 5, 7}; A
.9
+
= {5}

2. Find the -cuts at = 0, 0.5, 1 of the fuzzy set given below:.

e
e
e
=
] 3 , 2 ( , 3
] 2 , 1 ( , 1
] 1 , 0 ( ,
) (
x x
x
x x
x
A


A
0
= [0, 3], A
0.5
= [0.5, 2.5] and A
1
= [1, 2]

3. Fuzzy sets A, B and C are defined on the universe X = [0, 5] where

A
(x) =
2
) 5 ( 5 1
1
+ x
,
B
(x) = 2
-x
and
C
(x) =
5
2
+ x
x
. For each of these fuzzy sets
(i) sketch the membership functions (ii) find the -cuts at = 0.2, 0.7, 1

Fuzzy Vectors

Sometimes it is convenient to represent membership function of a fuzzy set in the form
of a vector whose components are membership values.

If A =
)
`

+ + +
n
n
x
a
x
a
x
a
...
2
2
1
1
then a = {a
1
, a
2
, , a
n
} is the corresponding fuzzy vector. It is
obvious that 0 a
i
1 for all i.

A
(x)

1


0.5
x 0 1 2 3 x
RHN Fuzzy Logic
18
Consider two fuzzy vectors a and b. Their inner product a b
T
is defined as
max {a
1
. b
1
), (a
2
. b
2
), (a
n
. b
n
)}
and outer product a b
T
is defined as
min {a
1
v b
1
), (a
2
v b
2
), (a
n
vb
n
)}.

The complement of a fuzzy vector a is the vector {1 a
1
, 1 a
2
, 1 a
n
}.

The maximum value of a
i
is called the upper bound and the minimum is called the lower
bound of the vector. They are denoted by a and a.

It can be easily verified that

-
T T
b a b a - = -
- a b
T
s a . b and a b
T
> a v b
- a a
T
= a and a a
T
> a
- a a s a 5 . 0 a > 5 . 0

For example, If a = {.1, .5, .7, .2, .3} and b = {.3, .2, .5, .1, .8} then a b
T
= 0.5 and
a b
T
= 0.2, = 0.7 and a = 0.1, a b
T
= a v b


Uncertainty and Impreciseness

Uncertainty is the inverse of information. More the information is, less is the
uncertainty. Uncertainty can be fuzzy, vague and ambiguous. In the first case, the
information is not sharp, unclear, imprecise and approximate. In the second case, the
information is not specific. The uncertainty is ambiguous means the information could
be contradictory or has too many choices. The uncertainty may be due to lack of
knowledge. For example, I shall repay the loan is vague, while I shall repay the loan in
another few days is fuzzy and I shall repay the loan within a week involves probability.

Probability and Fuzziness

There is confusion even among scholars about the relevance of fuzzy sets when there is
already the concept of probability. Both take values between 0 and 1. One notable
difference is that the sum of the probabilities on a finite universal set must be 1,
whereas membership values need not add up to 1.

Let us consider two examples.

RHN Fuzzy Logic
19
When we talk about the probability of a person being old is 0.75, it means that he is
likely to be an old man to the extent of 75%. We do not have adequate knowledge to
say for sure if he is really an old person.

Lack of information.

On the other hand, to say that his membership value in the set of old people is 0.75, it
means that he is partially in the set to the extent of 75% and partially outside the set to
the extent of 25%.

Yes to some extent and no to some extent.

Also, probability may differ from one observer to another. It depends on the knowledge
each observer has of the person concerned. If one knows the persons age correctly,
then the probability that he is old is either 0 or 1. For probability, the set is crisp, but
the membership value of an element being in the set is uncertain. For fuzziness, the set
itself is vague.

Another example that demonstrates the difference between the two is given by
Bezdeck. A man is caught in a desert and has no water to drink. He is very thirsty. He
finds two bottles containing water-like liquid. On one of them is written that the liquid
inside is water but its probability being poisonous is 10%. On the other is written that
the membership value of the liquid inside being poisonous is 10%. Which bottle would
you recommend to him?

We illustrate another difference between probability and fuzziness. Consider the
statement: Radha is beautiful and Radha is smart. How do we interpret this statement
using probability and fuzzy set?

If B is the set of all beautiful people and S that of smart people and if, say,
P(RadhaeB) = 0.8 and P(Radha e S) = 0.8, , then

P(Radha e B S) = 0.8 x 0.8 = 0.64.

The probability that Radha is both beautiful and smart is 0.64.

Let us now use fuzzy sets.
B
(Radha) = 0.8 and
S
(Radha) = 0.8. It means that Radha is
beautiful to a degree of 0.8 and she is smart to a degree 0.8. Then
BS
(Radha) = 0.8,
which when translated to ordinary language reads as, Radha is beautiful and smart to a
degree 0.8.

It sounds more reasonable.

RHN Fuzzy Logic
20
Probability is an indicator of the frequency or likelihood that an element belongs to a
set. Fuzzy theory deals with the similarity of an element to the set.

Both are valid approaches. If we were to classify a person as old, fuzzy approach
makes more sense than that of probability. If we were to classify the outcome of an
event then probability makes more sense.


Algebra of Fuzzy Sets

Consider two fuzzy sets A and B in a universe X.

A U B is called the union of the two sets.

AUB(x) = Max(
A(x),
B(x))

A B is called the intersection of the two sets

AB(x) = Min(
A(x),
B(x))

A is called the complement of A.

A(x) = 1 -
A(x)

Let A be a fuzzy interval between 5 and 8 and B be a fuzzy number about 4. The
corresponding figures are shown below.


Fuzzy set between 5 and 8
RHN Fuzzy Logic
21

Fuzzy set about 4

Union of the two sets

Intersection of the two sets

Complement of the fuzzy set between 5 and 8



RHN Fuzzy Logic
22
Example

If A=
)
`

+ + + +
5
3 .
4
1
3
6 .
2
4 .
1
1 .
and B =
)
`

+ + + +
6
1 .
5
4 .
4
5 .
3
7 .
2
1
in a universe
{1, 2, 3, 4, 5, 6} then

AU B
)
`

+ + + + +
6
1 .
5
4 .
4
1
3
7 .
2
1
1
1 .

A B
)
`

+ + +
5
3 .
4
5 .
3
6 .
2
4 .


A
)
`

+ + + + +
6
1
5
7 .
4
0
3
4 .
2
6 .
1
9 .


To show that B A B A B A + =

) (x A
A
= and ) (x B
B
=

) ( ) ( x x B A
B A


+ = +


= ) (x B A
B A
= ) ( ) ( x x
b A
v



Similarly,

= ) (x B A
B A
= ) ( ) ( x x
b A
.



Hence,


. + v = + ) ( ) ( ) ( ) ( x x x x B A B A
B A B A
= ) ( ) ( x x
B A
+

Properties

If A, B and C are three fuzzy sets in a universe X then

1. A(BC) = (AB)C A(BC) = (AB)C (Associative laws)

2. A (BC) = (AB)(AC A(BC) = (AB)(AC
(Distributive laws)

3. AA = A AA = A (Idem potency laws)
RHN Fuzzy Logic
23

4. A|= A A|= |; AX = X; AX = X (Identity laws)

5. If A _ B and B_ C, then A _ C (Transitivity law)

6. A = A (Involution law)

7. The excluded middle laws do not hold good for fuzzy sets.

A A X and A A |

8. AB= A B

AB= A B (De Morgans laws)

Example:

Show that the excluded middle laws do not hold for fuzzy sets by taking an example.

A =
)
`

+ + + +
6
1 .
5
4 .
4
5 .
3
7 .
2
1
, X = {1, 2, 3, 4, 5, 6, 7}
A =
)
`

+ + + + + +
7
1
6
9 .
5
6 .
4
5 .
3
3 .
2
0
1
1


A A
)
`

+ + + + + +
7
1
6
9 .
5
6 .
4
5 .
3
7 .
2
1
1
1
X and
A A
)
`

+ + + +
6
1 .
5
4 .
4
5 .
3
3 ..
2
0
|

Defuzzification

In a fuzzy operation the output is in the form of a fuzzy set. It is necessary to convert
such fuzzy outputs into crisp numbers so that the fuzzy device would understand the
output and carry out the necessary action based on the output. Such a process is known
as defuzzification.

There are many methods of defuzzification. Popular among them are

- Max-membership method
- Mean-max membership method
RHN Fuzzy Logic
24
- Centroid method
- Weighted average method
- Centre of sums method
- Centre of largest area method
- First (or last) of max method

Let C be the union of all output fuzzy sets C
I
and z be a member of C. We shall denote
the defuzzified value of z by z*.

Max-membership method: in this method, z* is the value of z for which the
membership value is the maximum.
C
(z*)
C
(z) for all z in C. This method is useful
when
c
(z) is a peaked function.

Mean-max membership method: When C consists of more than one fuzzy set then the
mean of values of z whose membership values is the maximum in each fuzzy set.

Centroid method: The value of z corresponding to the centroid of the area of the graph
of
C
(z) is taken as z*.
z* =
}
}
dz z
dz z z
C
C
) (
) (




Weighted average method: z* =

) (
) (
z
z z
C
C

, where z has the maximum membership


value in each fuzzy set.

Centre of sums method: : z* =

}
dz z
dz z z
C
C
) (
) (



Centre of largest area method: z* =
}
}
dz z
dz z z
m
C
m C
) (
) (

, where C
m
is the convex subregion of
having the largest area. It is the same as the centroid method if C has only one convex
region.

First (or last) of max method: z* is the least (or the greatest) value of z that have
maximum membership values.


RHN Fuzzy Logic
25


Which of these methods are the best suited depends on the context. The choice
depends on

- Continuity: Any small change in input must not result in large change in output
.
- Disambiguity: z* must be a unique number. In the centre of largest area
method, if there are more than one equal largest area then z* is vague.

- Plausibility: z* must be reasonable. Centroid method sometimes may give z*
that does not look reasonable.

- Computational simplicity

Example: Two fuzzy sets A and B are given below. Find the defuzzified value z* for their
union.

0 1 2 3 4 z 2 3 4 5 6 z


1



.
5
0 1 2 3 4 5 6 z
z*


1


.5
A
B
A B
First of max last of max z
First (or last) of maxima method

RHN Fuzzy Logic
26
2. Relations

If X and Y are two universes then the set of pairs of numbers (x, y), x X, y Y is called
the Cartesian product of X and Y. it is denoted by X x Y. A subset R = A x B, where A X
and B Y is called a relation. Similarly, Cartesian product of more than two universes
can be defined. In general, if X
1
, X
2
, , X
n
are n universes then the set of n-tuples (x
1
, x
2
,
, x
n
) i. e., X
1
x X
2
x x X
n
is called Cartesian product of these n universes.

If A {1, 2, 3, 4} and B = {5, 6, 7} then A x B = {(1, 5), (1, 7), (2, 5), (2, 6), (3, 5), (3, 6), (4, 6),
(4, 7} } is a relation. The relation can be put in a matrix form.

5 6 7
R =
(
(
(
(

1 1 0
0 1 1
0 1 1
1 0 1
4
3
2
1



Fuzzy Relation

If A is a fuzzy set in X and B in Y then the fuzzy set R given by R = A x B X x Y with its
membership function given by

R = Y X y x
y x
y x
R
e
)
`

) , ( ,
) , (
) , (
and
R
(x, y) = min(
A
(x),
B
(y)) is called a fuzzy relation.

This is a binary relation. If there are three universes X, Y and Z and A c X, B c Y and C c
Z then A x B x C is defined as
R = Z Y X z y x
z y x
z y x
R
e
)
`

) , , ( ,
) , , (
) , , (

Fuzzy relations have properties similar to fuzzy sets. Commutative, associative,
distributive, involution, idempotency and de Morgans laws are true. The excluded
middle laws do not hold.

Operations like union, intersection and complement are similar to those of fuzzy sets.

-cuts of a fuzzy relation

If R is a fuzzy relation then the -cut (0 1) of R is a crisp relation defined by

RHN Fuzzy Logic
27
R = {(x, y) |
R
(x, y) }

If R =
(
(
(

8 . 0 8 .
5 . 8 . 5 .
5 . 2 . 1
is a fuzzy relation then R
.8
=
(
(
(

1 0 1
0 1 0
0 0 1
and R
.5
=
(
(
(

1 0 1
1 1 1
1 0 1


Composition

If R is relation that maps universe X onto universe Y and S is relation that maps Y onto
universe Z then a relation T = R o S that maps X onto Z is given by

)) , ( ) , ( (
max
) , ( y x y x
Y y
z x
s R T
.
e
=

is called a max-min composition of R and S.

If instead,
T
(x, y) is calculated using the formula

)) , ( ) , ( (
max
) , ( y x y x
Y y
z x
s R T

e
=

by taking the product of membership values then it is called the max-product
composition.

If
)) , ( ), , ( (
max
) , ( y x y x average
Y y
z x
s R T

e
=

by taking average of membership values then the composition is called the max-average
composition.


Examples:

1. R and S are two relations given by

RHN Fuzzy Logic
28
R =
(
(
(

0 8 . 1 6 . 4 .
9 . 1 2 . 7 . 5 .
2 . 5 . 6 . 0 1
3
2
1
5 4 3 2 1
x
x
x
y y y y y
and S=
(
(
(
(
(
(

1 2 . 0 4 .
8 . 9 . 7 . 1
4 . 8 . 5 . 0
0 9 . 3 . 5 .
0 1 4 . 6 .
5
4
3
2
1
4 3 2 1
y
y
y
y
y
z z z z
are two fuzzy relations
find their (i) max-min (ii) max-product and (iii) max-average compositions.

(i) RoS
(
(
(

8 . 8 . 7 . 5 .
8 . 9 . 7 . 5 .
5 . 6 . 6 . 6 .
3
2
1
4 3 2 1
x
x
x
z z z z


(ii) RoS
(
(
(

64 . 8 . 56 . 8 .
9 . 9 . 7 . 7 .
4 . 1 4 . 6 .
3
2
1
4 3 2 1
x
x
x
z z z z


(iii) RoS
(
(
(

8 . 75 . 7 . 9 .
95 . 95 . 85 . 1
65 . 1 7 . 8 .
3
2
1
4 3 2 1
x
x
x
z z z z


2. in the field of computer networking there is an imprecise relationship between
the level of a use of network communication bandwidth and the latency
experienced in peer-peer communications. Let X be fuzzy set of use levels (in
terms of the % of full bandwidth used) and Y be a fuzzy set of latencies (in
milliseconds) with the following membership values.

A =
)
`

+ + + + +
100
1 . 0
80
6 . 0
60
1
40
8 . 0
20
5 . 0
10
2 . 0
and B =
)
`

+ + + + +
20
3 . 0
8
6 . 0
4
1
5 . 1
9 . 0
1
6 . 0
5 . 0
3 . 0
.

Their Cartesian product R = A x B is found to be

RHN Fuzzy Logic
29
R =
(
(
(
(
(
(
(
(

1 . 0 1 . 0 1 . 0 1 . 0 1 . 0 1 . 0
3 . 0 6 . 0 6 . 0 6 . 0 6 . 0 3 . 0
3 . 0 6 . 0 1 9 . 0 6 . 0 3 . 0
3 . 0 6 . 0 8 . 0 8 . 0 6 . 0 3 . 0
3 . 0 5 . 0 5 . 0 5 . 0 5 . 0 3 . 0
2 . 0 2 . 0 2 . 0 2 . 0 2 . 0 2 . 0
100
80
60
40
20
10


Now, if A
1
=
)
`

+ + + + +
100
5 . 0
80
1
60
9 . 0
40
7 . 0
20
6 . 0
10
3 . 0
is a second fuzzy set of bandwidth usage
we can find the corresponding fuzzy set B
1
using max-min composition.

B
1
= A
1
o R =
)
`

+ + + + +
20
3 . 0
8
6 . 0
4
9 . 0
5 . 1
9 . 0
1
6 . 0
5 . 0
3 . 0


Equivalence & Tolerance Relations

A crisp relation R is said to be an equivalence relation if it has the following properties.

1. Reflexivity: (x
i
, x
i
) e R
2. Symmetry: If (x
i
, x
j
) e R, then (x
j
, x
i
) e R and
3. Transitivity: If (x
i
, x
j
) e R and (x
j
, x
k
) e R then (x
i
, x
k
) e R

A relation having only the first two properties is called a tolerance relation.

For example, relations, is in the same class as in the universe of students and is
parallel to in the universe of straight lines are equivalence relations.

A fuzzy relation R that maps elements of a universe X to itself satisfying the first two of
the above properties is a tolerance relation. And the transitivity property has to be
modified as

R(x
i
, x
j
) =
1
and
R(x
j
, x
k
) =
2
, then
R(x
i
, x
k
) > min(
1
,
2
)

And the fuzzy relation having this property along with the other two is an equivalence
relation.

If R is an equivalence relation, then
Ro R _ R .
RHN Fuzzy Logic
30

A tolerance relation can be reformed into an equivalence relation by compositions, in
fact, by at most n 1 compositions where n is the number of rows in the relation matrix.

For example, the relation R given by

R =
(
(
(
(
(
(

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


is not transitive and therefore it is a tolerance relation.

For,
~
R
(x
1
, x
2
) = 0.6,
~
R
(x
2
, x
3
) = 0.5 whereas
~
R
(x
1
, x
3
) = 0.4 which is less than the
minimum of the other two.

By max-min composition
R1= R
2
= R o R =
(
(
(
(
(
(

1 7 . 0 4 . 0 3 . 0 3 . 0
7 . 0 1 4 . 0 4 . 0 4 . 0
4 . 0 4 . 0 1 5 . 0 5 . 0
3 . 0 4 . 0 5 . 0 1 6 . 0
3 . 0 4 . 0 5 . 0 6 . 0 1

is still not an equivalence relation.

For, R1 o R1 =
(
(
(
(
(
(

1 7 . 0 4 . 0 4 . 0 3 . 0
7 . 0 1 4 . 0 4 . 0 4 . 0
4 . 0 4 . 0 1 5 . 0 5 . 0
4 . 0 4 . 0 5 . 0 1 6 . 0
3 . 0 4 . 0 5 . 0 6 . 0 1
. This is not a subset of R1 and therefore it is
not an equivalence relation.
Hence we find R2 = R1 o R1

R2=
(
(
(
(
(
(

1 7 . 0 4 . 0 4 . 0 4 . 0
7 . 0 1 4 . 0 4 . 0 4 . 0
4 . 0 4 . 0 1 5 . 0 5 . 0
4 . 0 4 . 0 5 . 0 1 6 . 0
4 . 0 4 . 0 5 . 0 6 . 0 1

RHN Fuzzy Logic
31
is an equivalence relation.

2. Is
(
(
(
(

0 8 . 0 0
0 0 0 0
1 0 0 0
0 0 5 . 7 .
an equivalence relation? If not modify it.


Value assignment in a relation

There are several ways of finding membership values of a relation. Cartesian explained
above is one of them. Other methods are

- Cosine amplitude method
- Max-min method
- Absolute exponential method
- Geometric average method
- Scalar method
- Arithmetic average method

Cosine method

Consider a universe X = {x
1
, x
2
, x
3
, , x
n
}, where each x
i
is a vector of length m.

X
i
= {x
i1
, x
i2
, ..., x
im
}

If r
ij
is the element in the ith row and jth column of R, then
r
ij
= n j i
x x
x x
m
k
m
k
jk ik
m
k
jk ik
..., , 2 , 1 , ,
1 1
2 2
1
=

= =
=

Example: The following table gives the result of a test in five different sections of a
class. Express the data as a fuzzy relation using cosine method. p

6 . 0 3 . 0 2 . 0 4 . 0 4 . 0
2 . 0 2 . 0 5 . 0 4 . 0 5 . 0
2 . 0 5 . 0 3 . 0 2 . 0 1 . 0
3
2
1
5 4 3 2 1
i
i
i
x classes f irst of ratio
x passes of ratio
x f ailures of ratio
x x x x x

Using the above method, we get

RHN Fuzzy Logic
32
R=
(
(
(
(
(
(

1 95 . 0 95 . 0 95 . 0 84 . 0
82 . 0 1 82 . 0 81 . 0 45 . 0
95 . 0 82 . 0 1 92 . 0 90 . 0
95 . 0 81 . 0 92 . 0 1 92 . 0
84 . 0 45 . 0 90 . 0 98 . 0 1


This is a tolerance relation. It can be modified to an equivalence relation by repeated
compositions.
The modified R=
(
(
(
(
(
(

1 82 . 0 95 . 0 95 . 0 95 . 0
82 . 0 1 82 . 0 82 . 0 82 . 0
95 . 0 82 . 0 1 95 . 0 95 . 0
95 . 0 82 . 0 95 . 0 1 98 . 0
95 . 0 82 . 0 95 . 0 98 . 0 1


Max-min method
r
ij
= n j i
x x
x x
m
k
jk ik
m
k
jk ik
, ... , 2 , 1 , ,
) , max(
) , min(
1
1
=

=
=


Absolute exponential method
r
ij
= exp |
.
|

\
|

=
m
k
jk ik
x x
1

Geometric average method
r
ij
=

=
=
m
k
jk ik
m
k
jk ik
x x
x x
1
1
) , min(

Arithmetic average method
r
ij =

=
=
+
m
k
jk ik
m
k
jk ik
x x
x x
1
1
) (
2
1
) , min(

Example:

Surveys are conducted of the buildings in a region subjected to earthquake. All the
buildings in the region are described as being in one of the three damaged states: no
damage, medium damage and serious damage. The following table summarizes the
findings of the survey team.
RHN Fuzzy Logic
33

Regions x
1
x
2
x
3
x
4
x
5
x
i1
:No damage 0.3 0.2 0.1 0.7 0.4
x
i2
: Medium damage 0.6 0.4 0.6 0.2 0.6
x
i3
: Serious damage 0.1 0.4 0.3 0.1 0

Use cosine method and max-min methods to express these data as fuzzy relations.

Fuzzy relation equation

Given a fuzzy relation equation P o R = Q, where R is a relation then it is possible to find
P if we know P and R

Let P = [p
1,
p
2
, p
k
], Q.= [q
1
, q
2
, q
m
] and R = [r
ij
], I = 1, 2, k and j = 1, 2, m

Then p
i
=

>
<
ij j
ij j j
r q if
r q if q
j , 1
, min


This formula can be extended to cases where P and Q are many rowed matrices.

Example:
Find P if P o R Q if (i) R =
(
(
(
(

1 0 3 . 3 .
7 . 6 . 4 . 1 .
8 . 6 . 0 2 .
7 . 6 . 5 . 2 .
and Q =
(

2 . 2 . 2 . 1 .
6 . 6 . 4 . 2 .


p
11
= min{1, .4, 1, .6} = 0.4, p
12
= min{1, 1, 1, .6} = 0.6, p
13
= min{1, .2, .2, .6} = 0.2
p
14
= min{.2, 1, 1, .2} = 0.2, p
21
= min{.1, .2, .2,.2} =0.1, p
22
= min{.1, 1, .2,.2} =0.1,
p
23
= min{1, .2, .2,.2} =0.2, p
21
= min{.1, .2, 1,1} =0.1

Hence, P
(

1 . 2 . 1 . 1 .
2 . 2 . 6 . 4 .


(ii) R =
(
(
(
(

5 . 3 . 3 . 4 .
1 . 1 . 1 . 0
0 3 . 1 4 .
0 3 . 0 5 .
and Q =
(

2 . 4 . 4 . 5 .
1 . 3 . 3 . 5 .
(iii) R =
(
(
(

6 . 4 . 6 .
5 . 8 . 8 .
1 6 . 9 .
and Q [.6 .6 .5]
RHN Fuzzy Logic
34
(iv) R =
(
(
(
(

8 . 0 2 . 0
6 . 5 . 4 . 2 .
0 3 . 6 . 4 .
2 . 0 7 . 5 .
and Q [.5 .5 .4 .2]

Projection of a relation

If A and B are two fuzzy sets we have seen how we can find the relation R between
them. Is it possible to estimate A and B if we know R? the fuzzy sets obtained from R
are called the projections of R.

R
1
= ( )
)
`

e Y X y x y x
y
R
) , ) , (
max
is called the first projection of R.
R
2
= ( )
)
`

e Y X y x y x
x
R
) , ) , (
max
is called the second projection of R.

Note: Projections of relations of more than two universes are defined in a similar way.

Examples:
1. If X = {a, b, c}. Y = {d, e. f. g} and R(X x Y) =
)
`

+ + + + + +
g c d c f b e b g a f a d a ,
6 .
,
7 .
,
3 .
,
4 .
,
6 .
,
2 .
,
3 .
defined on X x Y then
R
1
=
)
`

+ +
c b a
7 . 4 . 6 .
and R
2
=
)
`

+ +
f e d
3 . 4 . 7 .
.

2. If X = {a, b, c}, Y ={d, e} and Z = {f, g, h} and
R(X x Y x Z) =
)
`

+ + + + + + +
g e c f e c h e b f d b h e a g d a f e a f d a , ,
1
, ,
6 .
, ,
7 .
, ,
8 .
, ,
4 .
, ,
6 .
, ,
5 .
, ,
3 .

defined on X x Y X Z find R
12
, R
13
, R
23
, R
1
, R
2
and R
3
.

3. A fuzzy relation R is defined on the sets x
1
={a, b, c}, x
2
= {s, t}, x
3
= {x, y} and
x
4
= {i, j} as follows:
R(x
1
, x
2
, x
3
, x
4) =
)
`

+ + + + +

i y s c j y t a j y s b i y s b i x s a i y t b , , ,
2 . 0
, , ,
6 . 0
, , ,
1
, , ,
9 . 0
, , ,
6 . 0
, , ,
4 . 0
.

Compute the projections R
1,2,4
, R
1,2
and R
1
.


RHN Fuzzy Logic
35
3. Extension Principle

In ordinary analysis, we are familiar with functions y = f(x
1
, x
2
,x
n
). The function
y = f(x
1
, x
2
,x
n
).defines a mapping from the set of n-tuples (x
1
, x
2
,x
n
) onto the set of y.
Can we extend the idea into fuzzy analysis?

Consensus sider two universes X and Y. If A is fuzzy set in X and B in Y with
B = f(A). Then.

B
(y) = ) (
) (
max
x
x f y
A

=


This is called the extension principle.

If the mapping is from the cartesian product X x Y onto a third universe Z, and If A is in X,
B in Y and C in Z then

C
(z) = )) ( ), ( {max(
) (
max
y x
x f y
B A

=
.

Example:

1. A fuzzy set A =
)
`

+ + +

+
2
1 .
1
4 .
0
5 .
1
7 .
2
1
find the image fuzzy set B under the
mapping is y = x
2
.

B
(y) = ) (
) (
max
x
x f y
A

=


B =
)
`

+ +
4
1
1
7 . 0
0
5 . 0


2. If R
1
=
)
`

+ +
5
6 . 0
4
8 . 0
3
5 . 0
and R
2
=
)
`

+ +
10
4 . 0
9
1
8
3 . 0
are two fuzzy sets representing
resistance of two resistors (ohms), then the equivalent resistance R = R
1
+ R
2
is got by
the extension principle

R
(z) = )) ( ), ( {max(
) (
max
y x
x f y
B A

=
.

RHN Fuzzy Logic
36
R =
)
`

+ + + +
15
4 . 0
14
6 . 0
13
8 . 0
12
5 . 0
11
3 . 0


3. A fuzzy set x is defined as x
)
`

+ + + +

+
3
1 . 0
2
3 . 0
1
7 . 0
0
1
1
7 . 0
2
3 . 0
3
1 . 0
. Using (i)
extension principle (ii) vertex method determine the fuzzy set z for (a) z = x
2
and
(b) z = x x

(i) (a) z = x
2
=
)
`

+ + +
9
1 . 0
4
3 . 0
1
7 . 0
0
1

(b) z = x x

=
)
`

+ + + + + + +

+
9
1 . 0
6
1 . 0
4
3 . 0
3
1 . 0
2
3 . 0
1
7 . 0
0
1
1
7 . 0
2
3 . 0
3
1 . 0
4
3 . 0
6
1 . 0
9
1 . 0


If the membership functions of fuzzy sets are continuous then errors may crop up in the
output fuzzy set. This is not due to any error in the extension principle, but due to
descretization of the membership function. Descretizing any continuous variable would
involve leaving out portions of solution space. Because of this drawback, alternate
methods are in vogue.

- Vertex method
- DSW algorithm

Vertex method
Vertex method is based on -cut concept. Here, the input fuzzy sets are divided into a
number of -cuts and the corresponding -cuts of the output fuzzy set are calculated.
On the basis of these -cuts the output fuzzy set is constructed as shown in the example
below.

Example: 1.
RHN Fuzzy Logic
37

Fuzzy set A is given above. Find its image B under the mapping y = x
2
2x .

A
0
= [0, 3]

To find the corresponding B
0
under the given mapping we take the minimum and
maximum values of the function in this interval. This involves taking the values at the
initial and end points of the interval and also any extreme value of the function in the
interval.

Let us check if the function has any extreme value in the interval.
y = f(x) = x
2
- 2x

By differentiating and equating to 0, we get x = 1 as a minimum point. And the minimum
value at x =1 is -1. The critical point lies within the interval.

Thus, B
0
= [min(f(0), f(3), f(1)), max(f(0), f(3), f(1))]

= [min(0, 3, -1), max(0, 3, -1)] = [-1, 3]

A
0.5
= [0.5, 2]

Therefore, B
0.5
= [min(f(0.5), f(2), f(1)), max(f(0.5), f(2), f(1))]
= [min(0.75, 0, -1), max(0.75, 0, -1)] = [-1, 0.75]

A
1

= [1, 1]

Therefore,
B
1
= [-1, -1]
With these three -cuts we can construct the fuzzy set B.


0 1 2 3 x



1


.5
RHN Fuzzy Logic
38

Example 2:


DSW Algorithm

In this method too, -cuts are used. But here, the estimation of output -cuts is done by
using interval analysis. Let us first recollect a few basic operations in interval analysis.

If I and J are two intervals with I =[a, b] and J = [c, d] then

I + J = [a+c, b+d]
I J = [a-d, b-c]
I * J = [min(ac, ad, bc, bd), max(ac, ad, bc, bd)]
I J = I * 1/J = [a, b] * [1/d, 1/c]


Example:

If A and B are two fuzzy sets as given below find A B A - B A- B A B B - A and B
A using DSW algorithm.

< <

< <
+
=
elsewhere
x
x
x
x
x
A
, 0
2 0 ,
2
2
2 2 ,
2
2
) (

< <

< <

=
elsewhere
x
x
x
x
x
B
, 0
6 4 ,
2
6
4 2 ,
2
2
) (

- 1 3 z





1



.5
Output fuzzy set B
RHN Fuzzy Logic
39


Fuzzy set A Fuzzy set B

(i) C = A + B

A
0
= [-2, 2] and B
0
= [2, 6]. The image C
0
= A
0
+ B
0
= [0, 8]

A
0.5
= [-1, 1] and B
0.5
= [3, 5]. The image C
0.5
= A
0.5
+ B
0.5
= [2, 6]

A
1
= [0, 0] and B
1
= [4, 4]. The image C
1
= A
1
+ B
1
= [4, 4]
(ii) C = A - B

A
0
= [-2, 2] and B
0
= [2, 6]. The image C
0
= A
0
- B
0
= [-8, 0]

A
0.5
= [-1, 1] and B
0.5
= [3, 5]. The image C
0.5
= A
0.5
- B
0.5
= [-6, -2]

A
1
= [0, 0] and B
1
= [4, 4]. The image C
1
= A
1
- B
1
= [-4, - 4]


(iii) C = A * B

A
0
= [-2, 2] and B
0
= [2, 6]. The image C
0
= A
0
* B
0
= [-12, 12]

A
0.5
= [-1, 1] and B
0.5
= [3, 5]. The image C
0.5
= A
0.5
* B
0.5
= [-5, 5]

A
1
= [0, 0] and B
1
= [4, 4]. The image C
1
= A
1
* B
1
= [0, 0]

(iv) C = A B

A
0
= [-2, 2] and B
0
= [2, 6]. The image C
0
= A
0
B
0
= [-2, 2] * [1/6, 1/2] = [-1, 1]
- 2 0 2 x




1




1
2 4 6
RHN Fuzzy Logic
40

A
0.5
= [-1, 1] and B
0.5
= [3, 5]. The image C
0.5
= A
0.5
B
0.5
= [-1, 1] * [1/5, 1/3]
= [-1/3, 1/3]

A
1
= [0, 0] and B
1
= [4, 4]. The image C
1
= A
1
B
1
= [0, 0] * [1/4, 1/4] = [0, 0]



(v) C = B - A

A
0
= [-2, 2] and B
0
= [2, 6]. The image C
0
= B
0
- A
0
= [0, 8]
A
0.5
= [-1, 1] and B
0.5
= [3, 5]. The image C
0.5
= B
0.5
- A
0.5
= [2, 6]
A
1
= [0, 0] and B
1
= [4, 4]. The image C
1
= B
1
- A
1
= [4, 4]

2. If A and B are two fuzzy sets, is A - B + B = A? Explain by means of an example.










0 4 8 x




1




1
-8 -4 0 6
DSW algorithm: A+ B A - B

RHN Fuzzy Logic
41




4. Fuzzy Logic

Before taking up fuzzy logic, let us review the classical mathematical logic. In classical
logic a proposition or a statement is either true or false. For example, the proposition
that I skip my lunch today can either be true or false. If P is proposition in a universe X
and T(P) is its truth value then T(P) is either 0 or 1.

If P and Q are two propositions in X then they are connected by the following
connectives.

- Disjunction
PQ : T(PQ) = max(T(P), T(Q))

- Conjunction
PQ : T(PQ) = min(T(P), T(Q))

- Negation

P : T( P ) = 1 T(P)

- Implication

PQ; T(PQ) = T( P Q)

P is called the antecedent and Q the consequent of the implication.

- Equivalence

PQ: T(PQ) =

=
otherwise
Q T P forT
, 0
) ( ) ( , 1


- Exclusive or

RHN Fuzzy Logic
42
P Q: T(P Q) =

=
otherwise
Q T P forT
, 1
) ( ) ( , 0


Let us tabulate the truth values of different compound propositions.

0 1 1 0 0 1 0 0
1 0 1 0 1 1 1 0
1 0 0 0 1 0 0 1
0 1 1 1 1 0 1 1
" " Q P Q P Q P Q P Q P P Q P v . v


Note: Let P be the statement It rains and Q be I will stay at home. Then P Q
means If it rains I will stay at home. Now if P is true and Q is false then P Q is false.
i.e., If it rains then I will not stay at home is not true. On the other hand, if P is false
and Q is true then P Q is true. i.e., If it does not rain then I will stay at home is true.
Also If it does not rain then I will not stay at home is also true.

A compound statement is called a tautology if it is true irrespective of the truth values
of the individual simple propositions. A compound statement is called a contradiction if
it is false irrespective of the truth values of the individual simple propositions. The
implication

P( PQ) Q

is a tautology and is called modus ponens. It means that a proposition P and P implies
another proposition Q are both true then Q is true. For example,

P: Ram is a good debater
Q: He will get a prize

If Ram is a good debater is true (P) and If Ram is a good debater then he will get a prize
is true (P Q) then it is true that he will get a prize (Q).

The compound proposition P Q P Q . )) ( ( , called modus tollens, is also a
tautology.

If Ram will get a prize is not true and if Ram is a good debater then he will get a prize is
true then Ram is a good debater is false.

RHN Fuzzy Logic
43
1 0 1 0 0
1 0 1 1 0
1 0 0 0 1
1 1 1 1 1
)) ( ( ) ( Q Q P P Q P P Q P Q P . .


Modus ponens is a tautology
Deductive Inferences


The implication P Q, where P is proposition in the set A c X and Q a proposition in
set B c Y, X and Y being two separate universes can be represented by the relation

R = ) ( ) ( Y A B A

The relation R represents the rule IF A, THEN B.

The rule IF A, THEN B ELSE C, where C c Y can be represented as

R = ) ( ) ( C A B A

Examples: 1. Under what conditions is the implication P Q a tautology?

When P = Q.

3. Show that the implication given below is tautology.

Babies are illogical; despised persons cannot manage crocodiles; illogical persons are
despised. Therefore, babies cannot manage crocodiles.

Let P: A person is a baby
Q: A person is illogical
R: A person is despised
S: A person cannot manage crocodiles

The first proposition is P Q, the second one is R S and the third proposition is
Q R. The implication is P S.

((P Q) (R S) (Q R)) (P S)

Let us check if it is a tautology by writing its truth table.

RHN Fuzzy Logic
44
1 1 1 1 1 1 0 0 0 0
1 1 1 1 1 1 1 0 0 0
1 1 0 1 0 1 0 1 0 0
1 1 1 1 1 1 1 1 0 0
1 1 0 0 1 1 0 0 1 0
1 1 0 0 1 1 1 0 1 0
1 1 0 1 0 1 0 1 1 0
1 1 1 1 1 1 1 1 1 0
1 0 0 1 1 0 0 0 0 1
1 1 0 1 1 0 1 0 0 1
1 0 0 1 0 0 0 1 0 1
1 1 0 1 1 0 1 1 0 1
1 0 0 0 1 1 0 0 1 1
1 1 0 0 1 1 1 0 1 1
1 0 0 1 0 1 0 1 1 1
1 1 1 1 1 1 1 1 1 1
E D
E
S P
D
C B A
C
R Q
B
S R
A
Q P
S R Q P
=

=

=



The last column contains only 1s. Therefore the implication is true.

Fuzzy Logic

We have already seen how classical logic fails in dealing with certain situations. What is
the truth value of statements like I am a liar? According to classical logic any
proposition can either be true or false, but not both at the same time. If P is the
proposition I am a liar then P is the statement I am not a liar. The situation is: If P,
then P .and If P . Then P i.e., P P and P P. Or, in other words P P .

i.e. T(P) = T( P ). i.e., T(P) = 1 T(P)

Hence, T(P) = 0.5

What it means is that a proposition can have partial truth value also. This idea has given
rise to fuzzy logic, in which a statement can have truth value any number between 0 and
1. Consider the example of getting old.. When does a person get old? The question can
be answered satisfactorily if the concept of partial truth value is accepted.
If P is a fuzzy proposition in a fuzzy set A, then T(P) is a mapping P onto [0, 1}. If we
represent the truth value of P by
A
(x), then
A
(x) e [0, 1].
RHN Fuzzy Logic
45

All logical connectives are valid in case of fuzzy logic also.

A fuzzy compound proposition is said to be quasi-tautology if its truth value is not 0
whatever is the truth value of its constituent propositions. Similarly, a compound
proposition is quasi-contradiction if its truth value is not 1 whatever is the truth value of
its constituent propositions.

The implication P Q, where P is proposition in the set A c X and Q a proposition in
set B c Y, X and Y being two separate universes can be represented by the relation

R = (A x B) ) ( Y A

The relation R represents the rule IF A, THEN B.

The rule IF A, THEN B ELSE C, where C c Y can be represented as

R = (A x B) A ( C)

This method fuzzy implication is called the classical method. There are other methods,
some of which are given below.

-
R
(x, y) = min (
A
(x),
B
(y)). This method is due to Mamdani.
-
R
(x, y) = min [1, (1
A
(x) +
B
(y))]. This method is due toLukasiewicz..
-
R
(x, y) = min (1,
A
(x) +
B
(y)). This method is called the bounded sum
implication..
-
R
(x, y) =

s
otherwise y
y x for
B
B A
), (
) ( ) ( , 1


. This method is called Brouwerian implication..

Approximate Reasoning

The implication AB means: IF x eA, THEN ye B.where A and B are fuzzy sets on
universes X and Y respectively. If, now, A is a new antecedent in X then the
corresponding consequent B is determined by the composition A o R

Example:

Given the fuzzy sets A and B in X and Y respectively,

RHN Fuzzy Logic
46
A =
}

x
x 1 . 0 1
, for x e [0, 10]
B =
}
y 2 . 0 , for y e [0, 5]

Let us construct the relation R using classical implication method.

Let us first descretize the fuzzy sets.

A
)
`

+ + + + +
1
0
8
2 . 0
6
4 . 0
4
6 . 0
2
8 . 0
0
1
and B=
)
`

+ + + + +
5
1
4
8 . 0
3
6 . 0
2
4 . 0
1
2 . 0
0
0


Ax B =
(
(
(
(
(
(
(
(

0 0 0 0 0 0
2 . 0 2 . 0 2 . 0 2 . 0 2 . 0 0
4 . 0 4 . 0 4 . 0 4 . 0 2 . 0 0
6 . 0 6 . 0 6 . 0 4 . 0 2 . 0 0
8 . 0 8 . 0 6 . 0 4 . 0 2 . 0 0
1 8 . 0 6 . 0 4 . 0 2 . 0 0
10
8
6
4
2
0


A x Y =
(
(
(
(
(
(
(
(

1 1 1 1 1 1
8 . 0 8 . 0 8 . 0 8 . 0 8 . 0 8 . 0
6 . 0 6 . 0 6 . 0 6 . 0 6 . 0 6 . 0
4 . 0 4 . 0 4 . 0 4 . 0 4 . 0 4 . 0
2 . 0 2 . 0 2 . 0 2 . 0 2 . 0 2 . 0
0 0 0 0 0 0
10
8
6
4
2
0
5 4 3 2 1 0




R = (Ax B( A x Y) =
(
(
(
(
(
(
(
(

1 1 1 1 1 1
8 . 0 8 . 0 8 . 0 8 . 0 8 . 0 8 . 0
6 . 0 6 . 0 6 . 0 6 . 0 6 . 0 6 . 0
6 . 0 6 . 0 6 . 0 4 . 0 4 . 0 4 . 0
8 . 0 8 . 0 6 . 0 4 . 0 2 . 0 2 . 0
1 8 . 0 6 . 0 4 . 0 2 . 0 0
10
8
6
4
2
0
5 4 3 2 1 0


RHN Fuzzy Logic
47
Let us now find B by max-min composition given the new antecedent A =
)
`

3
1

B A o R

=
| |
(
(
(
(
(
(
(
(

1 1 1 1 1 1
8 . 8 . 8 . 8 . 8 . 8 .
6 . 6 . 6 . 6 . 6 . 6 .
6 . 6 . 6 . 4 . 4 . 4 .
8 . 8 . 6 . 4 . 2 . 2 .
1 8 . 6 . 4 . 2 . 0
0 0 0 1 0 0
10 8 6 4 2 0

=
| | 6 . 6 . 6 . 4 . 4 . 4 .
5 4 3 2 1 0


4. For the following fuzzy sets L, M and N (on the speed of a motor as)

Slow speed = L =
)
`

+ + + +
5
0
4
0
3
0
2
5 . 0
1
1

mostly counter-clockwise M =
)
`

+ + + +
o o o o o
180
1
135
5 . 0
90
0
45
0
0
0

and Around neutral = N
)
`

+ + + +
o o o o o
180
0
135
5 . 0
90
1
45
5 . 0
0
0
find a relation R which
expresses the implication IF slow speed THEN mostly counter-clockwise ELSE around
neutral using approximate reasoning method.

L
)
`

+ + + +
5
1
4
1
3
1
2
5 . 0
1
0

L x M
(
(
(
(
(
(

0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
5 . 0 5 . 0 0 0 0
1 5 . 0 0 0 0
5
4
3
2
1
180 135 90 45 0
o o o o o


RHN Fuzzy Logic
48
L x N
(
(
(
(
(
(

0 5 . 0 1 5 . 0 0
0 5 . 0 1 5 . 0 0
0 5 . 0 1 5 . 0 0
0 5 . 0 5 . 0 5 . 0 0
0 0 0 0 0
5
4
3
2
1
180 135 90 45 0
o o o o o


IF slow speed THEN mostly counter-clockwise ELSE around neutral
R = (L x M (L x N
(
(
(
(
(
(

0 5 . 0 1 5 . 0 0
0 5 . 0 1 5 . 0 0
0 5 . 0 1 5 . 0 0
5 . 0 5 . 0 5 . 0 5 . 0 0
1 5 . 0 0 0 0
5
4
3
2
1
180 135 90 45 0
o o o o o



Fuzzy Rule-based systems

We use verbal and body language and gestures to communicate with one another. It is
remarkable that though these means of communication are imprecise and vague we do
not normally find it difficult to understand one another.

Fuzzy set theory defines fuzzy operators on fuzzy sets. The problem in applying this is
that the appropriate operator may not be known. For this reason fuzzy logic uses rule-
based IF THEN rules.

Fuzzy logic incorporates a simple rule-based approach to solve a problem rather than
attempting to model a system mathematically. It relies on ones intuition and
experience rather than ones technical expertise. .for example, instead of dealing with
temperature control in terms such as temp < 500
o
C or 210
o
C < temp < 220
o
C, terms
like IF process is too cool AND process is getting colder THEN add heat to the process
or If process is too hot0 AND process is heating rapidly THEN cool the process quickly
are used.

These terms are imprecise and vague but yet quite descriptive of what action has to
take place. In our everyday activities we rely more on our intuition and acquired
knowledge rather than taking precise measurements. If it is cold in a room, you will not
start checking the thermometer. Instinctively you switch on the heater to the desired
RHN Fuzzy Logic
49
level.. Interestingly, the results generally are satisfactory. We save on time and tedious
calculations. Fuzzy logic mimics this human behaviour at a very high rate.
For example, an extremely simple temperature regulator that uses a fan might look like
this:
IF temperature IS very cold THEN stop fan
IF temperature IS cold THEN turn down fan
IF temperature IS normal THEN maintain level
IF temperature IS hot THEN speed up fan
Linguistic variables

Any verbal language contains words like tall, fat, beautiful, hot, cold which we shall call
atoms. Some times to stress the degree of the attribute of these atomic words, we use
words like very, slightly, fairly etc. these are called the linguistic hedges.

Consider an atomic term in a universe X of natural language. Let Y be the universe of
interpretations of atomic terms. We define a fuzzy set A in Y being the interpretation of
.
For example, if is the atom tall, then A would be the fuzzy set given by the
definition,

A
(y) =

s s

>
. , 0
180 160 ,
20
160
180 , 1
otherwise
y if
y
cm y if


If and are two linguistic atoms, they can be combined by the connectives, and, or
and not. Their interpretations would be

- or :


or
(y) = max (

(y),

(y))
- and :


and
(y) = min (

(y),

(y))
- not :
not
(y) = 1

(y).

Linguistic Hedges

In our daily communication, we often modify the atoms with modifiers such as very,
fairly, slightly, almost and so on. They are called linguistic hedges. What would happen
to the corresponding interpretations of these modified atoms? If is an atom and h a
hedge then the modified phrase is h. In case of modified atoms, their membership
values are calculated as per the following formulae.

-
very
(y) = {

(y)}
2

RHN Fuzzy Logic
50

-
slightly
(y) = {

(y)}




-
fairly
(y) = {

(y)}




-
plus
(y) = {

(y)}
1.25


-
minus
(y) = {

(y)}
0.75



-
highly
(y) = {

(y)}
3


-
intensely
(y) =

>
s
5 . 0 ) ( , )] ( 1 [ 2 1
5 . 0 ) ( ), ( 2
2
2
y for y
y for y
o o
o o





The hedges very, plus etc., which reduce the membership values of atoms are called
concentrations, while those like fairly, slightly etc., which increase the membership
values are called the dilations. The hedge intensely which decreases the membership
value to a certain value of

(y) and then increases it is called intensification.



Example
Dilation Concentration
Intensification
RHN Fuzzy Logic
51

In risk assessment we deal with characterizing uncertainty in assessing the hazard to
human health posed by various chemical chemicals. Because the pharmacokinetics of
the human body are very difficult to explain for long-term chemical hazards, such as
chronic exposure to lead or to cigarette smoke, hazards can sometimes be uncertain
because of scarce data or uncertainty in exposure patterns. Let us characterize hazard
linguistically with two terms; low hazard and high hazard:

Low hazard =
)
`

+ + + +
5
0
4
1 . 0
3
8 . 0
2
3 . 0
1
0



High hazard =
)
`

+ + + +
5
0
4
8 . 0
3
2 . 0
2
1 . 0
1
0
.
pFind the fuzzy sets representing

(i) Low hazard and very high hazard
(ii) Very low hazard and not very low hazard
(iii) Slightly low hazard
(iv) Fairly high hazard

(i) Low hazard and very high hazard =
)
`

+ + + +
5
0
4
1 . 0
3
04 . 0
2
01 . 0
1
0

(ii) Very low hazard or not very high hazard =
)
`

+ + + +
5
0
4
64 . 0
3
96 . 0
2
99 . 0
1
0

(iii) Slightly low hazard =
)
`

+ + + +
5
0
4
31 . 0
3
89 . 0
2
55 . 0
1
0

(iv) Fairly high hazard =
)
`

+ + + +
5
0
4
2 . 0
3
9 . 0
2
4 . 0
1
0



Truth Qualification

A proposition x is A is represented as a fuzzy set. For example, consider the proposition,
Ram is tall. The truth value of the proposition depends not only on the membership
value of Rams height but on how true the proposition is. Following are some of the
possibilities.

Ram is tall is true.
Ram is tall is very true
Ram is tall is fairly true
Ram is tall is false
RHN Fuzzy Logic
52
Ram is tall is very false
Ram is tall is fairly false.
Let A be the fuzzy set tall and
A
(Ram) = a be the membership value of Ram in A.


Each of the above statements is a fuzzy set. Membership values of the above fuzzy sets
can be graphically represented as follows: a along the horizontal axis and
t
(), t
representing the above fuzzy sets, along the vertical axis. Let us say, that Ram is 168 I
tall. His membership value in fuzzy set tall is 0.6 and that in the fuzzy set Ram is tall is
very true is 0.36.


Fairly true
True
Very true


Fairly false
False
Very false
0 0.6 1 a

A
(a)




0.6


0.36

Truth values of a fuzzy proposition



t
(a)

1
Height x 0 160 168 180
0.6



0.36
Fuzzy set Tall
RHN Fuzzy Logic
53
i x y

Graphical Techniques of Inference

Though computers are used for inference procedures, sometimes it becomes necessary
to check the results manually. Manual checking is done graphically.

Consider a two-rule system where each rule has two antecedents and one consequent.

If x is A
k
and y is B
k
then z is C
k
, k = 1, 2, ., r.

Suppose x and y are crisp values.

Let A
1
and B
1
be the two antecedents of the I rule and A
2
and B
2
be the two antecedents
of the II rule and C
1
and C
2
the consequents. Then the output is obtained graphically as
follows. Consequents are obtained using max-min method.

The combined output is calculated by taking the disjunction of C
1
and C
2
. The defuzzified
value of z is calculated by any suitable technique



Graphical Technique of Inference


Fuzzy Rule-based Systems
RHN Fuzzy Logic
54

The expression of the form

If premise (antecedent) then conclusion (consequent)

is known as the if- then rule-based form. Using such a form one can infer a fact from a
given data. Though this is fairly adequate in dealing with most of the communication
needs, it is not very useful in dealing with the knowledge based on intuition, structure
and behaviour of things around us as the latter are not easily translated into linguistic
terms.

Linguistic statements can be

- Assignment statements
- Conditional statements or
- Unconditional statements

He is a good student is an assignment statement. If it rains, I will stay at home
is a conditional statement. Shut the door is an unconditional statement. The
assignment and unconditional statements can, however, be transformed into
conditional statements using a universal discourse of input conditions. For example, the
statement He is a good student can be written a conditional statement as If anything,
he is a good student. Therefore any rule-base can be considered as a collection of
conditional statements. It is to be noted here that
anything
(x) = 1.

Decomposition of compound rules

If compound rule system is involved, it is decomposed into several simple rules, known
as canonical rules as shown below.

Multiple Conjunctive Antecedents

IF A
1
and A
2
and and A
L
THEN B

can be decomposed as,

IF A THEN B where A A
1
A
2
A
L


Multiple Disjunctive Antecedents

IF A
1
or A
2
or or A
L
THEN B

can be decomposed as,
RHN Fuzzy Logic
55

IF A THEN B where A A
1
A
2
A
L


Conditional statements with ELSE and UNLESS

IF A
1
THEN (B
1
ELSE B
2
)

is decomposed into two rules connected by or.

IF A
1
THEN B
1
or IF not A
1
THEN B
2


Example: If my friend visits me, I will stay at home, else I will go to the college can be
decomposed into two statements connected by or.

If my friend visits me, I will stay at home or, If he does not visit me I will go to the
college

IF A
1 (
THEN B
1
) UNLESS A
2


becomes

IF A
1
THEN B
1
or, IF A
2
THEN not B
1


Example: If my friend visits me, I will stay at home, unless I have an important class
will become

If my friend visits me, I will stay at home or If I have an important class, I will not stay
at home

IF A
1
THEN (B
1
ELSE IF A
2
THEN B
2
)

is decomposed into two rules

IF A
1
THEN B
1
or IF not A
1
and A
2
THEN B
2


Example: If my friend visits me, I will stay at home, unless I have an important class
will become

If my friend visits me, I will stay at home or If he does not visit me and I have an
important class I will go to the college


RHN Fuzzy Logic
56
5. FUZZY DECISION MAKING

Decision making is an important aspect of the day-to-day activity of any living being,
particularly of human beings. Every moment of our life we make decisions. Do I stay at
home? What shirt shall wear today? When will I start studying? Do I join the college A or
B? Do I accept the job offered by the company A? Some decisions turn out to be good
and some bad. While arriving at any decision we weigh the options open to us and
choose the one that we think would give the desired results. Arriving at a decision is not
easy as we cannot possibly have the prior knowledge of what the consequence of our
decision would be. We tend to bank on our intuition, accumulated knowledge and
statistics in deciding what course of action to take. The human error caused by our
personal bias, many a times unreasonable, may adversely influence the evaluation. As
the decision making depends on the information on its outcome and this information is
normally is vague and ambiguous or fuzzy.

Synthetic Evaluation

It is the process of evaluation involving several individual fuzzy components synthesized
into an aggregate form. Naturally, the evaluation is many times vague and imprecise.
We shall highlight this evaluation process by an example.

Example:

A company manufactures a chemical additive that is used in engine oil lubricants. It is
required to find if a particular batch of additive produced by the company is good
enough to be sold in the market. The parameters on which the additive is evaluated are:
the colour, consistency, base number (measure of its capacity) and flash point (its
ignition temperature). After making several hundred of batches of the additive, the
following relation matrix is obtained:

fair good very excellent
FP
BN
y consistenc
colour
(
(
(
(

3 . 0 3 . 0 4 . 0
1 . 0 4 . 0 5 . 0
4 . 0 5 . 0 1 . 0
3 . 0 4 . 0 3 . 0


The weight factor for the additive is a = {0.1, 0.25, 0.4, 0.25}. Evaluate the quality of the
additive.
Evaluation fuzzy set e is found using the max-min composition.
e = a o R

RHN Fuzzy Logic
57
e = {0.4 0.4 0.25}

It means that the additive is between excellent and very good.

Sometimes, decisions are arrived at by comparative ranking as in the following example.
When comparative preferences are sought the results may not be transitive. For
example, between two models of cars, say A and B, I may prefer A, between B and
another model C I may prefer B, but between A and C, I may prefer C. Transitive
property does not hold here. To take care of such situations, we use a relativity function
defined as follows:

Membership value f(x | y) of choosing x over y is given by
f(x | y) =
)) ( ), ( max(
) (
y f x f
x f
x y
y
,

where f
y
(x) is the membership value of x with respect to y and f
x
(y) is the membership
value of y with respect to x. Obviously, f
x
(x) = 1. We can now form a relativity matrix C =
[c
ij
], where c
ij
= ) | (
j i
x x f

Then, the overall ranking is arrived at by determining the minimum value in each row of
C.

Example:

A man has three sons A, B and C. A is the eldest and C the youngest. A survey is done
among the family members as to their resemblance with the father. Estimates are given
below. F
A
(B) the membership value of B with respect to A.

f
A
(A) = 1 f
B
(A) = 0.8 f
C
(A) = 0.6 f
A
(B) = 0.5 f
B
(B) = 1 f
C
(B) = 0.7
f
A
(C) = 0.5 f
B
(C) = 0.4 f
C
(C) = 1

The relativity matrix is
57 . 0
63 . 0
1
1 57 . 0 83 . 0
1 1 63 . 0
1 1 1
min
(
(
(

C
B
A
C B A


The last column gives the minimum in each row. We conclude that the ranking of the
resemblance of the three sons to their father is A, B, C in that order.


RHN Fuzzy Logic
58
Preference and Consensus

When a group of experts evaluate an alternative compared to others how will they
arrive at a decision? There are two processes involved: the consensus process and the
selection process. The consensus process measures the degree of consensus among the
people. It is preferable that they reach a high degree of consensus. By this a solution set
of alternatives in the selection process is obtained.

We first define a consensus measure indicating the agreement among the group and
then we define a measure of distance to calculate how far the individual solutions are
from the collective solution. The first one is used to guide the consensus process and to
validate the final solution while the second one is used to guide the discussion phases of
the consensus process.
Let X = {x
1
, x
2
, x
n
} be a universe of n alternatives. We form a relation matrix R called
reciprocal relation, whose elements r
ij
are defined as follows:

r
ii
= 0 for 0 s i s n
r
ij
+ r
ji
=1 for i = j.

Here r
ij
is the measure of the preference of alternative x
i
to x
j
. r
ij
= 1 means that x
i
is
preferred completely over x
j
. r
ij
= 0 means x
i
is not preferred at all compared to x
j
.
r
ij
= 0.5 implies r
ji
= 0.5 and it means that x
i
and x
j
are equally preferred.

We shall define two measures of consensus.
If tr(R) is the trace of matrix =

=
n
i
ij
r
1
then the two measures average fuzziness F(R) and
the average certainty C(R in R are defined as

F(R =
) 1 (
) ( 2
2
n n
R tr


C(R) =
) 1 (
) ( 2
n n
RR tr
T


Clearly,
F(R C(R = 1

When F(R) is a maximum, C(R) is a minimum at r
ij
= 0.5 and vice versa.at r
ij
=1. At r
ij
=
0.5, F(R) = 0.5 (maximum value) and therefore C(R) = 0.5 (minimum value). It is evident
that 0 s F(R) s 0.5 and 0.5 s C(R) s 1.
RHN Fuzzy Logic
59

In one form of consensus called the maximal fuzzy consensus M
1
all alternatives are
rated equally. All off-diagonal elements are 0.5. In another called the crisp preference
M
2
which is the converse of M
1
the off-diagonal elements are either 1 or 0.

For example,

M
1
=
(
(
(
(

0 5 . 0 5 . 0 5 . 0
5 . 0 0 5 . 0 5 . 0
5 . 0 5 . 0 0 5 . 0
5 . 0 5 . 0 5 . 0 0
, M
2
=
(
(
(
(

0 0 0 1
1 0 0 1
1 1 0 0
0 0 1 0


There are three types of consensus.

Type I consensus: One of the alternatives has consensus. That is, elements in one
column are all 0 and the rest of the elements are either 1 or 0.5.

*
1
M =
(
(
(
(

0 5 . 0 0 5 . 0
5 . 0 0 0 5 . 0
1 1 0 1
5 . 0 5 . 0 0 0

is a type II consensus Here alternative 2 (column 2) has a clear consensus.

Type II consensus: One of the alternatives has a clear consensus but the other
alternatives have secondary preference. That is, if jth alternative has a consensus then
rij

= 0 for all i and r
kj
= 1 when k = j.
*
2
M =
(
(
(
(

0 . 0 0 1
1 0 0 0
1 1 0 1
0 1 0 0

is a type II consensus.

Type fuzzy consensus: Here too, alternative i is preferred but the other alternatives have
infinitely many fuzzy preferences.

*
f
M =
(
(
(
(

0 5 . 0 0 6 . 0
5 . 0 0 0 8 . 0
1 1 0 1
4 . 0 2 . 0 0 0

If |A| is the cardinality of the matrix A then |M
1
| = 1
RHN Fuzzy Logic
60

|M
2
| = 2
n(n-1)/2
,
*
1
M = n
*
2
M =
2
) 2 )( 1 (
2

n n
n
*
f
M =
In the above cited examples, where n = 4, we get |M
1
| = 1, |M
2
| = 64,
*
1
M = 4,
*
2
M =
32 and
*
f
M = .
We shall now define a distance to preference metric m(R) = 1 {2C(R) 1}

.
m(R) is 1 for M
1
, 0 for M
2
, 1 (2/n)

for
*
1
M and 0 for
*
2
M

Note: The distance between type I and type II consensus increases with n for n > 2.

Example: A manufacturing company plans to purchase a lathe and is assessing the
proposals from four lathe manufacturers. The company has developed a reciprocal
relation for the 4 manufacturers based on the speed of delivery of the lathes and the
cost. The relation is
R =
(
(
(
(

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

Calculate the degree of preference measures and the distance of Type I, Type II and
Type fuzzy consensus.

R
2
=
(
(
(
(





41 . 0
70 . 0
33 . 0
46 . 0
and R R
T
=
(
(
(
(





89 . 0
50 . 0
17 . 2
54 . 0


tr(R
2
) = 2.9 and tr(RR
T
) = 1.7

F(R 317 . 0
6
90 . 1
=
,
C(R) = 683 . 0
6
10 . 4
=
m(R) = 1 (2 x 0.683 1)

= 0.395,
m(
*
1
M ) = 1 0.5

= 0.293
The degree of consensus is 0.683. It is 1 0.395 = 0.605 or 60.5% away from maximal
consensus M
1
towards a Type II consensus. It is
293 . 0 1
605 . 0

= 0.855 or 85.5% towards a


Type I consensus.
RHN Fuzzy Logic
61
6. Fuzzy Classification

Classifying a set of data according to their patterns, attributes, features and other
characteristics is called classification or clustering. Classification criteria could numeric
or non-numeric. For example, if we are classifying a set of people as per their heights or
weights the data are numeric, whereas if they are classified as per their colour or race,
the data are non-numeric. Before we can classify a set of data points, we need to have a
criterion for classification.


Classification by Fuzzy Equivalence Relation

In this method, -cuts are used to classify the data. The method is highlighted in the
following example.


Example:
A fuzzy tolerance relation R is given. Modify it to an equivalence relation and classify it
at - cut levels of 0.9, 0.8 and 0.5.
R =
(
(
(
(
(
(

1 5 . 3 . 4 . 1 .
5 . 1 0 0 2 .
3 . 0 1 9 . 0
4 . 0 9 . 1 8 .
1 . 2 . 0 8 . 1
e
d
c
b
a
e d c b a


R is not an equivalence relation. To modify it to an equivalence relation, we need to do
its composition with itself (maximum 3 times).

Modified R is obtained as

R =
(
(
(
(
(
(

1 5 . 4 . 4 . 4 .
5 . 1 4 . 4 . 4 .
4 . 4 . 1 9 . 8 .
4 . 4 . 9 . 1 8 .
4 . 4 . 8 . 8 . 1
e
d
c
b
a
e d c b a


RHN Fuzzy Logic
62
R0.9 =
(
(
(
(
(
(

1 0 0 0 0
0 1 0 0 0
0 0 1 1 0
0 0 1 1 0
0 . 0 0 0 1
e
d
c
b
a
e d c b a


We see that the second and the third rows are identical. Therefore the partition is

[a], [b, c] [d] and [e]. What it means is that b and c are similar to the extent of 90%.

Similarly,
R0.8 =
(
(
(
(
(
(

1 0 0 0 0
0 1 0 0 0
0 0 1 1 1
0 0 1 1 1
0 . 0 1 1 1
e
d
c
b
a
e d c b a


Therefore, the partition at the level of 0.8 is [a, b, c], [d] and [e].

R0.5 =
(
(
(
(
(
(

1 1 0 0 0
1 1 0 0 0
0 0 1 1 1
0 0 1 1 1
0 . 0 1 1 1
e
d
c
b
a
e d c b a


Partition at the level 0.5 is [a, b, c], [d, e].

Cluster Analysis

In the cluster analysis, partition in sets is called c-partition, c being the number of
clusters into which the data points are clustered. There are two kinds of c-partitions.
One is the hard or crisp c-partition and the other is the soft or fuzzy c-partition. The data
are partitioned such that there is a strong similarity among the data points within blocks
of partition and weak for data in different blocks for this a suitable distance measure
must be defined. There are two basic types of fuzzy classification; fuzzy c- means and
fuzzy equivalence relation based hierarchical clustering.
RHN Fuzzy Logic
63

Cluster Validity

In some classification problems the number c of clusters is not known. In such cases
there may be more than value of c satisfying the condition of classification. Then it is
necessary to find the suitable value of c that gives the most satisfactory results for the
analysis. This is known as the cluster validity.

Fuzzy c-Means Clustering

Consider a universe with n data points to be classified into c clusters. Obviously,
2 c n. (When c = 1, there are no clusters) In the trivial case when c = n, there will be n
clusters each containing one and only one data point. There are two types

In fuzzy clustering, the distance of each data point from the cluster centre is the
criterion.
Let X = {x
1
, x
2
, x
n
} where each x
i
is defined by m features.

Hard c-Means (HCM) clustering

This method of clustering is used to partition data in a crisp sense. Let us define a family
of sets A
i
(i = 1, 2, , c) such that

c
i
i
A
1 =
= X

A
i
A
j
= , i j

c A
i
c X for all i = 1, 2 c.

In function-theoretic terms the above equations are written as

=
< <
= .
= v
n
k
k A
k A k A
k
i all f or x
k all f or x x
k all f or x
i
i
jj i
i
A
1
. 1 ) ( 0
0 ) ( ) (
1 ) (
_
_ _
_


For simplicity sake, we shall denote ) (
k i
x _ by _
ik
. Let U be a matrix with c rows and n
columns with elements _
ij
.

The number q of such matrices is given by the formula

RHN Fuzzy Logic
64
q =
n
c
i
i
i
c
i C
c

=

1
1
) 1 (
!
1


q is the number of hard partitions.

For example, X = {x
1
, x
2
, x
3
, x
4
, x
5
} is a universe with five data points. Then there are

} 2 ) 1 ( 2 [
2
1
5
+ = 15 hard partitions. The matrices corresponding to these partitions are

(

1 1 1 1 0
0 0 0 0 1
,
(

1 1 1 0 1
0 0 0 1 0
,
(

1 1 0 1 1
0 0 1 0 0
,
(

1 0 1 1 1
0 1 0 0 0
,

(

0 1 1 1 1
1 0 0 0 0
,
(

1 1 1 0 0
0 0 0 1 1
,
(

1 1 0 1 0
0 0 1 0 1
,
(

1 0 1 1 0
0 1 0 0 1


(

1 1 1 1 0
1 0 0 0 1
,
(

1 1 0 0 1
0 0 1 1 0
,
(

1 0 1 0 1
0 1 0 1 0
,
(

0 1 1 0 1
1 0 0 1 0
,

(

1 0 0 1 1
0 1 1 0 0
,
(

0 1 0 1 1
1 0 1 0 0

(

0 0 1 1 1
1 1 0 0 0
.

Which of these partitions is best suited? It is not always easy to go through all the
partitions to locate the one that is best suited as the cardinal number could be very
large. For example, when n = 25 and c = 10, the cardinal number is of the order of 10
18
!

An alternative iterative method as explained below is adapted. Let v
i
be the ith cluster
centre. v
i
is a vector of length m.
v
i
= {v
i1
, v
i2
, v
im
}, where v
ij
=

=
=
n
k
ik
n
k
kj ik
1
1
_
_ _
.

Start with a U matrix U
(0)
and iterate it till we obtain two successive which do not differ
from each other by an accepted tolerance limit.

1. Fix c (2 c n). Initialize the U matrix; U
(0)
. Each step is labeled r.
Do r = 0, 1, 2,
2. Find the cluster centres
) (r
i
v .
3. Update U
(r)
. Calculate the characteristic functions for all i, k.

RHN Fuzzy Logic
65
c j all for
otherwise
d d if
r
jk
r
ik r
ik
e

=
=
+
, 0
min( , 1
) ( ) (
) 1 (
_

where d
ik
is the distance of data point x
k
from the ith cluster centre v
i
.

i k i k ik
v x v x d d = = ) ( =

=

m
j
ij kj
v x
1
2
) (

3. If the matrix norm c s
+ ) ( ) 1 ( r r
U U (tolerance level) stop; else r = r + 1 and go to
step 2.

Note: The norm of a matrix A is

=
=
n
j
jk
a
k
A
1
max


Example:

k 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
x
k1
0 0 0 1 1 1 2 3 4 5 5 5 6 6 6
x
k2
0 2 4 1 2 3 2 2 2 1 2 3 0 2 4

Let c = 2 and c = 0.01

A
1
=
)
`

+ + +
15 2 1
854 .
...
854 . 854 .
x x x
and A
2
=
)
`

+ + +
15 2 1
146 .
...
146 . 146 .
x x x


After 6 iterations we get the cluster centres as v
1
= (0.88, 2) and v
2
= (5.14, 2)











RHN Fuzzy Logic
66
7. Conclusion

Fuzzy logic was conceived as a useful tool for solving problems but has proven to be very
efficient for many control system applications since it mimics human control logic. It
uses imprecise instructions to deal with input data more like humans. It can be built into
systems that are small, hand-held products to large computerized control systems.

A control system is an electronic or mechanical system that keeps the output of a
system automatically at a desired level. The thermostat in an iron box or a water heater
is a control system.

Computer based fuzzy logic control is like human logic control. It is not based on
mathematical formulas, but makes use of common sense. And probably because of this,
it is so versatile and simple that any one with a little knowledge can build a system that
is better than the one built by a skilled engineer using conventional methods. And it is
generally much cheaper.

There are thousands fuzzy logic based commercial products, from washing machines
that adjust themselves according to how dirty the clothes are to traffic controllers that
would regulate the traffic at traffic junction according to the density of traffic; from self-
focusing cameras to programs that are used in stock markets.

It is said that a layman can construct a control system that works better than the ones
constructed by experts using classical methods.

Fuzzy logic is not intended to replace the conventional logic. It only supplements.

You might also like