fuzzy logic - cs.umanitoba.ca · –fuzz inference mechanism –fuzzy knowledge base...

62
Fuzzy Logic Dr. Chi-Tai, Cheng

Upload: others

Post on 25-Feb-2021

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Fuzzy Logic

Dr. Chi-Tai, Cheng

Page 2: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Outline

• What is Fuzzy Logic?

• History and applications of Fuzzy Logic

• Fuzzy Control– Fuzzification– Fuzz Inference Mechanism– Fuzzy Knowledge Base

– Defuzzification

• Hand calculation of Fuzzy Control

• Paper of Fuzzy Control

Page 3: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

What is Fuzzy Logic?

• Traditional logic system: (Crisp set)– Item does or doesn’t belong to a group

(1, 0)• Human• Sports

Not Human

Human Hockey Basketball

Page 4: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

What is Fuzzy Logic?

• Fuzzy logic system:– Degree of a set [1, 0]

• Cold/Hot• Rich/Poor• Teenager/

Page 5: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

What is Fuzzy Logic?

Traditional logic system

Characteristic function

1

0

1

0

Fuzzy logic systemMembership function

Page 6: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

What is Fuzzy Logic?

• Example: • Input: Angle of Shoot, Distance of

Shoot• Output: Chance of Success

Small Normal Big

Close Normal Good Chance

Good Chance

Normal No Chance Normal Good Chance

Far No Chance No Chance Normal

Page 7: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

History and applications of Fuzzy Control

• Fuzzy logic was first proposed by Lotfi A. Zadeh of the University of California at Berkeley in a 1965 paper.

• Mid-1980, “ inverted pendulum” experiment.

Page 8: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

History and applications of Fuzzy Control

Page 9: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

History and applications of Fuzzy Control

ZE PS PBNB

NS

Page 10: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

History and applications of Fuzzy Control

• When can we use Fuzzy Control?

Page 11: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

History and applications of Fuzzy Control

• Fuzzy and Probability

Page 12: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

History and applications of Fuzzy Control

• For continuous values [0, 1]• For big and complicate problem• For no explicit define math problem• For human language - linguistic

variables

Page 13: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Jacky’s Assignment

Page 14: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Fuzzy set

