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

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 -6

Outline of the Lecture

 Fuzzy Relation

2 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing

• Fuzzy relation is a fuzzy set defined on the Cartesian product of


crisp set X1,X2, …., Xn
• Here, n-tuples (x1, x2, …, xn) may have varying degree of
memberships within the relationship.
• The membership values indicate the strength of the relation between
the tuples.
Example.
X={typhoid, viral, cold} and Y={running nose, high temp, shivering}
The fuzzy relation R is defined as-
running-nose high-temperature shivering
Typhoid 0.1 0.9 0.8
Viral 0.2 0.9 0.7
Cold 0.9 0.4 0.6

3 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing Fuzzy Cartesian Product

Suppose
• A is a fuzzy set on the universe of discourse X with μA(x) | x X
• B is a fuzzy set on the universe of discourse Y with μB(y) | y Y
• Then R = A B ⸦ X Y , where R has its membership function given
by μR(x, y) = μAB(x, y) = min{μA(x), μB(y)}
• Example -
A = {(a1, 0.2), (a2, 0.7), (a3, 0.4)} and B = {(b1, 0.5), (b2, 0.6)}
b1 b2
a1 0.2 0.2
R=A B= a2 0.5 0.6
a3 0.4 0.4

4 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing Operation on Fuzzy Relations

 Let R and S be fuzzy relations on the Cartesian space X × Y. Then


the following operations apply for the membership values for
various set operations.
 Union. µR∪S(x, y) = max(µR (x, y), µS(x, y))
 Intersection. µR∩S(x, y) = min(µR (x, y), µS (x, y))
 Complement. µR(x, y) = 1 − µR(x, y)
 Containment. R⊂ S ⇒ µR (x, y) ≤ µS (x, y)

5 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing Fuzzy Relation

• A fuzzy relation R is a mapping from the Cartesian space X Y to


the interval [0,1], where the strength of the mapping is expressed
by the membership function of the relation μR(x,y)
 μR . A × B → [0, 1]
 R = {((x, y), μR(x, y))| μR(x, y) ≥ 0 , x ∈ A, y ∈ B}

6 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing Crisp & Fuzzy Relation

Crisp relation Fuzzy relation

Cardinality of Fuzzy Relations.-


 Since the cardinality of fuzzy sets on any universe is infinity,
the cardinality of a fuzzy relation between two or more
universes is also infinity.

7 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing Fuzzy Cartesian Product and composition

• A fuzzy relation R is a mapping from the Cartesian space X × Y to


the interval [0,1], where the strength of the mapping is expressed by
the membership function of the relation μR(x,y)
▫ μR . X × Y → [0, 1]
▫ R = {((x, y), μR(x, y))| μR(x, y) ≥ 0 , x ∈ X, y ∈ }

8 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing

Example.
X = (x1, x2, x3), Y = (y1, y2), Z = (z1, z2, z3)

y1 y2
z1 z2 z 3
x1 0.5 0.1
R = y1 0.6 0.4 0.7
x2 0.2 0.9 S =
y2 0.5 0.8 0.9
x3 0.8 0.6

9 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing Fuzzy Max-Min Composition

10 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing Lecture -7

Outline of the Lecture

 Fuzzy Relation Operations

11 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing Fuzzy Max Product Composition

• Two fuzzy relations R and S are defined on sets X, Y and Z. That is,
R ⊆ X × Y, S ⊆ Y × Z. The composition R•S = RS of two relations R
and S is expressed by the relation from A to C.
▫ For (x, y) ∈ X × Y, (y, z) ∈ Y × Z
μR•S (x, z) = maxy [min(μR (x, y)) ,min(μS (y, z))]
= ∨y [μR (x, y) • μS (y, z)]
MR•S = MR • MS (matrix notation)

12 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing Fuzzy Relation Max-Min Composition Operation

Example.
Let X = (x1. x2. x3). Y = (y1. y2). Z = (z1. z2. z3)

