Sei sulla pagina 1di 47

Fuzzy Logic

Fuzzy Logic.

• In conventional logic, a statement is either true or false,


with nothing in between. This principle of true or false was
formulated by Aristotle some 2000 years ago as the Law of
the Excluded Middle.
Check this !

• Is the statement My child is good completely true or


completely false?

• How about: I am rich? This can be true (Mr. Ratan Tata)


or false (a begger), but how about most of us? Or she is
beautiful? The idea of gradations of truth is familiar to
every one.
Fuzzy Logic

• Fuzzy logic offers a better way of representing reality. In


fuzzy logic, a statement is true to various degrees, ranging
from completely true through half-truth to completely false.

• The basic idea of multi-valued logic has been explored to


some extent by a number of mathematicians in this century,
but the real breakthrough was made by Prof. Lotfi Zadeh of
the University of California in Berkeley. In 1965 he
published a paper on the theory of fuzzy sets; that paper has
given rise to hundreds of papers on fuzzy mathematics and
fuzzy systems theory.
Conventional Logic vs. Fuzzy Logic

• Consider the truth of the combination of two statements, A AND


B. A and B are both assertions; for example, Ram is a man, or I
don't have much free time this week.

• In conventional logic, both A and B must be either true or false.


The statement (A AND B) is true only if both A and B are
individually true; otherwise, the statement (A AND B) is false.

• Now, how do we define the fuzzy truth value of the statement (A


AND B) if the fuzzy truth values of A and B separately are
known?

• Fuzzy logic gives a remarkably simple answer to this problem: the


truth of (A AND B) together is the minimum of the truth value of
A and the truth value of B.
Classical / Crisp Set Theory

X: Universe
A

Element
not in A

Element in A =
a
Relations between sets

• If A and B are sets, A is a subset of B if each element of


A is also an element of B: 
A B.
• If A and B are sets, A and B are equal iff A B and B A.
We write A=B.
• A and B are disjoint iff no element of A is an element of
B and vice versa.
Operations on sets
For A, B in X,
• Union of A & B
AB   x U x  A...or...x  B

• Intersection of A & B
A  B   x   : x  A...and ...x  B
• Complement of A & B

