Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 51

AIDS-II

Module 3: Fuzzy Logic & Its Applications

Faculty Name :
Faculty Name: Ms. Jyoti Deone
Index

Introduction to Fuzzy Sets, Properties of Fuzzy Sets, Operations on Fuzzy Sets,

Fuzzy Membership Functions, Fuzzy Relations with Operations and its Properties

Fuzzy Composition: Max-Min Composition, Max-Product Composition,

Defuzzification Methods, Architecture of Mamdani Type Fuzzy Control System,

Design of Fuzzy Controllers like Domestic Shower Controller,

Washing Machine Controller, Water Purifier Controller , etc.

2
Lecture 1

Introduction to Fuzzy Sets, Properties of


Fuzzy Sets, Operations on Fuzzy Sets,
What Is Fuzzy Logic?

 The 'Fuzzy' word means the things that are not clear.


 Any event, process, or function that is changing continuously
cannot always be defined as either true or false, which means that
we need to define such activities in a Fuzzy manner.
 This concept was introduced by Lofti Zadeh in 1965 based on
the Fuzzy Set Theory. This concept provides the possibilities
which are not given by computers, but similar to the range of
possibilities generated by humans.

4
Cont..

• In the Boolean system, only two possibilities (0 and 1) exist, where 1 denotes
the absolute truth value and 0 denotes the absolute false value. But in the
fuzzy system, there are multiple possibilities present between the 0 and 1,
which are partially false and partially true.
Classical Set Theory

Mathematical Representation of a Set


Sets can be represented in two ways −
1. Roster or Tabular Form
• In this form, a set is represented by listing all the elements comprising it.
The elements are enclosed within braces and separated by commas.
• Following are the examples of set in Roster or Tabular Form −
• Set of vowels in English alphabet, A = {a,e,i,o,u}
• Set of odd numbers less than 10, B = {1,3,5,7,9}
2. Set Builder Notation

• In this form, the set is defined by specifying a property that elements of the set
have in common. The set is described as A = {x:p(x)}
• Example 1 − The set {a,e,i,o,u} is written as
• A = {x:x is a vowel in English alphabet}
• Example 2 − The set {1,3,5,7,9} is written as
• B = {x:1 ≤ x < 10 and (x%2) ≠ 0}
• If an element x is a member of any set S, it is denoted by x∈S and if an element
y is not a member of set S, it is denoted by y∉S.
• Example − If S = {1,1.2,1.7,2},1 ∈ S but 1.5 ∉ S
Types of Classical Sets

• Sets can be classified into many types; some of which are finite, infinite, subset, universal,
proper set, etc.
1. Finite Set
• A set which contains a definite number of elements is called a finite set.
• Example − S = {x|x ∈ N and 70 > x > 50}
2. Infinite Set
• A set which contains infinite number of elements is called an infinite set.
• Example − S = {x|x ∈ N and x > 10}

3. Subset
• A set X is a subset of set Y (Written as X ⊆ Y) if every element of X is an element of set Y.
• Example 1 − Let, X = {1,2,3,4,5,6} and Y = {1,2}. Here set Y is a subset of set X as all the elements
of set Y is in set X. Hence, we can write Y⊆X.
• Example 2 − Let, X = {1,2,3} and Y = {1,2,3}. Here set Y is a subset (not a proper subset) of set X
as all the elements of set Y is in set X. Hence, we can write Y ⊆X.
Cont..

4. Proper Subset
• The term “proper subset” can be defined as “subset of but not equal to”. A Set X is a
proper subset of set Y (Written as X ⊂ Y) if every element of X is an element of set Y
and |X| < |Y|.
• Example − Let, X = {1,2,3,4,5,6} and Y = {1,2}. Here set Y ⊂ X, since all elements in Y
are contained in X too and X has at least one element which is more than set Y.
5. Universal Set
• It is a collection of all elements in a particular context or application. All the sets in
that context or application are essentially subsets of this universal set. Universal sets
are represented as U.
• Example − We may define U as the set of all animals on earth. In this case, a set of all
mammals is a subset of U, a set of all fishes is a subset of U, a set of all insects is a
subset of U, and so on.
Cont..

