0% found this document useful (0 votes)
56 views

Unit-4 Soft Computing

Uploaded by

deepansh432109
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views

Unit-4 Soft Computing

Uploaded by

deepansh432109
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 41

lOMoARcPSD|50004020

Sc unit 4 application of soft computing kcs056

Application Of Soft Computing (Dr. A.P.J. Abdul Kalam Technical University)

Scan to open on Studocu

Studocu is not sponsored or endorsed by any college or university


Downloaded by Deepansh Sharma ([email protected])
lOMoARcPSD|50004020

SC Unit 4 - Application of Soft Computing KCS056

Soft Computing (Dr. A.P.J. Abdul Kalam Technical University)

Scan to open on Studocu

Studocu is not sponsored or endorsed by any college or university


Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

LECTURE NOTES ON

(KCS056) (APPLICATION OF SOFT COMPUTING)

(B.TECH.) (CSE/IT) (IVTH-YEAR) (VIITH-SEMESTER)

(AKTU)

(MR. MAN SINGH)


(ASSISTANT PROFESSOR)

DEPARTMENT OF COMPUTER SCIENCE


ENGINEERING & INFORMATION TECHNOLOGY)
(UNITED INSTITUTE OF TECHNOLOGY, PRAYAGRAJ)

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

UNIT – 4

(FUZZY LOGIC-

II)

Membership Function
The membership function is a graph that defines how each point in the input space is mapped to
membership value between 0 and 1. It allows you to quantify linguistic terms and represent a fuzzy
set graphically. A membership function for a fuzzy set A on the universe of discourse X is defined
as μA:X → [0,1]
It quantifies the degree of membership of the element in X to the fuzzy set A.
 x-axis represents the universe of discourse.
 y-axis represents the degrees of membership in the [0, 1] interval.
There can be multiple membership functions applicable to fuzzify a numerical value. Simple
membership functions are used as the complex functions do not add precision in the output. The
membership functions for LP, MP, S, MN, and LN are:

The triangular membership function shapes are most common among various other membership
function shapes. Here, the input to 5-level fuzzifier varies from -10 volts to +10 volts. Hence the
corresponding output also changes.
Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

Introduction to crisp and fuzzy logic

Logic is the science of reasoning. Symbolic or mathematical logic has turned out to be a powerful
computational paradigm. Not only does symbolic logic help in the description of events in the real world but
has also turned out to be an effective tool for inferring or deducing information from a given set of facts. Just
as mathematical sets have been classified into crisp sets and fuzzy sets , logic can also be broadly viewed as
crisp logic and fuzzy logic. Just as crisp sets survive on a 2-state membership (0/1) and fuzzy sets on a
multistate membership [0 - 1 ], crisp logic is built on a 2-state truth value (True/False) and fuzzy logic on a
multistate truth value (True/False/very True/partly False and so on.)
We now briefly discuss crisp logic as a prelude to fuzzy logic.

CRISP LOGIC
Consider the statements "Water boils at 90°C" and "Sky is blue". An agreement or disagreement with these
statements is indicated by a "True" or "False" value accorded to the statements. While the first statement takes
on a value false, the second takes on a value true.
Thus, a statement which is either 'True' or 'False' but not both is called a proposition. A proposition is indicated
by upper case letters such as P, Q, R and so on.

Example: P: Water boils at 90°C.


Q: Sky is blue.
are propositions.

A simple proposition is also known as an atom. Propositions alone are insufficient to represent phenomena in
the real world. In order to represent complex information, one has to build a sequence of propositions linked
using connectives or operators. Propositional logic recognizes five major operators as shown in Table.

Symbol Connective Usage Description


^ And P^Q P and Q are true

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

v Or PvQ Either P or Q is true


¬ or~ Not ¬P P is not true
⇒ Implication P⇒Q P implies Q is true
= equality P=Q P and Q are equal is true

Table Propositional logic connectives

Observe that ^, v, ⇒ and = are 'binary' operators requiring two propositions while ~ is a unary operator
requiring a single proposition. ^ and v operations are referred to as conjunction and and disjunction
respectively. In the case of ⇒ operator, the proposition occurring before the ⇒ symbol is called as the
antecedent and the one occurring after is called as the consequent. The semantics or meaning of the logical
connectives are explained using a truth table. A truth table comprises rows known as interpretations, each of
which evaluates the logical formulafor the given set of truth values.

Table :Truth table for the connectives ^, v, ~, ⇒ , =

P Q P^Q PvQ ~P P⇒Q P=Q


T T T T F T T
T F F T F F F
F F F F T T T
F T F T T T F

A logical formula comprising n propositions will have 2n interpretations in its truth table. A formula which has
all its interpretations recording true is known as a tautology and the one which records false for all its
interpretations is known as contradiction.

Example 1
Obtain a truth table for the formula (P v Q) ⇒ (~P). Is it a tautology?
Solution

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

P Q PvQ ~P P v Q ⇒~P
T T T F F
T F T F F
F F F T T
F T T T T

No, it is not a tautology since all interpretations do not record 'True' in its last column.

Example 2: Is (( P ⇒Q) ^ (Q ⇒P)) = ( P = Q) a tautology.


Solution:

P Q P⇒Q Q⇒P A=( P ⇒Q) ^ B= (P = Q) A=B


(Q ⇒P)
T F F T F F T
F T T F F F T
T T T T T T T
F F T T T T T
Yes, ·the given formula is a tautology.

Example 3
Show that (P ⇒ Q) = (~P v Q)
solution
P Q A= (P ⇒Q) ~P B=( ~PVQ) A=B
T F F F F T
F T T T T T
T T T F T T
F F T T T T

