370 likes | 533 Views
AI Lecture 17 Planning. Noémie Elhadad (substituting for Prof. McKeown). 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
E N D
AI Lecture 17Planning Noémie Elhadad (substituting for Prof. McKeown)
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
Planning • Combine logic and search • General language to represent the problem • General algorithm
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
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
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
STRIPS • State is a conjunction of positive ground literals On(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
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 Add list Delete list
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
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
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
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
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
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
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
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
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
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
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)
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
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
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.
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
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
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
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
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.
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 • …