AA offunction pmemebershi ],1 ,0[X: →µ

setfuzzy ,}X|))( ,{( ∈= xxxA Aµ

membership of degree ],1 ,0[)( ∈xAµ1

0

Teenager :A

13 1911 21

Page 15: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Fuzzy set

• Support set

• Core

• Crossover point

• Height 0

13 1911 21

}X ,0)(|{Supp ∈∀>= xxxA Aµ

}X ,1)(|{Core ∈∀== xxxA Aµ

5.0)( =xµ

)(max)(HeightX

xA Ax

µ∈

=

1Teenager :A

Page 16: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

α-cut sets

• α-cut sets1] [0,, ,set Universal:X ∈= α F(X)A

}X ,)(|{ ∈∀≥= xxxA A αµα

0

1

<∉≥∈

=))(( 0

))(( 1)(

αµαµ

χα

αα xAxif

xAxifx

A

AA

0.5 =α

Page 17: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Membership function

• Discrete membership function• Continuous membership function

– Triangular shape– Trapezoid– S function– Z function– Pi function– Bell shape

Page 18: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Discrete membership function

Page 19: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Triangular shape

≤≤≤

≤≤≤

=−−−−

xbfor

bxafor

axafor

axfor

xabxb

aaax

A

1

1

1

1

0

0

)(

1

1

1

1

µ

0

1

a1 a b1

Page 20: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Trapezoid

≤≤≤≤≤≤≤

=

−−

−−

xbfor

bxbfor

bxafor

axafor

axfor

x

bbxb

aaax

A

1

1

1

1

0

1

0

)(

1

1

1

1

µ

0

1

a1 a b b1

Page 21: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

S function

• monotonical increasing

≤≤≤−≤≤

=−−

−−

xfor

xfor

xfor

xfor

xSx

x

γγββα

α

γβααγγ

αγα

1

)(21

)(2

0

),,;(2

2

Page 22: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Z function

≤≤≤≤≤−

=−−

−−

xfor

xfor

xfor

xfor

xZx

x

γγββα

α

γβααγγ

αγα

0

)(2

)(21

1

),,;(2

2

Page 23: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Pi function

≥++−≤−−

=Πγβγγγγγγβγ

γβ β

β

xforxS

xforxSx

) , , ;(1

) , , ;(),;(

2

2

Page 24: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Bell shape

bA

acx

x 2

1

1)(

−+=µ

c

1

Page 25: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Relation

• Binary relational matrix• Example: Standard weight

60 70 80 90

150 1 0 0 0

160 0 1 0 0

170 0 0 1 0

180 0 0 0 1

60 70 80 90

150 1 0.6 0.2 0

160 0.6 1 0.6 0.2

170 0.2 0.6 1 0.6

180 0 0.2 0.6 1

Traditional logic Fuzzy logic

Page 26: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Traditional Logic Operate

• Brothers & Classmates

Brother Classmates

}David Carl, Bill, Albert,{=A}Grand ,Foster ,Eason{=B

Eason

Foster

Grand

Albert

0 1 0

Bill 0 0 1

Carl 0 0 0

David

1 0 0

Eason

Foster

Grand

Albert

0 1 1

Bill 0 1 0

Carl 1 0 1

David

1 1 0

Page 27: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Traditional Logic Operate - Union

• Relationship for who are brothers OR classmates (Union) => max(A, B)

Eason

Foster

Grand

Albert 0 1 0Bill 0 0 1Carl 0 0 0David 1 0 0

Eason

Foster

Grand

Albert

0 1 1Bill 0 1 0Carl 1 0 1David 1 1 0

∪ =Eason Foster Grand

Albert 0 1 1

Bill 0 1 1

Carl 1 0 1

David 1 1 0

Page 28: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Traditional Logic Operate - Intersection

• Relationship for who are brothers AND classmates (Intersection) => min(A, B)

Eason

Foster

Grand

Albert 0 1 0Bill 0 0 1Carl 0 0 0David 1 0 0

Eason

Foster

Grand

Albert

0 1 1Bill 0 1 0Carl 1 0 1David 1 1 0

∩ =Eason Foster Grand

Albert 0 1 0

Bill 0 0 0

Carl 0 0 0

David 1 0 0

Page 29: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Fuzzy Logic Operate

• B Higher & Heavier than A

Higher Heavier

}David Carl, Bill, Albert,{=A

}Grand ,Foster ,Eason{=B

Eason

Foster

Grand

Albert

0.8 0 0.9

Bill 1 0.8 1

Carl 0.1 0 0.7

David

0.7 0 0.8

Eason

Foster

Grand

Albert

0.4 0.9 0.3

Bill 0 0.4 0

Carl 0.9 0.5 0.8

David

0.6 0.7 0.5

Page 30: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Fuzzy Logic Operate - Union

• Relationship for B are higher OR heavier (Union) => max(A, B)

Eason

Foster

Grand

Albert 0.8

0 0.9

Bill 1 0.8

1

Carl 0.1

0 0.7

David 0.7

0 0.8

Eason

Foster

Grand

Albert 0.

40.9

0.3

Bill 0 0.4

0

Carl 0.9

0.5

0.8

David 0.

60.7

0.5

∪ =Eason Foster Grand

Albert 0.8 0.9 0.9

Bill 1 0.8 1

Carl 0.9 0.5 0.8

David 0.7 0.7 0.8

Page 31: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Fuzzy Logic Operate - Intersection

• Relationship for B are higher AND heavier (Union) => min(A, B)

Eason

Foster

Grand

Albert 0.8

0 0.9

Bill 1 0.8

1

Carl 0.1

0 0.7

David 0.7

0 0.8

Eason

Foster

Grand

Albert 0.

40.9

0.3

Bill 0 0.4

0

Carl 0.9

0.5

0.8

David 0.

60.7

0.5

=Eason Foster Grand

Albert 0.4 0 0.3

Bill 0 0.4 0

Carl 0.1 0 0.7

David 0.6 0 0.5

Page 32: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Composition operationComposition operation

• ExampleJerry} Ister, {Harry,=A

Mickey} Luffy, {Kalman,=B

}Lab {Hockey,C =

Harry

Ister Jerry

Kalman

0.8 0 0.3

Luffy 0.6 0.9 0.9

Mickey

0 0.2 1

Hockey

Lab

Harry 0.9 0

Ister 0.2 0.4

Jerry 0.7 0.9

Page 33: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Composition operationComposition operation

• Where will we meet Kalman, Luffy and Mickey tomorrow?

Harry

Ister Jerry

Kalman

0.8 0 0.3

Luffy 0.6 0.9 0.9

Mickey

0 0.2 1

Hockey

Lab

Harry 0.9 0

Ister 0.2 0.4

Jerry 0.7 0.9

Hockey

Lab

Kalman

0.8 0.3

Luffy 0.7 0.9

Mickey 0.7 0.9

Page 34: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Fuzzy Control

Fuzzy Inference Mechanism

Fuzzification Defuzzification

Fuzzy Knowledge Base

Controlled system

Crisp

Process Output Actual Control

CrispFuzzyTerms

FuzzyTerms

Page 35: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Fuzzy Control

• Fuzzification• Fuzzy Knowledge Base• Fuzzy Inference Mechanism• Defuzzification

Page 36: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Fuzzification

• Fuzzification transforms crisp values into grades of membership for linguistic terms of fuzzy sets.– Example: Shooting Success Rate : input

1->Angle

Page 37: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Fuzzy Knowledge Base

• Use linguistic variables to build the IF-THEN rules in Fuzzy Knowledge Base.

• Example: Shooting Success Rate Knowledge

Base

Distance

Close Normal Far

Angle

Small NormalNo

Chance

NoChanc

e

Normal

GoodChance

NormalNorma

l

BigGood

ChanceGood

Chance

GoodChanc

e

Page 38: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Fuzzy Inference Mechanism

• Combines the fuzzy terms obtained from the fuzzification with the rule base and data base

• Min-Max2222121

21212111

1

Bis THEN Y A is X AND A is X IF:R Bis THEN Y A is X AND A is X IF:R

1X

1X 2X

2X

Y

Y

Y

111 A is x

121 A is x

212 A is x

222 A is x

1 Bis y

2 Bis y*B

Page 39: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Defuzzification – Crisp Value

• Weighted Average Defuzzification

∑∑ ⋅

=

ii

ii

i

w

wmu*

Page 40: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Defuzzification – Fuzzy Set

• Center of Gravity DefuzzificationDiscrete Continuous

∑∑ ⋅

=

ii

iii

x

xxu

)(

)(*

µ

µ

∫∫ ⋅

=

x

x

dxx

xdxx

u)(

)(

µx

x*

µ

Page 41: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Defuzzification

0.80.50.4

1 2 3 Output

1

94.14.08.05.0

4.038.025.01 =++

×+×+×

Page 42: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Defuzzification

0.80.50.4

1 2 3 Output

1

94.14.08.05.0

4.038.025.01 =++

×+×+×

Page 43: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Center of Gravity Defuzzification

∑∑

∑∑∑∑

∑∑∑∑

⋅=

=⋅

=−⋅

=⋅−⋅

=⋅−

=⋅

)(

)(

)()(

0)()(

0)()(

0)()(

0)(CoG)-(

x

xxCoG

xCoGxx

xCoGxx

xCoGxx

xCoGx

xx

µµ

µµ

µµ

µµ

µ

µ

Page 44: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Example

KnowledgeBase

Distance

Close Normal Far

Angle

Small NormalNo

Chance

NoChanc

e

Normal

GoodChance

NormalNorma

l

BigGood

ChanceGood

Chance

GoodChanc

e

NormalGoodChanc

e

NoChanc

e

0.5 10

Input 1: Shooting Angle

Input 2: Shooting Distance

Output:Shooting Success Rate

• Use Shooting Angle and Shooting Distance to calculate the Shooting Success Rate for Ice Hockey

Page 45: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Example

Input 1: Shooting Angle

• Input 1: Shooting Angle

Page 46: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Example

Input 2: Shooting Distance

• Input 2: Shooting Distance

Page 47: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Example

• Knowledge Base

KnowledgeBase

Distance

Close Normal Far

Angle

Small Normal NoChance

NoChanc

e

Normal

GoodChance Normal Norma

l

Big GoodChance

GoodChance

GoodChanc

e

Page 48: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Knowledge Base

If Angle is Small and Distance is Close then output = NormalIf Angle is Small and Distance is Normal then output = No ChanceIf Angle is Small and Distance is Far then output = No ChanceIf Angle is Normaland Distance is Close then output = Good ChanceIf Angle is Normal and Distance is Normal then output = NormalIf Angle is Normal and Distance is Far then output = NormalIf Angle is Big and Distance is Close then output = Good ChanceIf Angle is Big and Distance is Normal then output = Good ChanceIf Angle is Big and Distance is Far then output = Good Chance

Page 49: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Example

• Angle = 20, Distance = 90. Output is ?

• Angle = 20, Distance = 81. Output is ?

– (Use Weighted Average Defuzzification)

Page 50: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Angle = 20, Distance = 90

If Angle is Small and Distance is Close then output = NormalIf Angle is Small and Distance is Normal then output = No ChanceIf Angle is Small and Distance is Far then output = No ChanceIf Angle is Normaland Distance is Close then output = Good ChanceIf Angle is Normal and Distance is Normal then output = NormalIf Angle is Normal and Distance is Far then output = NormalIf Angle is Big and Distance is Close then output = Good ChanceIf Angle is Big and Distance is Normal then output = Good ChanceIf Angle is Big and Distance is Far then output = Good Chance

Page 51: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Angle = 20, Distance = 90

Angle “20” is 20% degrees of Small Set and 80% degrees of Normal Set

Distance “90” is 100% degrees of Normal Set

Page 52: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Angle = 20, Distance = 90

4.08.02.0

5.08.002.0 =+

×+×=output

Page 53: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Angle = 20, Distance = 81

458.01.09.01.02.0

11.05.09.05.01.002.0 =+++

×+×+×+×=output

Page 54: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Quiz

• Angle = 15, Distance = 99

Page 55: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

A Fuzzy Logic Controller for Car-like Mobile Robots

• Input:– curvature, position error and orientation

error

• Output:– speed and direction

Page 56: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Input - Curvature

Page 57: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Input - Position error

Page 58: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Input - Orientation error

Page 59: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Output - Speed

Page 60: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Output - Direction

Page 61: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Rules

• straightLine & zeroDisp & zeroAngle– Fast & straight

• straightLine & zeroDisp & posHighAngle– Medium speed & sharpLeft

• leftCircle & posLowDisp &negLowAngle– Medium speed & lowLeft

Page 62: Fuzzy Logic - cs.umanitoba.ca · –Fuzz Inference Mechanism –Fuzzy Knowledge Base –Defuzzification •Hand calculation of Fuzzy Control •Paper of Fuzzy Control. What is Fuzzy

Reference

• http://www4.cs.umanitoba.ca/~jacky/Teaching/Courses/COMP_4180-IntelligentMobileRobotics/current/index.php• Ching-Chang Wong, 2010 Fuzzy Control class, TKU, Taiwan.• http://en.wikipedia.org/wiki/Fuzzy_control_system