Since the last column yields 'True' for all interpretations, it is a tautology.

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

Laws of Propositional Logic


propositional logic also supports the following laws which can be effectively used for their simplification.
Given P, Q, R to be the propositions,
(i) Commutativity
(P V Q) = (Q V P)
(P /\ Q) = (Q /\ P)
(ii) Associativity
(P V Q) V R = P V .(Q V R)
(P /\ Q) /\ R = P /\ (Q /\ R)
(iii) Distributivity
(P V Q) /\ R = (P /\ R ) V ( Q /\ R)
(P /\ Q) V R = (P V R ) /\ ( Q V R)
(iv) Identity
P v false = P
P /\True = P
· P /\ False = False
P V True = True
(v) Negation
P /\ ~P = False
P v ~P = True
(vi) Idempotence
PvP=P
p /\ P = P
(vii) Absorption
P /\ (P V Q) = P
P V (P /\ Q) = P
(viii) De Morgan's laws
~ (P v Q) =(~ P /\ ~Q)
~(P /\ Q) = (~P V ~Q)
(ix) Involution
~(~P) = P

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

.Example:
Verify De Morgan's laws.
(a) ~(P v Q) = (~P /\ ~Q)
.(b) ~(P /\ Q) = {~P V ~Q)

Solution
(a)
P Q PvQ A= ~(P v Q) ~P ~Q B=(~P ^ ~Q) A= B
T T T F F F F T
T F T F F T F T
F T T F T F F T
F F F T T T T T
Therefore, ~(P v Q) = ( ~ P I\ ~ Q)

(b)

P Q P^Q A = ~(P ^ ~P ~Q B= ~P v A=B


Q) ~Q
T T T F F F F T
T F F T F T T T
F T F T T F T T
F F F T T T T T

Therefore ~(PI\ Q) = (~P v ~Q)

Example
Simplify ( ~(P ^ Q) ⇒ R) ^ P ^ Q
Solution
Consider ( ~(P ^Q) ⇒ R) ^ P ^ Q
by eliminating '⇒' using (P ⇒ Q) = ( ~ P v Q))

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

= ( ~ ~(P ^ Q) v R) ^P ^Q
= ((P ^Q) v R) ^ P ^Q (by the law of involution)
= (P ^Q) (by the law of absorption)

Inference in Propositional Logic


Inference is a technique by which, given a set of facts or postulates or axioms or premises F1.F2, • . • , Fn, a
goal G is to be derived.
In propositional logic, three rules are widely used for infeITTng facts, namely
(i) Modus Ponens
(ii) Modus Tollens, and
(iii) Chain rule
Modus ponens (mod pons)
Given P ⇒ Q and P to be true, Q is true.
P⇒Q
p

Q
Here, the formulae above the line are the premises and the one below is the goal which
can be inferred from the premises.
Modus tollens
Given P ⇒ Q and ~Q to be true, ~ P is true.
P⇒Q
. ~Q

~P
Chain rule
Given P ⇒ Q and Q ⇒ R to be true, P ⇒ R is true.
P⇒Q
Q⇒R

P⇒

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

Note that the chain rule is a representation of the transitivity relation with respect to the ⇒ connective.
Example
Given
(i) C V D
(ii) ~H ⇒ (A /\~B)
(iii) (C V D) ⇒~H
(iv) (A /\~B) ⇒ (R v S)
Can (R v S) be inferred from the above?
Solution
(i) and (iii) using the rule of Modus Ponens , ~H can be inferred. from
(i) CvD
(iii) (C v D) ⇒ ~H
~H (v)
From (ii) and (iv) using the chain rule, ~ H ⇒ (R v S) can be inferred.
(ii) ~H ⇒ (A /\ ~B)
(A /\ ~ B) ⇒ ( R v S)
~H ⇒ (R v S) (vi)
From (v) and (vi) using the rule of Modus Ponens (R v S) can be inferred.-
(vi) ~H ⇒ (R v S)
(v) ~H
RvS
Hence, the result:

PREDICATE LOGIC
In propositional logic, events are symbolized as propositions which acquire either „True/False' values.
However, there are situations in the real world, where propositional logic falls short of its expectation. For
example, consider the following statements:
P : All men are mortal.
Q : Socrates is a man.

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

From the given statements it is possible to infer that Socrates is mortal. However, from the propositions P, Q
which symbolize .these statements, nothing can be made out. The reason being, propositional logic lacks the
ability to· symbolize quantification. Thus, in this example, the quantifier All" which represents the entire class
of then encompasses Socrates as well, who is declared to be a man, in proposition Q. Therefore; by _virtue of
the first proposition P, Socrates who is a man also becomes a: mortal, · giving. rise to the deduction · Socrates
is mortal. However, the deduction is not directly perceivable owing to the shortcomings in -propositional logic.
Therefore, propositional logic needs to be augmented with more tools to enhance its logical abilities.
Predicate logic comprises the following apart from the connectives and propositions recognized by
propositional logic.
(i) Constants
(ii) Variables
(ii) Predicates
(iv) Quantifiers
(v) Functions
Constants represent objects that do not change values.
Example Pencil, Ram, Shaft, 100°C.

Variables are symbols which represent values acquired by the objects as qualified by the quantifier with which
they are associated with.
Example x, y, z. \
Predicates are representative of associations between objects that are constants or variables and acquire truth
values 'True' or 'Fals'e'. A predicate carries a name representing the association followed by its arguments
representing the objects it is to associate.
Example
likes (Ram, tea) (Ram likes tea)
plays (Sita, x) (Sita plays anything)
Here, likes and plays are predicate names and Ram, tea and Sita, x are the associated objects . Also the
predicates acquire truth values. · If Ram disliked tea, likes (Ram, tea) acquires the value false and if Sita
played any sport, plays (Sita, x) would acquire the value true provided x is suitably qualified by a quantifier.

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

