You are on page 1of 18

ARTIFICIAL INTELLIGENCE 6 Fuzzy Logic

Sumber: Slide Kluliah Prof. Handayani Tjandrasa ITS

DEFINISI
Fuzzy logic: Cara untuk menyatakan variasi atau ketidaktepatan (tidak mutlak) dalam logika Misal dalam bahasa alami:

"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}
2

True/False Variables
King(Richard) Greedy(Richard) Evil(Richard) Richard is greedy is True or False: Greedy(Richard) {0,1}

Fuzzy Sets
Variabelnya dapat mempunyai nilai dalam batasan [0,1] Misal: Greedy(Richard) = 0.7 Fuzzy Linguistic Variables: digunakan untuk menyatakan nilai yang bervariasi dalam suatu spektrum Misal: Temp: {Freezing, Cool, Warm, Hot} Membership Function: Fungsi keanggotaan untuk menyatakan derajat kebenaran Contoh: How warm is it?
4

Membership Functions
Temp: {Freezing, Cool, Warm, Hot} Derajat kebenaran atau keanggotaan (membership)

Freezing

Cool

Warm

Hot

0 10 30 50 70 90 110 Temp. (F)


5

Membership Functions
Seberapa dingin 36 F ? 30% Cool dan 70% Freezing
1 Freezing Cool Warm Hot

0 10 30 50 70 90 110 Temp. (F)


6

Fuzzy Disjunction
AB
A
1 1 0.75

max(A, B)
B

0.375

(AB = C) (C = 0.75)

Fuzzy Conjunction
AB min(A, B)
7

(AB = C) (C = 0.375)

Contoh

AB

AB

Struktur Kontroler
Fuzzification
Petakan variabel input dalam nilai fuzzy

Inference Mechanism
Pendekatan reasoning dan deduksi aksi kontrol

Defuzzification
Konversi nilai fuzzy output ke aksi kontrol

Contoh Input: Temp & Cover Output: Speed Temp: {Freezing, Cool, Warm, Hot}
1 Freezing Cool Warm Hot

0 10 30 50 70 90 110 Temp. (F)

Cover: {Sunny, Partly, Overcast}


1 Sunny Partly Cloudy Overcast

Speed: {Slow, Fast}


1

0
Slow

20

40

60

80
Fast

100

Cloud Cover (%)

0 0 25 50 75 100 Speed (mph)

10

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)

11

Example Speed Calculation


How fast will I go if it is
65 F 25 % Cloud Cover ?

12

Fuzzification:
Berapa besar kecepatan bila temp. 65 F dan 25 % tertutup awan?
65 F Cool = 0.25, Warm= 0.75
1 Freezing Cool Warm Hot

0 10 30 50 70 90 110 Temp. (F)

25% Cover Sunny = 0.8, Cloudy = 0.2


1 Sunny Partly Cloudy Overcast

0 0 20 40 60 80 100 Cloud Cover (%)

13

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
1 Slow Fast

Speed = weighted mean = (2*25+7*75)/(9) = 63.8 mph


0 0 25 50 75 100

14

Speed (mph)

Fuzzy Linguistic Variables


Air Temperature Set cold {50, 0, 0} Set cool {65, 55, 45} Set just right {70, 65, 60} Set warm {85, 75, 65} Set hot {, 90, 80} Fan Speed Set stop {0, 0, 0} Set slow {50, 30, 10} Set medium {60, 50, 40} Set fast {90, 70, 50} Set blast {, 100, 80}

Rules
Air Conditioning Controller: IF Cold then Stop If Cool then Slow If OK then Medium If Warm then Fast IF Hot then Blast

Fuzzy Air Conditioner


0 100 90 80 70 60 50 40 30 20 10 0 if Cold then Stop
o St
m Co ol

s Bla

If Hot then Blast If Warm then Fast

Fa s

Med ium

If Just Right then Medium IF Cool then Slow

Sl

ow

0 45 50 55 60 65 70 75 80 85 90

Jus Rig t ht

Ho

ar

Co ld

TERIMA KASIH

You might also like