Fuzzylogic 180304090247
Fuzzylogic 180304090247
1
Syllabus
• Fuzzy sets and crisp sets
– Intersections of Fuzzy sets,
– Union of Fuzzy sets,
– The complement of Fuzzy sets.
2
Motivation
• The term “fuzzy logic” refers to a logic of
approximation.
• Boolean logic assumes that every fact is either
entirely true or false.
• Fuzzy logic allows for varying degrees of truth.
• Computers can apply this logic to represent vague
and imprecise ideas, such as “hot”, “tall” or
“balding”.
What is meant by fuzzy?
4
Difference between imprecision and
uncertainty
Consider the following two situations :
1. John has at least two children and I am sure about it.
2. John has three children but I am not sure about it.
5
Uncertainty
• There is uncertainty that arises from ignorance,
from various classes of randomness, from the
inability to perform adequate measurements,
from lack of knowledge, or from vagueness.
6
Types of Uncertainty
7
Ambiguity (vague)
• Food is hot.
• Here hot may be ‘spicy’ or ‘warm’
8
Partial truth
???????????????
9
World of information
10
Introduction
Fuzzy Logic was initiated in 1965, by Dr. Lotfi A. Zadeh,
professor for computer science at the university of
California in Berkley.
13
Can they see each other?
14
Binary logic Vs. Fuzzy logic
15
Fuzzy sets
• It has an ability to classify elements into a continuous
set using the concept of degree of membership.
• Fuzzy set is defined as a set whose elements have
degrees of membership.
• The characteristics function or membership function
not only gives 0 or 1 but can also give values between 0
and 1.
• Value 0-> non-membership
• Value 1->complete membership
• Value between 0 and 1-> degree of membership
16
Example of tumblers
17
Example
• There are following five tumblers, divided into
two classes: full and empty.
• It is obvious: tumbler 1 belongs to the class
full and tumbler 5 belongs to the class empty.
• Then tumblers 2, 3 and 4 belongs to which
class?
• These tumblers are neither 100% full nor
100% empty.
• In other word we can say that tumbler 2 is
75% full, or 25% empty.
18
Example
• Now we define two sets: F and E.
• F is the set of all tumblers that belong to the
class full.
• E is the set of all tumblers that belong to the
class empty.
19
Graphical representation of sets
20
Fuzzy sets
21
Fuzzy Logic
Basically, Fuzzy Logic is a multivalued logic, that allows
intermediate values to be defined between
conventional evaluations like true/false, yes/no,
high/low, etc.
Fuzzy Logic is a superset of conventional (Boolean)
logic that has been extended to handle the concept of
partial truth, i.e. truth values between “completely
true” and “completely false”.
Fuzzy Logic provides a simple way to arrive at a definite
conclusion based upon vague, ambiguous, imprecise,
noisy, or missing input information.
22
Fuzzy Logic Systems
23
Fuzzy Logic Systems
24
Some Fuzzy Logic applications
MASSIVE
28
Membership function
• The membership function is a graphical representation
of the magnitude of participation of each input.
• It associates a weighting with each of the inputs that
are processed, define functional overlap between
inputs, and ultimately determines an output response.
• The rules use the input membership values as
weighting factors to determine their influence on the
fuzzy output sets of the final output conclusion.
• Once the functions are inferred, scaled, and combined,
they are defuzzified into a crisp output which drives
the system.
29
Continued……..
There are different membership functions associated with
each input and output response. Some features to note
are:
• SHAPE - triangular is common, but bell, trapezoidal,
haversine and, exponential have been used. More complex
functions are possible but require greater computing
overhead to implement. HEIGHT or magnitude (usually
normalized to 1) WIDTH (of the base of function),
SHOULDERING (locks height at maximum if an outer
function. Shouldered functions evaluate as 1.0 past their
center) CENTER points (center of the member function
shape) OVERLAP (N&Z, Z&P, typically about 50% of width
but can be less).
•
30
Example
• For the tumbler example, fuzzy set can be
represented as
• Full={(1,1), (2,0.75), (3,0.5), (4,0.25), (5,0)}
31
Fuzzy Sets with Discrete Universes
• Fuzzy set C = “desirable city to live in”
X = {SF, Boston, LA} (discrete and nonordered)
C = {(SF, 0.9), (Boston, 0.8), (LA, 0.6)}
• Fuzzy set A = “sensible number of children”
X = {0, 1, 2, 3, 4, 5, 6} (discrete universe)
A = {(0, .1), (1, .3), (2, .7), (3, 1), (4, .6), (5, .2), (6, .1)}
32
Fuzzy Sets with Cont. Universes
33
Alternative Notation
X is continuous A m A( x) / x
X
34
Characteristics of Fuzzy Sets
– Support(A) = {x X | mA(x) > 0}
The support of fuzzy set, is the crisp set of all points in the
universe of discourse U such that membership function of A is
non zero.
35
Characteristics of Fuzzy Sets
Cardinality
• The cardinality of a fuzzy set A, the so-called SIGMA COUNT, is expressed
as a SUM of the values of the membership function of A, mA(x):
cardA = mA(x1) + mA(x2) + … mA(xn) = ΣmA(xi), for i=1..n
cardA = 1.8
cardB = 2.05
36
Characteristics of Fuzzy Sets
Empty Fuzzy Set
• A fuzzy set A is empty, IF AND ONLY IF:
mA(x) = 0, xX
37
Characteristics of Fuzzy Sets
Alpha-Cut and Strong-alpha cut
• An -cut or -level set of a fuzzy set A X is an ORDINARY SET A X, such
that:
A={mA(x), xX}.
A={mA(x)>, xX}.
38
Characteristics of Fuzzy Sets
Fuzzy singleton
39
Characteristics of Fuzzy Sets
Equality
• Fuzzy set A is considered equal to a fuzzy set B, IF AND ONLY IF:
mA(x) = mB(x), xX
40
Characteristics of Fuzzy Sets
Height
• The height of a fuzzy set ˜A is the maximum
value of the membership function, i.e. max
{μ(x)}.
41
Example 1
42
Solution 1
• Support={2,3,4,5,6,10}
• Crossover point x=4
• Normal point x=10
43
Logical Operations on Fuzzy set
• Fuzzy Intersection
• Fuzzy Union
• Complement
44
Logical Operations on Fuzzy set
m(x)=max(m(x),m(x)), x X
45
Fuzzy Set Operations
Union
• Union of 2 sets is comprised of those elements that belong
to one or both sets.
mAB (X) = max (mA(x), mB(x)) x X
• Example:
Tall = {0/5, 0.2/5.5, 0.5/6, 0.8/6.5, 1/7}
Short = {1/5, 0.8/5.5, 0.5/6, 0.2/6.5, 0/7}
mtall short =
m(x)=min(m(x),m(x)), x X
47
Fuzzy Set Operations
Intersection
• In classical set theory, intersection of 2 sets contains
elements common to both.
• In fuzzy sets, an element may be partially in both sets.
mAB (X) = min (mA(x), mB(x)) x X
• Example:
Tall = {0/5, 0.2/5.5, 0.5/6, 0.8/6.5, 1/7}
Short = {1/5, 0.8/5.5, 0.5/6, 0.2/6.5, 0/7}
mtall short =
Tall and short can mean medium
Highest at the middle and lowest at both end.
Logical Operations on Fuzzy set
mA(x) = 1 - mA(x)
49
Fuzzy Set Operations
Complementation (Not)
51
Solution 2
• Support:
supp(A) = {a, b, c, d }
supp(B) = {a, b, c, d, e }
• Cardinality:
card(A) = 1+0.3+0.2+0.8+0 = 2.3
card(B) = 0.6+0.9+0.1+0.3+0.2 = 2.1
• Complement:
A = {1/a, 0.3/b, 0.2/c 0.8/d, 0/e}
A = {0/a, 0.7/b, 0.8/c 0.2/d, 1/e}
• Union:
A B = {1/a, 0.9/b, 0.2/c, 0.8/d, 0.2/e}
• Intersection:
A B = {0.6/a, 0.3/b, 0.1/c, 0.3/d, 0/e}
52
Example 3
Suppose we have the following (discrete) fuzzy sets:
A = 0.4/1+0.6/2+0.7/3+0.8/4
B = 0.3/1+0.65/2+0.4/3+0.1/4
a) Represent A and B fuzzy sets graphically
b) Calculate the of union of the set A and set B
c) Calculate the intersection of the set A and set B
d) Calculate the complement of the union of A and B
53
Solution (a)
1 1
0.8 0.8
0.6 0.6
0.4 0.4
0.2 0.2
0 0
1 2 3 4 5 1 2 3 4 5
A B
Solution 3
(b) The union of the fuzzy sets A and B
= 0.4/1+0.65/2+0.7/3+0.8/4
(c) The intersection of the fuzzy sets A and B
= 0.3/1+0.6/2+0.4/3+0.1/4
(c) The complement of the fuzzy set A
= 0.6/1+0.4/2+0.3/3+0.2/4
55
Example 4
Given two fuzzy sets A and B
c
Intersection min (A, B) 0.0 / - 2 0.3 / - 1 0.6 / 0 1.0 / 1 0.5 / 2 0.2 / 3 0.0 / 4
d
Complement of (b) 1 - max(A, B) 0.9 / - 2 0.6 / - 1 0.3 / 0 0.0 / 1 0.4 / 2 0.7 / 3 1.0 / 4
Math Operations on Fuzzy Set
• kA = {kmA(x), xX}
Let k =0.5, and
A = {0.5/a, 0.3/b, 0.2/c, 1/d}
then
kA = {0.25/a, 0.15/b, 0.1/c, 0.5/d}
• Am = {mA(x)m, xX}
Let m =2, and
A = {0.5/a, 0.3/b, 0.2/c, 1/d}
then
Am = {0.25/a, 0.09/b, 0.04/c, 1/d}
• …
59
Example 5
There are two fuzzy subsets of the set X = {a, b, c, d, e }:
A = {1/a, 0.3/b, 0.2/c 0.8/d, 0/e} and B = {0.6/a, 0.9/b, 0.1/c,
0.3/d, 0.2/e}.
Find the kA, Am and α-cut. K=0.5 and m=2
60
Solution 5
• kA:
for k=0.5
kA = {0.5/a, 0.15/b, 0.1/c, 0.4/d, 0/e}
• Am:
for m=2
Aa = {1/a, 0.09/b, 0.04/c, 0.64/d, 0/e}
• α-cut:
A0.2 = {a, b, c, d}
A0.3 = {a, b, d}
A0.8 = {a, d}
A1 = {a}
61
Example 6
A = {0.2/a, 0.4/b, 1/c, 0.8/d, 0/e}
B = {0/a, 0.9/b, 0.3/c, 0.2/d, 0.1/e}
62
Solution 6
A = {0.2/a, 0.4/b, 1/c, 0.8/d, 0/e}
B = {0/a, 0.9/b, 0.3/c, 0.2/d, 0.1/e}
Support
Supp(A) = {a, b, c, d}
Supp(B) = {b, c, d, e}
Core
Core(A) = {c}
Core(B) = {}
Cardinality
Card(A) = 0.2 + 0.4 + 1 + 0.8 + 0 = 2.4
Card(B) = 0 + 0.9 + 0.3 + 0.2 + 0.1 = 1.5
Complement
Comp(A) = {0.8/a, 0.6/b, 0/c, 0.2/d, 1/e}
Comp(B) = {1/a, 0.1/b, 0.7/c, 0.8/d, 0.9/e}
63
Solution 6 cont....
A = {0.2/a, 0.4/b, 1/c, 0.8/d, 0/e}
B = {0/a, 0.9/b, 0.3/c, 0.2/d, 0.1/e}
Union
AB = {0.2/a, 0.9/b, 1/c, 0.8/d, 0.1/e}
Intersection
AB = {0/a, 0.4/b, 0.3/c, 0.2/d, 0/e}
C=A2
C = {0.04/a, 0.16/b, 1/c, 0.64/d, 0/e}
D = 0.5B
D = {0/a, 0.45/b, 0.15/c, 0.1/d, 0.05/e}
E = A0.5
E = {c, d}
64
Algebraic Operations on Fuzzy Set
Algebraic Product
• The product of two fuzzy sets in the same
universe of discourse is the new fuzzy set A.B
with a membership function that equal
product of the membership function of A and
the membership function of B.
65
Algebraic Operations on Fuzzy Set
Multiplying a fuzzy set by a crisp number
• When a fuzzy set A is multiplied by a crisp number a,
then its membership function is given by
ma.A(x) =amA(x)
66
Algebraic Operations on Fuzzy Set
Cartesian product
• The Cartesian product of two fuzzy sets A & B is a
fuzzy set C denoted by A X B and defined as
C=A X B= mc(x)/(a,b) |a A, b B
mc(C)=min(mA(a) ,mB(b) )
67
Algebraic Operations on Fuzzy Set
Algebraic Sum
The Algebraic sum of two fuzzy sets A & B is a fuzzy
set C denoted by A + B and defined as
68
Algebraic Operations on Fuzzy Set
Bounded Sum
• The bounded sum of two fuzzy sets A and B in
the universes X and Y with the membership
functions μA(x) and μB(x) respectively is
defined by
70
Algebraic Operations on Fuzzy Set
Bounded difference
• The bounded of difference of two fuzzy sets A
and B is a fuzzy set C denoted by
71
Example 7
• Let us consider two fuzzy sets
A={(1,0.6),(2,1.0),(3,0.5),(4,0.3),(5,0.8)
B={(2,0.5),(3,0.7)}
Find out the Algebraic product, Cartesian
product, Algebraic sum, Bounded Sum,
Bounded difference.
72
Solution 7
73
Solution 7 cont…….
74
Solution 7 cont…….
75
Properties of Fuzzy sets
1. Associative Property
2. Commutative Property
3. Distributive Property
4. Idem Potency
5. Identity
6. Transitive
7. Involution
8. Demorgan’s Law
76
Properties of Fuzzy sets
Associative Property
A∪ (B ∪ C) = (A ∪ B) ∪C
or
max [μ A(X), max{μ B(Y), μ C(Z)}] = max[ {max {μ A(x), μ B(Y)}, μ C(Z)]
and A ∩ (B ∩ C) = (A ∩ B) ∩C
or
min [μ A(X), min{μ B(Y), μ C(Z)}] = min[ {min {μ A(x), μ B(Y)}, μ C(Z)]
77
Properties of Fuzzy sets
Commutative Property
78
Properties of Fuzzy sets
Distributive Property
79
Properties of Fuzzy sets
Idem Potency
80
Properties of Fuzzy sets
Identity
81
Properties of Fuzzy sets
Transitive
82
Properties of Fuzzy sets
Involution
A’’=A
83
Properties of Fuzzy sets
Demorgan’s Law
84
Prove
85
Solution
86
Solve
87
Solve
88
Solve
1. For the given fuzzy set
90
Solution
91
Solve
92
Solve
93
Solve
94
Solve
95
Solution
96
Solve
97
Solve
98