y1 y2
z1 z2 z 3
x1 0.5 0.1
R = y1 0.6 0.4 0.7
x2 0.2 0.9 S =
y2 0.5 0.8 0.9
x3 0.8 0.6
z1 z 2 z 3
x1 0.5 0.4 0.5
R○S =
x2 0.5 0.8 0.9
x3 0.6 0.6 0.7

μS(x1, z1)} = max{ min (0.5. 0.6). min (0.1. 0.5)} = max{0.5. 0.1} = 0.5
And so on…….

13 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing Fuzzy Relation Max-Min Composition Operation
• Consider the following two sets P and D. which represent a set of
paddy plants and a set of plant diseases. More precisely-
• P = {P1,P2, P3, P4} a set of four varieties of paddy plants
• D = {D1, D2, D3, D4} of the four various diseases affecting the
plants.
• In addition to these also consider another set S = {S 1, S2, S3, S4} be
the common symptoms of the diseases.
• Let. R be a relation on P D. representing which plant is susceptible
to which diseases. then R can be stated as-
D1 D2 D3 D4
P1 0.6 0.6 0.9 0.8
P2 0.1 0.2 0.9 0.8
R = P3 0.9 0.3 0.4 0.8
P4 0.9 0.8 0.4 0.2

14 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing Fuzzy Relation Max-Min Composition Operation

Also, consider T be the another relation on D S, which is given by


S1 S2 S3 S4
D1 0.1 0.2 0.7 0.9
T = D2 1.0 1.0 0.4 0.6
D3 0.0 0.0 0.5 0.9
D4 0.9 1.0 0.8 0.2
Obtain the association of plants with the different symptoms of the
disease using max-min composition.

S1 S2 S3 S4
P1 0.8 0.8 0.8 0.9
R ○ T =tingP Applications
0.8 0.8 15.01.2016
0.8 0.9 14 / 64
2
P3 0.8 0.8 0.8 0.9
P4 0.8 0.8 0.7 0.9

15 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing Fuzzy Relation Max-Min Composition Operation

Let, R = x is relevant to y and S = y is relevant to z be two fuzzy


relations defined on X Y and Y Z, respectively,
where X = {1, 2, 3} ,Y = { α, β, γ, δ } and Z = {a, b}.
Assume that R and S can be expressed with the following relation
matrices .
Find the Max-min Composition T?
a b
α β γ δ
α 0.9 0.1
1 0.1 0.3 0.5 0.7
β 0.2 0.3
2 0.4 0.2 0.8 0.9
R = 3 0.6 0.8 0.3 0.2 S = γ 0.5 0.6
δ 0.7 0.2

16 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing Two-valued Logic and Multi-valued Logic

• The basic assumption upon which crisp logic is based - that every
proposition is either TRUE or FALSE.
• The classical two-valued logic can be extended to multi-valued
logic.
• As an example, three valued logic to denote true(1), false(0) and
indeterminacy ( 1/2 ).
• Different operations with three-valued logic can be extended as
shown in the following truth table:
Fuzzy connectives used in the
above table are:
AND (Λ), OR (ν), NOT (),
IMPLICATION (=>) and EQUAL
(=).
0
0
0
17 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024
Soft Computing Two-valued Logic and Multi-valued Logic

Fuzzy connectives defined for such a three-valued logic better can be


stated as follows:

18 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing Fuzzy Propositions

Example 1:
P : Ram is honest
1 T(P) = 0.0 : Absolutely false
2 T(P) = 0.2 : Partially false
3 T(P) = 0.4 : May be false or not false
4 T(P) = 0.6 : May be true or not true
5 T(P) = 0.8 : Partially true
6 T(P) = 1.0 : Absolutely true.

19 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing Fuzzy Propositions

P : Mary is efficient ; T(P) = 0.8;


