26
1 Pertemuan 8 Representing Knowledge Using Rules Matakuliah : T0264/Inteligensia Semu Tahun : 2005 Versi : 1

1 Pertemuan 8 Representing Knowledge Using Rules Matakuliah: T0264/Inteligensia Semu Tahun: 2005 Versi: 1

  • View
    215

  • Download
    0

Embed Size (px)

Citation preview

Page 1: 1 Pertemuan 8 Representing Knowledge Using Rules Matakuliah: T0264/Inteligensia Semu Tahun: 2005 Versi: 1

1

Pertemuan 8Representing Knowledge Using Rules

Matakuliah : T0264/Inteligensia Semu

Tahun : 2005

Versi : 1

Page 2: 1 Pertemuan 8 Representing Knowledge Using Rules Matakuliah: T0264/Inteligensia Semu Tahun: 2005 Versi: 1

2

Learning Outcomes

Pada akhir pertemuan ini, diharapkan mahasiswa

akan mampu :

• << TIK-99 >>

• << TIK-99>>

Page 3: 1 Pertemuan 8 Representing Knowledge Using Rules Matakuliah: T0264/Inteligensia Semu Tahun: 2005 Versi: 1

3

Outline Materi

• Materi 1

• Materi 2

• Materi 3

• Materi 4

• Materi 5

Page 4: 1 Pertemuan 8 Representing Knowledge Using Rules Matakuliah: T0264/Inteligensia Semu Tahun: 2005 Versi: 1

4

6.1 Procedural vs Declarative Knowledge

Consider the knowledge base :

man(Marcus)

man(Caesar)

person(Cleopatra)

x : man(x) person(x)

Supose we want to answer the question

y : person(y)

Page 5: 1 Pertemuan 8 Representing Knowledge Using Rules Matakuliah: T0264/Inteligensia Semu Tahun: 2005 Versi: 1

5

6.1 Procedural vs Declarative Knowledge

We could answer with any one of :y = Marcusy = Caesary = Cleopatra

Now consider an alternative KB :man(Marcus)man(Caesar)x : man(x) person(x)person(Cleopatra)

Page 6: 1 Pertemuan 8 Representing Knowledge Using Rules Matakuliah: T0264/Inteligensia Semu Tahun: 2005 Versi: 1

6

6.2 Logic Programming

PROLOG

A PROLOG program is composed of a set of Horn clauses.

A Horn clause is a clause that has at most one positive literal.

Examples : p

p qr s r s

Page 7: 1 Pertemuan 8 Representing Knowledge Using Rules Matakuliah: T0264/Inteligensia Semu Tahun: 2005 Versi: 1

7

6.2 Logic Programming

A Declarative and a Procedural

Representation

A Representation in Logic

x : pet(x) small(x) apartmentpet(x)

x : cat(x) dog(x) pet(x)

x : poodle(x) dog(x) small(x)

poodle(fluffy)

Page 8: 1 Pertemuan 8 Representing Knowledge Using Rules Matakuliah: T0264/Inteligensia Semu Tahun: 2005 Versi: 1

8

6.2 Logic Programming

A Representation in PROLOG

apartmentpet(x) : - pet(x), small(x).

pet(x) : - cat(x).

pet(x) : - dog(x).

dog(x) : - poodle(x).

small(x) : - poodle(x).

poodle(fluffy).

Page 9: 1 Pertemuan 8 Representing Knowledge Using Rules Matakuliah: T0264/Inteligensia Semu Tahun: 2005 Versi: 1

9

6.2 Logic Programming

Answering Question in PROLOG

?- apartmentpet(x).

?- cat(fluffy).

?- cat(mittens).

Page 10: 1 Pertemuan 8 Representing Knowledge Using Rules Matakuliah: T0264/Inteligensia Semu Tahun: 2005 Versi: 1

10

6.3 Forward vs Backward Reasoning

• Number of start and goal states.

• Branching factor in each direction.

• Need to justify reasoning.

• Triggers for problem solving.

Page 11: 1 Pertemuan 8 Representing Knowledge Using Rules Matakuliah: T0264/Inteligensia Semu Tahun: 2005 Versi: 1

11

6.3 Forward vs Backward Reasoning

Sample or the Rules for Solving the 8-

Puzzle

Assume the areas of the tray are numbered:

Page 12: 1 Pertemuan 8 Representing Knowledge Using Rules Matakuliah: T0264/Inteligensia Semu Tahun: 2005 Versi: 1

12

6.3 Forward vs Backward Reasoning

Square 1 empty and Square 2 contains tile n Square 2 empty and Square 1 contains tile n

Square 1 empty and Square 4 contains tile n Square 4 empty and Square 1 contains tile n

Square 2 empty and Square 1 contains tile n

