You are on page 1of 44

CT032-3-3

Further Artificial Intelligence

Fuzzy Logic
Learning Outcomes

• On successful completion of this topic, you


should be able to:
– Explain on Fuzzy Logic
– Apply Fuzzy Logic concepts.
– Implement Fuzzy logic controller

CT032-3-3 Further Artificial Intelligence Fuzzy Logic


Industrial Applications of Fuzzy
Logic Control
Fuzzy Logic Primer

• History, Current Level and Further


Development of Fuzzy Logic
Technologies in the U.S., Japan, and
Europe

• Types of Uncertainty and the Modeling


of Uncertainty

• The Basic Elements of a Fuzzy


Inference System (FIS)

• Types of Fuzzy Logic Controllers

CT032-3-3 Further Artificial Intelligence Fuzzy Logic


History, State of the Art, and
Future Development
1965 Seminal Paper “Fuzzy Logic” by Prof. Lotfi Zadeh,
Faculty in Electrical Engineering, U.C. Berkeley, Sets
the Foundation of the “Fuzzy Set Theory”
1970 First Application of Fuzzy Logic in Control
Engineering (Europe)
1975 Introduction of Fuzzy Logic in Japan
1980 Empirical Verification of Fuzzy Logic in Europe
1985 Broad Application of Fuzzy Logic in Japan
1990 Broad Application of Fuzzy Logic in Europe
1995 Broad Application of Fuzzy Logic in the U.S.
Today, Fuzzy Logic Has 2000 Fuzzy Logic Becomes a Standard Technology and Is
Already Become the Also Applied in Data and Sensor Signal Analysis.
Standard Technique for Application of Fuzzy Logic in Business and Finance.
Multi-Variable Control!

CT032-3-3 Further Artificial Intelligence Fuzzy Logic


Fuzzy Applications
Published in IEEE
• About 1100 Successful Fuzzy Logic Applications Have
Been Published (an estimated 5% of those in
existence)
• Almost All Applications Have Not Involved the
Replacement of a Standard Type Controller (PID,..),
But Rather Multi-Variable Supervisory Control
• Applications Range from Embedded Control (28%),
Industrial Automation (62%) to Process Control (10%)
• Of 311 Authors That Answered a Questionnaire, About
90% State That Fuzzy Logic Has Slashed Design Time
By More Than Half
• In This Questionnaire, 97.5% of the Designers Stated
That They Will Use Fuzzy Logic Again in Future
Applications, If Fuzzy Logic Is Applicable

Fuzzy Logic Will Play a Major Role in


Control Engineering!
CT032-3-3 Further Artificial Intelligence Fuzzy Logic
Types of Uncertainty and the
Modeling of Uncertainty
Stochastic Uncertainty:
• The Probability of Hitting the Target Is 0.8

Lexical Uncertainty:
• "Tall Men", "Hot Days", or "Stable Currencies"
• We Will Probably Have a Successful Business Year.
• The Experience of Expert A Shows That B Is Likely
to Occur. However, Expert C Is Convinced This Is
Not True.

Most Words and Evaluations We Use in Our Daily Reasoning Are Not
Clearly Defined in a Mathematical Manner.
This Allows Humans to Reason on an Abstract Level!
CT032-3-3 Further Artificial Intelligence Fuzzy Logic
Probability and
Uncertainty
“... a person suffering from
hepatitis shows in 60% of all
cases a strong fever, in 45% of
all cases yellowish colored skin,
and in 30% of all cases suffers
from nausea ...”

Stochastic and Fuzzy Logic


Complement Each Other !

CT032-3-3 Further Artificial Intelligence Fuzzy Logic


Fuzzy Logic
Introduction
Fuzzy Logic is an innovative technology that enhances
conventional system design with engineering expertise. It will
circumvent the need for rigorous mathematical modeling.
Fuzzy logic addresses such applications perfectly as it
resembles human decision making with an ability to generate
precise solutions from certain or approximate information. It
fills an important gap in engineering design methods left
vacant by purely mathematical approaches (e.g. linear
control design), and purely logic-based approaches (e.g.
expert systems) in system design.