Q : Ram is efficient ; T(Q) = 0.6
1 Mary is not efficient.
T(P) = 1 - T(P) = 0:2
2 Mary is efficient and so is Ram.
T(P Λ Q) = min{T(P), T(Q)} = 0:6
3 Either Mary or Ram is efficient
T(P V Q) = max{(P), T(Q)} = 0:8
4 If Mary is efficient then so is Ram
T(P =>) Q) = max{1 - T(P), T(Q)} = 0:6

20 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing Fuzzy Propositions Vs. Crisp Propositions

• The fundamental difference between crisp (classical) proposition


and fuzzy propositions is in the range of their truth values.
• While each classical proposition is required to be either true or
false, the truth or falsity of fuzzy proposition is a matter of degree.
• The degree of truth of each fuzzy proposition is expressed by a
value in the interval [0,1] both inclusive.

21 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing Canonical Representation of Fuzzy Propositions

• Suppose, X is a universe of discourse of five persons.


• Intelligence of x in X is a fuzzy set as defined below.
• Intelligent: {(x1, 0.3), (x2, 0.4), (x3, 0.1), (x4, 0.6), (x5, 0.9)}
• We define a fuzzy proposition as follows:
• P : x is intelligent
• The canonical form of fuzzy proposition of this type, P is expressed
by the sentence P : v is F .

• Predicate in terms of fuzzy set.


• P : v is F ; where v is an element that takes values v from some
universal set V and F is a fuzzy set on V that represents a fuzzy
predicate.
• In other words, given, a particular element v, this element belongs to
F with membership grade F (v).

22 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing Graphical Representation of Fuzzy Propositions

 For a given value v of variable V in proposition P, T(P) denotes the


degree of truth of proposition P.

23 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing

Fuzzy Implications

24 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing Fuzzy Rule

• A fuzzy implication (also known as fuzzy If-Then rule, fuzzy rule,


or fuzzy conditional statement) assumes the form :
• If x is A then y is B
• where, A and B are two linguistic variables defined by fuzzy sets A
and B on the universe of discourses X and Y, respectively.
• Often, x is A is called the antecedent or premise, while y is B is
called the consequence or conclusion.
• Example-1:
• If pressure is High then temperature is Low
• If mango is Yellow then mango is Sweet else mango is Sour
• If road is Good then driving is Smooth else traffic is High
• The fuzzy implication is denoted as R : A → B
• In essence, it represents a binary fuzzy relation R on the (Cartesian)
product of A B

25 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing Fuzzy Rule (Example-2)

• Suppose, P and T are two universes of discourses representing


pressure and temperature, respectively as follows.
• P = {1, 2, 3, 4} and T = {10, 15, 20, 25, 30, 35, 40, 45, 50}
• Let the linguistic variable High temperature and Low pressure are
given as
• THIGH = {(20, 0.2), (25, 0.4), (30, 0.6), (35, 0.6), (40, 0.7), (45, 0.8),
(50, 0.8)}
• PLOW = {(1, 0.8), (2, 0.8), (3, 0.6), (4, 0.4)}
• Then the fuzzy implication If temperature is High then pressure
is Low can be defined as R : THIGH → PLOW

Note : If temperature iswhere,


40 R =
then what about low pressure?
26 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024
Soft Computing Interpretation as Coupled with B

In general, there are two ways to interpret the fuzzy rule A → B as


 A coupled with B
 A entails B

T-norm operator
• The most frequently used T-norm operators are:
• Minimum : Tmin(a, b) = min(a, b) = a Λ b
• Algebraic product : Tap(a, b) = ab
• Bounded product : Tbp(a, b) = 0 V (a + b - 1)

27 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing Interpretation as Coupled with B

• Based on the T-norm operator as defined above, we can


automatically define the fuzzy rule R : A → B as a fuzzy set with
two - dimensional MF:
• μR(x, y) = f(μA(x), μB(y)) = f (a, b) with a = μA(x) , b = μB(y), and f
is the fuzzy implication function.

In the following, few implications of R : A → B


