You are on page 1of 10

Page 1 Stranica 1

Artificial Intelligence Course : Module 9: Fuzzy logic Fuzzy LogicNeizrazita logika

1. Introduction 1. Uvod

Fuzzy logic: Neizrazita logika:

A way to represent variation or imprecision in logicNain predstavljanja varijacija


ili nepreciznosti u logici
A way to make use of natural language in logicNain koritenja prirodnog jezika u
logici
Priblian zakljuak Approximate reasoning

Humans say things like "If it is sunny and warm today, I will drive fast" Ljudi kau stvari
poput "Ako je danas sunano i toplo, vozit u brzo"

Linguistic variables: jezine varijable:

Temp: {freezing, cool, warm, hot} Temp: {zamrzavanje, hladno, toplo, vrue}
Oblak pokrivenosti: {oblano, djelomino oblano, sunano}
Brzina: {slow, fast}

2. Crisp (Traditional) Variables 2. vrste (tradicionalne) logike varijable

Crisp variables represent precise quantities: vrste varijable predstavljaju tone veliine:

x = 3.1415296 x = 3,1415296
A {0,1}

A proposition is either True or False Prijedlog je istinit ili netoan

A B CA B C

King(Richard) Greedy(Richard) Evil(Richard) kralj (Richard) Greedy (Richard)


zlo (Richard)

Richard is either greedy or he isn't: Richard je ili pohlepan ili nije:

Greedy(Richard) {0,1} Greedy (Richard) {0,1}

3. Fuzzy Sets 3. Fuzzy setovi

What if Richard is only somewhat greedy? to ako Richard samo malo pohlepan?
Fuzzy Sets can represent the degree to which a quality is possessed. Fuzzy setovi mogu
predstavljati stupanj do kojeg je kvaliteta posjedovana.

Fuzzy Sets (Simple Fuzzy Variables) have values in the range of [0,1] Fuzzy setovi
(Simple Fuzzy Variables) imaju vrijednosti u rasponu od [0,1]

Greedy(Richard) = 0.7 Pohlepan (Richard) = 0,7

Question: How evil is Richard? Pitanje: Koliko je zlo Richard?

4. Fuzzy Linguistic Variables 4. Fuzzy jezine varijable

Fuzzy Linguistic Variables are used to represent qualities spanning a particular spectrum
Fuzzy lingvistike varijable koriste se za predstavljanje kvaliteta koje obuhvaaju odreeni
spektar

Temp: {Freezing, Cool, Warm, Hot} Temperatura: {smrzava, Cool, toplo, vrue}

Membership Function Funkcija lanstva

Question: What is the temperature? Pitanje: Koja je temperatura?

Answer: It is warm. Odgovor: To je toplo.

Question: How warm is it? Pitanje: Koliko je to toplo?

5. Membership Functions 5. Funkcije lanstva

Temp: {Freezing, Cool, Warm, Hot} Temp: {Zamrzavanje, hladno, toplo, vrue}

Degree of Truth or "Membership" Stupanj istine ili "lanstvo"

11

Page 2 Stranica 2

Artificial Intelligence Course : Module 9: Fuzzy logic Umjetna inteligencija predmeta:


Modul 9: Neizrazita logika

Lecture Date: 14-03-2016 Datum predavanja: 14-03-2016

Time: 08:30 Am Vrijeme: 08:30 am

Example 1: How cool is 36 F? Primjer 1: Kako je svje 36 F?

It is 30% Cool and 70% Freezing, To je 30% hladno i 70% za zamrzavanje,


6. Fuzzy Logic Operators 6. Fuzzy operatori logike

How do we use fuzzy membership functions in predicate logic? Kako koristimo nejasne
funkcije lanstva u predikatnoj logici?

Fuzzy logic Connectives: Fuzzy logic Connectives:

Fuzzy Conjunction, Fuzzy konjunkt,

Fuzzy Disjunction, Fuzzy Disjunction,

Operate on degrees of membership in fuzzy sets Djelujte na stupnjevima lanstva u


neizrazitim setovima

6.1 Fuzzy Disjunction 6.1 Fuzzy Disjunction

AB max(A, B) AB max (A, B)

AB = C "Quality C is the disjunction of Quality A and B" AB = C "Kvaliteta C je


razdvajanje kvalitete A i B"

6.2 Fuzzy Conjunction 6.2 Fuzzy konjunkt

AB min (A, B) A B min (A, B)

AB = C "Quality C is the conjunction of Quality A and B" AB = C "Kvaliteta C je spoj


kvalitete A i B"

0.7 0,7

0.3 0,3

(AB = C) (C = 0.75) (AblB = C) (C = 0,75)

(AB = C) (C = 0.375) (A B = C) (C = 0,375)

22

Page 3 Stranica 3

Artificial Intelligence Course : Module 9: Fuzzy logic Umjetna inteligencija predmeta:


Modul 9: Neizrazita logika

Lecture Date: 14-03-2016 Datum predavanja: 14-03-2016


Time: 08:30 Am Vrijeme: 08:30 am

Example 2: Fuzzy Conjunction: Calculate AB given that A is .4 and B is 20? Primjer 2:


fuzzy Square: Izraunati AB obzirom da je A .4 i B je 20?