Fuzzy Set Theory  Extension of classical set theory


CT032-3-3 Further Artificial Intelligence Fuzzy Logic ‹#›
Introduction

• Fuzziness is deterministic uncertainty.


• Fuzziness is connected with the degree to
which events occur rather than the
likelihood of their occurrence (probability).
• For example, the degree to which a
person is young is a fuzzy event rather
than a random event.

CT032-3-3 Further Artificial Intelligence Fuzzy Logic


Why Fuzzy Logic?

• Fuzzy Logic can:


– Represent vague language naturally
– Enrich not replace crisp sets
– Allow flexible engineering design
– Improve model performance
– Are simple to implement
– And best of all they often work!

CT032-3-3 Further Artificial Intelligence Fuzzy Logic


Components of Fuzzy
Logic
Fuzzification: defines input parameters
using linguistic data.

Inference rules: relates the input


parameters with the output parameters.

Defuzzification: converts the linguistic


value of data into crisp values.

CT032-3-3 Further Artificial Intelligence Fuzzy Logic ‹#›


Fuzzy Set Theory

Conventional (Boolean) Set Theory:

38.7°C
38°C
40.1°C 41.4°C
Fuzzy Set Theory:
42°C
39.3°C
“Strong Fever” 38.7°C
37.2°C 38°C
40.1°C 41.4°C

42°C
39.3°C
“More-or-Less” Rather Than “Strong Fever”
“Either-Or”! 37.2°C
CT032-3-3 Further Artificial Intelligence Fuzzy Logic
Overview (figure from Earl Cox)

CT032-3-3 Further Artificial Intelligence Fuzzy Logic


Fuzzy Sets

• A crisp set is a set for which each value either is or is


not contained in the set.
• Crisp sets can be defined by values within it
• For a fuzzy set, every value has a membership
value, and so is a member to some extent.
• The membership value defines the extent to which a
variable is a member of a fuzzy set.
• The membership value is from 0 (not at all a member
of the set) to 1.

CT032-3-3 Further Artificial Intelligence Fuzzy Logic


Fuzzy Set Operators

• Fuzzy set operators can be defined by


their membership functions
– M¬A(x) = 1 - MA(x)
– MA  B (x) = MIN (MA (x), MB (x))
– MA  B (x) = MAX (MA (x), MB (x))
• We can also define containment (subset
operator):
– B  A iff x (MB (x)  MA (x))

CT032-3-3 Further Artificial Intelligence Fuzzy Logic


Fuzzy Set Operators
• There are several traditional set theory that use a number
of operators that can be applied to set A and B
– Not A the Complement of A, which contains the elements
that are not contained in A
– A ∩ B the intersection of A and B, which contains those
elements that are contained in both A and B
– A U B the union of A and B, which contains all the elements
of A and all the elements of B

• Also related to the logical operators: ¬, Λ and V

• With combination of those operators, as a result the set


operators are commutative, associative and distributive,
and obey DeMorgan’s laws
CT032-3-3 Further Artificial Intelligence Fuzzy Logic
• DeMorgan’s Law:
The rules allow the
expression of
conjunctions and
disjunctions purely in
terms of each other via
negation.

CT032-3-3 Further Artificial Intelligence Fuzzy Logic


Hedges
• A fuzzy set qualifier, such as “very”, “quite”, “extremely”, or
“somewhat”
• When applied to fuzzy set, the new set will be produce
– Eg: apply “very” to “tall people” – subset of “tall people” will be
produced, that is called “very tall people”

• The meanings of these hedges are fairly subjective


• Usually use a systematic mathematic definition for the hedges
so that it can be applied logically.
• Often hedges is applied by raising the set’s membership
function to an appropriate power
– Eg:
– MVA(x) = (MA(x))2
CT032-3-3 Further Artificial Intelligence Fuzzy Logic
Fuzzy Set Definitions

