Soft Computing UNIT -I
Introduction to Soft Computing
4th Semester CSE (AR-23)
1 Department of CSE, GIET University, Gunupur Thursday, February 27, 2025
Soft Computing Lecture -3
Outline of the Lecture
Fuzzy Logic
Membership Function
Basic Fuzzy Set Operations
2 Department of CSE, GIET University, Gunupur Thursday, February 27, 2025
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 Thursday, February 27, 2025
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 Thursday, February 27, 2025
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 Thursday, February 27, 2025
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 Thursday, February 27, 2025
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 Thursday, February 27, 2025
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 Thursday, February 27, 2025
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 Thursday, February 27, 2025
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 Thursday, February 27, 2025
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 Thursday, February 27, 2025
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 Thursday, February 27, 2025
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 Thursday, February 27, 2025
Soft Computing Basic Fuzzy Set Operations
Algebraic product or Vector product (A∙B):
μA∙B(x) = μA(x) ∙ μB(x)
Scalar product (α A):
α A(x) = A(αx)
Sum (A + B):
μA+B(x) = μA(x) + μB(x) – μA(x) ∙ μB(x)
Difference ( A – B = A BC ):
μA–B(x) = μABc (x)
Disjunctive sum: A⊕B
A⊕B =((AC B) (A BC))
Bounded Sum: | A(x) ⊕ B(x) |
μ|A(x)⊕B(x)| = min{1, μA(x) + μB(x)}
Bounded Difference: | A(x) ⊖ B(x) |
μ|A(x)⊖B(x)| = max{0, μA(x) + μB(x) – 1}
14 Department of CSE, GIET University, Gunupur Thursday, February 27, 2025
Soft Computing Basic Fuzzy Set Operations: Equality & Power
Equality (A = B):
μA(x) = μB(x)
Power of a fuzzy set A:
μAα(x) = {μA(x)}α
If α < 1, then it is called dilation.
If α > 1, then it is called concentration.
15 Department of CSE, GIET University, Gunupur Thursday, February 27, 2025
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)}
Algebraic product or Vector product (A∙B):
μA∙B(x) = μA(x) ∙ μB(x)
Scalar product (α A):
16 A(x) =
Department A(x)
of CSE, GIET University, Gunupur Thursday, February 27, 2025
Soft Computing Basic Fuzzy Set Operations
Sum (A + B):
μA+B(x) = μA(x) + μB(x) – μA(x) ∙ μB(x)
Difference ( A – B = A BC ):
μA–B(x) = μABc (x)
Disjunctive sum A⊕B:
A⊕B =((AC B) (A BC))
Bounded Sum | A(x) ⊕ B(x) | :
μ|A(x)⊕B(x)| = min{1, μA(x) + μB(x)}
Bounded Difference | A(x) ⊖ B(x) | :
μ|A(x)⊖B(x)| = max{0, μA(x) + μB(x) – 1}
Equality (A = B):
μA(x) = μB(x)
Power of a fuzzy set A:
μAα(x) = {μA(x)}α
If α < 1, then it is called dilation.
If α > 1, then it is called concentration.
17 Department of CSE, GIET University, Gunupur Thursday, February 27, 2025
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
18 Department of CSE, GIET University, Gunupur Thursday, February 27, 2025
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
19 Thursday, February 27, 2025
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
20 Department of CSE, GIET University, Gunupur Thursday, February 27, 2025
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.
21 Department of CSE, GIET University, Gunupur Thursday, February 27, 2025
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.
22 Department of CSE, GIET University, Gunupur Thursday, February 27, 2025
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.
23 Department of CSE, GIET University, Gunupur Thursday, February 27, 2025
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
24 Department of CSE, GIET University, Gunupur Thursday, February 27, 2025
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.
25 Department of CSE, GIET University, Gunupur Thursday, February 27, 2025
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
26 Department of CSE, GIET University, Gunupur Thursday, February 27, 2025
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
27 Department of CSE, GIET University, Gunupur Thursday, February 27, 2025
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}}
28 Department of CSE, GIET University, Gunupur Thursday, February 27, 2025
Soft Computing Properties of Fuzzy & Crisp Sets
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
29 Department of CSE, GIET University, Gunupur Thursday, February 27, 2025
Soft Computing Question Answer Session
30 Department of CSE, GIET University, Gunupur Thursday, February 27, 2025
Soft Computing
31 Department of CSE, GIET University, Gunupur Thursday, February 27, 2025