Min operator:
Rm = A B = μA(x) Λ μB(y) | (x,y) or fmin(a, b) = a Λ b
[Mamdani rule]
Algebraic product operator
Rap = A B = μA(x) . μB(y) | (x,y) or fmin(a, b) = a.b
[Larsen rule]

28 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing Product Operator

Bounded product operator

Drastic product operator

29 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing Interpretation of A entails B
There are three main ways to interpret such implication:
Material implication :
R : A → B = AC B
Propositional calculus :
R : A → B = AC (A B)
Extended propositional calculus :
R : A ! B = (AC BC) B
• With the above mentioned implications, there are a number of fuzzy
implication functions that are popularly followed in fuzzy rule-
based system.
Zadeh’s arithmetic rule :

30 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing Interpretation of A entails B

Zadeh’s max-min rule :

Boolean fuzzy rule

Goguen’s fuzzy rule:

31 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing Zadeh’s Max-Min Rule

32 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing

Defuzzification Methods

33 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing

Deffuzification-
Defuzzification means the conversion of the fuzzy output values into
crisp values. For example, if we say "the output force must be large"
and large variable takes the values between (70, 90) N, then what is the
force will be needed 75 or 80 or …N, we can know what is the force
we want by using defuzzification method. There are different types of
defuzzification methods.

34 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing

Defuzzification
Inference
Input Fuzzifier Defuzzifier Output
Engine

Fuzzy
Knowledge base

• Converts the fuzzy output of the inference

engine to crisp using membership functions

analogous to the ones used by the fuzzifier.

35 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing

Defuzzification Methods

1)Max-membership principle

1
c(Z )  c(z) ,  z  Z
*

z* z

2)Centroid principle

𝑧∗=
∫ 𝜇𝑐 ( 𝑧 ) • 𝑧𝑑𝑧
∫ 𝜇𝑐 ( 𝑧 ) 𝑑𝑧
z* z

36 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing

Eg- Centroid method:


∫ 𝜇 𝐵 ( 𝑧 ) • 𝑧𝑑𝑧
𝑧 = =¿
∫ 𝜇 𝐵 ( 𝑧 ) 𝑑𝑧

37 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing

Defuzzification Methods
3)Weighted average method
(Only valid for symmetrical output membership function)


∑ 𝜇𝑐 ( ¯𝑧 ) • ¯𝑧 .9
𝑧 =
∑ 𝜇𝑐 ( ¯𝑧 ) .5

0 a b
z

• Formed by weighting each functions in the


output by its respective maximum
membership value
• Produces results very close to centroid method
• Less computational intensive

38 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing

Eg-Weighted-Average Method:

( .3 × 2.5 ) + ( .5 ×5 ) + ( 1× 6.5 )
𝑧∗= =5.41 𝑚𝑒𝑡𝑒𝑟𝑠
.3+.5+ 1

39 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing

Defuzzification Methods
4)Mean-max membership
(middle-of-maxima method) 
Can be applied only for symmetrical functions
1


𝑧 = ( 𝑎+ 𝑏 ) / 2 0 a z* b z

Eg-Mean-Max Method:
(6 +7)/ 2=6.5

40 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing

Defuzzification Methods

Three other popular methods are available because


of their appearance in some applications:

5)The Center of Sums,


6)Center of Largest Area,
7)First of Maxima Methods

41 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing
Defuzzification Methods
5)Center of sums Method
• Faster than any defuzzification method
• Involves algebraic sum of individual output fuzzy sets, instead of their
union
• Drawback: intersecting areas are added twice.

∑ 𝑍𝑖 . 𝐴𝑖
∗ 𝑖= 0
𝑍 = 𝑛

∑ 𝐴𝑖
 Here, Ai denotes the area of𝑖the = region
0 bounded by the fuzzy set
Ci and Zi is the geometric center of that area.
 It is similar to the weighted average method, but
the weights are the areas, instead of individual
membership values.