Discrete Definition: (for body temperature)


µSF(35°C) = 0µSF(38°C) = 0.1µSF(41°C) = 0.9
µSF(36°C) = 0µSF(39°C) = 0.35 µSF(42°C) = 1
µSF(37°C) = 0µSF(40°C) = 0.65 µSF(43°C) = 1
No More Artificial Thresholds!
Continuous Definition:
µ(x)
1

0
36°C 37°C 38°C 39°C 40°C 41°C 42°C

CT032-3-3 Further Artificial Intelligence Fuzzy Logic


Linguistic Variables

...Terms, Degree of Membership, Membership Function, Base Variable...

µ(x)
low temp normal raised temperature strong fever
1
… pretty much raised …

... but just slightly strong …

0
36°C 37°C 38°C 39°C 40°C 41°C 42°C

CT032-3-3 Further Artificial Intelligence Fuzzy Logic


Basic Elements of a
Fuzzy Logic System
Fuzzy Logic Defines
Fuzzification, Fuzzy Inference, Defuzzification: the Control Strategy on
a Linguistic Level!

Measured Variables 2. Fuzzy-Inference Command Variables


(Linguistic Values) (Linguistic Values)

Linguistic
Level
1. Fuzzification 3. Defuzzification
Numerical
Level

Measured Variables Plant Command Variables


(Numerical Values) (Numerical Values)

CT032-3-3 Further Artificial Intelligence Fuzzy Logic


Basic Elements of a
Fuzzy Logic System
Closing the Loop
Control Loop of the Fuzzy Logic Controlled Container Crane: With Words!

Angle, Distance 2. Fuzzy-Inference Power


(NumericalVariable)
(Linguistic Values) (Linguistic Variable)

Linguistic
Level
1. Fuzzification 3. Defuzzification
Numerical
Level

Angle, Distance Container Crane Power


(Numerical Values) (Numerical Values)

CT032-3-3 Further Artificial Intelligence Fuzzy Logic


1. Fuzzification:
Linguistic Variables
The Linguistic
Variables Are the
Term Definitions: “Vocabulary” of
Distance := {far, medium, close, zero, neg_close} a Fuzzy Logic
Angle := {pos_big, pos_small, zero, neg_small, neg_big} System!
Power := {pos_high, pos_medium, zero, neg_medium, neg_high}

Membership Function Definition:


µ zero
µ neg_close zero close medium far
neg_big neg_small pos_small pos_big
1 1
0.9
0.8

0.2
0.1
0 0
-90° -45° 0° 4° 45° 90° -10 0 10 12m 20 30
Angle Distance [yards]
CT032-3-3 Further Artificial Intelligence Fuzzy Logic
The components of a fuzzy
inference system

CT032-3-3 Further Artificial Intelligence Fuzzy Logic ‹#›


2. Fuzzy-Inference:
“IF-THEN”-Rules
Computation of the “IF-THEN”-Rules:
#1: IF Distance = medium AND Angle = pos_small THEN Power = pos_medium
#2: IF Distance = medium AND Angle = zero THEN Power = zero
#3: IF Distance = far AND Angle = zero THEN Power = pos_medium

• Aggregation: Computing the “IF”-Part


• Composition: Computing the “THEN”-Part
The Rules of the
Fuzzy Logic Systems
Are the “Laws” It
Executes!

CT032-3-3 Further Artificial Intelligence Fuzzy Logic


2. Fuzzy-Inference:
Aggregation
Boolean Logic Only Fuzzy Logic Delivers
Defines Operators for 0/1: a Continuous Extension:
A B A+B • AND: µAvB = min{ µA; µB }
0 0 0
• OR: µA+B = max{ µA; µB }
0 1 1
1 0 1 • NOT: µ-A = 1 - µA
1 1 1

Aggregation of the “IF”-Part:


#1: min{ 0.9, 0.8 } = 0.8 Aggregation Computes
How “Appropriate” Each
#2: min{ 0.9, 0.2 } = 0.2 Rule Is for the Current
#3: min{ 0.1, 0.2 } = 0.1 Situation !

