SlideShare a Scribd company logo
Lecture 9 of Artificial Intelligence
Fuzzy Logic:
Human-like decision making
Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/1
Topics of this lecture
• Definition of fuzzy set
• Membership function
• Notation of fuzzy set
• Operations of fuzzy set
• Fuzzy number and
operations
• Extension principle
• Fuzzy rules
• De-fuzzification
• Fuzzy control
• ファジィ集合の定義
• メンバシップ関数
• ファジィ集合の記述方法
• ファジィ集合の演算
• ファジィ数とその演算
• 拡張原理
• ファジィルール
• 非ファジィ化
• ファジィ制御
Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/2
History of fuzzy logic
• The opposite word (antonym) of
fuzzy is crisp. Fuzzy means un-clear
or ambiguous, and crisp means
clear, clean, and sharp.
• Fuzzy logic was proposed by Zadeh
in 1965, and was applied in steam
engine control by Mamdani in 1974.
• Fuzzy logic was made practically
useful in Japan in the 1990s.
Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/3
Conventional set vs. fuzzy set
• X: universe of discourse. Set A is defined by
where m(x) is a membership function.
– For conventional set, the range of m(x) is {T, F}
– For fuzzy set, the range of m(x) is [0,1]. So, the above definition
cannot be used for fuzzy set. We cannot say clearly if x is in A or
not when 0<m(x) < 1.
Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/4
Examples of fuzzy set
✓ young people, old people, kind people
✓ temperature is hot, just good, a little bit cold
A={ x |m(x)=T ⋀ x in X}
Description of fuzzy set
• Membership function of a fuzzy set A: mA: X→[0,1]
• If the universe of discourse X={x1,x2,…,xN}, A is
described as follows:
where / is a separator, and + is the logic OR.
• If X is a continuous space, integral is used instead of
the summation.
Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/5
A = mA(x1)/x1+ mA(x2)/x2+…+ mA(xN)/xN
= SmA(xi)/xi
Operations of fuzzy sets
Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/6
Meaning Set notation Logic notation Membership function
Equivalence
Implication
Complement
(negation)
Union, OR
(disjunction)
Intersection, AND
(conjunction)
B
A = )
(
)
( x
x B
A m
m  )
(
)
( x
x B
A m
m =
B
A  )
(
)
( x
x B
A m
m  )
(
)
( x
x B
A m
m 
A )
(x
A
m
 )