Quantifiers are symbols which indicate the two types of quantification, namely, All (∀) and Some (∃). '∀' is
termed universal quantifier and '∃' is termed existential quantifier.
Example Let,
man (x) : x is a
man. mortal (x) : x is
mortal
mushroom (x) : x is a . mushroom.
poisonous (x) : x is poisonous.

Then, the statements


All men are mortal.
Some mushrooms· are poisonous . .
are represented as
∀ x (man (x) ⇒ mortal (x))
∃ x (mushroom (x) A poisonous (x))
Here, a useful rule to follow is that a universal quantifier goes with implication and an existential quantifier
with conjunction. Also, it is possible for logical formula to be quantified by multiple quantifiers.

Example Every ship has a captain.


∀ x ∃y (ship (x) ⇒ captain (x, y))
where, ship (x) : x is a ship
captain (x, y) : y is the captain of x.
Functions are similar to predicates in form and in their representation of association between objects but unlike
predicates which acquire truth values alone, functions acquire values other than truth values. Thus, functions
only serve as object descriptors.

Example
plus (2, 3) (2 plus 3 which is 5)
mother (Krishna) (Krishna's mother)
Observe that plus ( ) and mother ( ) indirectly describe "5" and "Krishna's mother"
respectively.
Example 7.7

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

Write predicate logic statements for


(i) Ram likes all kinds of food.
(ii) Sita likes anything which Ram likes.
(iii) Raj likes those which Sita and Ram both like.
(iv) Ali likes some of which Ram likes.
Solution
Let food (x) : x is food.
likes (x, y) : x likes y

Then the above statements are translated as


(i) ∀ x food (x) ⇒ likes (Ram, x))
(ii) ∀ X (likes (Ram, x): ⇒ 'likes· (Sita, x)) .
(iii) ∀ x (likes (Sita, x) /\ likes (Ram, x)) ⇒· likes (Raj, x))
(iv) ∃x (likes (Ram, x) /\ likes (Ali, .x))
The application of the rule of universal quantifier and. rule of existential quantifier can be observed in the
translations given above.

Interpretations of Predicate Logic Formula

For a formula in propositional logic, depending on the truth values acquired by the propositions, the truth table
interprets the formula. But in the case of predicate logic, depending on the truth values acquired by the
predicates, the nature. of the quantifiers, and the values taken by the constants and functions over a domain D,
the formula is interpreted.
Example
Interpret the formulae
(i) ∀ x p(x)
(ii) ∃x p(x)
where the domain D = { I, 2} and
p(l) p(2)
True False
Solution

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

(i) ∀ x p(x) is true only if p(x) is true for all values of x in the domain D, otherwise it is false
Here, for x =1 and x = 2 the two possible values for x chosen from D, namely p(l)=true and p(2)= false
respectively, yields (i) to be false since p(x) is not true for x = 2. Hence ∀ x p(x) is false.
(ii) ∃x p(x) is true only if there is at least one value of x for which p(x) is true. Here, for x = 1, p(x) is
true resulting in (ii) to be true. Hence, 3x p(x) is true.

Example Interpret ∀ x ∃y P(x, y) for D = { 1, 2} and


P (l, 1) P(l, 2) P(2, 1) P(2 ,2)
True False False True
Solution
For x = I, there exists a y, (y = 1) foi- which P(x,y), i.e. (P(l, 1)) is true.
For x = 2, there exists a y, (y = 2) for which P(x, y) (P(2, 2)) is true.
Thus, for all values of x there exists a y for which P (x, y) is true.
Hence, ∀x ∃y P(x, y) is true.

Fuzzy System elements


– Input Vector : X = [x1 , x2, . . . xn ] T are crisp values, which are transformed into fuzzy sets in the
fuzzification block.

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

– Output Vector : Y = [y1 , y2, . . . ym ] T comes out from the defuzzification block, which transforms an
output fuzzy set back to a crisp value.
– Fuzzification : a process of transforming crisp values into grades of membership for linguistic terms,
"far", "near", "small" of fuzzy sets.
− Fuzzy Rule base : a collection of propositions containing linguistic variables; the rules are expressed in
the form: If (x is A ) AND (y is B ).......THEN (z is C)
where x, y and z represent variables (e.g. distance, size) and A, B and Z are linguistic variables (e.g. `far',
`near', `small').
– Membership function : provides a measure of the degree of similarity of elements in the universe
of discourse to fuzzy set.
– Fuzzy Inferencing : combines the facts obtained from the Fuzzification with the rule base and conducts the
Fuzzy reasoning process.
– Defuzzyfication: Translate results back to the real world values.

FUZZY LOGIC
In crisp logic, the truth values acquired by propositions or predicates are 2-valued, namely True, False which
may be treated numerically equivalent to (0, 1). However, in fuzzy logic, truth values are multi valued such as
absolutely true, partly true, absolutely false, very true, and so on and are numerically equivalent to (0--1).

Fuzzy propositions
A fuzzy proposition is a statement which acquires a fuzzy truth value. Thus, given P‟ to be a fuzzy proposition,
T(P‟) represents the truth value (0--1) attached to P‟. In its simplest form fuzzy propositions are associated
with fuzzy sets. The fuzzy membership value associated with the fuzzy set A‟ for P ‟ is treated as the fuzzy
truth value T(P‟).
i.e. T(P‟) = μA‟(x) where 0≤μA‟(x) ≤1

