ai lecture 17 planning noémie elhadad (substituting for prof. mckeown)

34
AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)

Upload: everett-beasley

Post on 17-Jan-2016

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)

AI Lecture 17Planning

Noémie Elhadad

(substituting for Prof. McKeown)

Page 2: AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)

AI Lecture 17 2/34

Problem solving so far

• Need to solve a problem– Choose a representation– Choose a heuristic– Choose a search algorithm

• Can this scale up to more complex problems?– Many irrelevant actions– Human must provide the heuristic– No knowledge on how to “decompose” or “nearly-

decompose” the problem

Page 3: AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)

AI Lecture 17 3/34

Planning

• Combine logic and search• General language to represent the problem• General algorithm

Page 4: AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)

AI Lecture 17 4/34

Planning components

• Expressive Formal Language describes– Initial state of world– Agent’s goal– Possible actions that can be performed

• Solver generates a sequence of actions which achieve the goal– Planning algorithm

Page 5: AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)

AI Lecture 17 5/34

An example – Blocks world

• Blocks on a table• Can be stacked, but only one block on top of

another• A robot arm can pick up a block and movie to

another position– On the table– On another block

• Arm can pick up only one block at a time– Cannot pick up a block that has another one on it

Page 6: AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)

AI Lecture 17 6/34

Representation language

• STRIPS (Fikes & Nilsson, 1971)

– One of the first planning systems– Robotics– See it in action at http://www.ai.sri.com/movies/Shakey.ram

• Main contribution is its language description formalism

• Many variants/extensions

Page 7: AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)

AI Lecture 17 7/34

STRIPS

• State is a conjunction of positive ground literalsOn(B, Table) Λ Clear (A)

• Goal is a conjunction of positive ground literals Clear(A) Λ On(A,B) Λ On(B, Table)

• Action schema– Conjunction of positive literals as preconditions– Conjunction of positive and negative literals as effects

Page 8: AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)

AI Lecture 17 8/34

More on action schema

• Example: Move (b, x, y)– Precondition:

Block(b) Λ Clear(b) Λ Clear(y) Λ On(b,x) Λ (b ≠ x) Λ (b ≠ y) Λ (y ≠ x)

– Effect: ¬Clear(y) Λ ¬On(b,x) Λ Clear(x) Λ On(b,y)

• An action is applicable in any state that satisfies its precondition

Delete list Add list

Page 9: AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)

AI Lecture 17 9/34

STRIPS assumptions

• Closed World assumption– Unmentioned literals are false (no need to explicitly

list out)– w/an open world assumption unmentioned literals are

unknown

• STRIPS assumption– Every literal not mentioned in the “effect” of an action

schema remains unchanged

Page 10: AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)

AI Lecture 17 10/34

STRIPS expressiveness

• Literals are function free: Move (Block(x), y, z)

• Any action scheme can be propositionalized Move(b,x,y) and 3 blocks and table can be expressed as 48 purely

propositional actions

• No disjunctive goals: On(B, Table) V On(B, C)

• No conditional effects: On(B, Table) if ¬On(A, Table)

• In original STRIPS, no equality: x ≠ y

• Ramification – esp. in more complex domain

Page 11: AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)

AI Lecture 17 11/34

Planning components

• Expressive Formal Language describes– Initial state of world– Agent’s goal– Possible actions that can be performed

• Solver generates a sequence of actions which achieve the goal– Planning algorithm

Page 12: AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)

AI Lecture 17 12/34

Planning algorithms

• Planning algorithms are search procedures• Which state to search?

– State-space search• Each node is a state of the KB• Plan = path through the states

– Plan-space search• Each node is a set of partially-instantiated

operators and set of constraints• Plan = node

Page 13: AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)

AI Lecture 17 13/34

State search

• Search the space of situations, which is connected by operator instances

• The sequence of operators instances the plan• Since we have both preconditions and effects

available for each action schema, we can try different searches: Forward vs. Backward

Page 14: AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)

AI Lecture 17 14/34

Forward state-space search (1)

• Progression• Initial state: initial state of the problem• Actions:

– Applied to a state if all the preconditions are satisfied– Succesor state is built by updating KB with add and

delete lists

• Goal test: state satisfies the goal of the problem

Page 15: AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)

AI Lecture 17 15/34

Forward search in the Blocks world

Page 16: AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)

AI Lecture 17 16/34

Forward state-space search (2)

• Advantages– No functions in the declarations of goals

search state is finite– Sound– Complete (if algorithm used to do the search is

complete)

• Limitations– Irrelevant actions not efficient– Need heuristic or prunning procedure

Page 17: AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)

AI Lecture 17 17/34

Backward state-space search (1)

• Regression• Initial state: goal state of the problem• Actions:

– Choose an action that• Is relevant; has one of the goal literals in its effect

set• Is consistent; does not negate another literal