(
1
)
( x
x A
A
m
m −
=
B
A  )
(
)
( x
x B
A m
m  )}
(
),
(
max{
)
( x
x
x B
A
B
A m
m
m =

B
A  )
(
)
( x
x B
A m
m  )}
(
),
(
min{
)
( x
x
x B
A
B
A m
m
m =

Examples
Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/7
Upper-left: AND
Lower-left: OR
Upper-right: Negation
Example 5.1 p. 89
• The universe of discourse:
• Fuzzy sets A=“young persons” and B=“Tall persons” are
defined by
– A = 0.4/Masahiro+0.6/Tsuyoshi+0.8/Takuya+1.0/Saburo+0.9/Masami
– B = 0.3/Masahiro+0.5/Tsuyoshi+0.9/Takuya+0.6/Saburo+0.9/Masami
• The OR and AND of A and B are as follows:
– A∪B=0.4/Masahiro+0.6/Tsuyoshi+0.9/Takuya+1.0/Saburo+0.9/Masami
– A∩B =0.3/Masahiro+0.5/Tsuyoshi+0.8/Takuya+0.6/Saburo+0.9/Masami
Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/8
X={Masahiro, Tsuyoshi, Takuya, Saburo, Masami}
Fuzzy number
• A fuzzy number is a fuzzy set of (real) numbers.
• The membership function mA of a fuzzy number A
satisfies the following properties:
– There is an x, such that mA(x)=1;
– The support {x| mA(x)>0} is bounded;
– The a-cut {x| mA(x)>a} is closed.
• Examples of fuzzy number:
– The distance between Aizuwakamatsu city and Sendai is about
200 km.
– If we go from Aizuwakamatsu city to Sendai by train, it takes
about 2 hours.
Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/9
Computation with fuzzy numbers
• Based on the extension principle, a binary operation ◦
between two fuzzy numbers can be calculated by
• The operation ◦ can be .
𝐶 = 𝐴 ∘ 𝐵 : 𝜇𝐴∘𝐵(𝑦) = sup
𝑥1∘𝑥2=𝑦
{𝜇𝐴(𝑥1) ∧ 𝜇𝐵(𝑥2)}
Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/10
1 2 4
3 5 6 8
7 9 10 12
11
About 2 About 4 About 6
About 6 is more ambiguous!
Superior (上限)
+, −,×, or ÷
An example to illustrate the
extension principle
Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/11
𝑥1 𝜇2(𝑥1) 𝑥2 𝜇4(𝑥2) 𝑦 𝜇2(𝑥1)⋀𝜇4(𝑥2) 𝜇6(𝑦)
0 0 4 1 4 0 0
1 0 3 0 0
2 1 2 0 0
3 0 1 0 0
4 0 0 0 0
1.5 0.5 3.5 0.5 5 0.5 0.5
2 1 3 0 0
2.5 0.5 2.5 0 0
3 0 2 0 0
3.5 0 1.5 0 0
2 1 4 1 6 1 1
3 0 3 0 0
4 0 2 0 0
5 0 1 0 0
6 0 0 0 0
Linguistic values of a fuzzy number
• To inference (reasoning) with fuzzy numbers, we may read a fuzzy
number using “about”, “approximately”, or “roughly”, but these
representations may not help us to understand the physical meaning.
• For example, to say a body temperature is about 39 degree, we may
not understand that this number if relatively dangerous for an adult
person. Rather, if we say the body temperature is “very high” or
“very dangerous”, we can get the meaning more easily.
Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/12
35 36 37 38 Body Temperature
Low Normal High Very high
1
0
Fuzzy rules
Number of attributes: 𝑁
Number of rules: 𝐾
The 𝑘−th fuzzy rule 𝑅𝑘 is given as follows:
where 𝐹𝑘𝑗 and 𝐵𝑘 are all 𝑙𝑖𝑛𝑔𝑢𝑖𝑠𝑡𝑖𝑐 𝑣𝑎𝑙𝑢𝑒𝑠
(𝑘=1,2,…,𝐾; 𝑗=1,2,…,𝑁)
Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/13
𝑖𝑓 𝑥1 = 𝐹𝑘1 ∧ 𝑥2 = 𝐹𝑘2 ∧ ⋯ ∧ 𝑥𝑁= 𝐹𝑘𝑁
𝑡ℎ𝑒𝑛(𝑦 = 𝐵𝑘)
Example of fuzzy rule
Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/14
10 20 30 40 50
T
Low
-2 0 2
S
On
If (Water temperature = Low)
Then (Heating = On)
Pattern matching for fuzzy rules
• For a given input datum 𝑥 = (𝑥1, 𝑥2, ⋯ , 𝑥𝑁),
the similarity between 𝑥 and the condition
of the 𝑘−th rule is defined by
where ∧ is defined as the min.
Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/15
The similarity can also be considered
the degree of matching.
𝑆(𝑥, 𝑅𝑘) = 𝜇𝐹𝑘1
(𝑥1) ∧ 𝜇𝐹𝑘2
(𝑥2) ∧ ⋯ ∧ 𝜇𝐹𝑘𝑁
(𝑥𝑁)
Fuzzy inference
For a given input datum 𝑥 = (𝑥1, 𝑥2, ⋯ , 𝑥𝑁), we can make
a fuzzy decision as follows:
• Step 1: Find the membership function of the result 𝐵∗,
which is also a fuzzy number, using the following
equation:
𝜇𝐵∗(𝑦) = 𝜇𝑅1
(𝑥) ∨ 𝜇𝑅2
(𝑥) ∨ ⋯ ∨ 𝜇𝑅𝐾
(𝑥)
where ∨ is max, and 𝜇𝑅𝑘
(𝑥) = 𝑆(𝑅𝑘) ∧ 𝜇𝐵𝑘
(𝑦).
Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/16
Fuzzy inference
• Step 2: The final output is calculated as follows:
– This is the gravity center of the fuzzy number B*.
– We may also use median or the maximum value.
– The process for finding a concrete number from a fuzzy number
is called de-fuzzification.
𝑏∗ =
‫׬‬
𝑌
𝑦 × 𝜇𝐵∗(𝑦)𝑑𝑦
‫׬‬
𝑌
𝜇𝐵∗(𝑦)𝑑𝑦
Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/17
Example 5.3 pp. 93-96
Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/18
• According to Japanese
Road laws, road around the
corner must be constructed
based on the relation
between the curvature and
the speed limitation.
• For example, if the speed
limit is 50 km/h, the radius of
the curve must be 100m or
more (see Table 5.4 in p. 94
of the textbook).
Fuzzy rules for speed control
Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/19
• R1: If(v=Normal∧
r=Sharp curve)
Then(B=Weak)
• R2: If(v=A little fast∧
r=Sharp curve)
Then(B=Weak)
• R3: If(v=Fast∧
r=Normal)
Then(B=Weak)
• R4: If(v=Fast∧
r=Sharp curve)
Then(B=Strong)
Speed (v) Curvature
(radius r)
Break (b)
Normal Slow curve As is
Normal Normal As is
Normal Sharp curve Weak
A little fast Slow curve As is
A little fast Normal As is
A little fast Sharp curve Weak
Fast Slow curve As is
Fast Normal Weak
Fast Sharp curve Strong
Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/20
Proper speed for a given condition
Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/21
Step 1: First, find the similarity (degree of matching) for
each rule as follows:
• S(R1)=min(mnormal(65), msharp(90))=min(0,0.8)=0
• S(R2)=min(ma little fast(65), msharp(90))=min(0.75,0.8)=0.75
• S(R3)=min(mfast(65), mnormal(90))=min(0.25,0.2)=0.20
• S(R4)=min(mfast(65), msharp(90))=min(0.25,0.8)=0.25
𝜇𝐵∗(𝑦)
= max[ min( 0.75, 𝜇𝑤𝑒𝑎𝑘(𝑦)), min( 0.25, 𝜇𝑠𝑡𝑟𝑜𝑛𝑔(𝑦))]
Proper speed for a given condition
• Step 2: Defuzzification
• That is, if the speed is reduced from 65 to 44.3
km/h, the car can pass the curve safely.
Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/22
=20.7 km/h
𝑏∗ =
‫׬‬𝑌
𝑦 × 𝜇𝐵∗(𝑦)𝑑𝑦
‫׬‬
𝑌
𝜇𝐵∗(𝑦)𝑑𝑦
Problems in using fuzzy control
• Fuzzy control is a kind of soft control that uses human
knowledge. The performance depends on the
membership functions of the linguistic values.
• To find the optimal membership functions, we must use
some other tools.
• For example, we may use genetic algorithm to fine-tune
the parameters of the membership functions (e.g. to
determine the shape or type).
• We may also use deep neural networks to capture the
best membership functions through learning.
Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/23
Homework for lecture 9
-- Algorithm assignment
• Solve problem 5.4 in p. 97 in the textbook for “car speed”.
• That is, find the equations for the membership functions
of the linguistic values of “speed” (the top figure in
Example 5.3 given in slide 20),
Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/24
Homework for lecture 9
-- Programming assignment
• Based on the skeleton program, write a program to
implement a fuzzy system for speed control.
• Plot the results using “gnuplot”, and save the 3-D figure.
• The name file should be “plot.png”, and the coordinates
are as follows:
– (X, Y, Z) = (v, r, b)
• From the figure, try to describe the relation between b
and (v, r), and add your description in “summary_09.txt”.
Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/25
How to write and submit the report?
• Put the result of the “algorithm assignment” and the
contents written in the file “summary_09.txt” together into
one file (in MS-Word or other form), convert the file to
pdf-form, and submit it before the specified deadline.
Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/26
Quizzes for lecture 9
(1) Find the compliment set of A given in slide 8.
(1) Using the extension principle, find the membership
function of “fuzzy number 5”, when “fuzzy number
2” and “fuzzy number 3” are defined below.
(3) Below is a fuzzy rule for controlling a robot based
on light sensors.
Suppose that the minimum and maximum values of each
sensor are 0 and 1023. Try to define the membership
functions for the linguistic values VeryBright and
VeryDark.
Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec05/27
1 2 4
3 5 6 8
7 9 10 12
11
Fuzzy 2
Fuzzy 3
?
𝑅𝑠 : 𝑖 𝑓(𝑥1 = 𝑉𝑒𝑟𝑦𝐵𝑟𝑖𝑔ℎ𝑡 ∧
𝒙2 = 𝑉𝑒𝑟𝑦𝐵𝑟𝑖𝑔ℎ𝑡 ∧ 𝑥3 = 𝑉𝑒𝑟𝑦𝐷𝑎𝑟𝑘 ∧
𝑥4 = 𝑉𝑒𝑟𝑦𝐷𝑎𝑟𝑘)
𝑡ℎ𝑒𝑛(𝑦 = 𝐺𝑜𝐹𝑜𝑟𝑤𝑎𝑟𝑑𝑄𝑢𝑖𝑐𝑘𝑙𝑦)
1024
0 512
Robot

More Related Content

Similar to fuzzy logic

parallel programming.ppt
parallel programming.pptparallel programming.ppt
parallel programming.ppt
nazimsattar
 
Asymptotics 140510003721-phpapp02
Asymptotics 140510003721-phpapp02Asymptotics 140510003721-phpapp02
Asymptotics 140510003721-phpapp02
mansab MIRZA
 
Algorithm
AlgorithmAlgorithm
Algorithm
Anirban Sarkar
 
Algorithm
AlgorithmAlgorithm
Algorithm
Syam Kumar
 
Improving Variational Inference with Inverse Autoregressive Flow
Improving Variational Inference with Inverse Autoregressive FlowImproving Variational Inference with Inverse Autoregressive Flow
Improving Variational Inference with Inverse Autoregressive Flow
Tatsuya Shirakawa
 
Chap 8. Optimization for training deep models
Chap 8. Optimization for training deep modelsChap 8. Optimization for training deep models
Chap 8. Optimization for training deep models
Young-Geun Choi
 
Machine Learning 1
Machine Learning 1Machine Learning 1
Machine Learning 1
cairo university
 
Fuzzy logic and fuzzy time series edited
Fuzzy logic and fuzzy time series   editedFuzzy logic and fuzzy time series   edited
Fuzzy logic and fuzzy time series edited
Prof Dr S.M.Aqil Burney
 
Asymptotic Notations
Asymptotic NotationsAsymptotic Notations
Asymptotic Notations
Rishabh Soni
 
Unit ii algorithm
Unit   ii algorithmUnit   ii algorithm
Unit ii algorithm
Tribhuvan University
 
A Tutorial of the EM-algorithm and Its Application to Outlier Detection
A Tutorial of the EM-algorithm and Its Application to Outlier DetectionA Tutorial of the EM-algorithm and Its Application to Outlier Detection
A Tutorial of the EM-algorithm and Its Application to Outlier Detection
Konkuk University, Korea
 
AJMS_477_23.pdf
AJMS_477_23.pdfAJMS_477_23.pdf
AJMS_477_23.pdf
BRNSS Publication Hub
 
c++ Data Types and Selection
c++ Data Types and Selectionc++ Data Types and Selection
c++ Data Types and Selection
Ahmed Nobi
 
Abductive commonsense reasoning
Abductive commonsense reasoningAbductive commonsense reasoning
Abductive commonsense reasoning
San Kim
 
IRJET- A Study on Some Repairable Systems
IRJET- A Study on Some Repairable SystemsIRJET- A Study on Some Repairable Systems
IRJET- A Study on Some Repairable Systems
IRJET Journal
 
computer notes - Data Structures - 9
computer notes - Data Structures - 9computer notes - Data Structures - 9
computer notes - Data Structures - 9
ecomputernotes
 
Paper Study: Melding the data decision pipeline
Paper Study: Melding the data decision pipelinePaper Study: Melding the data decision pipeline
Paper Study: Melding the data decision pipeline
ChenYiHuang5
 
A common random fixed point theorem for rational inequality in hilbert space
A common random fixed point theorem for rational inequality in hilbert spaceA common random fixed point theorem for rational inequality in hilbert space
A common random fixed point theorem for rational inequality in hilbert space
Alexander Decker
 
International Journal of Engineering Research and Development
International Journal of Engineering Research and DevelopmentInternational Journal of Engineering Research and Development
International Journal of Engineering Research and Development
IJERD Editor
 
[DL輪読会]GANとエネルギーベースモデル
[DL輪読会]GANとエネルギーベースモデル[DL輪読会]GANとエネルギーベースモデル
[DL輪読会]GANとエネルギーベースモデル
Deep Learning JP
 

Similar to fuzzy logic (20)

parallel programming.ppt
parallel programming.pptparallel programming.ppt
parallel programming.ppt
 
Asymptotics 140510003721-phpapp02
Asymptotics 140510003721-phpapp02Asymptotics 140510003721-phpapp02
Asymptotics 140510003721-phpapp02
 
Algorithm
AlgorithmAlgorithm
Algorithm
 
Algorithm
AlgorithmAlgorithm
Algorithm
 
Improving Variational Inference with Inverse Autoregressive Flow
Improving Variational Inference with Inverse Autoregressive FlowImproving Variational Inference with Inverse Autoregressive Flow
Improving Variational Inference with Inverse Autoregressive Flow
 
Chap 8. Optimization for training deep models
Chap 8. Optimization for training deep modelsChap 8. Optimization for training deep models
Chap 8. Optimization for training deep models
 
Machine Learning 1
Machine Learning 1Machine Learning 1
Machine Learning 1
 
Fuzzy logic and fuzzy time series edited
Fuzzy logic and fuzzy time series   editedFuzzy logic and fuzzy time series   edited
Fuzzy logic and fuzzy time series edited
 
Asymptotic Notations
Asymptotic NotationsAsymptotic Notations
Asymptotic Notations
 
Unit ii algorithm
Unit   ii algorithmUnit   ii algorithm
Unit ii algorithm
 
A Tutorial of the EM-algorithm and Its Application to Outlier Detection
A Tutorial of the EM-algorithm and Its Application to Outlier DetectionA Tutorial of the EM-algorithm and Its Application to Outlier Detection
A Tutorial of the EM-algorithm and Its Application to Outlier Detection
 
AJMS_477_23.pdf
AJMS_477_23.pdfAJMS_477_23.pdf
AJMS_477_23.pdf
 
c++ Data Types and Selection
c++ Data Types and Selectionc++ Data Types and Selection
c++ Data Types and Selection
 
Abductive commonsense reasoning
Abductive commonsense reasoningAbductive commonsense reasoning
Abductive commonsense reasoning
 
IRJET- A Study on Some Repairable Systems
IRJET- A Study on Some Repairable SystemsIRJET- A Study on Some Repairable Systems
IRJET- A Study on Some Repairable Systems
 
computer notes - Data Structures - 9
computer notes - Data Structures - 9computer notes - Data Structures - 9
computer notes - Data Structures - 9
 
Paper Study: Melding the data decision pipeline
Paper Study: Melding the data decision pipelinePaper Study: Melding the data decision pipeline
Paper Study: Melding the data decision pipeline
 
A common random fixed point theorem for rational inequality in hilbert space
A common random fixed point theorem for rational inequality in hilbert spaceA common random fixed point theorem for rational inequality in hilbert space
A common random fixed point theorem for rational inequality in hilbert space
 
International Journal of Engineering Research and Development
International Journal of Engineering Research and DevelopmentInternational Journal of Engineering Research and Development
International Journal of Engineering Research and Development
 
[DL輪読会]GANとエネルギーベースモデル
[DL輪読会]GANとエネルギーベースモデル[DL輪読会]GANとエネルギーベースモデル
[DL輪読会]GANとエネルギーベースモデル
 

Recently uploaded

Zener Diode and its V-I Characteristics and Applications
Zener Diode and its V-I Characteristics and ApplicationsZener Diode and its V-I Characteristics and Applications
Zener Diode and its V-I Characteristics and Applications
Shiny Christobel
 
Mechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdfMechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdf
21UME003TUSHARDEB
 
Digital Twins Computer Networking Paper Presentation.pptx
Digital Twins Computer Networking Paper Presentation.pptxDigital Twins Computer Networking Paper Presentation.pptx
Digital Twins Computer Networking Paper Presentation.pptx
aryanpankaj78
 
Data Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason WebinarData Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason Webinar
UReason
 
Applications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdfApplications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdf
Atif Razi
 
Call For Paper -3rd International Conference on Artificial Intelligence Advan...
Call For Paper -3rd International Conference on Artificial Intelligence Advan...Call For Paper -3rd International Conference on Artificial Intelligence Advan...
Call For Paper -3rd International Conference on Artificial Intelligence Advan...
ijseajournal
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
Divyanshu
 
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
Gino153088
 
SENTIMENT ANALYSIS ON PPT AND Project template_.pptx
SENTIMENT ANALYSIS ON PPT AND Project template_.pptxSENTIMENT ANALYSIS ON PPT AND Project template_.pptx
SENTIMENT ANALYSIS ON PPT AND Project template_.pptx
b0754201
 
Software Engineering and Project Management - Software Testing + Agile Method...
Software Engineering and Project Management - Software Testing + Agile Method...Software Engineering and Project Management - Software Testing + Agile Method...
Software Engineering and Project Management - Software Testing + Agile Method...
Prakhyath Rai
 
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
MadhavJungKarki
 
Introduction to Computer Networks & OSI MODEL.ppt
Introduction to Computer Networks & OSI MODEL.pptIntroduction to Computer Networks & OSI MODEL.ppt
Introduction to Computer Networks & OSI MODEL.ppt
Dwarkadas J Sanghvi College of Engineering
 
smart pill dispenser is designed to improve medication adherence and safety f...
smart pill dispenser is designed to improve medication adherence and safety f...smart pill dispenser is designed to improve medication adherence and safety f...
smart pill dispenser is designed to improve medication adherence and safety f...
um7474492
 
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
ecqow
 
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
sydezfe
 
2. protection of river banks and bed erosion protection works.ppt
2. protection of river banks and bed erosion protection works.ppt2. protection of river banks and bed erosion protection works.ppt
2. protection of river banks and bed erosion protection works.ppt
abdatawakjira
 
Pressure Relief valve used in flow line to release the over pressure at our d...
Pressure Relief valve used in flow line to release the over pressure at our d...Pressure Relief valve used in flow line to release the over pressure at our d...
Pressure Relief valve used in flow line to release the over pressure at our d...
cannyengineerings
 
Height and depth gauge linear metrology.pdf
Height and depth gauge linear metrology.pdfHeight and depth gauge linear metrology.pdf
Height and depth gauge linear metrology.pdf
q30122000
 
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
shadow0702a
 
Supermarket Management System Project Report.pdf
Supermarket Management System Project Report.pdfSupermarket Management System Project Report.pdf
Supermarket Management System Project Report.pdf
Kamal Acharya
 

Recently uploaded (20)

Zener Diode and its V-I Characteristics and Applications
Zener Diode and its V-I Characteristics and ApplicationsZener Diode and its V-I Characteristics and Applications
Zener Diode and its V-I Characteristics and Applications
 
Mechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdfMechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdf
 
Digital Twins Computer Networking Paper Presentation.pptx
Digital Twins Computer Networking Paper Presentation.pptxDigital Twins Computer Networking Paper Presentation.pptx
Digital Twins Computer Networking Paper Presentation.pptx
 
Data Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason WebinarData Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason Webinar
 
Applications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdfApplications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdf
 
Call For Paper -3rd International Conference on Artificial Intelligence Advan...
Call For Paper -3rd International Conference on Artificial Intelligence Advan...Call For Paper -3rd International Conference on Artificial Intelligence Advan...
Call For Paper -3rd International Conference on Artificial Intelligence Advan...
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
 
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
 
SENTIMENT ANALYSIS ON PPT AND Project template_.pptx
SENTIMENT ANALYSIS ON PPT AND Project template_.pptxSENTIMENT ANALYSIS ON PPT AND Project template_.pptx
SENTIMENT ANALYSIS ON PPT AND Project template_.pptx
 
Software Engineering and Project Management - Software Testing + Agile Method...
Software Engineering and Project Management - Software Testing + Agile Method...Software Engineering and Project Management - Software Testing + Agile Method...
Software Engineering and Project Management - Software Testing + Agile Method...
 
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
 
Introduction to Computer Networks & OSI MODEL.ppt
Introduction to Computer Networks & OSI MODEL.pptIntroduction to Computer Networks & OSI MODEL.ppt
Introduction to Computer Networks & OSI MODEL.ppt
 
smart pill dispenser is designed to improve medication adherence and safety f...
smart pill dispenser is designed to improve medication adherence and safety f...smart pill dispenser is designed to improve medication adherence and safety f...
smart pill dispenser is designed to improve medication adherence and safety f...
 
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
 
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
 
2. protection of river banks and bed erosion protection works.ppt
2. protection of river banks and bed erosion protection works.ppt2. protection of river banks and bed erosion protection works.ppt
2. protection of river banks and bed erosion protection works.ppt
 
Pressure Relief valve used in flow line to release the over pressure at our d...
Pressure Relief valve used in flow line to release the over pressure at our d...Pressure Relief valve used in flow line to release the over pressure at our d...
Pressure Relief valve used in flow line to release the over pressure at our d...
 
Height and depth gauge linear metrology.pdf
Height and depth gauge linear metrology.pdfHeight and depth gauge linear metrology.pdf
Height and depth gauge linear metrology.pdf
 
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
 
Supermarket Management System Project Report.pdf
Supermarket Management System Project Report.pdfSupermarket Management System Project Report.pdf
Supermarket Management System Project Report.pdf
 

fuzzy logic

  • 1. Lecture 9 of Artificial Intelligence Fuzzy Logic: Human-like decision making Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/1
  • 2. Topics of this lecture • Definition of fuzzy set • Membership function • Notation of fuzzy set • Operations of fuzzy set • Fuzzy number and operations • Extension principle • Fuzzy rules • De-fuzzification • Fuzzy control • ファジィ集合の定義 • メンバシップ関数 • ファジィ集合の記述方法 • ファジィ集合の演算 • ファジィ数とその演算 • 拡張原理 • ファジィルール • 非ファジィ化 • ファジィ制御 Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/2
  • 3. History of fuzzy logic • The opposite word (antonym) of fuzzy is crisp. Fuzzy means un-clear or ambiguous, and crisp means clear, clean, and sharp. • Fuzzy logic was proposed by Zadeh in 1965, and was applied in steam engine control by Mamdani in 1974. • Fuzzy logic was made practically useful in Japan in the 1990s. Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/3
  • 4. Conventional set vs. fuzzy set • X: universe of discourse. Set A is defined by where m(x) is a membership function. – For conventional set, the range of m(x) is {T, F} – For fuzzy set, the range of m(x) is [0,1]. So, the above definition cannot be used for fuzzy set. We cannot say clearly if x is in A or not when 0<m(x) < 1. Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/4 Examples of fuzzy set ✓ young people, old people, kind people ✓ temperature is hot, just good, a little bit cold A={ x |m(x)=T ⋀ x in X}
  • 5. Description of fuzzy set • Membership function of a fuzzy set A: mA: X→[0,1] • If the universe of discourse X={x1,x2,…,xN}, A is described as follows: where / is a separator, and + is the logic OR. • If X is a continuous space, integral is used instead of the summation. Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/5 A = mA(x1)/x1+ mA(x2)/x2+…+ mA(xN)/xN = SmA(xi)/xi
  • 6. Operations of fuzzy sets Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/6 Meaning Set notation Logic notation Membership function Equivalence Implication Complement (negation) Union, OR (disjunction) Intersection, AND (conjunction) B A = ) ( ) ( x x B A m m  ) ( ) ( x x B A m m = B A  ) ( ) ( x x B A m m  ) ( ) ( x x B A m m  A ) (x A m  ) ( 1 ) ( x x A A m m − = B A  ) ( ) ( x x B A m m  )} ( ), ( max{ ) ( x x x B A B A m m m =  B A  ) ( ) ( x x B A m m  )} ( ), ( min{ ) ( x x x B A B A m m m = 
  • 7. Examples Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/7 Upper-left: AND Lower-left: OR Upper-right: Negation
  • 8. Example 5.1 p. 89 • The universe of discourse: • Fuzzy sets A=“young persons” and B=“Tall persons” are defined by – A = 0.4/Masahiro+0.6/Tsuyoshi+0.8/Takuya+1.0/Saburo+0.9/Masami – B = 0.3/Masahiro+0.5/Tsuyoshi+0.9/Takuya+0.6/Saburo+0.9/Masami • The OR and AND of A and B are as follows: – A∪B=0.4/Masahiro+0.6/Tsuyoshi+0.9/Takuya+1.0/Saburo+0.9/Masami – A∩B =0.3/Masahiro+0.5/Tsuyoshi+0.8/Takuya+0.6/Saburo+0.9/Masami Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/8 X={Masahiro, Tsuyoshi, Takuya, Saburo, Masami}
  • 9. Fuzzy number • A fuzzy number is a fuzzy set of (real) numbers. • The membership function mA of a fuzzy number A satisfies the following properties: – There is an x, such that mA(x)=1; – The support {x| mA(x)>0} is bounded; – The a-cut {x| mA(x)>a} is closed. • Examples of fuzzy number: – The distance between Aizuwakamatsu city and Sendai is about 200 km. – If we go from Aizuwakamatsu city to Sendai by train, it takes about 2 hours. Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/9
  • 10. Computation with fuzzy numbers • Based on the extension principle, a binary operation ◦ between two fuzzy numbers can be calculated by • The operation ◦ can be . 𝐶 = 𝐴 ∘ 𝐵 : 𝜇𝐴∘𝐵(𝑦) = sup 𝑥1∘𝑥2=𝑦 {𝜇𝐴(𝑥1) ∧ 𝜇𝐵(𝑥2)} Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/10 1 2 4 3 5 6 8 7 9 10 12 11 About 2 About 4 About 6 About 6 is more ambiguous! Superior (上限) +, −,×, or ÷
  • 11. An example to illustrate the extension principle Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/11 𝑥1 𝜇2(𝑥1) 𝑥2 𝜇4(𝑥2) 𝑦 𝜇2(𝑥1)⋀𝜇4(𝑥2) 𝜇6(𝑦) 0 0 4 1 4 0 0 1 0 3 0 0 2 1 2 0 0 3 0 1 0 0 4 0 0 0 0 1.5 0.5 3.5 0.5 5 0.5 0.5 2 1 3 0 0 2.5 0.5 2.5 0 0 3 0 2 0 0 3.5 0 1.5 0 0 2 1 4 1 6 1 1 3 0 3 0 0 4 0 2 0 0 5 0 1 0 0 6 0 0 0 0
  • 12. Linguistic values of a fuzzy number • To inference (reasoning) with fuzzy numbers, we may read a fuzzy number using “about”, “approximately”, or “roughly”, but these representations may not help us to understand the physical meaning. • For example, to say a body temperature is about 39 degree, we may not understand that this number if relatively dangerous for an adult person. Rather, if we say the body temperature is “very high” or “very dangerous”, we can get the meaning more easily. Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/12 35 36 37 38 Body Temperature Low Normal High Very high 1 0
  • 13. Fuzzy rules Number of attributes: 𝑁 Number of rules: 𝐾 The 𝑘−th fuzzy rule 𝑅𝑘 is given as follows: where 𝐹𝑘𝑗 and 𝐵𝑘 are all 𝑙𝑖𝑛𝑔𝑢𝑖𝑠𝑡𝑖𝑐 𝑣𝑎𝑙𝑢𝑒𝑠 (𝑘=1,2,…,𝐾; 𝑗=1,2,…,𝑁) Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/13 𝑖𝑓 𝑥1 = 𝐹𝑘1 ∧ 𝑥2 = 𝐹𝑘2 ∧ ⋯ ∧ 𝑥𝑁= 𝐹𝑘𝑁 𝑡ℎ𝑒𝑛(𝑦 = 𝐵𝑘)
  • 14. Example of fuzzy rule Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/14 10 20 30 40 50 T Low -2 0 2 S On If (Water temperature = Low) Then (Heating = On)
  • 15. Pattern matching for fuzzy rules • For a given input datum 𝑥 = (𝑥1, 𝑥2, ⋯ , 𝑥𝑁), the similarity between 𝑥 and the condition of the 𝑘−th rule is defined by where ∧ is defined as the min. Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/15 The similarity can also be considered the degree of matching. 𝑆(𝑥, 𝑅𝑘) = 𝜇𝐹𝑘1 (𝑥1) ∧ 𝜇𝐹𝑘2 (𝑥2) ∧ ⋯ ∧ 𝜇𝐹𝑘𝑁 (𝑥𝑁)
  • 16. Fuzzy inference For a given input datum 𝑥 = (𝑥1, 𝑥2, ⋯ , 𝑥𝑁), we can make a fuzzy decision as follows: • Step 1: Find the membership function of the result 𝐵∗, which is also a fuzzy number, using the following equation: 𝜇𝐵∗(𝑦) = 𝜇𝑅1 (𝑥) ∨ 𝜇𝑅2 (𝑥) ∨ ⋯ ∨ 𝜇𝑅𝐾 (𝑥) where ∨ is max, and 𝜇𝑅𝑘 (𝑥) = 𝑆(𝑅𝑘) ∧ 𝜇𝐵𝑘 (𝑦). Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/16
  • 17. Fuzzy inference • Step 2: The final output is calculated as follows: – This is the gravity center of the fuzzy number B*. – We may also use median or the maximum value. – The process for finding a concrete number from a fuzzy number is called de-fuzzification. 𝑏∗ = ‫׬‬ 𝑌 𝑦 × 𝜇𝐵∗(𝑦)𝑑𝑦 ‫׬‬ 𝑌 𝜇𝐵∗(𝑦)𝑑𝑦 Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/17
  • 18. Example 5.3 pp. 93-96 Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/18 • According to Japanese Road laws, road around the corner must be constructed based on the relation between the curvature and the speed limitation. • For example, if the speed limit is 50 km/h, the radius of the curve must be 100m or more (see Table 5.4 in p. 94 of the textbook).
  • 19. Fuzzy rules for speed control Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/19 • R1: If(v=Normal∧ r=Sharp curve) Then(B=Weak) • R2: If(v=A little fast∧ r=Sharp curve) Then(B=Weak) • R3: If(v=Fast∧ r=Normal) Then(B=Weak) • R4: If(v=Fast∧ r=Sharp curve) Then(B=Strong) Speed (v) Curvature (radius r) Break (b) Normal Slow curve As is Normal Normal As is Normal Sharp curve Weak A little fast Slow curve As is A little fast Normal As is A little fast Sharp curve Weak Fast Slow curve As is Fast Normal Weak Fast Sharp curve Strong
  • 20. Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/20
  • 21. Proper speed for a given condition Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/21 Step 1: First, find the similarity (degree of matching) for each rule as follows: • S(R1)=min(mnormal(65), msharp(90))=min(0,0.8)=0 • S(R2)=min(ma little fast(65), msharp(90))=min(0.75,0.8)=0.75 • S(R3)=min(mfast(65), mnormal(90))=min(0.25,0.2)=0.20 • S(R4)=min(mfast(65), msharp(90))=min(0.25,0.8)=0.25 𝜇𝐵∗(𝑦) = max[ min( 0.75, 𝜇𝑤𝑒𝑎𝑘(𝑦)), min( 0.25, 𝜇𝑠𝑡𝑟𝑜𝑛𝑔(𝑦))]
  • 22. Proper speed for a given condition • Step 2: Defuzzification • That is, if the speed is reduced from 65 to 44.3 km/h, the car can pass the curve safely. Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/22 =20.7 km/h 𝑏∗ = ‫׬‬𝑌 𝑦 × 𝜇𝐵∗(𝑦)𝑑𝑦 ‫׬‬ 𝑌 𝜇𝐵∗(𝑦)𝑑𝑦
  • 23. Problems in using fuzzy control • Fuzzy control is a kind of soft control that uses human knowledge. The performance depends on the membership functions of the linguistic values. • To find the optimal membership functions, we must use some other tools. • For example, we may use genetic algorithm to fine-tune the parameters of the membership functions (e.g. to determine the shape or type). • We may also use deep neural networks to capture the best membership functions through learning. Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/23
  • 24. Homework for lecture 9 -- Algorithm assignment • Solve problem 5.4 in p. 97 in the textbook for “car speed”. • That is, find the equations for the membership functions of the linguistic values of “speed” (the top figure in Example 5.3 given in slide 20), Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/24
  • 25. Homework for lecture 9 -- Programming assignment • Based on the skeleton program, write a program to implement a fuzzy system for speed control. • Plot the results using “gnuplot”, and save the 3-D figure. • The name file should be “plot.png”, and the coordinates are as follows: – (X, Y, Z) = (v, r, b) • From the figure, try to describe the relation between b and (v, r), and add your description in “summary_09.txt”. Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/25
  • 26. How to write and submit the report? • Put the result of the “algorithm assignment” and the contents written in the file “summary_09.txt” together into one file (in MS-Word or other form), convert the file to pdf-form, and submit it before the specified deadline. Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec09/26
  • 27. Quizzes for lecture 9 (1) Find the compliment set of A given in slide 8. (1) Using the extension principle, find the membership function of “fuzzy number 5”, when “fuzzy number 2” and “fuzzy number 3” are defined below. (3) Below is a fuzzy rule for controlling a robot based on light sensors. Suppose that the minimum and maximum values of each sensor are 0 and 1023. Try to define the membership functions for the linguistic values VeryBright and VeryDark. Produced by Qiangfu Zhao (Since 2008), All rights reserved © AI Lec05/27 1 2 4 3 5 6 8 7 9 10 12 11 Fuzzy 2 Fuzzy 3 ? 𝑅𝑠 : 𝑖 𝑓(𝑥1 = 𝑉𝑒𝑟𝑦𝐵𝑟𝑖𝑔ℎ𝑡 ∧ 𝒙2 = 𝑉𝑒𝑟𝑦𝐵𝑟𝑖𝑔ℎ𝑡 ∧ 𝑥3 = 𝑉𝑒𝑟𝑦𝐷𝑎𝑟𝑘 ∧ 𝑥4 = 𝑉𝑒𝑟𝑦𝐷𝑎𝑟𝑘) 𝑡ℎ𝑒𝑛(𝑦 = 𝐺𝑜𝐹𝑜𝑟𝑤𝑎𝑟𝑑𝑄𝑢𝑖𝑐𝑘𝑙𝑦) 1024 0 512 Robot