Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to AI & AI Principles (Semester 1) WEEK 6 – Tuesday Introduction to AI & AI Principles (Semester 1) WEEK 6 – Tuesday (2008/09) John Barnden.

Similar presentations


Presentation on theme: "Introduction to AI & AI Principles (Semester 1) WEEK 6 – Tuesday Introduction to AI & AI Principles (Semester 1) WEEK 6 – Tuesday (2008/09) John Barnden."— Presentation transcript:

1 Introduction to AI & AI Principles (Semester 1) WEEK 6 – Tuesday Introduction to AI & AI Principles (Semester 1) WEEK 6 – Tuesday (2008/09) John Barnden Professor of Artificial Intelligence School of Computer Science University of Birmingham, UK

2 Exercises [10 mins] on Logic Expression 1)holds0(Mike, B)  is-open(D-KH) 2)next-to(Mike,D-KS)   is-open(the-door-of(F)) [remember that F refers to the fridge door] 3)Mike is holding the bottle or I am not holding it. 4)I am next to the fridge and the bottle is in it. 5)I am not holding the bottle in my right hand. 6)The bottle is empty. [Invent a new symbol.] 7)The bottle is full. [Invent a new symbol.] 8)The bottle is neither full nor empty. 9)The bottle is open.

3 Answers to Exercises on Logic Expression 1)holds0(Mike, B)  is-open(D-KH) Mike is holding the bottle or the door between kitchen and hall is open (or both). 2)next-to(Mike,D-KS)   is-open(the-door-of(F)) [remember that F refers to the fridge door] Mike is next to the door between kitchen and sitting-room and the fridge door isn’t open.

4 Answers to Exercises on Logic Expression 3)Mike is holding the bottle or I am not holding it. holds0(Mike, B)   holds0(Ego, B) 4)I am next to the fridge and the bottle is in it. next-to(Ego, F)  in(B, F) 5)I am not holding the bottle in my right hand.  holds1(Ego, B, the-right-hand-of(Ego))

5 Answers to Exercises on Logic Expression 6)The bottle is empty. [Invent a new symbol.] empty(B) 7)The bottle is full. [Invent a new symbol.] full(B) 8)The bottle is neither full nor empty.  empty(B)   full(B) OR  (empty(B)  full(B)) 9)The bottle is open. is-open(B) ?? OR do we need a new symbol??: is-open1(B)

6 Reasoning about the Nature of one situation [BRIEF INTRO] (Planning the Delivery of One Drink, contd)

7 One Method: “Production System” (NB: this is a common method but NOT standard logical reasoning) uSome Rules (“Productions”) [a,o, etc. are variables]: 1)IF next-to(a, o)  holds0(a, x) THEN next-to(x, o). 2)IF in(a, room1)  holds0(a, x) THEN in(x, room1) 3)IF holds1(a, z, h) THEN holds0(a, z). 4)IF holds3(a, z) THEN holds0(a, z). 5)IF in(a, room1)  distinct(room1, room2) THEN  in(a, room2) 6)IF has(a, o)  distinct(a, b) THEN  has(b, o).

8 Production System, contd. uThe PS also contains an inference engine to manage the application of the rules. uThere’s a working memory: e.g., a collection of facts the system currently takes to be true. uApplication of a rule, with bindings (instantiations) of the variables to particular values, causes the contents of WM to be changed: additions; deletions; modifications of existing things. uIn forwards chaining, the inference engine “cycles round”, applying one rule instantiation at a time, until (say) some conjectured fact is established or the system gives up.

9 Brief Example of Forwards Chaining holds3(Ego, B)  distinct(K,S) in(Ego, K) 1)IF next-to(a, o)  holds0(a, x) THEN next-to(x, o). 2)IF in(a, room1)  holds0(a, x) THEN in(x, room1) 3)IF holds1(a, z, h) THEN holds0(a, z). 4)IF holds3(a, z) THEN holds0(a, z). 5)IF in(a, room1)  distinct(room1, room2) THEN  in(a, room2) 6)IF has(a, o)  distinct(a, b) THEN  has(b, o). Working Memory: Initial State Apply an instance of Rule 4 holds3(Ego, B) holds0(Ego, B)  distinct(K,S) in(Ego, K)  Apply an instance of Rule 2 holds3(Ego, B) holds0(Ego, B) distinct(K,S)  in(Ego, K) in(B, K)  holds3(Ego, B) holds0(Ego, B) distinct(K,S) in(Ego, K) in(B, K)  in(B, S) Apply an instance of Rule 5

10 Forwards Chaining, contd.: Dependency Diagram  in(B, S) in(B, K)distinct(K,S) in(Ego, K) holds0(Ego, B) holds3(Ego, B) Rule 4 (a:Ego, z:B) Rule 2 (a:Ego, room1:K, x: B) Rule 5 (a:Ego, room1:K, room2: S) room1:K, room2: S)