6. Empty Set or Null Set


• An empty set contains no elements. It is denoted by Φ. As the number of elements in an
empty set is finite, empty set is a finite set. The cardinality of empty set or null set is zero.

• Example – S = {x|x ∈ N and 7 < x < 8} = Φ


7. Equal Set
• If two sets contain the same elements, they are said to be equal.
• Example − If A = {1,2,6} and B = {6,1,2}, they are equal as every element of set A is an
element of set B and every element of set B is an element of set A.
8. Equivalent Set
• If the cardinalities of two sets are same, they are called equivalent sets.
• Example − If A = {1,2,6} and B = {16,17,22}, they are equivalent as cardinality of A is
equal to the cardinality of B. i.e. |A| = |B| = 3
Cont..

9. Overlapping Set
• Two sets that have at least one common element are called overlapping sets. In case
of overlapping sets −
• Example − Let, A = {1,2,6} and B = {6,12,42}. There is a common element ‘6’, hence
these sets are overlapping sets.
10. Disjoint Set
• Two sets A and B are called disjoint sets if they do not have even one element in
common. Therefore, disjoint sets have the following properties −
Example − Let, A = {1,2,6} and B = {7,9,14}, there is not a single common element, hence these sets
are overlapping sets.
Operations on Classical Set

Following are the various operations which are performed on the classical sets:

1. Union Operation
2. Intersection Operation
3. Difference Operation
4. Complement Operation
Cont..

1.Union
The union of sets A and B (denoted by A ∪ BA ∪ B) is the set of elements which are in A,
in B, or in both A and B. Hence, A ∪ B = { x | x ∈ A OR x ∈ B }
• Example − If A = {10,11,12,13} and B = {13,14,15}, then A ∪ B = {10,11,12,13,14,15} – The
common element occurs only once.
2. Intersection
• The intersection of sets A and B (denoted by A ∩ B) is the set of elements which are in
both A and B. Hence, A ∩ B = {x|x ∈ A AND x ∈ B}.
3. Difference Operation

• This operation is denoted by (A - B). A-B is the set of only those elements which
exist only in set A but not in set B.
• It can be described as: A - B = { x | x ∈ A AND x ∉ B }.
4. Complement Operation: This operation is denoted by (A′). It is applied on a
single set. A′ is is the set of elements which do not exist in set A.
• It can be described as: A′ = {x|x ∉ A}.
Properties of Classical Set
1. Commutative Property: 5. Transitive property
A∪B=B∪A If A ⊆ B ⊆ C, then A ⊆ C
A∩B=B∩A 6. De Morgan's Law
2. Associative Property:
A ∪ (B ∪ C) = (A ∪ B) ∪ C
A ∩ (B ∩ C) = (A ∩ B) ∩ C
3. Idempotency Property:
A∪A=A
A∩A=A
4. Distributive Property:
A∪ (B ∩ C) = (A ∪ B)∩ (A ∪ C)
A∩ (B ∪ C) = (A∩B) ∪ (A∩C)
Fuzzy Set

• The set theory of classical is the subset of Fuzzy set theory. Fuzzy logic is
based on this theory, which is a generalisation of the classical theory of set
(i.e., crisp set) introduced by Zadeh in 1965.
• Fuzzy sets are denoted or represented by the tilde (~) character.
•  fuzzy set (Ã) is a pair of U and M, where U is the Universe of discourse and M is
the membership function which takes on values in the interval [ 0, 1 ].
 