CT032-3-3 Further Artificial Intelligence Fuzzy Logic


2. Fuzzy-Inference:
Composition
Result for the Linguistic Variable "Power":

pos_high with the degree 0.0


pos_medium with the degree 0.8 ( = max{ 0.8, 0.1 } )
zero with the degree 0.2
neg_medium with the degree 0.0
neg_high with the degree 0.0 Composition Computes
How Each Rule
Influences the Output
Variables!

CT032-3-3 Further Artificial Intelligence Fuzzy Logic


CT032-3-3 Further Artificial Intelligence Fuzzy Logic ‹#›
CT032-3-3 Further Artificial Intelligence Fuzzy Logic ‹#›
CT032-3-3 Further Artificial Intelligence Fuzzy Logic ‹#›
Step 1

CT032-3-3 Further Artificial Intelligence Fuzzy Logic ‹#›


Step 2

CT032-3-3 Further Artificial Intelligence Fuzzy Logic ‹#›


Step 3

CT032-3-3 Further Artificial Intelligence Fuzzy Logic ‹#›


Step 4

CT032-3-3 Further Artificial Intelligence Fuzzy Logic ‹#›


Step 5

CT032-3-3 Further Artificial Intelligence Fuzzy Logic ‹#›


min

CT032-3-3 Further Artificial Intelligence Fuzzy Logic ‹#›


3. Defuzzification
Finding a Compromise Using “Center-of-Maximum”:

µ neg_high neg_medium zero pos_medium pos_high


1

0
-30 -15 0 15 30
Power [Kilowatts] 6.4 KW
CT032-3-3 Further Artificial Intelligence Fuzzy Logic
Types of Fuzzy Controllers:
Direct Controller
The Outputs of the Fuzzy Logic System Are the Command Variables of the Plant:

Command
IF temp=low
AND P=high
Variables
THEN A=med

IF ...
Plant

Fuzzification Inference Defuzzification

Measured Variables

Fuzzy Rules Output


Absolute Values!
CT032-3-3 Further Artificial Intelligence Fuzzy Logic
Types of Fuzzy Controllers:
Supervisory Control
Fuzzy Logic Controller Outputs Set Values for Underlying PID Controllers:

IF temp=low
Set Values PID
AND P=high
THEN A=med

PID Plant
IF ...

Fuzzification Inference Defuzzification PID

Measured Variables

Human Operator
Type Control!

CT032-3-3 Further Artificial Intelligence Fuzzy Logic


Types of Fuzzy Controllers:
PID Adaptation
Fuzzy Logic Controller Adapts the P, I, and D Parameter of a Conventional PID Controller:
Set Point Variable

IF temp=low
AND P=high P
THEN A=med
I Command Variable
D
IF ...
PID Plant
Fuzzification Inference Defuzzification

Measured Variable

The Fuzzy Logic System Analyzes the Performance


of the PID Controller and Optimizes It!
CT032-3-3 Further Artificial Intelligence Fuzzy Logic
Types of Fuzzy Controllers:
Fuzzy Intervention
Fuzzy Logic Controller and PID Controller in Parallel:
Set Point Variable

IF temp=low
AND P=high
THEN A=med Command Variable

IF ...
Plant
PID
Fuzzification Inference Defuzzification

Measured Variable

Intervention of the Fuzzy Logic


Controller into Large Disturbances!
CT032-3-3 Further Artificial Intelligence Fuzzy Logic
Summary

– Apply fuzzy logic concepts.


– Explain on Fuzzy Logic
– Implement Fuzzy logic controller

CT032-3-3 Further Artificial Intelligence Fuzzy Logic


Q&A

CT032-3-3 Further Artificial Intelligence Fuzzy Logic 43


Next Session

– Neural Expert System


– Neuro-Fuzzy
– Neuro-Genetic
– Fuzzy-Genetic

CT032-3-3 Further Artificial Intelligence Fuzzy Logic

You might also like