Example
P‟ : Ram is honest.
T( P‟ ) = 0.8, if P‟ is partly true. T(
P‟ ) = 1, if P‟ is absolutely true.

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

Fuzzy connectives
Fuzzy logic similar to crisp logic supports the following connectives:
. (i) Negation :~
(ii) Disjunction :v
(iii) Conjunction :/\
(iv) Implication :⇒
Following Table illustrates the definition of the connectives. Here P‟, Q‟ are fuzzy propositions and T(P‟), T(Q‟),
_are their truth values.

Symbol Connective Usage Definition

~ Negation ~P‟ 1 – T(P‟)


V Disjunction P‟ V Q‟ max(T(P‟), T(Q‟))
/\ conjunction P‟ /\ Q‟ min(T(P‟), T(Q‟))
⇒ Implication P‟ ⇒ Q‟ ~p‟ V Q‟ = max(1 - T(P‟), T(Q‟))

P‟ and Q‟ related by the ' ⇒' operator are known as antecedent and consequent respectively. Also, just as in
crisp logic, here to ⇒ represents the IF –THEN statement as
IF x is A‟ THEN y is B‟, and is equivalent to
R‟ =(A‟x.B‟) U (~A‟ x Y‟)

The membership function of R‟ is given by


μR‟(x,y) = max(min(μA‟ (x), μB‟(y)), 1-μA‟ (x))

Also, for the compound implication IF x is A‟ THEN y is B‟ ELSE y is C‟ the relation R‟ is equivalent to R‟
= (A‟ X B‟)U(~A‟ X C‟)

The membership function of R‟ is given by


μR‟(x,y) = max (min (μA‟ (x), μB‟(Y)), min (1 – μA‟ (x), μC‟ (y)))

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

Note: These relations is also known as Implication relation.


Example
P‟ : Mary is efficient, T( P‟ ) = 0.8 Q‟
: Ram is efficient, T( Q‟ ) = 0.65 .
(i) P‟: Mary is not efficient.
T(P‟) =· 1 - T(P‟)' = 1 - 0.8 = 0.2
(ii) P‟ /\Q‟ : Mary is efficient and so is Ram.
T(P‟ /\ Q‟) = min (T(P‟), T(Q‟))
= min (0.8 , 0.65)
= 0.65
(iii) T(P‟ v Q‟) : Either Mary or Ram is efficient.
T(P‟ v Q‟) = max (T(P‟), T(Q‟))
= max (0.8, 0.65)
= 0.8
(iv) P‟ => Q‟: If Mary is efficient then so is Ram.
T(P‟ ⇒Q‟) = max (1 -T(P‟ ), T(Q‟))
= max (0.2, · 0.65)
= 0.65

Example
Let X = { a, b, c, d} Y = { 1, 2, 3, 4}
and A‟ = { (a, 0)(b, 0.8)(c, 0.6)(d, 1)}
B‟= { (1, 0.2)(2, 1)(3, o.8)(4, 0)}
C‟ = {(1, 0)(2, 0.4)(3, 1)(4, 0.8)}
Determine the implication relations
(i) IF x is A‟ THEN y is B‟ .
(ii) · IF x is A‟ THEN y is B‟ ELSE y is C‟ .

Solution
To determine (i) compute
R‟ = (A‟ x B‟) U (~A‟ x Y‟) where

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

μR‟(x,y) = max·(min (μA‟(x), μB‟(y)), I. – μA‟(x))


1 2 3 4
a 0 0 0 0
b 0.2 0.8 0.8 0
A‟xB‟= c 0.2 0.6 0.6 0
d 0.2 1 0.8 0

1 2 3 4
a 1 1 1 1
b 0.2 0.2 0.2 0.2
~A‟xY‟ = C 0.4 0.4 0.4 0.4
d 0 0 0 0

Here, Y the universe of discourse could be viewed as {(1, 1) (2, 1) (3, 1) (4, 1)} a fuzzy set all of whose
elements x have μ(x) = 1.
Therefore,
1 2 3 4
A 1 1 1 1
b 0.2 0.8 0.8 0.2
R‟ = C 0.4 0.6 0.6 0.4
d 0.2 0.1 0.8 0
which represents IF x is A‟ THEN y is B‟ .

To determine (ii) compute


R, = (A‟ x B‟) U (~A‟ x C‟) where
μR‟(x,y) = max (min (μA‟(x ), μ B‟(y)), min (1 - μ A‟(x). μ C‟ (y)))
1 2 3 4
a 0 0 0 0
b 0.2 0.8 0.8 0

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

A‟xB‟ = c 0.2 0.6 0.6 0


d 0.2 1 0.8 0

1 2 3 4
a 0 0.4 1 0.8
b 0 0.2 0.2 0.2
~A‟xC‟ = c 0 0.4 0.4 0.4
d 0 0 0 0

Therefore,

R‟ = (A‟x B‟)U (~A‟x C‟.) gives


= max (min (μA‟(x ), μ B‟(y)), min (1 - μ A‟(x), μ C‟ (y)))

1 2 3 4
a 0 0.4 1 0.8
b 0.2 0.8 0.8 0.2
R‟ = c 0.2 0.6 0.6 0.4
d 0.2 1 0.8 0

The above R‟ represents IF x is A‟ THEN y is B‟ ELSE y is C‟.

Fuzzy Inference
Fuzzy inference also referred to as approximate reasoning refers to computational procedures used for
evaluating linguistic descriptions. The two important inferring procedures are
(i) Generalized Modus Ponens (GMP)
(ii) Generalized Modus Tollens· (GMT)

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

