Soft Computing UNIT -I
Introduction to Soft Computing
4th Semester CSE (AR-21)
1 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024
Soft Computing Lecture -3
Outline of the Lecture
Fuzzy Logic
Membership Function
Basic Fuzzy Set Operations
2 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024
Soft Computing Membership Function
A fuzzy set is completely characterized by its membership function
(sometimes abbreviated as MF and denoted as). So it would be
important to learn how a MF can be expressed.
A membership function can be on
a) a discrete universe of discourse and
b) a continuous universe of discourse.
Ex:
Number of children (X) → Age (X) →
3 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024
Soft Computing Membership Function
So, membership function on a discrete universe of course is trivial.
However, a membership function on a continuous universe of
discourse needs a special attention.
Ex: Following figure shows typical examples of membership
function.
Triangular Trapezoidal Curve
Non-Uniform Non-Uniform
4 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024
Soft Computing Membership Function
So the previous diagrams shows typical form of fuzzy set usually
considered in our fuzzy system of fuzzy theorem.
How such a fuzzy set can be better described in some mathematical
notation so that we can process them in our future fuzzy system
design.
How a MF can be mathematically described and that mathematical
specification can be used to process in subsequent requirement will be
discuss in “Fuzzy MF Formulation and Parameterization”.
5 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024
Soft Computing Membership Function
In the following, we try to parameterize the different MFs on a
continuous universe of discourse.
A Triangular MF is specified by three parameters {a, b, c} and can be
formulated as follows:
Triangle(x; a, b, c) =
A Trapezoidal MF is specified by four parameters {a, b, c, d} and
canbe defined as follows:
Trapezoid(x; a, b, c, d) =
6 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024
Soft Computing Membership Function
A Gaussian MF is specified by two parameters {c, σ} and can be
defined as below:
Gaussian(x; c, σ) =
A Bell MF is also called Cauchy MF. A generalized bell MF is
specified by three parameters {a, b, c} and is defined as:
Bell(x; a, b, c)=
7 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024
Soft Computing Membership Function
A Sigmoid MF is specified by two Parameters: {a, c} ;
where c = crossover point and a = slope at c;
Sigmoid(x; a, c) =
8 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024
Soft Computing Example of Grading System
Example : Consider the following grading system for a course.
Excellent = Marks 90
Very good = 75 Marks 90
Good = 60 Marks 75
Average = 50 Marks 60
Poor = 35 Marks 50 A fuzzy implementation will
Bad= Marks 35 look like the following.
You can
decide a
standard
fuzzy MF for
each of the
fuzzy garde.
9 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024
Soft Computing Operation on Fuzzy Set
As we have learned fuzzy set (FS). FS is basic elements in fuzzy
system. So, we learn different operation on FS like the operation there
in CS.
Union operation of two FS
Intersection operation of two FS
Complements operation of FS
If two FS are A & B, then the union of two FS denoted by the symbol
. Here, we need to take maximum of two values of the membership.
If two FS are A or B, then the intersection of two FS Denoted by
symbol . Here, we need to take minimum of two values of the
membership.
Union and intersection are binary operation where, complement
operation is a unary operation which is applicable to one FS.
10 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024
Soft Computing Union () Operation
Union (A B): μAB(x) = max{μA(x), μB(x)}
Example:
A = {(x1, 0.5), (x2, 0.1), (x3, 0.4)} and
B = {(x1, 0.2), (x2, 0.3), (x3, 0.5)};
C = A B = {(x1, 0.5), (x2, 0.3), (x3, 0.5)}
11 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024
Soft Computing Intersection () Operation
Intersection (A B): μAB(x) = min{μA(x), μB(x)}
Example:
A = {(x1, 0.5), (x2, 0.1), (x3, 0.4)} and
B = {(x1, 0.2), (x2, 0.3), (x3, 0.5)};
C = AB = {(x1, 0.2), (x2, 0.1), (x3, 0.4)}
12 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024
Soft Computing Compliment Operation
Complement (AC):
μ Ac (x) = 1- μA(x)
Example:
A = {(x1, 0.5), (x2, 0.1), (x3, 0.4)}
C = AC = {(x1, 0.5), (x2, 0.9), (x3, 0.6)}
13 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024
Soft Computing Basic Fuzzy Set Operations
Algebraic product or Vector product (A∙B):
A(x).B(x) = {(x, µA(x).µB(x)), x ϵ X }
Eg-A(x)={(x1,0.1),(x2,0.2),(x3,0.3),(x4,0.4)}
B(x)={(x1,0.5),(x2,0.7),(x3,0.8),(x4,0.9)}
A(x).B(x) ={(x1,0.05),(x2,0.14),(x3,0.24),(x4,0.36)}
Algebraic sum of two fuzzy sets (sum)–
The Algebraic sum of two fuzzy sets A(x) and B(x) for all x ∈ X, is
denoted by A(x)+B(x) and defined as follows –
A(x)+B(x)= {(x,µA+B(x), x ϵ X }
Where µA+B(x) = µA(x)+µB(x) - µA(x).µB(x)
A(x)={(x1,0.1),(x2,0.2),(x3,0.3),(x4,0.4)}
B(x)={(x1,0.5),(x2,0.7),(x3,0.8),(x4,0.9)}
Now (x)+B(x) = {(x1,0.55),(x2,0.76),(x3,0.86),(x4,0.94)}
14 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024
Soft Computing
Algebraic difference between two fuzzy sets-
The Algebraic deference of two fuzzy sets A(x) and B(x) for all
x ∈ X, is denoted as follows
A(x) - B(x)= {(x,µA-B(x), x ϵ X }
μA–B(x) = μABc (x)
A(x)={(x1,0.1),(x2,0.2),(x3,0.3),(x4,0.4)}
B(x)={(x1,0.5),(x2,0.7),(x3,0.8),(x4,0.9)}
B̅ (x) = {(x1,0.5),(x2,0.3),(x3,0.2),(x4,0.1)}
A(x) - B(x) = {(x1,0.1),(x2,0..2),(x3,0.2),(x4,0.1)}
15 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024
Soft Computing
Bounded Sum:
The bounded sum of two fuzzy sets A(x) and B(x) for all x ∈ X,
is denoted by | A(x) ⊕ B(x) | and defined as follows
μ|A(x)⊕B(x)| = min{1, μA(x) + μB(x)}
Bounded Difference:
The bounded difference of two fuzzy sets A(x) and B(x) for all x
∈ X, is denoted by
| A(x) ⊖ B(x) | and defined as follows-
μ|A(x)⊖B(x)| = max{0, μA(x) + μB(x) – 1}
Eg-A(x)={(x1,0.1),(x2,0.2),(x3,0.3),(x4,0.4)} B(x)={(x1,0.5),
(x2,0.7),(x3,0.8),(x4,0.9)}
| A(x) ⊖ B(x) |={(x1,0),(x2,0),(x3,0.1),(x4,0.3)}
16 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024
Soft Computing Basic Fuzzy Set Operations: Equality & Power
Disjunctive sum: A⊕B
A⊕B =((AC B) (A BC))
Eg-A(x)={(x1,0.4),(x2,0.8)}
Complement of A(x)={(x1,0.6),(x2,0.2)}
B(x)={(x1,0.2),(x2,0.6)}
Complement of B(x)={(x1,0.8),(x2,0.4)}
A⊕B={(x1,0.4),(x2,0.4)}
Equality (A = B):
μA(x) = μB(x)
A(x)={(x1,0.5),(x2,0.4)}
B(x)={(x1,0.8),(x2,0.4)}
C(x)={(x1,0.5),(x2,0.4)}
Here we can say that fuzzy set A and C are equal
17 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024
Soft Computing
Power of a fuzzy set A:
The α power of a fuzzy set A is a new fuzzy set Aα whose
membership function is given by-
μAα(x) = (μA(x))α
Eg- A={(x1,0.4),(x2,0.2)}
For α=2
μA2(x) = (μA(x))2
Hence- A2 ={(x1,0.16),(x2,0.04)}
If α < 1, then it is called dilation.
If α > 1, then it is called concentration.
18 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024
Soft Computing Basic Fuzzy Set Operations
Example:
A = {(x1, 0.5), (x2, 0.1), (x3, 0.4)} and
B = {(x1, 0.2), (x2, 0.3), (x3, 0.5)};
Union (A B): μAB(x) = max{μA(x), μB(x)}
C = A B = {(x1, 0.5), (x2, 0.3), (x3, 0.5)}
Intersection (A B): μAB(x) = min{μA(x), μB(x)}
C = AB = {(x1, 0.2), (x2, 0.1), (x3, 0.4)}
Complement (AC): μ Ac (x) = 1- μA(x)
C = AC = {(x1, 0.5), (x2, 0.9), (x3, 0.6)}
19 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024
Soft Computing Properties of Fuzzy & Crisp Sets
Commutativity :
∼ ∼ ∼ ∼
A B=B A
A B=BA
Associativity :
A (B C) = (A B) C
A (B C) = (A B) C
Distributivity :
A (B C) = (A B) (A C)
A (B C) = (A B) (A C)
Idempotence :
A A=A
A A=A
Transitivity :
If A B, B C then A C
Involution :
(AC)C = A
20 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024
Soft Computing Properties of Fuzzy & Crisp Sets
Identity:
A ϕ=A
A ϕ=ϕ
A X=X
A X=A
Law of Absorption:
A ∪ (A B) = A
A (A ∪ B) = A
De Morgan’s law:
(A B)C = AC BC
(A B)C = AC BC
Excluded middle laws:
A ∪ Ac = X
Contradiction laws:
A Ac = ∅
Only excluded middle laws doesn’t holds good for Fuzzy set
PropertyDepartment of CSE, GIET University, Gunupur
21 Saturday, May 4, 2024
Soft Computing Fuzzy Set Operation
Consider the following two fuzzy sets A and B defined over a universe
of discourse [0,5] of real numbers with their membership functions
μA(x) = and μB(x) = 2-x
Determine the membership functions of the following and draw them
graphically.
i. Ac , Bc
ii. A B
iii. A B
iv. (A B)c
22 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024
Soft Computing Fuzzy Set Operation Example
Two fuzzy sets A and B with membership functions μA(x) and μB(x),
respectively defined as below.
A = Cold climate with μA(x) as the M.F.
B = Hot climate with μB(x) as the M.F.
Here, X being the universe of discourse representing entire range of
temperatures.
23 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024
Soft Computing Fuzzy Set Operation Example
What are the fuzzy sets representing the following?
Not Cold climate
Not Hot climate
Extreme climate
Pleasant climate
Note: Note that ”Not Cold climate” ”Hot climate” and vice-versa.
24 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024
Soft Computing Fuzzy Set Operation Example
Answer would be the following.
1 Not cold climate
A with 1 - μA(x) as the M.F.
2 Not hot climate
B with 1 - μB(x) as the M.F.
3 Extreme climate
A B with μAB(x) = max(μA(x), μB(x)) as the M.F.
4 Pleasant climate
A B with μAB(x) = min(μA(x), μB(x)) as the M.F.
The plot of the M.F.s of A B and A B are shown in the following.
25 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024
Soft Computing Classical and Fuzzy Set
A set is defined as a collection of objects, which share certain
characteristics.
A classical set is a collection of distinct objects -- set of negative
integers, set of persons with height<6 ft, days of the week etc.
Each individual entity in a set is called a member or an element
of the set.
The Classical set is defined in such a way that the Universe of
Discourse is split into 2 groups: members and Nonmembers
A classical set is a container that wholly includes or wholly
excludes any given element. For example, the set of days of the
week unquestionably includes Tuesday, Wednesday, and Saturday.
It just as unquestionably excludes butter, liberty, shoe polish, and
so on.
It was Aristotle who first formulated the Law of the Excluded
Middle, which says X must either be in set A or in set not-A, ie.,
Of any subject, one thing must be either asserted or denied
26 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024
Soft Computing Crisp Relation
In classical relations (crisp relations), Relationships between
elements of the sets are only in two degrees; “completely related”
and “not related”.
Fuzzy relations take on an infinitive number of degrees of
relationships between the extremes of “ completely related” and
“not related”
To understand the fuzzy relations, it is better to discuss first crisp
relation.
Suppose, A and B are two (crisp) sets. Then Cartesian product
denoted as A B is a collection of order pairs, such that
A B = {(a, b) | a A and b B}
Note :
(1) A B B A
(2) |A B| = |A| |B|
(3)A B provides a mapping from a A to b B.
The mapping so mentioned is called a relation.
27 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024
Soft Computing Crisp Relation
Example 1:
Consider the two crisp sets A and B as given below. A ={1, 2, 3, 4}
B = {3, 5, 7}
Then, A B = {(1, 3), (1, 5), (1, 7), (2, 3), (2, 5), (2, 7), (3, 3), (3, 5),
(3, 7), (4, 3), (4, 5), (4, 7)}
Let us define a relation R as R = {(a, b) | b = a + 1, (a,
b) A B}
Then, R = {(2, 3), (4, 5)} in this case.
We can represent the relation R in a matrix form as
follows. 3 5 7
1 0 0 0
2 1 0 0
3 0 0 0
4R 0= 1 0
28 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024
Soft Computing Operations on Crisp Relation
Suppose, R(x, y) and S(x, y) are the two relations define over two crisp
sets x A and y B
Union:
R(x, y) S(x, y) = max(R(x, y),S(x, y)),
Intersection:
R(x, y) S(x, y) = min(R(x, y),S(x, y)),
Complement:
R(x, y) = 1 - R(x, y)
Example:
Suppose, R(x, y) and S(x, y) are the two relations define over two crisp
sets x A and y B
0 1 0 0 1 0 0 0 Find the following:
0 0 1 0 0 1 0 0 1. R S
R= S =
0 0 0 1 0 0 1 0 2. R S
0 0 0 0 0 0 0 1 3. Rc
29 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024
Soft Computing Composition
Given R is a relation on X, Y and S is another relation on Y, Z.
Then R ○ S is called a composition of relation on X and Z which is
defined as follows.
R ○ S = {(x, z) | (x, y) R and (y, z) S and y Y}
Max-Min Composition
Given the two relation matrices R and S, the max-min composition is
defined as T = R ○ S ,
T(x, z) = max{min{R(x, y),S(y, z) and y Y}}
30 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024
Soft Computing Example on Composition
Let the Given
X ={1, 3, 5}, Y ={1, 3, 5}, R ={(x, y) | y = x + 2}, S = {(x, y) | x < y}
Here, R and S is on X Y.
Thus, we have R = {(1, 3), (3, 5)} S = {(1, 3), (1, 5),
(3, 5)}
1 3 5 1 3 5
1 0 1 0 1 0 1 1
R= and S =
3 0 0 1 3 0 0 1
5 0 0 0 5 0 0 0
1 3 5
1 0 0 1
Using max-min composition R ○ S =
3 0 0 0
5 0 0 0
31 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024