0% found this document useful (0 votes)
6 views22 pages

Lec16 (Is)

This document discusses fuzzy logic, a mathematical approach developed by Lotfi A. Zadeh in 1965 to handle vague or ambiguous situations in decision-making. It contrasts fuzzy logic with traditional Boolean logic, emphasizing the flexibility of fuzzy sets that allow for degrees of membership rather than binary true/false values. The lecture also includes applications of fuzzy logic in various fields, such as control systems and artificial intelligence, and provides examples of fuzzy logic systems and membership functions.

Uploaded by

Nooraldeen Ali
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)
6 views22 pages

Lec16 (Is)

This document discusses fuzzy logic, a mathematical approach developed by Lotfi A. Zadeh in 1965 to handle vague or ambiguous situations in decision-making. It contrasts fuzzy logic with traditional Boolean logic, emphasizing the flexibility of fuzzy sets that allow for degrees of membership rather than binary true/false values. The lecture also includes applications of fuzzy logic in various fields, such as control systems and artificial intelligence, and provides examples of fuzzy logic systems and membership functions.

Uploaded by

Nooraldeen Ali
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/ 22

Ninevah University

College of Electronics Engineering


Computer and Informatics Engineering Department

Intelligent Systems
Lecture 16
Fuzzy Logic

Lecturer
Dr. Faris S. Alghareb
PhD in Computer Engineering @ UCF
email: [email protected]
Copyright © 2020 Faris S. Alghareb. All rights reserved.
Fuzzy Logic
v In the real world, many times we encounter in our daily work and home environments a situation
when we cannot determine whether the state is true or false

v In some case, it is hard to make a decision since it is not adequately clear or is vague, therefore,
fuzzy logic was developed to assist in solving complex or fuzzy problems.

v In 1965, Lotfi A. Zadeh, of university of California at Berkeley published “FUZZY


Sets,” which laid out the mathematics of fuzzy set theory, then extended to fuzzy
logic.

v Zadeh had observed that conventional computer logic could not manipulate data
that represented subjective or vague ideas, thus he invented fuzzy logic to allow
computers to determine the distinctions among data with shades of gray in a way
such that the process of human reasoning.

v So, if we aim to replicate the control actions of a human operator,


◆ we must be able to model the activities of the operator, and
◆ Our model must be built so that it is capable of dealing with vague information such that the fuzzy logic
provides a very valuable flexibility for reasoning

EECIE20-S4305 Intelligence Systems & Software Engineering: Fuzzy logic Slide 1


Fuzzy Logic
v In 1974, the scientist Mamdani could apply fuzzy logic in steam engine control, and then fuzzy
logic become more practical useful in Japan in the 1990s.

v Fuzzy logic-based systems can be used to do precise decisions, so they are perfectly used where
systems are particularly complex.

v They have been used successfully in many applications such as voice and handwriting recognition
and subway train speed control.

v A crisp subset can be defined from a more extensive set where the elements of the set belong to the
subset according to some condition.

v The opposite word (antonym) of fuzzy is crisp. Fuzzy means unclear or ambiguous while crisp
means clear and sharp (precise).
crisp deals with values that have a strict boundaries, i.e., Fales or True.

v Fuzzy logic provides a very valuable flexibility for reasoning, for example, we can consider the
inaccuracies and uncertainties of any situation

EECIE20-S4305 Intelligence Systems & Software Engineering: Fuzzy logic Slide 2


Fuzzy Set Theory – Introduction
v Conventional control schemes require accurate models in order to create the appropriate system.

v On the other hand, experienced practical engineers may well be able to control a process without
having the slightest knowledge of its mathematical model.

v They can control the system by knowing only its overall physical characteristics and using their
experience.

v Artificial Intelligence (AI) based control systems have been developed to attempt to replicate the
benefits of human-type reasoning in controller design and implementation.

v In this module, the AI technique that we are going to focus on in this lecture is Fuzzy Logic.