GMP is formally stated as


IF x is A‟ THEN y is B‟
And x is A'

Conclusion y is B‟

Here, A‟, B‟, A' and B' are fuzzy terms. Every· fuzzy linguistic statement above the line is analytically known
and what is below is analytically unknown.
To compute the membership function of B' the max-min composition of fuzzy set A' with
R‟ (x, y) which is known as implication relation (IF-THEN relation) is used. That is,
B‟ = A‟ o R‟(x,y)
In terms of membership function,

μ B‟(y) = max (min (μA‟(x), μR‟(x,y)))


where μA‟(x)is the membership function. of A', μR‟(x,y) is- the membership function of the
implication relation and μ B‟, (y) is the membership function of B‟.
On the other hand, GMT has the form
IF x is A‟ THEN y is B‟
y is B'

x is A'
The membership of A' is computed on similar lines as

A‟ = B‟ o R‟(x,y)
In terms of membership function,

μ A‟(x) = max (min (μB‟(y), μR‟(x,y)))

Example: Apply the fuzzy Modus Ponens rule to deduce Rotation is quite slow given
(i) If the temperature is high then the rotation is slow.
(ii) The temperature is very high.
Let H’ (High), VH’ (Very High), S‟ (Slow) and QS’ (Quite Slow) indicate the associated fuzzy sets as follows:
For X = { 30, 40, 50, 60, 70, 80, 90, I 00}, the set of temperatures and Y = { 10, 20, 30, 40, 50, 60},
the set of rotations per minute,

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

H’ = {(70, 1) (80, 1) (90, 0.3)}


VH’ = { (90, 0.9) (100, 1)}
QS’ = { (10, 1) (20, 0.8)}
S’ = { (30, 0.8) (40, 1) (50, 0.6)}
To derive R’ (x, y) representing the implication -relation (i), we need to compute
R’ (x, y) = max(H‟ x S’, ~H’ x Y’)
10 20 30 40 50 60
30 0 0 0 0 0 0
40 0 0 0 0 0 0
50 0 0 0 0 0 0
H’ x S’ = 60 0 0 0 0 0 0
70 0 0 0.8 l 0.6 0
80 0 0. 0.8 1 0.6 0
90 0 0 0.3 0.3 0.3 0
100 0 0 0 0 0 0

10 20 30 40 50 60
· 30 1 1 1 1 1 1
40 1 1 1 1 1 1
50 1 1 1 1 1 1
~H‟x S‟ = 60 1 1 1 1 1 1
70 0 0 0 0 0 0
80 0 0 0 0 0 0
90 0.7 0.7 0.7 0.7 0.7 0.7
100 1 1 1 1 1 1

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

10 20 30 40 50 60
30 1 1 1 1 1 1
40 1 1 1 1 1 1
50 1 I 1 1 1 1
R’(x,y) = 60 1 1 1 1 1 1
70 0 0 0.8 1 0.6 0
80 0 0 0.8 1 0.6 0
90 0.7 0.7 0.7 0.7 0.7 0.7
100 1 1 1 1 1 1

To deduce Rotation is quite slow we make use of the composition rule


1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
QS’ = VH’ o R’(x,y) = [0 0 0 0 0 0 0.9 l] X 0 0 0.8 1 0.6 0
0 0 0.8 1 0.6 0
0.7 0.7 0.7 0.7 0.7 0.7
l 1 1 1 1 1

= [1 1 1 1 1 1]

FUZZY RULE BASED SYSTEM

Fuzzy linguistic descriptions are formal representations of systems made through fuzzy IF-THEN rules. They
encode knowledge about a system in statements of the form-
IF (a set of conditions) are satisfied THEN (a set of consequents) can be inferred.
Fuzzy IF-THEN rules are coded in the form-
IF (xI is A’I ,x2 is A’2 , ... ,x11 isA‟11 ) THEN (y1 is B’1,y2 is B’2 , ... ,y11 is B’11 )·

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

where linguistic variables xi, yi take the values of fuzzy sets Ai and Bi respectively.
Example
If there is ”heavy” rain and “strong” winds
then there must be “severe” flood warning.
Here, heavy, strong, and severe are fuzzy sets qualifying the variables rain, wind, and flood
warning respectively.
A collection of rules referring to a particular system is known as a fuzzy rule base. If the
conclusion C to be drawn from a rule base R is the conjunction of all the individual consequents
Ci of each rule, then
C = C1 ∩ C2 ∩ ... ∩ Cn where
μc(Y) = min (μc1 (y), μc2 (y), ... , μcn (y)), ∀y ∈ Y
here Y is the universe of discourse.
on the other hand, if the conclusion C to be drawn from a rule base R is the disjunction of
the individual consequents of each rule, then
C = C1 u C2 u C3 ... u Cn where
μc(Y) = max (μc1 (y), μc2 (y), ... , μcn (y)), ∀y ∈ Y

FUZZIFICATION:

Fuzzification is the process of making a crisp quantity fuzzy. We do this by simply recognizing that many
of the quantities that we consider to be crisp and deterministic are actually not deterministic at all. They carry
considerable uncertainty happens. if the form of uncertainly happens to atise because of imprecision,
ambiguity, or vagueness, then the variable is probably fuzzy and can be represented by a membership crisp
function.
The fuzzification is a process of transforming crisp values into grades of membership for linguistic terms
of fuzzy sets. The purpose is to allow a fuzzy condition in a rule to be interpreted.

Fuzzification of the car speed


Example 1 : Speed X0 = 70km/h
Fig below shows the fuzzification of the car speed to characterize a low and a medium speed fuzzy set.

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

