Sie sind auf Seite 1von 36

FUZZY LOGIC

Dr Nor Samsiah Sani

WHAT IS FUZZY LOGIC?

Definition of fuzzy
Fuzzy

not clear, distinct, or precise

Definition of fuzzy logic


A

form of knowledge representation suitable for

notions that cannot be defined precisely, but which


depend upon their contexts.

WHAT IS FUZZY LOGIC?


Fuzzy

logic:

A way to represent variation or imprecision in logic


A way to make use of natural language in logic
Approximate reasoning

Humans

say things like "If it is sunny and


warm today, I will drive fast"
Linguistic variables:
Temp: {freezing, cool, warm, hot}
Cloud Cover: {overcast, partly cloudy, sunny}
Speed: {slow, fast}

CRISP (TRADITIONAL) VARIABLES


Crisp

variables represent precise


quantities:
Temperature
A

= 36 C

{0,1}

proposition is either True or False


King(Richard) Greedy(Richard)
Evil(Richard)
Richard is either greedy or he isn't:
Greedy(Richard)

{0,1}

TRADITIONAL REPRESENTATION OF LOGIC

Slow
Speed = 0

Fast
Speed = 1

bool speed;
get the speed
if ( speed == 0) {
// speed is slow
}
else {
// speed is fast
}

Name Height,
cm

Degree of

Membership
______________________________

Chris

208

Crisp sets
1

John

198

Mark

193

Bob

172

FUZZY SETS

Fuzzy Sets can represent the degree to which a


quality is possessed.
Fuzzy Sets (Simple Fuzzy Variables) have values
in the range of [0,1]
Question: How greedy is Richard?
Greedy(Richard) = 0.7

Fuzzy Sets

For every problem must represent in terms of fuzzy sets.

Slowest

Slow

Fast

float speed;
get the speed
if ((speed >= 0.0)&&(speed < 0.25)) {
// speed is slowest
}
else if ((speed >= 0.25)&&(speed < 0.5))
{
// speed is slow
}
else if ((speed >= 0.5)&&(speed < 0.75))
{
// speed is fast
}
else // speed >= 0.75 && speed < 1.0
{
// speed is fastest
}

Fastest

FUZZY SETS

Name Height,
cm

Degree of
Membership
______________________________

Fuzzy sets
Chris

208

0.95

John

198

0.82

Mark

193

0.74

Bob

172

0.30

FUZZY SETS

Fuzzy Linguistic Variables are used to represent


qualities spanning a particular spectrum
Temp: {Freezing, Cool, Warm, Hot}
Membership Function
Question: What is the temperature?
Answer: 36 C.
Question: How warm is 36 C?

MEMBERSHIP FUNCTIONS
Temp:

{Freezing, Cool, Warm, Hot}


Degree of Truth or "Membership"

10

MEMBERSHIP FUNCTIONS
How

cool is 36 F ?

11

MEMBERSHIP FUNCTIONS
How

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

0.7

0.3
12

FUZZY LOGIC
How do we use fuzzy membership functions in
predicate logic?
Fuzzy logic Connectives:

Fuzzy

Conjunction (AND),
Fuzzy Disjunction (OR),

Operate on degrees of membership in fuzzy sets

13

FUZZY DISJUNCTION
AB = max(A, B)
AB = C "Quality C is the disjunction of
Quality A and B"

(AB = C) (C = 0.75)

14

FUZZY CONJUNCTION
AB = min(A, B)
AB = C "Quality C is the conjunction of
Quality A and B"

(AB = C) (C = 0.375)

15

EXAMPLE: FUZZY CONJUNCTION


Calculate AB given that A is 0.4 and B is 20

16

EXAMPLE: FUZZY CONJUNCTION


Calculate AB given that A is .4 and B is 20

Determine degrees of membership:

17

EXAMPLE: FUZZY CONJUNCTION


Calculate AB given that A is .4 and B is 20

0.7

Determine degrees of membership:


A = 0.7
18

EXAMPLE: FUZZY CONJUNCTION