v Fuzzy logic is based on Fuzzy Set Theory – a development of set theory which replace the Boolean
concept of entities either being members of a well-defined set or not with the notion that membership
can be Fuzzy – that entities can have degrees of membership of a set.

v In the next slide, we will start a quick review of basic theory and then extend those concepts to
describe Fuzzy Set Theory.

EECIE20-S4305 Intelligence Systems & Software Engineering: Fuzzy logic Slide 3


Boolean Logic and Fuzzy Logic
v Assume that there are some objects of any shape as shown below and that the desired task is to
distinguish between the shapes that have angles and shapes that only have curves:

Shape C
Shape A Shape B Shape D

Shape E Shape F Shape G


Shape H

v Clearly then the objects that have only curves are: Shape C, Shape D, Shape F, and Shape H.
v Therefore, a set {S1} can be created that has these objects.
EECIE20-S4305 Intelligence Systems & Software Engineering: Fuzzy logic Slide 4
Fuzzy Set Theory
v Mathematically, this is written as: S1 = {Shape C, Shape D, Shape F, Shape H}

v The set, {S2}, that has all other objects is: S2 = {Shape A, Shape B, Shape E, Shape G}

v The set that has all the objects is called the universe of discourse and is:
Ø SU = {Shape A, Shape B, Shape C, Shape D, Shape E, Shape F, Shape G, Shape H}

v Subsets can also be created, for example a set S3 that consists of all the objects with 4
angles is: S3 = {Shape A, Shape B, Shape G}
Ø S3 clearly is a subset of S2, i.e., 𝐒𝟑 ⊂ 𝐒𝟐

v Union is a set that has all the elements of other sets:


Ø S1 ∪ S3 = {Shape C, Shape D, Shape F, Shape H, Shape A, Shape B, Shape G}
Ø Obviously: S1 ∪ S2 = S2 ∪ S1 = SU

v Set intersection in=s another set that has the common elements in two sets:
Ø Let S4 = {Shape G, Shape H} then
S2 ∩ S4 = {Shape G}. Note that S2 ∩ S4 = S4 ∩ S2
EECIE20-S4305 Intelligence Systems & Software Engineering: Fuzzy logic Slide 5
Other properties of sets
Other properties of sets are:
Ø A∪A=A
Ø A∩A=A
Ø A ∪ (B ∪ C) = (A ∪ B) ∪ C = A ∪ B ∪ C
Ø A ∩ (B ∩ C) = (A ∩ B) ∩ C = A ∩ B ∩ C
Ø A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)
Ø A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C)
Ø A∪ ∅=A
Ø A∩ ∅= ∅

v In all the above, an element was either 100% a member of set or 0%. This logic is called Boolean
(True & False logic).
v Now, assume that there is a set of temperatures. Further create a subset that will have all the
temperatures that will correspond to a hot environment.
v Then by using the previous logic, it might be said that hot temperatures are all the temperatures
above 25 degrees:
BUT what about a temperature of 24.99 degrees.
Ø HOT = {temperature | temperature > 25} à Is it hot?
EECIE20-S4305 Intelligence Systems & Software Engineering: Fuzzy logic Slide 6
Boolean and fuzzy sets
v Obviously it is, but not so hot as 25 degrees. This points towards the need to create sets (fuzzy sets)
with elements that do not follow Boolean logic.
v However, this will require a membership function that determines how much they belong to a set.
v For example, the temperature 25 is hot 100%, then 24 is hot 90%, 20 is 50% hot, 15 is 0%, and so
on
Membership Membership
Function Function
𝝁 𝝁
100% 100%

0% 0%
25 Temperature 15 25 Temperature

Boolean Fuzzy
v The membership function that is shown in the figure above is nothing more than a function that
shows how much an element is a member or not of a fuzzy set.
v For instance, if “t ” is the temperature then its membership function for a specific set is 𝝁(t).
EECIE20-S4305 Intelligence Systems & Software Engineering: Fuzzy logic Slide 7
Membership – Mathematical expression
v In the previous example, t = 25 degrees, 𝜇(t) = 1, for t = 24, 𝜇(t) = 0.9, and for t = 15, 𝜇(t) =
0.