– Construct new search state• Remove all positive effects of A that appear in goal• Add all preconditions, unless already appears

• Goal test: state is the initial world state

Page 18: AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)

AI Lecture 17 18/34

Backward state-space search (2)

• Possible because of STRIPS-like language– Goals are listed – Predecessors are listed for each action/state

• Advantages– Consider only relevant actions much smaller

branching factor– Ways to reduce even more the branching factors

• Limitations– Still need heuristic to be more efficient

Page 19: AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)

AI Lecture 17 19/34

Heuristics for state-space search (1)

• Valid both for forward and backward searches• Valid for many planning problems• Possible approaches

– Divide and conquer– Derive a relaxed problem– Combine both

Page 20: AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)

AI Lecture 17 20/34

Heuristics for state-space search (2)

• Divide and conquer– Subgoal independence assumption

• What if there are negative interactions between the subgoals of the problems?

• What if there are redundant actions in the subgoals?

• Derive a relaxed problem– Remove all preconditions from the actions– Remove all negative effects from the actions

(empty delete list)

Page 21: AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)

AI Lecture 17 21/34

Limitation of state-space search

• Linear planning or Total order planning• Example

– Initial state: all the blocks are clear and on the table– Goal: On(A,B) On(B,C)∧– If search achieves On(A,B) first, then needs to undo it

in order to achieve On(B,C)

• Have to go through all the possible permutations of the subgoals

Page 22: AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)

AI Lecture 17 22/34

Partial order planning (1)

• Approaches that are not constrained to consider only totally ordered sequences of actions.

• Strategy:– Decompose goal into subgoals– Solve subgoals independently with subplans– Combine subplans into plan

• Flexibility in order of plan construction• Least commitment

– Delay choice during search so can work on important subplans before working on less important ones

Page 23: AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)

AI Lecture 17 23/34

Partial order planning (2)

• Search in Plan space not State space– Focus search on the constrained parts of the plan first– More flexible– Graph of actions, not a sequence

• Strategy– Start with empty plan (Start-Finish)– Refine the plan until get a complete plan that solves the problem– Actions are on the plan (not on the world/KB)

• add step to the plan• Impose an ordering constraint between two steps• …

• Every linearization of a partial-order solution is a total-order solution.

Page 24: AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)

AI Lecture 17 24/34

Partial order plan example

Page 25: AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)

AI Lecture 17 25/34

Partial plan• A set of steps/actions

– Start, Finish, A, B

• A set of ordering constraints – A < B: A must be carried out before B, not necessarily right

before

• A set of causal links– A→pB: A achieves p for B– p is an effect of A and a precondition of B– p must remain true between from A to B

• Set of open preconditions– Preconditions not achieved in the plan

• A consistent plan has no cycles in the ordering constraints and no conflicts in the causal links

• Solution = consistent plan with no open preconditions

Page 26: AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)

AI Lecture 17 26/34

Maintaining consistency

• Given causal link A→pB– C that has an effect ¬p – Causes a conflict if there is a possible ordering for

which C comes after A and before B

• Say that C is a threat to causal link• Take an action to resolve threats by introducing

additional ordering constraints

Page 27: AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)

AI Lecture 17 27/34

POP Search• Initial plan: Start and Finish

– Start < Finish– no causal links– and all preconditions in Finish as open preconditions.

• Successor: pick an open precondition p (on action B), and look for an action A that achieves p– If new, then introduce A to plan, along with Start < A and

A < Finish– Add causal link; add ordering constraint A < B– Check for conflicts

• between new causal link and all existing actions; • between action and all existing causal links

– Add B < C or C < A if necessary to “resolve threat”; if no cycles then generate a successor state

• Goal: check there are no open preconditions

Page 28: AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)

AI Lecture 17 28/34

POP in the Blocks world

Page 29: AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)

AI Lecture 17 29/34

POP in the Blocks world

Page 30: AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)

AI Lecture 17 30/34

POP in the Blocks world

Page 31: AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)

AI Lecture 17 31/34

POP in the Blocks world

Page 32: AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)

AI Lecture 17 32/34

POP

• Advantages– Causal links help prunning since avoids irresolvable

conflicts

• Limitations– In some cases duplication of efforts– Since deal with plans (rather than states of the world),

it is difficult to estimate how far we are from solution

Page 33: AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)

AI Lecture 17 33/34

Other planning algorithms

• Planning graph – allows for better heuristics• SAT – translates the planning problem into

propositional axioms and applies a satisfiability algorithm to find the model that corresponds to a valid plan.

• Very active field of AI research!– Not one clear winner. Each approach is better

adapted to a type of problem.

Page 34: AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)

AI Lecture 17 34/34

One more assumption…

• So far, we looked only at “classical planning” environments.

• Lots of research on planning in non-classical environments:– Environments where time plays an important role

(“scheduling jobs”)– Partially observable or stochastic environments– …