A '   x   : x  A
Operations on Sets
1. A  B  B  A; A  B  B  A
2. A  ( B  C )  ( A  B )  C
A  ( B  C )  ( A  B)  C
3. A  A '  U
A  A '  Null
4.( A ') '  A
5.( A  B) '  A ' B '
6. A  A  A; A  A  A
7. A  ( B  C )  ( A  B)  ( A  C )
A  ( B  C )  ( A  B)  ( A  C )
Characteristic Functions

• Let U be a fixed non-empty set, Universal set of Universe of


discourse (UOD) or simply domain.
• We define a function f
f: U {0, 1}
f is the characteristic function on U( CH(U) ).
Relations on CH(U)
For f and g in CH(U),
1. f is less than or equal to g, written as f ≤ g, iff f(x) ≤ g(x) for
all x in U.
2. f is equal to g, f = g, iff f ≤ g and g ≤ f [ f(x)=g(x) for all x in
U].
Cartesian Product

• AxB ={(a,b): a A and b B}.


• Note: AxB ≠ BXA and Ax(BxC) ≠ (AxB)xC where A, B
and C are distinct sets.

• Solve problems from books.


• Problem 4.
What is a fuzzy set?
• The set (concept, predicate) A is characterized by a
membership function m: X → {0, 1}.

• The unit interval [0, 1] is also represented as I.

• First we consider a set X of all real numbers between 0


and 10 which we call the universe of discourse. Now,
let's define a subset A of X of all real-numbers in the
range between 5 and 8.
A = [5,8]
• We now show the set A by its characteristic function, i.e. this
function assigns a number 1 or 0 to each element in X,
depending on whether the element is in the subset A or not.
This results in the following figure:

• A(x) is called the membership grade of x.


A  {( x, A( x)) : x  U }
• Consider U={a, b, c, d} and A:UI defined by A(a)=0,
A(b)=0.7, A(c)=0.4, A(d)=1. The fuzzy set can be written
as:

A={(a,0), (b,0.7), (c, 0.4), (d,1)}


• In this example we want to describe the set of young people.
More formally we can denote
B = {set of young people}
• Since - in general - age starts at 0 the lower range of this set is
clear. The upper range, on the other hand, is rather hard to
define. As a first attempt we set the upper range to, say, 20
years. Therefore we get B as a crisp interval, namely:
B = [0,20]
• Now the question arises: why is somebody on his 20th
birthday young and right on the next day not young?
Obviously, this is a structural problem, for if we move the
upper bound of the range from 20 to an arbitrary point we can
pose the same question.
• A more natural way to construct the set B would be to
relax the strict separation between young and not young.
• We will do this by allowing not only the (crisp) decision
YES: he/she is in the set of young people or NO: he/she
is not in the set of young people but more flexible
phrases like Well, he/she belongs a little bit more to the
set of young people or NO, he/she belongs nearly not to
the set of young people.
• To be more concrete we now show the set of young people
similar to our first example graphically by its characteristic
function

• This way a 25 years old would still be young to a degree of 50


percent.
Operations on Fuzzy Sets
• Similar to the operations on crisp sets we also want to intersect, unify
and negate fuzzy sets.

• Let A be a fuzzy interval between 5 and 8 and B be a fuzzy number


about 4. The corresponding figures are shown below.
• The following figure shows the fuzzy set between 5 and 8 AND
about 4 (notice the blue line).
• The Fuzzy set between 5 and 8 OR about 4 is shown in the
next figure (again, it is the blue line).
• This figure gives an example for a negation. The blue line is the
NEGATION of the fuzzy set A.
Example: Inverted pendulum
• The problem is to balance a pole on a mobile platform
that can move in only two directions, to the left or to the
right.

First of all, we have to define (subjectively) what high
speed, low speed etc. of the platform is; this is done by
specifying the membership functions for the fuzzy sets
• negative high (cyan)
• negative low (green)
• zero (red)
• positive low (blue)
• positive high (magenta)
• The same is done for the angle between the platform and the
pendulum and the angular velocity of this angle:
• Now we give several rules that say what to do in
certain situations
Framing Rules
• Consider for example that the pole is in the upright position (angle is
zero) and it does not move (angular velocity is zero). Obviously this
is the desired situation, and therefore we don't have to do anything
(speed is zero).

• Let's consider another case: the pole is in upright position as before


but is in motion at low velocity in positive direction. Naturally we
would have to compensate the pole's movement by moving the
platform in the same direction at low speed.

• So far we've made up two rules that can be put into a more
formalized form like this:
• If angle is zero and angular velocity is zero then speed shall be
zero.
• If angle is zero and angular velocity is pos. low then speed shall be
pos. low.
We can summarize all applicable rules in a table:

Angle
speed NH NL Z PL PH
V NH NH
E NL NL Z
L Z NH NL Z PL PH
O PL Z PL
CITY PH PH

NH: Negative high; PL: Positive Low


• Let’s take two explicit values for angle & angular velocity. Consider
the following situation:

An actual value for angle:

An actual value for angular


velocity:
• Let's apply the rule
if angle is zero and angular velocity is zero then speed is zero
to the values
Only 4 rules yield a result (they fire), & we overlap them
into one single result

• if angle is zero and angular


velocity is zero then speed is
zero
is:

• if angle is zero and angular


velocity is negative low then
speed is negative low
• if angle is positive low and
angular velocity is zero
then speed is positive low

• if angle is positive low and


angular velocity is
negative low then speed
is zero
These 4 results overlapped yield the overall
result
Result of the controller
• The result of the fuzzy controller so far is a fuzzy
set (of speed), so we have to choose one
representative value as the final output. There
are several heuristic methods (defuzzification
methods), one of them is e.g. to take the center
of gravity of the fuzzy set:
Fuzzy Logic Systems
Fuzzy Proposition
• A fuzzy proposition is a statement that can acquire a fuzzy truth table.
The fuzzy membership value associated with the fuzzy set A for P is
treated as the fuzzy truth value T(P).
– ie., T(P) = µA(x) where 0 ≤ µA(x) ≤ 1
Ex. P: Krishna is honest.
T(P) = 0.8, if P is partly true. T(P) = 1, if P is absolutely true.

• Fuzzy Connectives :
– 1. Negation
– 2. Disjunction
– 3. Conjunction
– 4. Implication
Connectives
Symbol Connective Usage Definition

- Negation P 1-T(P)

V Disjunction PVQ max((T(P),T(Q))

Λ Conjunction PΛQ min((T(P),T(Q))

=> Implication P=>Q max(1-(T(P),


T(Q))

In =>, P is antecedent Q is consequent


• P: Mary is efficient : T(P) = 0.8.
• Q : Ram is efficient :T(Q)=0.65.
1. P’: Mary is not efficient: T(P’)=1-T(P)=1-0.8=0.2
2. P Λ Q : Mary is efficient and so is Ram.
T(P Λ Q ) = min (T(P),T(Q))= min(0.8, 0.65) = 0.65.
3. 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.
4. 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.
Fuzzy Quantifiers
• Fuzzy propositions are quantified by fuzzy quantifiers.
There are two classes :
– Absolutely quantifier
– Relative quantifier.
Absolute quantifier are defined over all R, relative
quantifier are defined over [0 1].
Fuzzy Inference
• Fuzzy inference, otherwise known as approximate
reasoning refers to computational procedures used for
evaluating linguistic descriptions. Two important inferring
procedures are :
• Generalized Modus Ponens (GMP)
• Generalized Modus Tollens (GMT)
GMP is stated as :
IF x is A THEN y is B
x is A’
y is B’
GMT is stated as :
IF x is A THEN y is B
y is B’
x is A’
Fuzzy linguistics
• Fuzzy linguistic descriptions are formal representation of
systems made through fuzzy IF-THEN rules.
• Fuzzy IF THEN rules are coded as :
IF (x1 is A1, x2 is A2,,…. xn is An ) THEN (y1 is B1, y2 is B2,,…. yn is
Bn ) where linguistic variables xi ,yj takes the values of fuzzy
sets Ai, and Bj respectively.
Ex: If there is heavy rain and strong winds then there must be
severe flood warning.
Here, heavy, strong, and severe are fuzzy sets quantifying the
variables rain, wind and flood warming respectively.
A collection of rules referring to a particular system is known
as a fuzzy rule base.
Conclusion

• If the conclusion C is 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.
where Y is the universe of discourse.
Defuzzification

• The conversion of a fuzzy set to a single crisp value is called


defuzzification and is the reverse process of fuzzification.
Some of the methods are:-
1.Centroid method
2. Centre of sums
3. Mean of maxima.
Thank you !

Potrebbero piacerti anche