feb14

advertisement
CS 4100 Artificial Intelligence
Prof. C. Hafner
Class Notes Feb 14, 2012
Assignment 5
• Why you must re-standardize variables every time a
rule is retrieved.
• Test data in assignments/A5sampleInputs
–
–
–
–
easy
average
hard
veryhard
State space search examples
4
3
A
S
4
B
C
5
5
G
4
3
2
D
B
4
E
F
A 10.4 6.7
S
11.0
D 8.9
C
4.0
G
E 6.9
3.0
F
New Topic: AI planning
• Generating plans
• Given:
–
–
–
–
A way to describe the world (“ontology”)
An initial state of the world
A goal description
A set of possible actions to change the world
• Find:
– A sequence of actions to change the initial state into
one that satisfies the goal
• Note similarity to state space search (e.g., 8 puzzle)
• Planning extends to more complex worlds and actions
States of the world have partial descriptions
(assertions of agent’s beliefs about its current situation)
S1
go(store)
[ ┐holds(at(home)) ]
holds(at(store))
holds(color(door, red))
S0
paint(door, green)
holds(at(home))
holds(color(door, red))
S2
Applications
• Mobile robots
– An initial motivator, and still being developed
• Simulated environments
– Goal-directed agents for training or games
• Web and grid environments
– Intelligent Web “bots”
– Workflows on a computational grid
• Managing crisis situations
– E.g. oil-spill, forest fires, urban evacuation, in factories,
…
• And many more
– Factory automation, flying autonomous spacecraft,
playing bridge, military planning, …
Plannning challenge: Representing change
• As actions change the world OR we consider possible
actions, we need to:
– Know how an action will alter the world
– Keep track of the history of world states (avoid loops)
• 3 approaches:
– Strips approach with total order planning (state space
search)
– Strips approach with partial order planning (POP)
– Situation calculus
“Classical Planning” Assumptions
• Discrete Time
– Instantaneous actions
•
•
•
•
Deterministic Effects
Omniscience
Sole agent of change
Goals of attainment (not avoidance)
Strips
• Highly influential representation for actions:
• Instead of F: state X action  next state, uses a set of
planning operators for achieving goals and subgoals
–
–
–
–
Preconditions (list of propositions to be true)
Delete list (list of propositions that will become false)
Add list (list of propositions that will become true)
[Implementation]
• More efficient to capture known strategies instead of
searching the space of possible primitive actions and
resulting states.
Example problem:
Initial state: at(home), ┐have(beer), ┐have(chips)
Goal:
have(beer), have(chips), at(home)
Operators:
Buy (X):
Pre: at(store)
Add: have(X)
Go (X, Y):
Pre: at(X)
Del: at(X)
Add: at(Y)
States of the world have partial descriptions
(assertions of agent’s beliefs
S1
go(store)
[ ┐holds(at(home)) ]
holds(at(store))
holds(color(door, red))
S0
mow_lawn()
holds(at(home))
holds(color(door, red))
S2
Frame problem (again)
• I go from home to the store, creating a new situation
S’. In S’:
– The store still sells chips
– My age is still the same
– Los Angeles is still the largest city in California…
• How can we efficiently represent everything that
hasn’t changed?
– Strips provides a good solution for simple actions
Another problem: Ramification problem
• I go from home to the store, creating a new
situation S’. In S’:
– I am now in Marina del Rey
– The number of people in the store went up by 1
– The contents of my pockets are now in the store..
• Do we want to say all that in the action
definition?
Solutions to the frame and ramification
problems
• In Strips, some facts are inferred within a world state,
– e.g. the number of people in the store
• All other facts, e.g. at(home) persist between states
unless changed (remain unless on delete list)
• A challenge for knowledge engineer to avoid
mistakes
Questions about Strips
• What would happen if the order of goals was
at(home), have(beer), have(chips) ?
• When Strips returns a plan, is it always correct?
efficient?
• Can Strips always find a plan if there is one?
Strips operators for blocks world
• Move-to (x, b):
– Preconditions: Isa(b,Block), On(x, y), Cleartop(x),
Cleartop(b)
– Add: On(x, b), Cleartop(y)
– Delete: On(x, y), Cleartop(b)
– Implementation: Puton(x, Topof(b))
• Move-to(x, Table):
–
–
–
–
Preconditions:
Add: On(x, Table)
Delete:
Implementation: Findspace(x, Table), Puton(x, Table)
Example: blocks world (Sussman anomaly)
Initial:
Goal:
C
A
A
B
B
C
State I: (On A Table) (On C A) (On B Table) (Cleartop B)
(Cleartop C)
Goal: (On A B) (On B C)
“Naïve” planning algorithm output: Put C on table, put A
on B [goal 1 accomplished], put A on table, put B on C
[both goals accomplished] DONE!!!!
Partial Order Planning (POP)
• Explicitly views plans as a partial order of steps. Add
ordering into the plan as needed to guarantee it will
succeed.
• Avoids the problem in Strips, that focussing on one
subgoal forces the actions that resolve that goal to
be contiguous.
How to get dressed
• State: {}
• Goal {RightShoeOn, LeftShoeOn}
• Plan Operators:
–
–
–
–
PutRshoe, Precond: RightSockOn, Effect: RightShoeOn
PutLshoe, Precond: LeftSockOn, Effect: LeftShoeOn
PutRsock, Effect: RightSockOn
PutLsock, Effect: LeftSockOn
• Create a POP graph of solutions with causal links:
p
“A achieves P for B” A
B (also called protection
links). This prevents another goal from causing a sock to be
removed before the shoe goes on.
Total-Order vs Partial-Order Plans
Remember the “Sussman Anomaly”
Initial State:
Goal:
A
C
A
B
B
C
State I: (On A Table) (On C A) (On B Table)
(Cleartop B) (Cleartop C)
Goal: (On A B) (On B C)
POP using Nets Of Action Hierarchies
on(a, b)
S
J
on(b, c)
clear(a)
S
S
clear(b)
J
puton(a, b)
J
clear(b)
S
clear(c)
J
puton(b, c)
Nets Of Action Hierarchies
on(a, b)
S
J
on(b, c)
clear(a)
S
S
clear(b)
J
puton(a, b)
J
clear(b)
S
clear(c)
J
puton(b, c)
Add a “threat” link to the network of plan actions
Resolve threat with an “order” link
clear(a)
S
S
clear(b)
J
puton(a, b)
J
clear(b)
S
clear(c)
J
puton(b, c)
J
puton(a, b)
clear(a)
S
S
clear(b)
J
clear(b)
S
clear(c)
J
puton(b, c)
clear(a)
S
S
clear(b)
J
puton(a, b)
J
clear(b)
S
clear(c)
J
puton(b, c)
clear(a)
S
J
clear(b)
S
clear(c)
J
puton(b, c)
puton(a, b)
clear(a)
S
J
puton(a, b)
clear(b)
S
J
clear(c)
puton(b, c)
puton(c, X)
clear(a)
J
S
clear(b)
S
clear(c)
J
puton(b, c)
puton(a, b)
Final plan
puton(c, X)
clear(a)
J
S
clear(b)
puton(b, c)
puton(a, b)
Planning using logic and resolution:
The situation calculus
• Key idea: represent a snapshot of the world, called a
‘situation’ explicitly.
• ‘Fluents’ are statements that are true or false in any
given situation, e.g. ‘I am at home’
• Actions map situations to situations.
Blocks world example
• A move action: Move(x, loc)
• Use of the Result function:
Result(Move(x, loc), state)  the state resulting from
doing the Move action
• An axiom about moving:
x loc s [ At(x, loc, Result(Move(x, loc), s)) ]
“If you move some object to a location, then in the resulting
state that object is at that location
• At(B1, Table, S0)
• At(B1, Top(B2), Result(Move(B1, Top(B2)), S0))
using the axiom
Monkeys and Bananas Problem
• The monkey-and-bananas problem is faced by a
monkey standing under some bananas which are
hanging out of reach from the ceiling. There is a box in
the corner of the room that will enable the monkey to
reach the bananas if he climbs on it.
• Use situation calculus to represent this problem and
solve it using resolution theorem proving.
Representation of Monkey/Banana problem
• Fluents:
– At(x, loc, s)
– On(x, y, s)
– Reachable(x, Bananas, s)
– Has(x, y, s)
• Other predicates
– Moveable(x), Climbable(x)
– Can-move(x)
• Actions
– Climb-on(x, y)
– Reach(x, y)
Constants:
- BANANAS
- MONKEY
- BOX
- S0
- CORNER
- UNDER-BANANAS
-- Move(x, loc)
-- Push(x, y, loc)
Monkey/Bananas axioms
1. ∀ x1, s1 [ Reachable(x1, BANANAS, s1) 
Has(x1, BANANAS, Result(Reach(x1, BANANAS), s1)) ]
If a person can reach the bananas then the result of
reaching them is to have them.
2. ∀ s2 [At(BOX, UNDER-BANANAS, s2) ^
On(MONKEY, BOX, s2)  Reachable(MONKEY,
BANANAS, s2)
If a box is under the bananas and the monkey is on the box
then the monkey can reach the bananas.
Monkey/Bananas axioms
3. ∀ x3, loc3, s3 [ Can-move(x3) 
At(x3, loc, Result(Move(x3, loc3), s3)) ]
The result of moving to a location is to be at that location
4. ∀ x4, y4, s4 [∃ loc4 [At(x4, loc4, s4) ^ At(y4, loc4, s4)] ^
Climbable(y4)  On(x4, y4, Result(Climb-on(x4, y4), s4))]
The result of climbing on an object is to be on the object
5. ∀ x5, y5, loc5, s5 [∃ loc [At(x, loc0, s) ^ At(y5, loc0, s5) ] ^
Moveable(y5)  At(y5, loc5, Result(Push(x5, y5, loc5),
s5))
6. <same>  At(x6, loc6, Result(Push(x6, y6, loc6), s6)) ]
The result of x pushing y to a location is both x and y are at
that location.
Monkey/Bananas axioms (initial state S0)
F1. Moveable(BOX)
F2. Climbable(BOX)
F3. Can-move(MONKEY)
F4. At(BOX, CORNER, S0)
F5. At(MONKEY, UNDER-BANANAS, S0)
• To solve this for the goal Has(MONKEY, BANANAS, s):
– Convert to clause form
– Apply resolution to prove something like this:
Has(MONKEY, BANANAS, Result(Reach( . . . ), Result(. .) . .), S0)
which gives you the plan in reverse order.
(don’t forget to standardize!)
We need 2 additional “frame axioms” for the proof
Frame Axioms for Monkey/Bananas world
7. ∀ x, y, loc, s [ At(x, loc, s) 
At(x, loc, Result(Move(y, loc), s)) ]
The location of an object does not change as a result of
someone moving to the same location.
8. ∀ x, y, loc, s [ At(x, loc, s) 
At(x, loc, Result(Climb-on(y, x), s)) ]
The location of an object does not change as a result of
someone climbing on it.
Refutation Resolution as the theoretical basis of BC
A query is conceptualized with existential variables:
? Likes(John, x) means ? ∃x Likes(John, x)
to answer the question, assert its NEGATION, and attempt to
derive a contradiction by RESOLVING TO THE EMPTY CLAUSE!
~ ∃x Likes(John, x) is equivalent to ∀ x ~ Likes(John, x), so add that to
the KB and try to derive the empty clause
Resolution rule:
[A1 V A2 V . . . An] ^
[B1 V B2 V . . Bm V ~A1’] where A1 and A1’ unify
--------------------------------------------------------------[ A2’ V . . . An’ ] ^ [B1’ V B2’ V . . . Bm’]
Likes(John, Pizza) ^ ~ Likes(John, x) resolves to { }, given {x/Pizza}
A Limitation of Situation Calculus:
The Frame problem
• I go from home (S) to the store, creating a new
situation S’. In S’:
–
–
–
–
My friend is still at home
The store still sells chips
My age is still the same
Los Angeles is still the largest city in California…
• How can we efficiently represent everything that
hasn’t changed?
Successor state axioms
• Normally, things stay true from one state to the next -unless an action changes them:
At(p, loc, Result(a, s)) iff a = Go(p, x)
or [At(p, loc, s) and a != Go(p, y)]
• We need one or more of these for every fluent
• Now we can use theorem proving (or possibly backward
chaining) to deduce a plan: not very practical
Download
Related flashcards

Virtual reality

23 cards

Robots in television

52 cards

Video game controllers

38 cards

User interfaces

40 cards

Create Flashcards