16
Operations on Fuzzy Set
Given à and B are the two fuzzy sets, and X be the universe of discourse with the
following respective member functions:
1. Union Operation: The union operation of a fuzzy set is defined by:
μA∪B(x) = max (μA(x), μB(x))
Example:
Let's suppose A & B is a set which contains following elements:
A = {( X1, 0.6 ), (X2, 0.2), (X3, 1), (X4, 0.4)}
B = {( X1, 0.1), (X2, 0.8), (X3, 0), (X4, 0.9)}
then,
AUB = {( X1, 0.6), (X2, 0.8), (X3, 1), (X4, 0.9)}
Because, according to this operation
For X1
μA∪B(X1) = max((μA(X1), μB(X1))
μA∪B(X1) = max (0.6, 0.1)
μA∪B(X1) = 0.6
17
Cont..

2. Intersection Operation: The intersection operation of fuzzy set is defined by:

μA∩B(x) = min (μA(x), μB(x))


Consider set A = {( X1, 0.3 ), (X2, 0.7), (X3, 0.5), (X4, 0.1)}
And B = {( X1, 0.8), (X2, 0.2), (X3, 0.4), (X4, 0.9)}
Then, A∩B = {( X1, 0.3), (X2, 0.2), (X3, 0.4), (X4, 0.1)}

3. Complement Operation: The complement operation of fuzzy set is defined by:

μĀ(x) = 1-μA(x),
Let's suppose A is a set which contains following elements:
A = {( X1, 0.3 ), (X2, 0.8), (X3, 0.5), (X4, 0.1)}
Then, Ā= {( X1, 0.7 ), (X2, 0.2), (X3, 0.5), (X4, 0.9)}
4. Difference Operation:
μ A | B(x) = μ A ∩ B
18
= min (μA(x), μB(x))
Graphical representation of operations

19
Properties of Fuzzy Sets

1. Commutative Property
• Having two fuzzy sets A˜and B˜, this property states
• A˜∪B˜=B˜∪A˜
• A˜∩B˜=B˜∩ A˜
2. Distributive Property
• Having three fuzzy sets A˜, B˜ and C˜, this property states −
• A˜∪(B˜∩C˜)=(A˜∪B˜)∩(A˜∪C˜)
• A˜∩(B˜∪C˜)=(A˜∩B˜)∪(A˜∩C˜)

20
3. Idempotency Property
• For any fuzzy set A˜A~, this property states −
• A˜∪A˜=A˜
• A˜∩A˜=A˜

21
EX1:

A~ ={1/2.0 + .65/4.0 +0.5/6.0 + 0.35/8.0 + 0/10.0 }


B~ ={0/2.0 + 0.35/4.0 + 0.5/6.0 + 0.65/8.0 + 1/10.0}
Find the following
1.

22
23
24
More operations on fuzzy sets

25
Classical and fuzzy relations

• Crisp relations
• Operation on crisp relation
• Examples
• Fuzzy relations

26
Classical Relation

 Fuzzy relation defines the mapping of variables from one fuzzy set to


another.
 A X B is not equal to B X A
 |A X B| = |A| X |B|
 Cartesian product of two set is not same as the arithmetic product of
two or more sets

27
EX :Consider the two crisp set A & B

A = { 2,4,6,8}
B = {3,7,8,9 }

Cartesian product of two sets

A X B = { (2,3),(2,7),(2,8),(2,9)
(4,3),(4,7),(4,8),(4,9)
(6,3),(6,7),(6,8),(6,9)
(8,3),(8,7),(8,8),(8,9)
}

R ={ (a,b) | a=b-1; (a,b) E A X B }

28
Cont..

• We can calculate the relation R from above Cartesian


product

• R= { (2,3) ,(8, 9) }
• We can represent R in a matrix form is as

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

29
2. Mapping Representation

2 3

4 7

6 8

8 9

30
Operation on crisp relations

• Let R and S be two separate relation on Cartesian A X B defined over two crisp
sets a E A and b E B

1. Union
R(a,b) U S(a,b) = max(R(a,b),S(a,b))

2.Intersection
R(a,b)  S(a,b) = min(R(a,b),S(a,b))

3. Complement
R(a,b) = 1- R(a,b)
4. Difference
A | B= A  B
B|A= B A

31
EX 2

A = { 2,4,6,8}
B = {3,7,8,9 }

Cartesian product of two sets

A X B = { (2,3),(2,7),(2,8),(2,9)
(4,3),(4,7),(4,8),(4,9)
(6,3),(6,7),(6,8),(6,9)
(8,3),(8,7),(8,8),(8,9)
}

R ={ (a,b) | a=b-1; (a,b) E A X B }


S ={ (a,b) | b=a; (a,b) E A X B }

32
Cont..

R S

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

33
find following
1. Union R U S 2. Intersection R  S

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

34
 we can also define the relation over fuzzy sets.
 Let A be a fuzzy set on universe X and B be a fuzzy set on universe Y, then the Cartesian
product between fuzzy sets A and B will result in a fuzzy relation R which is contained
with the full Cartesian product space or it is subset of cartesian product of fuzzy subsets.
 Formally, we can define fuzzy relation as,

R = A x B and R ⊂ (X x Y

35
Fuzzy Composition: Max-min and Max-product
Fuzzy Composition: Max-min and Max-product

Fuzzy composition
• Fuzzy composition can be defined just as it is for crisp (binary) relations.
Suppose R is a fuzzy relation on X × Y, S is a fuzzy relation on Y × Z, and T is a
fuzzy relation on X × Z; then,
1. Fuzzy Max–Min composition is defined as:

• T = R ∘ S = μT(x, z)

•  Max{[ min ( μR(x, y) , μS(y, z) ) ]}

2. Fuzzy Max–Product composition is defined as:

• T = R ∙ S = μT(x, z)

• Max{ [ μR(x1, y1) ∙ μS(y1, z1)] , [ μR(x1, y2) ∙ μS(y2, z1)] }

37
Find the resulting relation, T which relates elements of universe X to
elements of universe Z, i.e., defined on Cartesian space X × Z
Using Max–Min composition and
Using Max-Product composition

38
Sol-

39
Max-Min Composition:

• T = R ∘ S = μT(x, z) 

• μT(x1, z1) = max ( min( μR(x1, y1), μS(y1, z1)), min( μR(x1, y2), μS(y2, z1)) )

= max(min(0.7, 0.8), min(0.6, 0.1)) = max(0.7, 0.1) = 0.7

• μT(x1, z2) = max ( min( μR(x1, y1), μS(y1, z2)), min( μR(x1, y2), μS(y2, z2)) )

= max(min(0.7, 0.5), min(0.6, 0.6)) = max(0.5, 0.6) = 0.6

• μT(x1, z3) = max ( min( μR(x1, y1), μS(y1, z3)), min( μR(x1, y2), μS(y2, z3)) )

= max(min(0.7, 0.4), min(0.6, 0.7)) = max(0.4, 0.6) = 0.6

• μT(x2, z1) = max ( min( μR(x2, y1), μS(y1, z1)), min( μR(x2, y2), μS(y2, z1)) )

= max(min(0.8, 0.8), min(0.3, 0.1)) = max(0.8, 0.1) = 0.8

• μT(x2, z2) = max ( min( μR(x2, y1), μS(y1, z2)), min( μR(x2, y2), μS(y2, z2)) )

= max(min(0.8, 0.5), min(0.3, 0.6)) = max(0.5, 0.3) = 0.5


40
• μT(x2, z3) = max ( min( μR(x2, y1), μS(y1, z3)), min( μR(x2, y2), μS(y2, z3)) )
Cont..

• So we got final Max-Min Composition of relations

41
2. Max-Product Composition:
T = R ∙ S = μT(x, z)

• μT(x1, z1) = max ( (μR(x1, y1) × μS(y1, z1)), ( μR(x1, y2) × μS(y2, z1)) )

= max((0.7 × 0.8), (0.6 × 0.1)) = max(0.56, 0.06) = 0.56

• μT(x1, z2) = max ( ( μR(x1, y1) × μS(y1, z2)), ( μR(x1, y2) × μS(y2, z2)) )

= max( (0.7 × 0.5), (0.6 × 0.6)) = max(0.35, 0.36) = 0.36

• μT(x1, z3) = max ( ( μR(x1, y1) × μS(y1, z3)), ( μR(x1, y2) × μS(y2, z3)) )

= max((0.7 × 0.4), (0.6 × 0.7)) = max(0.28, 0.42) = 0.42


• μT(x2, z1) = max ( ( μR(x2, y1) × μS(y1, z1)), ( μR(x2, y2) × μS(y2, z1)) )
= max((0.8 × 0.8), min(0.3 × 0.1)) = max(0.64, 0.03) = 0.64

• μT(x2, z2) = max ( ( μR(x2, y1) × μS(y1, z2)), ( μR(x2, y2) × μS(y2, z2)) )

= max((0.8 × 0.5), (0.3 × 0.6)) = max(0.4, 0.18) = 0.40


• μT(x2, z3) = max ( ( μR(x2, y1) × μS(y1, z3)), ( μR(x2, y2) × μS(y2, z3)) )
42 = max((0.8 × 0.4), (0.3 × 0.7)) = max(0.32, 0.21) = 0.32
Cont..

• So we got resultant Max-Product composition as follows:

43
Lecture

Tolerance and Equivalence Relations


Types of Relations

1. Reflexive Relation: A relation R on set A is said to be a reflexive if (a, a)


∈ R for every a ∈ A.
• Example: If A = {1, 2, 3, 4} then R = {(1, 1) (2, 2), (1, 3), (2, 4), (3, 3), (3,
4), (4, 4)}. Is a relation reflexive?
2. Symmetric Relation: A relation R on set A is said to be symmetric iff (a, b)
∈ R ⟺ (b, a) ∈ R.
• Example: Let A = {1, 2, 3} and R = {(1, 1), (2, 2), (1, 2), (2, 1), (2, 3), (3,
2)}. Is a relation R symmetric or not?
3. Transitive Relations: A Relation R on set A is said to be transitive iff (a, b)
∈ R and (b, c) ∈ R ⟺ (a, c) ∈ R.
• Example1: Let A = {1, 2, 3} and R = {(1, 2), (2, 1), (1, 1), (2, 2)}. Is the
relation transitive?

45
Equivalence Relations

A relation R on a set A is called an equivalence relation if it


satisfies following three properties:
• Relation R is Reflexive, i.e. aRa ∀ a∈A.
• Relation R is Symmetric, i.e., aRb ⟹ bRa
• Relation R is transitive, i.e., aRb and bRc ⟹ aRc.

46
Reflexivity:

• Consider the universe X = {1, 2, 3}. The fuzzy relation R defined over X


is,
• As we can see that μR(1, 1) = μR(2, 2) = μR(3, 3) = 1.

• This relation holds the condition μR(x, x) = 1 for all x in X. So this is


reflexive relation.

47
Symmetricity:

Relation R is called symmetric if element x is related to element y then


element y must be related to x, i.e. μR(x, y) = μR(y, x), ∀x, y ∈ X
Example:
Consider the universe X = {1, 2, 3}. The fuzzy relation R defined over X
is,

As we can see that the transpose of relation matrix R is the matrix it self. So
the given relation is symmetric relation.

48
Transitivity:

For fuzzy relation:

• Let λ1= μR(xi, xj ), λ2= μR(xj, xk) and λ = μR(xi, xk)

• For fuzzy relation to be transitive, λ ≥ min⁡(λ1, λ2 ) for all λ

How to test transitivity?


• We can compute R2 by taking composition of relation R with it self,
i.e. R2= R ∘ R

• μR2(x, z) = max( μR(x, y), μR(y, z) ) where y ∈ X

• R is transitive if R2 ⊂ R, i.e. μR2(x, y) ≤ μR(x, y)

49
Example

• Check if given relation is transitive or not?

Solution:
to check the transitivity of relation R, we shall compute R2

As μR2(x, y) is not always less than or equal to μR(x, y), for all (x, y), hence R is not
transitive

50
Thank You

You might also like