Given car speed value X0=70km/h


: grade μA(x0) = 0.75 belongs to
fuzzy low, and grade μB(x0) = 0.25
belongs to fuzzy medium

Fig: Characterizing two grades, low and medium speed fuzzy set

Example 2 : Speed X0 = 40km/h

Given car speed value X0=40km/h :


grade μA(x0) = 0.6 belongs to fuzzy
low, and grade μB(x0) = 0.4 belongs
to fuzzy medium.
Fig.: Characterizing five grades, Very low, low, medium, high and very high speed fuzzy set

DEFUZZIFICATION
In many situations, for a system whose output is fuzzy, it is easier to take a crisp decision if the output is
represented as a single scalar quantity. This conversion of a fuzzy set to single crisp value is called
defuzzification and is the reverse process of fuzzification. The typical Defuzzification methods are:
 centroid method
 centre of sums
 mean of maxima.

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

Centroid method
Also known as the centre of gravity or the centre of area method, it obtains the centre of area (x*)
occupied by the fuzzy set. It is given by the expression.

for a continuous membership function, and

for a discrete membership function.


Here, n represents the number of elements in the sample, xi's are the elements, and μ(xi) is its membership
function.

Centre of sums (COS) method


In the centroid method, the overlapping area is counted once whereas in centre of sums, the overlapping area is
counted twice. COS builds the resultant membership function by taking the algebraic sum of outputs from each
of the contributing fuzzy sets A’ 1, A‟2, ... , etc. The defuzzified
value x* is given by

Here n is the number of fuzzy sets and N the number of fuzzy variables. COS is actually the most commonly
· used defuzzification method. It can be implemented easily and leads to rather fast inference cycles.

Mean of maxima (MOM) defuzzification

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

One simple way of defuzzifying the output is to take the crisp value with the highest degree of membership. In
cases with more than one element having the maximum value, the mean value of the maxima is taken. The
equation of the defuzzified value x* is given by

where M = {xi | μ(xi) is equal to the height of fuzzy set}.


| M | is the cardinality of the set M. In the continuous case, M could be defined as
M = {x ∈ [-c, c] | μ(x) is· equal to the height of the fuzzy set}

In such a case, the mean of maxima is the arithmetic average of mean values of all intervals contained in M
including zero length intervals.
The height of a fuzzy set A, i.e. h(A) is the largest membership grade obtained by any element in that set.
Example
A’1, A’2, and A‟3 are three fuzzy sets as shown in Fig.1 (a), (b), and (c). Fig.: 2 illustrates the aggregate of the
fuzzy sets.

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

Fig.1 Fuzzy sets. A’1, A‟2, .A‟3.

Fig. 2 Aggregated fuzzy set of A1, A2 , and A3


The defuzzification using (i) centroid method, (ii) centre of sums method, and (iii) mean of
maxima method is illustrated as follows.

Centroid method
To compute x*, the centroid, we view the aggregated fuzzy sets as shown in Fig. 2 and 3.
Note that in Fig. 3 the aggregated output has been divided into areas for better understanding.

Fig. 3 Aggregated fuzzy set of A‟1, A‟2, and A‟3 viewed as area segments.

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

Table illustrates the computations for obtaining x*.


Table · Computation of x*
Area Segment No. Area(A) x Ax
1 ½*0.3*1 =0.15 0.67 0.1005
2 2.6*0.3 =0.78 2.3 1.1794
3 0.3*0.4 = 0.12 3.8 0.456
4 ½ * 0.4*0.2 =0.04 3.8667 0.1546
5 1.5*0.5 =0.75 4.75 3.5625
6 0.5*0.5 =0.25 5.75 1.4375
7 ½ * 0.5*0.5 =0.125 5.833 0.729
8 1*1 =1 6.5 6.5
9 ½*1*1 =0.5 7.33 3.665
Total 3.715 18.353

In above Table Area (A) shows the area of the segments of the aggregated fuzzy set and x shows the
corresponding centroid. Now,

x* = 18.353/3.715
= 4.9

Centre of sums method


Here, unlike centroid method the overlapping area is counted not once but twice. Making use of the aggregated
fuzzy set shown in Fig.7.2, the centre of sums, x* is given by

=5

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

Here, the areas covered by the fuzzy sets A‟1, A’2, A‟3 (Refer Figs. l(a), (b), and (c)) are given by
½ X 0.3 X (3 + 5) , ½ x 0.5 x (4 + 2) and ½ x 1 x (3 + 1) respectively.

Mean of maxima method


Since the aggregated fuzzy set shown in Fig. 2 is a continuous set, x* the mean of maxima is computed as x* =
6:5.
Here, M = {X ∈ [6, 7]| μ (x) = 1} and the height of the aggregated fuzzy set is 1. Figure 4 shows the
defuzzified outputs -using the above three methods.

Fig. 7 .4 Defuzzified outputs of the aggregate of A‟1, A‟2, and A‟3•

Industry applications
Here, we will discuss the fields where the concepts of Fuzzy Logic are extensively applied.

Aerospace
In aerospace, fuzzy logic is used in the following areas −
 Altitude control of spacecraft
 Satellite altitude control
 Flow and mixture regulation in aircraft deicing vehicles

Automotive
In automotive, fuzzy logic is used in the following areas −

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

 Trainable fuzzy systems for idle speed control


 Shift scheduling method for automatic transmission
 Intelligent highway systems
 Traffic control
 Improving efficiency of automatic transmissions

Business
In business, fuzzy logic is used in the following areas −
 Decision-making support systems
 Personnel evaluation in a large company

