510 likes | 748 Views
Planners and Planning Languages. April 4th, 2000 Ryan Wagner. Introduction Simple Planning Agent Planning vs. Problem Solving Planning Using Situation Calculus Basic Representation for Planning Planning Examples Summary. Introduction. Origins Problem solving using state-space searching
E N D
Planners and Planning Languages April 4th, 2000 Ryan Wagner
Introduction • Simple Planning Agent • Planning vs. Problem Solving • Planning Using Situation Calculus • Basic Representation for Planning • Planning Examples • Summary Planners and Planning Languages
Introduction • Origins • Problem solving using state-space searching • Theorem proving • Robotics • Planners are like problem solving agents • states • goals • actions Planners and Planning Languages
Introduction (2) • Differences: • use logic to represent goals, states, and actions • searches are executed differently • use of partial plans and planning algorithms to achieve a solution • in some ways more “intelligent” than a problem solving agent Planners and Planning Languages
Introduction • Simple Planning Agent • Planning vs. Problem Solving • Planning Using Situation Calculus • Basic Representation for Planning • Planning Examples • Summary Planners and Planning Languages
Simple Planning Agent • The planning agent uses its percepts of the world state to form a model of the world. • The agent then takes the goal and formulates a plan to achieve it. • Planners must be able to distinguish two special cases: • infeasible goals • goals that are already achieved Planners and Planning Languages
Plans • Sets of executable steps ordered to achieve the goal given. • Can be formed progressively or regressively • i.e. from the initial state (progressive), or from the goal state backwards (regressive) • Partial plans are basically frameworks for the plan that will achieve the goal. Planners and Planning Languages
Plans: A simple example • Suppose we are at home and we want to go to school, and we must take the bus to do so. • A simple plan would likely be: • Start state: We are at home. • Actions required to get to school: • Go to the bus stop • Get on the bus • Ride the bus to school • Get off of the bus • Walk from the bus stop to the school • Goal State: We are at school. Planners and Planning Languages
Introduction • Simple Planning Agent • Planning vs. Problem Solving • Planning Using Situation Calculus • Basic Representation for Planning • Planning Examples • Summary Planners and Planning Languages
Planning vs. Problem Solving • Planning tries to create a representation of goals, states, and actions that are a bit more flexible. • These elements are described using a formal language, like first-order logic. • States and goals correspond to logical sentences and actions are pairings of preconditions and the resulting effects. Planners and Planning Languages
Planning vs. Problem Solving (2) • In creating a plan, actions are added in a non-linear manner - whenever and wherever they are needed. • Planners try to make important decisions first to avoid having to backtrack. • Planners assume the world is mostly independent, so multiple conjunctive goals can be achieved. Planners and Planning Languages
Conjunctive Goals • The planner will attempt to solve a conjunctive goal by splitting it into sub-goals and creating individual plans to deal with each piece. • Often, however, we require a complex planning algorithm to achieve a solution as there may be a particular order in which the sub-plans must be executed. Planners and Planning Languages
Eat Go to Restaurant Go to Dry Cleaners Pick up clothes Go to Rogers Rent video Goal ... Go to store Buy Milk Buy Bread Sit in a chair ... Read book Go to Sleep Video Rental - Search Goal: Rent a video, buy some bread, and come home Start Planners and Planning Languages
Video Rental - Planning • A simple regressive plan might be • Start state: At Home without Video and Bread • Actions: • Go to Store • Buy Bread • Go to Rogers • Rent Video • Go Home • Goal state: At Home with Video and Bread Planners and Planning Languages
Introduction • Simple Planning Agent • Planning vs. Problem Solving • Planning Using Situation Calculus • Basic Representation for Planning • Planning Examples • Summary Planners and Planning Languages
Planning Using Situation Calculus • Situation Calculus can often aid us in creating a planner, using a theorem-prover to decide on a plan. • Situation Calculus planners represent the initial state as a sentence, the goal state as a query, and the actions are such that they transform the state. • A solution is a plan that achieves the goal state. Planners and Planning Languages
Planning Using Situation Calculus (2) • The major drawback of using a theorem-prover for a planner is that a theoretical solution and a practical solution are often not one and the same. • In fact, the only guarantee we have for the solution is that we have reached the goal state, but no information on the means. • (DoNothing, DoNothing, …, Plan) • (DoSomething, Plan, UndoSomething) Planners and Planning Languages
Planning Using Situation Calculus (3) • Remember that the method of logical inference is semidecidable. This affects planning if the method of inference is unguided by making it extremely inefficient. • The solution to the problem of semidecidabilityis to restrict the language understood by the prover - i.e. create a planner rather than a general purpose theorem prover. • The planner will have an algorithm to handle its language efficiently. Planners and Planning Languages
Introduction • Simple Planning Agent • Planning vs. Problem Solving • Planning Using Situation Calculus • Basic Representation for Planning • Planning Examples • Summary Planners and Planning Languages
Basic Representation for Planning • The most basic representation used for creating planners was developed in 1970 - a language known as STRIPS • STanfordResearchInstituteProblem Solver • Extensions of the STRIPS language are often used in planners today. • STRIPS blends efficient planning with the expressive situation calculus representation. Planners and Planning Languages
Basic Representation for Planning (2) • States are represented as conjunctions of literals, though planners will often not store entire sets of literals describing the current state. • In fact, “incomplete” states often assume that the literals not indicated are to be treated as false. • Goals are conjunctions of literals and (often existentially) qualified variables. Planners and Planning Languages
Planner vs. Theorem Prover • The fundamental difference between a planner and a theorem prover is that the planner requests a sequence of steps that, if executed, will result in the goal state being true. The theorem prover evaluates the sentences for validity. Planners and Planning Languages
STRIPS Operators • Action, Preconditions, and Effects • An operator is applicable to a given state just in case the variables for the operator can be instantiated so all preconditions are satisfied. • The result contains all items introduced by the effect, plus the old status. However, any effect that negates something in the old status will not be true in the new state. Planners and Planning Languages
Situation and Plan Spaces • Situations are nodes of the search tree between the initial and goal states. • Planners can search through the situation space progressively or regressively. • Regressive searches are possible because the operators have enough knowledge about the resulting state and the preconditions to decide if an operator is actually applicable. • Regressive searching is desirable as goals are not as complex as initial states (fewer conjuncts), but it is very complicated in application, and inefficient to do attempt to overcome this. Planners and Planning Languages
Situation and Plan Spaces (2) • Plan spaces are made up of partial plans - basically frameworks for plans • Plan modification involves inserting, removing, and ordering steps, instantiating variables, etc. • The solution is the final plan • The steps taken to achieve this are irrelevant Planners and Planning Languages
Situation and Plan Spaces (3) • Two operators are generally used on plans: • Refinement: constrain or eliminate plans from the space • Modification: any other type of plan modification • Plan frameworks will all contain a start state and a goal descriptor. The start state sets the preconditions for the first action, and the goal state matches the results of the last action. Planners and Planning Languages
Plan Spaces • Least Commitment - don’t make a decision until you have to. • If a decision is not important at a given stage, leaving it undecided allows for greater flexibility later on and results in less backtracking • This leads to a partial order within the plan. Any given plan will be a linearization of this partial ordering. Planners and Planning Languages
Causal Links • Causal links are formed based on precondition fulfilling. A causal link is created when a given state s1 contains a precondition c for state s2. s1 c s2 • Causal links are protected. Threats that may delete a precondition are ordered either before the first state (demoted) or after the second (promoted) when linearizing the plan. This prevents removing the link. Planners and Planning Languages
s3 s1 ¬c c s1 s2 c s2 s3 ¬c Causal Links (2) demote promote s1 s3 c ¬c s2 Planners and Planning Languages
Plans • Are a set of steps (starting with a start state and ending with a goal), that involve: • ordering restraints (s1 comes before s2) • variable binding (v is set to X) • causal links (if it is possible to reach a state s2 from s1, any preconditions to reach s2 created by s1 are stored) Planners and Planning Languages
Solutions • Solutions are executable plans • Complete Solutions • if then s1 < s2 and there is no s3 such that ¬c results from it where s1 < s3 < s2 • Consistent Solutions • there are no orderings such that s1 < s2 and s2 < s1, or where a variable v = A and v = B (or v = x = B) • Note the transitivity of the < and = operators s1 c s2 Planners and Planning Languages
Possible Threats • When a state threatens to remove a precondition necessary to reach another state, it is called a threat. • Often when variables are not yet instantiated, they pose possible threats, depending on what they are later assigned. • There are 3 methods of dealing with the possible threat. Planners and Planning Languages
Possible Threat Solutions • Resolving with an equality constraint • Immediately instantiate the variable to something that is non-threatening • Resolving with an inequality constraint • Immediately mark the variable as not equal to the threatening value. This has lower commitment. • Resolve the threat later • This has the lowest commitment, but may not result in an actual solution plan. Planners and Planning Languages
Introduction • Simple Planning Agent • Planning vs. Problem Solving • Planning Using Situation Calculus • Basic Representation for Planning • Planning Examples • Summary Planners and Planning Languages
Planning Examples • Partial-order Planner (POP) algorithm - p356 • Blocks World - p359 • Shakey’s World - p360 • Video Rental Problem - revisited Planners and Planning Languages
Partial Order Planner • Uses regressive planning to create a solution. • Starts with a minimal partial plan and extends the plan at each step by achieving the precondition of a state S. • operators are chosen from any steps currently in the plan or the operator pool • It then sets up causal links and eliminates threats • If it cannot find an operator at a given point, it backtracks to the previous choice point. • The POP algorithm is sound and complete - it always finds a solution if one is possible. Planners and Planning Languages
Blocks World • Builds stacks of blocks on a table top • Uses two state descriptors and an operator: • On(x, y) : indicates x is on top of y • Clear(x) : indicates x has nothing on top of it • Move(x, y, z) : • Preconditions: Clear(x) /\ Clear(z) /\ On(x, y) • Effect: On(x, z) /\ Clear(y) /\ ¬On(x, y) /\ ¬Clear(z) • Note: Move(x, y, Table) and Move(x, Table, z) have some concerns with Clear(Table). In the former, the table must be clear to move the block and in the later, the table is then marked as clear. Planners and Planning Languages
Blocks World (2) • Solution: • Change the meaning of Clear(x) to mean “there is room on x for a block” • Add a new rule MoveToTable(x, y) • Preconditions: On(x, y) /\ Clear(x) /\ ¬Table(y) • Effect: On(x, Table) /\ Clear(y) /\ ¬On(x, y) • Modify the Move(x, y, z) rule: • Preconditions: On(x,y) /\ Clear(x) /\ Clear(z) /\ ¬Table(z) • Effect: On(x, z) /\ Clear(y) /\ ¬On(x, y) /\ ¬Clear(z) Planners and Planning Languages
A Start Goal C B A B C • MoveToTable(C, A) - Preconditions: On(C, A), Clear(C) Effect: On(C, Table) /\ Clear(A) /\ ¬On(C, A) • Move(B, Table, C) - Preconditions: On(B, Table), Clear(C) Effect: On(B, C) /\ Clear(Table) /\ ¬On(B, Table) /\ ¬Clear(C) • Move(A, Table, B) - Preconditions: On(A, Table), Clear(B) Effect: On(A, B) /\ Clear(Table) /\ ¬On(A, Table) /\ ¬Clear(B) Blocks World Example • Start State: On(A, Table) /\ On(C, A) /\ Clear(C) /\ On(B, Table) /\ Clear(B) • Goal State: On(C, Table) /\ On(B, C) /\ On(A, B) /\ Clear(A) Planners and Planning Languages
Shakey’s World • A planner designed to allow a robot to move between rooms and perform some restricted actions. • Uses actions such as • Go(loc), • Push(obj, loc1, loc2), • Climb(box) and Down(box) • TurnOn(light_switch) and TurnOff(light_switch) • Predicates such as • Pushable(object), On(Shakey, level), At(Shakey, loc), Climbable(box), In(obj, loc) • Constant - Floor Planners and Planning Languages
Eat Go to Restaurant Go to Dry Cleaners Pick up clothes Go to Rogers Rent video Goal ... Go to store Buy Milk Buy Bread Sit in a chair ... Read book Go to Sleep Video Rental - Search Goal: Rent a video, buy some bread, and come home Start Planners and Planning Languages
Video Rental - Planning Start At(Home) Rents(Rogers, Video) Sells(Store, Bread) At(Home) Have(Video) Have(Bread) Finish Planners and Planning Languages
At(s) Rents(s, Video) At(s) Sells(s, Bread) Rent(Video) Buy(Bread) Video Rental - Planning Start At(Home) Rents(Rogers, Video) Sells(Store, Bread) At(Home) Have(Video) Have(Bread) Finish Planners and Planning Languages
At(Rogers) Rents(Rogers, Video) At(Store) Sells(Store, Bread) Rent(Video) Buy(Bread) Video Rental - Planning Start At(Home) Rents(Rogers, Video) Sells(Store, Bread) At(Home) Have(Video) Have(Bread) Finish Planners and Planning Languages
Video Rental - Planning Start At(Home) Rents(Rogers, Video) Sells(Store, Bread) At(x) At(x) Go(Rogers) Go(Store) At(Rogers) Rents(Rogers, Video) At(Store) Sells(Store, Bread) Buy(Bread) Rent(Video) At(Home) Have(Video) Have(Bread) Finish Planners and Planning Languages
At(Home) Video Rental - Planning Start At(Home) Rents(Rogers, Video) Sells(Store, Bread) At(Home) Go(Rogers) Go(Store) At(Rogers) Rents(Rogers, Video) At(Store) Sells(Store, Bread) Buy(Bread) Rent(Video) At(Home) Have(Video) Have(Bread) Finish Planners and Planning Languages
At(Rogers) At(Store) Go(Home) Video Rental - Planning Start At(Home) Rents(Rogers, Video) Sells(Store, Bread) At(Home) Go(Rogers) Go(Store) At(Rogers) Rents(Rogers, Video) At(Store) Sells(Store, Bread) Buy(Bread) Rent(Video) At(Home) Have(Video) Have(Bread) Finish Planners and Planning Languages
At(Home) Go(Rogers) At(Rogers) Rents(Rogers, Video) Rent(Video) At(Rogers) Go(Store) At(Store) Sells(Store, Bread) Buy(Bread) At(Store) Go(Home) At(Home) Have(Video) Have(Bread) Finish Video Rental - Planning Start Planners and Planning Languages
Introduction • Simple Planning Agent • Planning vs. Problem Solving • Planning Using Situation Calculus • Basic Representation for Planning • Planning Examples • Summary Planners and Planning Languages
Summary • Planners use formal representations of states, goals, and actions to allow greater flexibility in determining paths from the start state to the finish. • Planners often take one of two approaches to solving a problem - progressive or regressive plan building. • Least Commitment is making decisions only when it is necessary, thus reducing backtracking. • Partial Plans are often a better solution mechanism than searching as they reduce the complexity of the method. • Causal links are used to determine and resolve conflicts when working with partial-order plans. Planners and Planning Languages