Bài giảng Trí tuệ nhân tạo - Chapter 6: Using rules
Using Rules
Chapter 6
Logic Programming
(Definite) logic program:
A ← B1, B2, …, Bm
head body
program clause (Horn)
← A1, A2, …, An
goal clause
2
Logic Programming
PROLOG (Alain Colmerauer 1972):
apartmentpet(X) :- pet(X), small(X)
pet(X) :- cat(X)
pet(X) :- dog(X)
dog(X) :- poodle(X)
small(X) :- poodle(X)
poodle(fluffy)
pet(mittens)
?- apartmentpet(X)
3
Forward vs. Backward Reasoning
• Forward: from the start states.
• Backward: from the goal states.
4
Forward vs. Backward Reasoning
• Forward rules: to encode knowledge about how to
respond to certain input.
• Backward rules: to encode knowledge about how to
achieve particular goals.
5
Forward vs. Backward Reasoning
Combining forward and backward reasoning
← A1, …, Ak-1, Ak, Ak+1, …, An
achieved by
forward reasoning
achieved by
backward reasoning
6
Production Systems
Working memory:
{A(1), A(2), B(2), B(3), B(4), C(5)}
Rule memory:
A(x) ∧ B(x) ∧ C(y) ⇒ add D(x)
A(x) ∧ B(y) ∧ D(x) ⇒ add E(x)
A(x) ∧ B(x) ∧ E(x) ⇒ delete A(x)
7
Production Systems
RETE network (Forgy, 1982)
D
A=D
C
add E
add D
B
A=B
A
C(5)
D(2)
A(1), A(2)
B(2), B(3), B(4)
A(2)
B(2)
E
delete A
8
Production Systems
Conflict resolution:
Preferences based on rules:
Specificity of rules
Physical order of rules
Preferences based on objects:
Importance of objects
Position of objects
Preferences based on states:
Evaluation of states
9
Pattern Matching
ELIZA (Weizenbaum, 1966):
Person: Men all are alike.
ELIZA: In what way?
Person: They're always bugging us about something or other.
ELIZA: Can you think of specific example?
Person: Well, my boyfriend made me come here.
ELIZA: Your boyfriend made you come here.
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?
10
Pattern Matching
ELIZA (Weizenbaum, 1966):
Person: I need some help, that much seems certain.
ELIZA: What would it mean to you if you got some help?
Person: Perhaps I could learn to get along with my brother.
ELIZA: Tell me more about your family.
....
11
Pattern Matching
ELIZA (Weizenbaum, 1966):
(X me Y)
→ (X you Y)
(I remember X)
→ (Why do you 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)
Person: My brother is mean to me.
ELIZA: Who else in your family is mean to you?
....
12
Bạn đang xem tài liệu "Bài giảng Trí tuệ nhân tạo - Chapter 6: Using rules", để tải tài liệu gốc về máy hãy click vào nút Download ở trên
File đính kèm:
bai_giang_tri_tue_nhan_tao_chapter_6_using_rules.pdf

