Вы находитесь на странице: 1из 39

Fuzzy Logic

Dr. Umang Soni


MPAE Div, NSIT
BRIEF HISTORY

Classical Logic
 Invented by ancient Greeks, Socrates

 used by mathematicians

In this logic

 Every statement is either TRUE or FALSE


 Statements can be combined with the logical connections:
Aristotle
AND and OR
 A statement can be modified with NOT
 Truth tables are used to evaluate the truth value of a complicated
statement (i.e., TRUEness or FALSEness)
 Logical IF–THEN statements are used to express “THEOREMS”

2
INTRODUCTION
• It is the mark of an instructed mind to rest satisfied with that degree of
precision which the nature of the subject admits, and not to seek exactness
where only an approximation of the truth is possible.
Aristotle, 384–322 BC (Ancient Greek philosopher)

• Precision is not truth , Henri E. B. Matisse, 1869–1954

• All traditional logic habitually assumes that precise symbols are being
employed. It is therefore not applicable to this terrestrial life but only to an
imagined celestial existence.
Bertrand Russell, 1923
• Most engineering texts do not address the uncertainty in the information, models,
and solutions that are conveyed within the problems addressed therein.

• The more complex a system is, the more imprecise or inexact is the information that
we have to characterize that system. It seems, then, that precision, information and
complexity are inextricably related in the problems we pose for eventual solution.

• However, for most of the problems that we face, we can do a better job in accepting
some level of imprecision.

• It seems intuitive that we should balance the degree of precision in a problem with
the associated uncertainty in that problem
BRIEF HISTORY Boolean Logic
George Boole

• Based on Classical Logic


• In Boolean logic, we use only two possible values, called by various names, such as
"true" and "false",
"yes" and "no",
"on" and "off“,
"1" and "0".
• Formulas evaluate truth values
• 1854: Logical algebra was published by George Boole
 known today as “Boolean Algebra”
• It’s a convenient and systematic way of expressing and analyzing the operation of “logic circuits”.
• 1938: Boole’s work was applied to the analysis and design of logic circuits by Claude Shannon.

5
Boolean Logic

In Boolean logic, each element either belongs to or


does not belong to a set.
If an element is a member of a given set, the Boolean
logic will return :
1 (representing complete membership)
0 (representing non-membership)

6
Boolean Logic
If A represents an ordinary crisp set/ Boolean set
Then A ={x | P(x)} indicates that the set A consists of those items
x for which the property P is true.

For example:
“THE BULB GLOWS AT A SUPPLY VOLTAGE OF 220V”
According to this statement the bulb will glow at 220V and not otherwise.

GLOW, 1

NOT GLOW, 0 216 218 220 222 224 226


BOOLEAN REPRESENTATION

1
Fuzzy logic

The Statement “Today is sunny” can be


• 100% true if there are no clouds
• 80% true if there are a few clouds
• 50% true if it's hazy and
• 0% true if it rains all day

8
1
Basics of Fuzzy Logic…
Now consider the statement “The bulb glows when supply voltage is "around 220V”

According to this statement , the bulb will glow even for voltages lower as well as higher
than 220V.
The condition “around 220V” cannot be represented by either 1 or 0, although the
human mind can very well comprehend that it refers to voltages little below or higher
than 220V.
Thus “ around 220V” is not a binary /crisp condition. i.e. two distinct states 1 and 0 are
not enough to characterize it. So one might be inclined to say that we require more states
or multiple states. But how many states?

1
THE ANSWER LIES WITH FUZZY LOGIC

0
214 216 218 220 222 224 226
FUZZY REPRESENTATION
9
1
Basics of Fuzzy Logic…

The terms like AROUND, APPROXIMATELY, MORE-OR-LESS, SLIGHTLY, VERY represent an intuitive feel
of expert human and can be expressed as FUZZY SETS.

FUZZY SET
Fuzzy set is a mathematical measure of ambiguous phenomenon and a technique for mathematically
expressing linguistics ambiguity.

The phrase” around 220V” can be represented by a set of points. Each point is a measure of the
degree to which the phrase” around 220V” is true.

10
Basics of Fuzzy Logic…
• The collection of points which determine the curve “AROUND 220V” can
be written in the form
F   μ F (x)/x OR F   μ F (x)/x
u
u

• The ∫ and  do not represent the conventional integration or


differentiation signs, but they only denote the collection of points which
form the set F. F is called a fuzzy Set.

• F= AROUND 220V = [0/208, 0.1/210, 0.2/212, 0.4/214, 0.6/216, 0.8/217,


1/220, 0.8/224, 0.6/226, 0.2/230, 0/234]