Defense
In defense, fuzzy logic is used in the following areas −
 Underwater target recognition
 Automatic target recognition of thermal infrared images
 Naval decision support aids
 Control of a hypervelocity interceptor
 Fuzzy set modeling of NATO decision making

Electronics
In electronics, fuzzy logic is used in the following areas −
 Control of automatic exposure in video cameras
 Humidity in a clean room
 Air conditioning systems
 Washing machine timing
 Microwave ovens
 Vacuum cleaners

Finance
In the finance field, fuzzy logic is used in the following areas −
 Banknote transfer control
 Fund management
 Stock market predictions

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

Industrial Sector
In industrial, fuzzy logic is used in following areas −
 Cement kiln controls heat exchanger control
 Activated sludge wastewater treatment process control
 Water purification plant control
 Quantitative pattern analysis for industrial quality assurance
 Control of constraint satisfaction problems in structural design
 Control of water purification plants

Manufacturing
In the manufacturing industry, fuzzy logic is used in following areas −
 Optimization of cheese production
 Optimization of milk production

Marine
In the marine field, fuzzy logic is used in the following areas −
 Autopilot for ships
 Optimal route selection
 Control of autonomous underwater vehicles
 Ship steering

Medical
In the medical field, fuzzy logic is used in the following areas −
 Medical diagnostic support system
 Control of arterial pressure during anesthesia
 Multivariable control of anesthesia
 Modeling of neuropathological findings in Alzheimer's patients
 Radiology diagnoses
 Fuzzy inference diagnosis of diabetes and prostate cancer

Securities
In securities, fuzzy logic is used in following areas −

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

 Decision systems for securities trading


 Various security appliances

Transportation
In transportation, fuzzy logic is used in the following areas −
 Automatic underground train operation
 Train schedule control
 Railway acceleration
 Braking and stopping

Pattern Recognition and Classification


In Pattern Recognition and Classification, fuzzy logic is used in the following areas −
 Fuzzy logic based speech recognition
 Fuzzy logic based
 Handwriting recognition
 Fuzzy logic based facial characteristic analysis
 Command analysis
 Fuzzy image search

Psychology
In Psychology, fuzzy logic is used in following areas −
 Fuzzy logic based analysis of human behavior
 Criminal investigation and prevention based on fuzzy logic reasoning

Fuzzy Logic vs Probability

Fuzzy Logic Probability


Probability is associated with events and
In fuzzy logic, we basically try to capture the essential
not facts, and those events will either occur
concept of vagueness.
or not occur
Fuzzy Logic captures the meaning of partial truth Probability theory captures partial

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

knowledge
Probability is a mathematical model of
Fuzzy logic takes truth degrees as a mathematical basis
ignorance

Advantages of Fuzzy Logic


Fuzzy logic provides simple reasoning similar to human reasoning. There are more such advantages of using
this logic, such as:
 The structure of Fuzzy Logic Systems is easy and understandable
 Fuzzy logic is widely used for commercial and practical purposes
 It helps you to control machines and consumer products
 It helps you to deal with the uncertainty in engineering
 Mostly robust as no precise inputs required
 If the feedback sensor stops working, you can program it into the situation
 You can easily modify it to improve or alter system performance
 Inexpensive sensors can be used which helps you to keep the overall system cost and complexity low

Disadvantages of Fuzzy Logic

 Fuzzy logic is not always accurate. So the results are perceived based on assumptions and may not be
widely accepted
 It cannot recognize machine learning as-well-as neural network type patterns
 Validation and Verification of a fuzzy knowledge-based system needs extensive testing with
hardware
 Setting exact, fuzzy rules and, membership functions is a difficult task
 At times, the fuzzy logic is confused with probability theory

Fuzzy Controller
Tthere are two examples of Fuzzy contoller, namely
(i) Greg Viot 's (Greg Viol, 1993) Fuzzy Cruise Control System

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

(ii) Yamakawa 's (Yamakawa, 1993) Air Conditioner Controller


Greg Viot's Fuzzy Cruise Controller
This controller is used to maintain a vehicle at a desired speed. The system consists of two fuzzy inputs,
namely speed difference and acceleration; and one fuzzy output, namely throttle control as illustrated in Fig.

Fig. 7.5 Fuzzy cruise controller.