Square 1 empty and Square 2 contains tile n

Page 13: 1 Pertemuan 8 Representing Knowledge Using Rules Matakuliah: T0264/Inteligensia Semu Tahun: 2005 Versi: 1

13

6.3 Forward vs Backward Reasoning

An Example :

Page 14: 1 Pertemuan 8 Representing Knowledge Using Rules Matakuliah: T0264/Inteligensia Semu Tahun: 2005 Versi: 1

14

6.3 Forward vs Backward Reasoning

A Bad Use of Heuristic Bidirectional Search

Page 15: 1 Pertemuan 8 Representing Knowledge Using Rules Matakuliah: T0264/Inteligensia Semu Tahun: 2005 Versi: 1

15

6.4 Matching

Representation Affects Matching

Page 16: 1 Pertemuan 8 Representing Knowledge Using Rules Matakuliah: T0264/Inteligensia Semu Tahun: 2005 Versi: 1

16

6.4 Matching

White pawn at

Square(file e, rank 2)

AND

Square(file e, rank 3) move pawn from

is empty Square(file e, rank 2)

AND to Square(file e, rank 4)

Square(file e, rank 4)

is empty

Page 17: 1 Pertemuan 8 Representing Knowledge Using Rules Matakuliah: T0264/Inteligensia Semu Tahun: 2005 Versi: 1

17

6.4 Matching

Many-to-Many Matching• The temporal nature of data.• Structural similarity in rules.

mammal(x) feline(x) jaguar(x)carnivorous(x) has-spots(x)mammal(x) feline(x) tiger(x)carnivorous(x) has-stripes(x)

Page 18: 1 Pertemuan 8 Representing Knowledge Using Rules Matakuliah: T0264/Inteligensia Semu Tahun: 2005 Versi: 1

18

6.4 Matching

• Persistance of variable binding consistency.

son(x,y) grandparent(x,z)

son(y,z)

Page 19: 1 Pertemuan 8 Representing Knowledge Using Rules Matakuliah: T0264/Inteligensia Semu Tahun: 2005 Versi: 1

19

6.4 Matching

A Bit of Dialogue with ELIZA

Person: Men are all alike.

ELIZA: In what way?

Person: They’re always bugging us about something or other.

ELIZA: Can you think of a specific example?

Person: Well, my boyfriend made me come here.

ELIZA: Your boyfriend made you come here.

Page 20: 1 Pertemuan 8 Representing Knowledge Using Rules Matakuliah: T0264/Inteligensia Semu Tahun: 2005 Versi: 1

20

6.4 Matching

Person: He says I’m depressed much of the time.

ELIZA: I am sorry to hear you are depressed.

Person: It’s true. I am unhappy.

ELIZA: Do you think coming here will help you not to be unhappy?

Person: I need some help, that much seems certain.

ELIZA: What would it mean to you if you got some help?

Page 21: 1 Pertemuan 8 Representing Knowledge Using Rules Matakuliah: T0264/Inteligensia Semu Tahun: 2005 Versi: 1

21

6.4 Matching

Person: Perhaps I could learn to get along with my mother.

ELIZA: Tell me more about your family.

Page 22: 1 Pertemuan 8 Representing Knowledge Using Rules Matakuliah: T0264/Inteligensia Semu Tahun: 2005 Versi: 1

22

6.4 Matching

Some ELIZA - like rules(X me Y) (X you Y)

(I remember Z)

(Why do remember X just now ?)

(My {family-member} is Y)

(Who else in your family is Y)

(X {family-member} Y)

(Tell me more about your family)

Page 23: 1 Pertemuan 8 Representing Knowledge Using Rules Matakuliah: T0264/Inteligensia Semu Tahun: 2005 Versi: 1

23

6.4 Matching

Conflict Resolution

• Preferences based on rules Rule order Prefer special cases over more general

ones

• Preferences based on objects Prefer some objects to others location in STM

• Preferences based on states

Page 24: 1 Pertemuan 8 Representing Knowledge Using Rules Matakuliah: T0264/Inteligensia Semu Tahun: 2005 Versi: 1

24

6.5 Control Knowledge

Syntax for a Control Rule

Under conditions A and B,

Rules that do {not} mention X

{ at all,

in their left-hand side,

in their right-hand side}

Page 25: 1 Pertemuan 8 Representing Knowledge Using Rules Matakuliah: T0264/Inteligensia Semu Tahun: 2005 Versi: 1

25

6.5 Control Knowledge

will

{ definitely be useless,

probably be useless

...

probably be especially useful

definitely be especially useful}

Page 26: 1 Pertemuan 8 Representing Knowledge Using Rules Matakuliah: T0264/Inteligensia Semu Tahun: 2005 Versi: 1

26

<< CLOSING>>