Calculate AB given that A is .4 and B is 20

0.9
0.7

Determine degrees of membership:


A = 0.7 B = 0.9

19

EXAMPLE: FUZZY CONJUNCTION


Calculate AB given that A is .4 and B is 20

0.9
0.7

Determine degrees of membership:


A = 0.7 B = 0.9
Apply Fuzzy AND
AB = min(A, B) = 0.7

20

FUZZY CONTROL

Fuzzy Control combines the use of fuzzy


linguistic variables with fuzzy logic
Example: Speed Control
How fast am I going to drive today?
It depends on the weather.
Disjunction of Conjunctions

21

INPUTS: TEMPERATURE,
CLOUD COVER
Temp:

{Freezing, Cool, Warm, Hot}

Cover:

{Sunny, Partly, Overcast}

22

OUTPUT: SPEED

Speed: {Slow, Fast}

23

RULES

If it's Sunny and Warm, drive Fast


Sunny(Cover)Warm(Temp) Fast(Speed)
If it's Cloudy and Cool, drive Slow
Cloudy(Cover)Cool(Temp) Slow(Speed)
Driving Speed is the combination of output of
these rules...

24

THE SEQUENCE OF FUZZY LOGIC


SYSTEM

Fuzzification: A crisp set of input data are gathered and converted to a fuzzy
set using fuzzy linguistic variables and membership functions. This step is
known as fuzzification.
Construct fuzzy rules
Perform fuzzy inference into the system. An inference is made based on a set
of rules.
Defuzzification: The resulting fuzzy output is mapped to a crisp output using
the membership functions.

EXAMPLE SPEED CALCULATION

How fast will I go if it is


65

F
25 % Cloud Cover ?

26

FUZZIFICATION:
CALCULATE INPUT MEMBERSHIP LEVELS
65

F Cool = 0.4, Warm= 0.7

25%

0.2

Cover Sunny = 0.8, Cloudy =

27

RULES EVALUATION
If it's Sunny and Warm, drive Fast
Sunny(Cover)Warm(Temp)Fast(Speed)

0.8 0.7 = 0.7


Fast = 0.7

If it's Cloudy and Cool, drive Slow


Cloudy(Cover)Cool(Temp)Slow(Speed)

0.2 0.4 = 0.2


Slow = 0.2

28

DEFUZZIFICATION:
CONSTRUCTING THE OUTPUT

Speed is 20% Slow and 70% Fast

Find centroids: Location where membership is


100%
29

DEFUZZIFICATION:
CONSTRUCTING THE OUTPUT

Speed is 20% Slow and 70% Fast

Find centroids: Location where membership is


100%
30

DEFUZZIFICATION:
CONSTRUCTING THE OUTPUT

Speed is 20% Slow and 70% Fast

Speed

= weighted mean
= (0.2*25+...
31

DEFUZZIFICATION:
CONSTRUCTING THE OUTPUT

Speed is 20% Slow and 70% Fast

Speed

= weighted mean
= (0.2*25+0.7*75)/(0.9)
= 63.8 mph

32

The usage

Fuzzy Logic provides a more efficient and resourceful


way to solve Control Systems.

Some Examples
Temperature

Controller

TEMPERATURE CONTROLLER

The problem

Change

the speed of a heater fan, based off the room


temperature and humidity.

A temperature control system has four settings

Cold,

Humidity can be defined by:

Low,

Cool, Warm, and Hot

Medium, and High

Using this we can define


the fuzzy set.

CONCLUSION

Fuzzy logic provides an alternative way to


represent linguistic and subjective attributes of
the real world in computing.

It is able to be applied to control systems and


other applications in order to improve the
efficiency and simplicity of the design process.

CONCLUSION
Fuzzy

Logic provides way to calculate with


imprecision
Fuzzy Logic can be used to represent some
kinds of human expertise
Fuzzy Membership Sets
Fuzzy Linguistic Variables
Fuzzy AND and OR

36

Das könnte Ihnen auch gefallen