11
• Suppose set A is the crisp set of all people with 5.0 ≤ x ≤ 7.0 feet.
• A particular individual, x1, has a height of 6.0 feet. The membership of this
individual in crisp set A is equal to 1, or full membership, given symbolically as
χA(x1) = 1.
• Another individual, say x2, has a height of 4.99 feet. The membership of this
individual in set A is equal to 0, or no membership, hence χA(x2) = 0.
• In these cases the membership in a set is binary, either an element is a member of
a set or it is not.

Membership functions for a crisp set A


• The sets on the universe X that can accommodate “degrees of membership”
were termed by Zadeh as fuzzy sets.
• Continuing further on the example on heights, consider a set H, consisting of
heights near 6 feet .
• Since the property near 6 feet is fuzzy, there is no unique membership function
for H.
• Rather, the analyst must decide what the membership function, denoted μH,
should look like.

Membership functions for a fuzzy set H.


• A key difference between crisp and fuzzy sets is their membership
function; a crisp set has a unique membership function, whereas a
fuzzy set can have an infinite number of membership functions to
represent it.

• For fuzzy sets, the uniqueness is sacrificed, but flexibility is gained


because the membership function can be adjusted to maximize the
utility for a particular application.
Fuzzy Set Operations

• Define three fuzzy sets A, B, and C on the universe X.


• For a given element x of the universe, the following function-theoretic operations
for the set-theoretic operations of union, intersection, and complement are
defined for A ,B, and C on X:
• Union μA∪B(x) = μA(x) ∨ μB(x) = max(A(x), B(x))

• Intersection μA∩B(x) = μA(x) ∧ μB(x) = min(A(x), B(x))

• Complement μ Ā(x) = 1 − μA(x)


Fuzzification
Fuzzification

Fuzzification is the process of changing a real scalar value into a fuzzy value.
This is achieved with the different types of fuzzifiers (membership functions).

The process of transforming crisp(bivalued) input values into linguistic values is called
fuzzification

Steps of Fuzzification:
Step 1: Input values are translated into linguistic concepts, which are represented by fuzzy set.
Step 2: Membership functions are applied to the measurements, and the degree of membership
is determined
Fuzzification

Fuzzy Linguistic Variables are used to represent qualities spanning a particular spectrum
Temp: {Freezing, Cool, Warm, Hot}
Question: What is the temperature?
Answer: It is warm.
Question: How warm is it?
Fuzzification

Temp: {Freezing, Cool, Warm, Hot}


Degree of Truth or "Membership"

Freezing Cool Warm Hot


1

0
10 30 50 70 90 110
Temp. (F°)

Membership Functions
Fuzzification

How cool is 36 F° ?
It is 30% Cool and 70% Freezing

Freezing Cool Warm Hot


1

0.7

0.3

0
10 30 50 70 90 110
Temp. (F°)
Fuzzification
Membership Functions
The MATLAB toolbox includes 11 built-in membership function types.
These 11 functions are, in turn, built from several basic functions:
• piecewise linear functions
• the Gaussian distribution function
• the sigmoid curve
• quadratic and cubic polynomial curves
Fuzzification
Membership Functions
The simplest membership functions are formed using straight lines. The
simplest is the triangular membership function, and it has the function
name trimf.
The trapezoidal membership function, trapmf, has a flat top and really is
just a truncated triangle curve. These straight line membership
functions have the advantage of simplicity.
Fuzzification
Membership Functions
Two membership functions are built on the Gaussian distribution
curve: a simple Gaussian curve and a two-sided composite of two
different Gaussian curves. The two functions are gaussmf and
gauss2mf. The generalized bell membership has the function name
gbellmf.

Because of their smoothness and concise notation, Gaussian and bell


membership functions are popular methods for specifying fuzzy sets.
Both of these curves have the advantage of being smooth and nonzero
at all points.
Fuzzification
Membership Functions
Although the Gaussian membership functions and bell membership
functions achieve smoothness, they are unable to specify asymmetric
membership functions, which are important in certain applications.

the sigmoidal membership function is defined, which is either open


left or right. Asymmetric and closed (i.e. not open to the left or right)
membership functions can be synthesized using two sigmoidal
functions, so in addition to the basic sigmf, you also have the
difference between two sigmoidal functions, dsigmf, and the product
of two sigmoidal functions psigmf.
Fuzzification
Membership Functions
Polynomial based curves account for several of the membership
functions in the toolbox.
Three related membership functions are the Z, S, and Pi curves, all
named because of their shape. The function zmf is the asymmetrical
polynomial curve open to the left, smf is the mirror-image function
that opens to the right, and pimf is zero on both extremes with a rise
in the middle.
Membership functions

