asst3soln2006

advertisement
Solution to Assignment 3, COSC 4117, due Dec 6, 2006
#1 page 316, #9.4
a. P(A,B,B), P(x,y,z) unified by Subst{x/A,y/B,z/B}
b. Q(y,G(A,B)),Q(G(x,x),y) y must be substituted with
G(A,B) and G(x,x) if the predicates are to be unified.
G(A,B) and G(x,x) cannot be unified if A and B are
distinct objects because x must be substituted by A and
B in unifying.
c. Older(Father(y),y), Older(Father(x), John) unified by
Subst{y/John, x/John}
d. Knows(Father(y),y), Knows(x,x) Assuming Father(y)
identifies the object that is the father of object
referenced by y and hence cannot be the same object,
these predicates cannot be unified because x must be
substituted with both y and Father(y).
#2 page 316, #9.9
(1)
x (Pig(x)  Cow(x)  Horse(x)) => Mammal(x)
(2)
x y (Offspring(x,y)  Horse(y)) => Horse(x)
(3)
Horse(Bluebeard)
(4)
Parent(Bluebeard,Charlie)
(5)
x y Parent(y,x) <=> Offspring(x,y)
(6)
x Mammal(x) => y Parent(y,x)
#3
CNF
Eliminate biconditionals and implications
(1)
x ~(Pig(x)  Cow(x)  Horse(x))  Mammal(x)
(2)
x y ~(Offspring(x,y)  Horse(y))  Horse(x)
(3)
Horse(Bluebeard)
(4)
Parent(Bluebeard,Charlie)
(5a) x y ~Parent(y,x)  Offspring(x,y)
(5b) x y ~Offspring(x,y)  Parent(y,x)
(6)
x ~Mammal(x)  y Parent(y,x)
Move negatives inwards
(1)
x (~Pig(x)  ~Cow(x)  ~Horse(x))  Mammal(x)
(2)
x y (~Offspring(x,y)  ~Horse(y))  Horse(x)
(3)
Horse(Bluebeard)
(4)
Parent(Bluebeard,Charlie)
(5a) x y ~Parent(y,x)  Offspring(x,y)
(5b) x y ~Offspring(x,y)  Parent(y,x)
(6)
x ~Mammal(x)  y Parent(y,x)
Standardize variables
(1)
x (~Pig(x)  ~Cow(x)  ~Horse(x))  Mammal(x)
(2)
z y ~Offspring(z,y)  ~Horse(y)  Horse(z)
(3)
Horse(Bluebeard)
(4)
Parent(Bluebeard,Charlie)
(5a) v w ~Parent(w,v)  Offspring(v,w)
(5b) t s ~Offspring(t,s)  Parent(s,t)
(6)
r ~Mammal(r)  p Parent(p,r)
Skolemize existential
(6)
r ~Mammal(r)  Parent(P(r),r)
Drop universals
(1)
(~Pig(x)  ~Cow(x)  ~Horse(x))  Mammal(x)
(2)
~Offspring(z,y)  ~Horse(y)  Horse(z)
(3)
Horse(Bluebeard)
(4)
Parent(Bluebeard,Charlie)
(5a) ~Parent(w,v)  Offspring(v,w)
(5b) ~Offspring(t,s)  Parent(s,t)
(6)
~Mammal(r)  Parent(P(r),r)
Distribute  over 
(1a) ~Pig(x)  Mammal(x)
(1b) ~Cow(x)  Mammal(x)
(1c) ~Horse(x)  Mammal(x)
(2)
~Offspring(z,y)  ~Horse(y)  Horse(z)
(3)
Horse(Bluebeard)
(4)
Parent(Bluebeard,Charlie)
(5a) ~Parent(w,v)  Offspring(v,w)
(5b) ~Offspring(t,s)  Parent(s,t)
(6)
~Mammal(r)  Parent(P(r),r)
Standardize variables again
(1a) ~Pig(x)  Mammal(x)
(1b) ~Cow(m)  Mammal(m)
(1c) ~Horse(n)  Mammal(n)
(2)
~Offspring(z,y)  ~Horse(y)  Horse(z)
(3)
Horse(Bluebeard)
(4)
Parent(Bluebeard,Charlie)
(5a) ~Parent(w,v)  Offspring(v,w)
(5b) ~Offspring(t,s)  Parent(s,t)
(6)
~Mammal(r)  Parent(P(r),r)
To show Charlie is a mammal, add the opposite statement to the
KB:
(1a) ~Pig(x)  Mammal(x)
(1b) ~Cow(m)  Mammal(m)
(1c) ~Horse(n)  Mammal(n)
(2)
~Offspring(z,y)  ~Horse(y)  Horse(z)
(3)
Horse(Bluebeard)
(4)
Parent(Bluebeard,Charlie)
(5a) ~Parent(w,v)  Offspring(v,w)
(5b) ~Offspring(t,s)  Parent(s,t)
(6)
~Mammal(r)  Parent(P(r),r)
(7)
~Mammal(Charlie)
Use resolution to establish a contradiction if possible
With Subst({Charlie/n}), unify Mammal() and resolve (1c),(7)
(8)
~Horse(Charlie)
With Subst({Charlie/z}), unify Horse() and resolve (2),(8)
(9)
~Offspring(Charlie,y)  ~Horse(y)
With Subst({Bluebeard/y}), unify Horse() and resolve (3),(9)
(10) ~Offspring(Charlie,Bluebeard)
With Subst({Bluebeard/w, Charlie/v}), unify Offspring() and
resolve (5a),(10)
(11) ~Parent(Bluebeard, Charlie)
Without substitution, resolve (4) and (11)
(12) NIL
This contradiction refutes the assumption ~Mammal(Charlie) so
Mammal(Charlie); Charlie is a mammal.
4.
Planning in Blocks World (as developed in lecture)
Actions
Move(b,x,y)
PRE:On(b,x)^Clear(b)^Clear(y)^Block(b)^Block(y)
EFFECT:~On(b,x)^~Clear(y)^Clear(x)^On(b,y)
MoveToTable(b,x)
PRE:On(b,x)^Clear(b)^Block(b)
EFFECT:~On(b,x)^Clear(x)^On(b,T)
Plan:
START
causal
Preconditions: NIL