42 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing
Example: Continuing with Example on the railroad company
planning to lay a new rail line, we will calculate the defuzzified
values using the (1) center of sums method, (2) center of largest
area, and (3) first maxima and last maxima
(1) center of sums method :According to the center of sums method

43 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing

Defuzzification Methods

6) Center of largest area: If the output fuzzy set has at least


two convex sub regions, then the center of gravity (i.e., z∗ is
calculated using the centroid method) of the convex fuzzy sub
region with the largest area is used to obtain the defuzzified
value z∗ of the output

44 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing

7) First (or last) of maxima: This method uses the overall output or union
of all individual output fuzzy sets Ck to determine the smallest value of
the domain with maximized membership degree in Ck.
• FoM is The smallest value of the domain with maximized membership
degree-
• FoM = First of Maxima: z∗ = min⁡{ z | μC(z) = h(C) }
• LoM is the largest value of the domain with maximized membership
degree-
• LoM = Last of Maxima: z∗ = max{ z | μC(z) = h(C) }

45 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing
(2) center of largest area : The center of largest area method,
provides the same result (i.e., z∗ = 4.9) as the centroid method
the complete output fuzzy set is convex, as seen in Figure.
3) First of maxima solution (z1= 6) and last of maxima
solution (z2= 7).

46 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing Solar Pool Heater Example
• Suppose We measure the pool water temp and the wind speed and
we want to adjust the valve that sends water to the solar panels
• We have two input parameters
 Temp
 wind_speed

• we have one output parameter


 change_in_valve

47 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing

Solar Pool Heater Example


• set up membership functions for the inputs
– for each input, decide on how many categories there will
be and decide on their membership functions

cold nominal warm


cool hot calm
brisk strong

calm brisk strong

60 70 80 90 100 °F 4 12 20 mph

temp wind_speed
48 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024
Soft Computing

Solar Pool Heater Example


• set up membership functions for the output(s)
– for each output, decide on how many categories there will be
and decide on their membership functions
big no small
neg. smallchangepos. big
neg. pos.

big neg sm. neg. no ch. sm. pos. Big pos.

-10 -5 0 5 10 degrees

change_in_valve
49 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024
Soft Computing

Solar Pool Heater Example

• set up the rules

if (temp is hot) AND (wind_speed is calm)


then (change_in_valve is big_negative)

if (temp is warm) AND (wind_speed is brisk)


then (change_in_valve is small_negative)

if (temp is nominal) OR (temp is warm)


then (change_in_valve is no_change)

50 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024


Soft Computing

Solar Pool Heater Example

Fuzzify the inputs-

cold
nominalwarm
0 cool hot calm
0.35 0.6 strong
0 0 0.4 brisk
0.55 0

calm brisk strong

60 70 80 90 100 °F 4 12 20 mph

51 temp =of87°F
Department CSE, GIET University, Gunupur
wind_speed = 9 mph
Saturday, May 4, 2024
Soft Computing

Solar Pool Heater Example


cold
nominal warm
0 cool hot
0.35 0.6
• 0 0
fire the rules
0 0.4
if (temp is hot) AND (wind_speed is calm)
then (change_in_valve is big_negative)
0.6 0 0.55
if (temp is warm) AND (wind_speed is brisk)
then (change_in_valve is small_negative) calm
strong
0.55 0.6 0.4 brisk
0.35
if (temp is nominal) OR (temp is warm) 0.55 0
then (change_in_valve is no_change)
0.6
52 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024
Soft Computing

Solar Pool Heater Example


big no small
neg. small change pos. big
neg. pos.
0 0.6 0
0.55 0
• fire the rules
0 0.4
if (temp is hot) AND (wind_speed is calm)
then (change_in_valve is big_negative)
0
0.6 0.55
if (temp is warm) AND (wind_speed is brisk)
then (change_in_valve is small_negative)
0.55
0.35 0.6
if (temp is nominal) OR (temp is warm)
then (change_in_valve is no_change)
0.6
53 Department of CSE, GIET University, Gunupur Saturday, May 4, 2024

You might also like