v Therefor, to fully define a fuzzy set, it is not enough to say that an element is in it or not.
Pair is needed which will define the element and how much the element belongs or not, i.e.,
its membership function:
A = {𝒙, 𝝁(𝒙) |𝒙 ∈ X}
Ø The above expression indicates that the set A has the element 𝑥 with the membership
𝜇 𝑥 when 𝑥 belongs to the universe of discourse.
Ø Membership value normally goes from zero membership (0) to complete membership
(1).
v The main membership functions that are sometimes used are:
! Triangular form
Triangular
! Trapezoidal form
! Gaussian forms
! Sigmoidal forms Trapezoidal
! Polynomial forms
EECIE20-S4305 Intelligence Systems & Software Engineering: Fuzzy logic Slide 8
Membership Functions
v The choice of membership function shape is not straightforward and only experience can help the
designer. The most common choices are the triangular and trapezoidal, due to their simplicity and
their linearity.
v The figure below illustrates a possible set of fuzzy membership functions that describe temperature.

𝝁(𝒙)
Very
cold Cold Warm Hot

70%
30%

Temperatures

v We can see that the temperature at 11 belongs to the membership function (MF) “Very clod” to the
value around 70% and to the MF Cold about 30%.
v What about temperature 15? (if we try to interest the 15 with the membership form, we can find it is
100% belongs to the MF Cold.
EECIE20-S4305 Intelligence Systems & Software Engineering: Fuzzy logic Slide 9
Membership Function (MF)
v In Boolean Logic, elements are either members of a set or not. There is either full membership or no
membership.
v Thus, the Boolean membership function can be expressed as the following formula:

1, 𝑥 ∈ 𝐴
𝜇! 𝑥 = . i.e., 𝜇' 𝑥 = {0, 1}
0, 𝑥 ∉ 𝐴
v In Fuzzy Logic, set A has no sharp borderline; it is a fuzzy subset of the universe of discourse X.
v Element has a degree of membership of the Fuzzy Set A which lies between 0 and 1. Therefore,
we write its membership function for a fuzzy set as:

𝜇' 𝑥 = {[0, 1]} , where [0, 1] is the range of all values between 0 and 1.

X: Universe A X: Universe A
This element Element that
is not in set A has a degree of
Membership,
This element is Between 0 & 1,
in set A in set A

EECIE20-S4305 Intelligence Systems & Software Engineering: Fuzzy logic Slide 10


Traditional logic vs. Fuzzy logic

Traditional logic Fuzzy logic


True False True False
1 0 0.7 0.3
Absolute true Absolute false partially true partially false

Tap water Temperature

Cold Hot Cold Hot

EECIE20-S4305 Intelligence Systems & Software Engineering: Fuzzy logic Slide 11


Boolean system vs. Fuzzy logic

Boolean system

Yes à 1
using Is the tea hot?
values No à 0

Fuzzy logic

Extremely hot à 0.9


fuzzy Hot/Very hot à 0.7
Is the tea hot?
values Cold à 0.5
Extremely cold à 0.3

EECIE20-S4305 Intelligence Systems & Software Engineering: Fuzzy logic Slide 12


Fuzzy Logic system components

Input Rules Output


(fuzzification: linguistic variables) Defuzzification
(e.g., center of gravity)

Fuzzification
(Input 1)

Rules Defuzzification

Fuzzification
(Input 2)

Multi-input single output fuzzy logic

EECIE20-S4305 Intelligence Systems & Software Engineering: Fuzzy logic Slide 13


Fuzzy system – Example #1
✏ For a solar energy system, the controller works based on a servomotor that rotates the solar board
according to the weather’s temperature and humidity values. Design a fuzzy-based controller to
control the rotation of the solar board so that the controller drives the servo motor by an appropriate
angle degree. Assume you have the following:
◆ Temperature degree is between 0 and 5,
◆ Humidity degree is between 0 and 5,
◆ Servo-motor angle between 0 and 90o,
◆ The output cases of the controller is given in the truth-table.
Then find the output angle of the servo motor. T S M B
H
S L L M

T Fuzzy Position
M L M H
H controller

B M H H
Solar system for power-harvesting
Output cases
EECIE20-S4305 Intelligence Systems & Software Engineering: Fuzzy logic Slide 14
Fuzzy system – Example #1
Ø The general representation of the system
S M B
1

T
0 1 2 3 4 5

Fuzzification
(Input 1)
Rules Defuzzification
Fuzzification
(Input 2) T
H S M B
L M H
S L L M 1
S M B
1 M L M H
B M H H 0 15 30 45 60 75 90
H Output cases
1 2 3 4 5 Position
0
EECIE20-S4305 Intelligence Systems & Software Engineering: Fuzzy logic Slide 15
Programming the controller (Rules) – Example #1

If (T is S) and (H is S) then position is L


Elseif (T is M) and (H is S) then position is L
Elseif (T is B) and (H is S) then position is M
Elseif (T is S) and (H is M) then position is L
Elseif (T is M) and (H is M) then position is M
Elseif (T is B) and (H is M) then position is H
Elseif (T is S) and (H is B) then position is M
Elseif (T is M) and (H is B) then position is H
Elseif (T is B) and (H is B) then position is H

◆ Fuzzy conjunction (AND) à Min


◆ Fuzzy disjunction (OR) à Max

EECIE20-S4305 Intelligence Systems & Software Engineering: Fuzzy logic Slide 16


Testing the system – Example #1
v Assume you have the following values for temperature and humidity:
◆ T=2
◆ H=3

S M B
1

0.5
T intersects with S at 0.2, and
0.2 T intersects with M at 0.5
T
0 1 2 3 4 5

S M B
1

0.6 H intersects with M at 0.6, and


0.1 H intersects with B at 0.1
H
0 1 2 3 4 5

EECIE20-S4305 Intelligence Systems & Software Engineering: Fuzzy logic Slide 17


Defuzzification (center of gravity) – Example #1
v Assume you have the following values for T and H:
◆ T=2
T intersects with S at 0.2, and H intersects with M at 0.6, and
◆ H=3
T intersects with M at 0.5 H intersects with B at 0.1
Take the Min
T is S(0.2) and H is M(0.6) then position is L(0.2)
T is S(0.2) and H is B(0.1) then position is M(0.1)
T is M(0.5) and H is M(0.6) then position is M(0.5)
T is M(0.5) and H is B(0.1) then position is H(0.1)
L M H
1

0.5
Take the Max to draw
the function,
0.2
0.1 Position then apply
15 30 45 60 75 90 center of gravity
0
on the graph to find
46o the angle
EECIE20-S4305 Intelligence Systems & Software Engineering: Fuzzy logic Slide 18
Fuzzy Logic Controllers
v Do not need much detailed knowledge of the system
à What the controller should do is determined by the Linguistic rules

v If optimization tools are used like Genetic Algorithms, can get away without knowing much
of anything.

v The system does not need to be reduced or idealized to develop a working Fuzzy Logic
Controller

v The conditions when Fuzzy Controllers will work are much more robust because they can
account for more variability in the inputs.

EECIE20-S4305 Intelligence Systems & Software Engineering: Fuzzy logic Slide 19


Fuzzy Logic Applications
v Number of applications virtually limitless
◆ Control Systems
§ Kitchen appliances
§ Car control system
§ Aerospace vehicle control systems

◆ Image processing

◆ Decision-making

◆ Route-planning

v Still in development and testing of safety-critical


systems
v Has already been tested in some instances like
small satellite attitude control

EECIE20-S4305 Intelligence Systems & Software Engineering: Fuzzy logic Slide 20


End of Lecture 16

You might also like