Effect: On(A,T)^On(B,T)^On(C,A)
^Clear(B)^Clear(C)^Clear(T)
^Block(A)^Block(B)^Block(C)
MOVETOTABLE(C,A)
Preconditions:Clear(C)^On(C,A)^
Block(C)
Effect:~On(C,A)^Clear(A)
^On(C,T)
MOVE(B,T,C)
Preconditions:Clear(B)^Clear(C)^
On(B,T)^Block(B)^Block(C)
Effect:~On(B,T)^~Clear(C)^
Clear(T)^On(B,C)^~On(B,T)
MOVE(A,T,B)
Preconditions:Clear(A)^Clear(B)^
On(A,T)^Block(A)^Block(B)
Effect:~On(A,T)^~Clear(B)^
Clear(T)^On(A,B)^~On(A,T)
FINISH
Preconditions:On(A,B)^On(B,C)
open {}
Effect: NIL
SOLUTION:
The initial state of the problem:
On(A,T)^On(B,T)^On(C,A)
^Clear(B)^Clear(C)^Clear(T)
^Block(A)^Block(B)^Block(C)
Action: MoveToTable(C,A) EFFECT:~On(C,A)^Clear(A)^On(C,T)
On(A,T)^On(B,T)^On(C,T)
^Clear(B) ^Clear(C) ^Clear(A)^Clear(T)
^Block(A)^Block(B)^Block(C)
Action: Move(B,T,C) EFFECT:~On(B,T)^~Clear(C)^On(B,C)
On(A,T)^On(B,C)^On(C,T)
^Clear(B) ^Clear(A)^Clear(T)
^Block(A)^Block(B)^Block(C)
Action: Move(A,T,B) EFFECT:~On(A,T)^~Clear(B)^On(A,B)
On(A,B)^On(B,C)^On(C,T)
^ Clear(A)^Clear(T)
^Block(A)^Block(B)^Block(C)
== goal state
plan is {MoveToTable(C,A),Move(B,T,C),Move(A,T,B)}
A non-interleaved planner will not solve the problem because
it concatenates plans for individual goals: On(A,B) and
On(B,C) In either order, from the given start state, the
second plan destroys the result of the first.
I On(A,B) then On(B,C)
1. plan: MoveToTable(C,A), Move(A,T,B)  On(A,B)
2. plan: MoveToTable(A,B), Move(B,T,C)  On(B,C) but ~On(A,B)
OR
II On(B,C) then On(A,B)
1. plan: Move(B,T,C)  On(B,C)
2. plan: MoveToTable(B,C), MoveToTable(C,A),Move(A,T,B) 
On(A,B) but ~On(B,C)
NOTE: full marks were given for a sequential plan (with KB
changes) and/or for the plan graph
Download