11 Backwards Chaining in PSs uStart with a top-level goal. Cycle round the following steps until the top-level goal is satisfied. [This is one possible, approx. process.] l Choose an existing unsatisfied goal. l IF it does not match any item in Working Memory THEN choose a rule instance that would achieve that goal if applied, and establish the instantiated versions of the rule’s conditions as goals. l ELSE mark the chosen goal as satisfied, and, as far as possible, propagate the effects of this up to other goals that depend on it, by applying the relevant rules.

12 Previous Example done by Backwards Chg holds3(Ego, B) distinct(K,S), distinct(K,H) in(Ego, K) OPEN GOALS:  in(B, S) 2) IF in(a, room1)  holds0(a, x) THEN in(x, room1) 3) IF holds1(a, z, h) THEN holds0(a, z). 4) IF holds3(a, z) THEN holds0(a, z). 5) IF in(a,rm1)  distinct(rm1,rm2) THEN  in(a,rm2) holds3(Ego, B) distinct(K,S), distinct(K,H) in(Ego, K) OPEN GOALS:  in(B, S), By 5: in(B, r1), distinct(r1,S) holds3(Ego, B) distinct(K,S) , distinct(K,H) in(Ego, K) OPEN GOALS:  in(B, S), altered: in(B, K) holds3(Ego, B) distinct(K,S), distinct(K,H), in(Ego, K) OPEN GOALS:  in(B, S), in(B, K), By 2: in(a,K), holds0(a,B) holds3(Ego, B) distinct(K,S), distinct(K,H), in(Ego, K)  OPEN GOALS:  in(B, S), in(B, K), altered: holds0(Ego,B) and then by 4: holds3(Ego,B) holds3(Ego, B) , distinct(K,S), distinct(K,H), in(Ego, K)  in(B, S), in(B, K), holds0(Ego,B) By a match to a WM fact:

13 Backwards Chaining: Tree Diagram

14 Exercise 1 [5 mins] on PSs: Forwards Chaining holds1(M, Ego, the-right..(M)) holds0(Ego, B) next-to(M, F) next-to(M, Peter) 1)IF next-to(a, o)  holds0(a, x) THEN next-to(x, o). 2)IF in(a, room1)  holds0(a, x) THEN in(x, room1) 3)IF holds1(a, z, h) THEN holds0(a, z). 4)IF holds3(a, z) THEN holds0(a, z). 5)IF in(a, room1)  distinct(room1, room2) THEN  in(a, room2) 6)IF has(a, o)  distinct(a, b) THEN  has(b, o). Working Memory: Initial State (M = Mike) next-to(B, F) Final WM should include: Fill in the intermediate Working Memory states and provide a dependency diagram.

15 Ans. To Exercise 1 on PSs holds1(M, Ego, the-right..(M))  holds0(Ego, B) next-to(M, F), next-to(M, Peter) 1)IF next-to(a, o)  holds0(a, x) THEN next-to(x, o). 2)IF in(a, room1)  holds0(a, x) THEN in(x, room1) 3)IF holds1(a, z, h) THEN holds0(a, z). 4)IF holds3(a, z) THEN holds0(a, z). 5)IF in(a, room1)  distinct(room1, room2) THEN  in(a, room2) 6)IF has(a, o)  distinct(a, b) THEN  has(b, o). Working Memory: Initial State An instance of Rule 3 gives: holds1(M, Ego, the-right..(M)) holds0(M, Ego)  holds0(Ego, B) next-to(M, F)  next-to(M, Peter) holds1(M, Ego, the-right..(M)) holds0(M, Ego) holds0(Ego, B)  next-to(M, F), next-to(M, Peter) next-to(Ego, F) An instance of Rule 1 gives: Another instance of Rule 1 gives Final WM : holds1(M, Ego, the-right..(M)) holds0(M, Ego) holds0(Ego, B) next-to(M, F), next-to(M, Peter) next-to(Ego, F), next-to(B, F) holds1(M, Ego, the-right..(M)) holds0(M, Ego) holds0(Ego, B)  next-to(M, F), next-to(M, Peter) next-to(Ego, F) 

16 Ans. To Ex. 1, contd.: Dependency Diagram next-to(B, F) next-to(Ego, F)holds0(Ego, B) next-to(M, F) holds0(M, Ego) holds1(M, Ego) Rule 3 (a:M, z:Ego, h: the-right..(M)) Rule 3 (a:M, z:Ego, h: the-right..(M) ) Rule 1 (a:M, o:F, x: Ego) Rule 1 (a:Ego, o:F, x: B)


Download ppt "Introduction to AI & AI Principles (Semester 1) WEEK 6 – Tuesday Introduction to AI & AI Principles (Semester 1) WEEK 6 – Tuesday (2008/09) John Barnden."

Similar presentations


Ads by Google