Determine degrees of membership: A = 0.7, B = 0.9, Odredite stupnjeve lanstva: A = 0,7,


B = 0,9,

Apply Fuzzy AND Primijeni neizraziti AND

AB = min(A, B) = 0.7 A B = min (A, B) = 0,7

7. Fuzzy Control 7. Fuzzy Control

Fuzzy Control combines the use of fuzzy linguistic variables with fuzzy logic Fuzzy
Control kombinira upotrebu neizrazitih jezinih varijabli s neizrazitom logikom

Example: Speed Control Primjer: Kontrola brzine

How fast am I going to drive today? Koliko brzo idem voziti danas?

It depends on the weather. Ovisi o vremenu.

Disjunction of Conjunctions Odvajanje konjunktura

7.1 Inputs: Temperature 7.1 Ulazi: Temperatura

Temp: {Freezing, Cool, Warm, Hot} Temp: {Zamrzavanje, hladno, toplo, vrue}

Cover: {Sunny, Partly, Overcast Pokriva: {Sunny, Djelomino, Oblano

0.9 0,9

0.7 0,7

33

Page 4 Stranica 4

Artificial Intelligence Course : Module 9: Fuzzy logic Umjetna inteligencija predmeta:


Modul 9: Neizrazita logika

Lecture Date: 14-03-2016 Datum predavanja: 14-03-2016

Time: 08:30 Am Vrijeme: 08:30 am


7.2 Output: Speed 7.2 Izlaz: Brzina

Temp: {Freezing, Cool, Warm, Hot} Temp: {Zamrzavanje, hladno, toplo, vrue}

8. Rules 8. Pravila

If it's Sunny and Warm, drive Fast Ako je sunano i toplo, vozite brzo

Sunny (Cover) Warm (Temp) Fast (Speed) Sunano (pokriva) Vlada (Temp) Brzo
(Brzina)

If it's Cloudy and Cool, drive Slow Ako je Cloudy i Cool, vozite Sporo

Cloudy (Cover) Cool (Temp) Slow (Speed) Oblano (pokriva) Cool (Temp) Sporo
(Brzina)

Driving Speed is the combination of output of these rules... Brzina vonje je kombinacija
izlaza ovih pravila ...

Example Speed Calculation Primjer izrauna brzine

How fast will I go if it is Koliko brzo idem ako jest

65 F 65 F

25 % Cloud Cover? 25% pokrivenosti oblaka?

Fuzzification: Calculate Input Membership Levels Fuzzification: Izraunajte ulazne razine


lanstva

65 F Cool = 0.4, Warm= 0.7 65 F Cool = 0,4, Toplo = 0,7

25% Cover Sunny = 0.8, Cloudy = 0.2 Poklopac od 25% Sunny = 0,8, Oblano = 0,2

44

Page 5 Stranica 5

Artificial Intelligence Course : Module 9: Fuzzy logic Umjetna inteligencija predmeta:


Modul 9: Neizrazita logika

Lecture Date: 14-03-2016 Datum predavanja: 14-03-2016

Time: 08:30 Am Vrijeme: 08:30 am


... Calculating... ... Izraun ...

If it's Sunny and Warm, drive Fast Ako je sunano i toplo, vozite brzo

Sunny (Cover) Warm (Temp) Fast (Speed) Sunano (pokriva) Warm (Temp) Brzo
(Brzina)

0.8 0.7 = 0.7 Fast = 0.7 0.8 0,7 0,7 0,7 Brzo

If it's Cloudy and Cool, drive Slow Ako je Cloudy i Cool, vozite Sporo

Cloudy (Cover) Cool (Temp) Slow (Speed) Oblano (pokriva) Cool (Temp) Slow
(Brzina)

0.2 0.4 = 0.2 Slow = 0.2 0.2 0.4 = 0.2 Sporo = 0.2

Defuzzification: Constructing the Output Defuzzification: Izrada izlaza

Speed is 20% Slow and 70% Fast Brzina je 20% spora i 70% bra

Find centroids: Location where membership is 100%? Pronaite centaride: mjesto gdje
je lanstvo 100%?

Solution: Rijeenje:

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

9. Notes: Follow-up Points 9. Napomene: Follow-up Points

Fuzzy Logic Control allows for the smooth interpolation between variable centroids with
relatively few Fuzzy Logic Control omoguuje glatku interpolaciju izmeu varijabilnih
sredita s relativno malo

rules pravila

This does not work with crisp (traditional Boolean) logic Ovo ne radi s jasnom
(tradicionalnom logikom logikom)

Provides a natural way to model some types of human expertise in a computer program
Prua prirodan nain modeliranja nekih vrsta ljudske strunosti u raunalnom programu

10. Notes: Drawbacks to Fuzzy logic 10. Biljeke: Nedostaci u neizrazitoj logici

Requires tuning of membership functions Zahtijeva usklaivanje lanstva

Fuzzy Logic control may not scale well to large or complex problems Fuzzy Logic
kontrola ne smije se dobro prilagoditi velikim ili sloenim problemima
Deals with imprecision, and vagueness, but not uncertainty Bavi se nepreciznosti i
neodreenosti, ali ne i nesigurnosti

55