Fuzzy rule base .
A sample fuzzy rule base R governing the cruise control is as given in Table.
•_· . ~ .
Table 7.5 Sample cruise control rule base
~- r '•' •
Rule l : If (speed difference· is NL) ,~d (acceleration .is ZE) -th~n (throttle control is
PL). Rule 2: If (speed difference is ZE) and (acceleration . is. NL) then (throttle control is PL).
Rule 3: If (speed difference is NM) and (acceleration is ZE) then (throttle control is PM).
Rule 4: If (speed difference is NS) and (a,cceleration is PS) then (throttle control is PS).
Rule 5: If (speed difference is PS) and (acceleration· is NS) then (throttle control is NS).
Rule 6: If (speed difference is PL) and (acceleration is ZE) then (throttle control is NL).
Rule 7: If (speed difference is ZE) and (acceleration 'is NS) then (throttle conttol is PS).
Rule 8: If (speed difference is ZE) and (acceleration is NM) then (throttle control is PM).

Key
NL - Negative Large
ZE - Zero
PL - Positive Large
NM - Negative Medium

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

PM - Positive Medium
NS - Negative Small
PS - Positive Small

the fuzzy sets which characterize the inputs and output are as given in Fig. 7 .6.

Fig. 7 .6 Fuzzy sets characterizing fuzzy cruise control.

Fuzzification of inputs
For the fuzzification 'of inputs, that is, to compute the membership for the antecedents, the formula
illustrated in Fig.: is used.

Degree of membership
• Compute Delta 1 = x - point 1

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

Delta 2 = Point 2 - x
• If (Delta 1 ≤ 0) or (Delta 2 ≤
0) then Degree of membership =
0 else Degree of membership

Delta 1 • Slope 1
=min Delta 2 • Slope 2
Max

Here, x which is the system input has its membership function values computed for all fuzzy sets. For example,
the system input speed difference deals with 7 fuzzy sets,. namely NL, NM, ZE, PS, PM, and PL. For a
measured value of the speed difference x', the membership function of x' in each of the seven sets is computed
using the formula shown in above Fig. . Let μ'1, μ'2,,, ..., μ'7 be the seven membership values. Then, all these
values are recorded for the input x' in an appropriate data structure.
Similarly, for each of the other system inputs (acceleration in this case), the fuzzy membership function values
are recorded.
Example
Let the measured normalized speed difference be 100 and the normalized acceleration be 70, then the fuzzified
inputs after computation of the fuzzy membership values are shown in Fig.

Fig. A Fuzzy membership values for speed difference = 100 and acceleration = 70.

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

The computations of the fuzzy membership values for the given inputs have been shown in Fig. given below

Fig. Fuzzification of speed difference = 100.


For speed difference (x = 100), the qualifying fuzzy sets are as shown in above Fig.
Fuzzy membership function of x for NS where
Delta 1 = 100 - 63= 37
Delta 2 = 127 - 100 = 27
Slope 1 = 1/32 = 0.03125
Slope 2 = 1/32 = 0.03125
Delta 1 = 100 - 63
Degree of membership function
37 x 0.03125
μNS(x) = min 27 X 0.03125
1
= 0.8438
Fuzzy membership function of x for ZE where
Delta 1 = 100 - 95 = 5
Delta 2 = 159 – 100= 59
Slope 1 = 1/32 = 0.03125
Slope 2 = 1/32 = 0.03125
Degree of membership function
5 X 0.03125
μZE(x) =min 59 x 0.03125 = 0.1563
1
The membership function of x with the remaining fuzzy sets, namely NL, NM, PS, PM, PL is zero.

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

Similarly for acceleration (x = 70), the qualifying fuzzy sets are as shown in below Fig. The fuzzy membership
function of x = 70 for NM is μNM(x) = 0.7813 and for NS is μNS(x) = 0.2188.

Fig. Fuzzification of acceleration = 70.


Rule strength computation
The rule strengths are obtained by computing the minimum of the membership functions of the antecedents.
Example
For the sample rule base R given in Table, the rule strengths using the fuzzy membership values illustrated in
Fig. A are
Rule 1: min (0, 0) = 0
Rule 2: min (0.1563, 0) = 0
Rule 3: min (0, 0) = 0
Rule 4: min (0.8438, 0) = 0
Rule 5: min (0, 0.2188) = 0
Rule 6: min (0,0) = 0
Rule 7: min (0.1563, 0.2188) = 0.1563
Rule 8: min (0.1563, 0.7813) = 0.1563
Fuzzy output
The fuzzy output of the system is .the 'fuzzy OR' of all the fuzzy outputs of the rules with non-zero rule
strengths. In the event of more than one rule qualifying for the same fuzzy output, the stronger' among them is
chosen.
Example
In the given rule base R, the competing fuzzy outputs are those of Rules 7 and 8 with strengths of 0.1563 each.
However, the fuzzy outputs computed here do not aid a clear-cut decision on the throttle control. Hence, the
need for defuzzification arises.

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

Defuzzification
The centre Qf gravity method is applied to defuzzify the output. Initially the- centroids are compμted for each
of the competing output membership functions. Then, the new output membership areas are determined by
shortening the height of the membership value on the Y axis as dictated by the rule strength value. Finally, the
Centre of Gravity (CG) is computed using the weighted average of the X-axis centroid points with the newly
computed output areas, the latter serving as weights.
Example
Below Figure illustrates the computation of CG for the two competing outputs of rules 7 and 8 with
strength of 0.1563 each

Fig. Computation of CG for fuzzy cruise control system.


For the fuzzy set PS,
X-axis centroid point = 159
Rule strength applied to determine output area = 0.1563
Shaded area = 1/2 h(a1 + b1)
= ½ (0.1563)(64 + 63.82)
= 9.99
For the fuzzy set PM,
X-axis centroid point = 191
Rule strength applied to determine output area = 0.1563
Shaded area = 1/2 h (a1 + b1)
= 1/2(0.1563)(64 + 63.82)
= 9.99
Therefore

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])
lOMoARcPSD|50004020

Weighted average, CG = (9.99x159+9.99x191)/19.98 = 175


In crisp terms, the throttle control (normalized) is to be set as
175.

Air Conditioner Controller


The system as illustrated Fig . Comprises a dial to control the flow of warm/hot or cool/cold air and a
thermometer to measure the room temperature (70C) When the dial is turned positive, warm/hot air is supplied
from the air conditioner and if it is turned negative, cool/cold air is supplied. If set to zero, no air is supplied.

Fig. Air conditioner control system.

A person now notices the difference in temperature (∆ T °C) between the room temperature ( T °C) as
measured by the thermometer and the desired temperature (TO °C) at which the room is desired to be kept (set-
point). The problem now is to determine to what extent the dial should be turned so that the appropriate supply
of air (hot/worm/cool/cold) will nullify the change in temperature.

Downloaded
Downloaded by by Deepa Solanki
Deepansh Sharma([email protected])
([email protected])

You might also like