• A triangular membership function is specified by three parameters {a,


b, c}:
• Triangle(x; a, b, c) = 0 if x  a;
• = (x-a)/(b-a) if a  x  b;
• = (c-b)/(c-b) if b  x  c;
• = 0 if c  x.
A trapezoidal membership function is specified by four
parameters {a, b, c, d} as follows:

Trapezoid(x; a, b, c, d) = 0 if x  a;
= (x-a)/(b-a) if a  x  b;
= 1 if b  x  c;
= (d-x)/(d-c) 0 if c  x  d;
= 0, if d  x.
A sigmoidal membership function is specified by two
parameters {a, c}:
• Sigmoid(x; a, c) = 1/(1 + exp[-a(x-c)]) where a controls slope at the
crossover point x = c.
• These membership functions are some of the commonly used
membership functions in the fuzzy inference systems.
Fuzzy Rules
• Fuzzy rules are useful for modeling human thinking, perception and
judgment.
• A fuzzy if-then rule is of the form “If x is A then y is B” where A and B
are linguistic values defined by fuzzy sets on universes of discourse X
and Y, respectively.
• “x is A” is called antecedent and “y is B” is called consequent.
Binary fuzzy relation
• A binary fuzzy relation is a fuzzy set in X × Y which maps each
element in X × Y to a membership value between 0 and 1. If X and Y
are two universes of discourse, then
• R = {((x,y), R(x, y)) | (x,y) Є X × Y } is a binary fuzzy relation in X × Y.
• X × Y indicates cartesian product of X and Y
Fuzzy rule as a relation
If x is A, then y is B
x is A, y is B fuzzy predicates A( x), B( y )
If A( x), then B( y )
can be represente d by relation
R( x, y ) : A( x)  B( y )
R( x, y ) can be considered a fuzzy set with 2 - dim membership function
 R ( x, y )  f (  A ( x),  B ( y ))
where f is " fuzzy implicatio n function" , performs the task
of transform ing the membership degrees of x in A and y in B
into those of ( x, y ) in A  B

31
Fuzzy implications

32
Example of Fuzzy implications

Let T and H be universe of temperatu re and humidity,


and define variables t  T and h  H.
A " high" , A  T
B " fairly high" , B  H
then the rule can be rewritten as
R(t, h) : If t is A, then h is B
R(t) : t is A, R(h) : h is B
R(t, h) : R(t)  R(h)
R(t, h)  A  B    A (t )   B (h) /(t , h)
33
Example of Fuzzy implications

R(t, h)  A  B    A (t )   B (h) /(t , h)

h
20 50 70 90
t
20 0.1 0.1 0.1 0.1
30 0.2 0.5 0.5 0.5
40 0.2 0.6 0.7 0.9

34
Example of Fuzzy implications
When " temperatur e is fairly high" or t is A' , A'  T

We can use composition of fuzzy relations to find R(h)


R(h)  R(t ' )  R C (t , h)
h
20 50 70 90
t
20 0.1 0.1 0.1 0.1
30 0.2 0.5 0.5 0.5
40 0.2 0.6 0.7 0.9
35
Representation of Fuzzy Rule
Single input and single output
Fact: u is A ' : R(u)
Rule: If u is A then w is C : R(u, w)
Result: w is C ' : R( w)  R(u) R(u, w)
Multiple inputs and single output
Fact: u1 is A1' ' and u2 is A2' ' and ... and un is An' '
Rule: If u1 is A1 and u2 is A2 and ... and un is An then w is C
Result: w is C '
Multiple inputs and Multiple outputs
Fact: u1 is A1' and u2 is A2' and ... and un is An'
Rule: If u1 is A1 and u2 is A2 and ... and un is An then w1 is C1 , w2 is C2 ,..., wm is Cm
Result: w1 is C1' , w2 is C2' ,..., wm is Cm'
36
Representation of Fuzzy Rule
Multiple rules
Fact : u1 is A' 1 and u2 is A ' 2 and ... and un is A' n
Rule j : If u1 is A' 1 j and u2 is A ' 2 j and ... and un is A' nj , then w 1j is C'1j , w 2j is C' 2j , ..., w mj is C' mj
Result : w1 is C'1 , w 2 is C' 2 , ..., w m is C' m

37
Compositional rule of inference
The inference procedure is called as the “compositional rule of inference”. The
inference is determined by two factors : “implication operator” and
“composition operator”.

For the implication, the two operators are often used:

For the composition, the two operators are often used:

38
Representation of Fuzzy Rule
Fact: u is A ' : R(u)
Rule: If u is A then w is C : R(u, w)
Result: w is C ' : R( w)  R(u) R(u, w)

Max-min composition operator

R(u, w) : A  C

Mamdani: min operator for the implication


Larsen: product operator for the implication 39

Вам также может понравиться