You are on page 1of 4

Name: Mandar Bhide

Class: BE Comp
Roll No. 8027

Soft Computing and Optimization Algorithms


Assignment 1

Problem Statement
Implement Union, Intersection, Complement and Difference operations on fuzzy sets. Also
create fuzzy relation by Cartesian product of any two fuzzy sets and perform max-min
composition on any two fuzzy relations.

Outcome
Understanding and implementation of operations on fuzzy sets.

Software/Hardware Requirements: Python 3.7

Theory:
Fuzzy logic was introduced by Lotfi Zadeh to take into account vagueness in the boundaries
in reality.
Fuzzy set operates on concept of membership. Degree of membership of any particular
element of fuzzy set expresses the degree of compatibility of the element within that set.
Every element in a fuzzy set is a tuple of element and its membership value.
A = {(x, μA(x))} where x is an element and μA is membership function of A.
Value of μA is always between 0 and 1 i.e., 0 ≤ μA ≤ 1.
Operations on fuzzy sets:
1. Union:
μA U μB (x) = max(μA (x), μB (x))

2. Intersection:
μA ∩ μB (x) = min(μA (x), μB (x))

3. Complement
μ𝐴
̅̅̅(𝑥) = 1 - μ𝐴 (𝑥)

4. Difference:
μ𝐴 |μ𝐵 = μ𝐴 ∩ ̅̅̅
μ𝐵
For example, A = {(2,1), (4,0.3), (6,0.5), (8,0.2)} and B = {(2,0.5), (4,0.4), (6,0.1), (8,1)}
Then:
AUB = {(2,1), (4,0.4), (6,0.5), (8,1)}
A∩B = {(2,0.5), (4,0.3), (6,0.1), (8,0.2)}
̅ = {(2,0), (4,0.7), (6,0.5), (8,0.8)}
A
̅ = {(2,0.5), (4,0.6), (6,0.9), (8,0)}
B
A-B = {(2,0.5), (4,0.3), (6,0.5), (8,0)}
B-A = {(2,0), (4,0.4), (6,0.1), (8,0.8)}
Cartesian product:
R = AxB = min(μ𝐴 (x), μ𝐵 (y))
e.g., A = {(a,1), (b,0.2), (c,0.5)} and B = {(x,0.9), (y,0.4), (z,0.9)}
AxB =
x y z
a 0.9 0.4 0.9
b 0.2 0.2 0.2
c 0.5 0.4 0.5

Max-Min composition:
C = {(a,0.1), (b,0.2), (c,0.7)}
μ𝐶 R(x1, y1) = max(min(0.1, 0.9), min(0.2, 0.2), min(0.7, 0.5)) = max(0.1,0.2,0.5) = 0.5
Similarly, C.R = [0.5, 0.4, 0.5]
Code:
Output:

Conclusion:

Hence in this assignment, operations on fuzzy sets studied and implemented.

You might also like