# Language for planning problems

## Presentation on theme: "Language for planning problems"— Presentation transcript:

Language for planning problems
STRIPS: STanford Research Institute Problem Solver world described by logical conditions state as conjunction of positive literals propositional; e.g., Happy ^ Hungry to represent the state of the agent first-order ground and function-free terms; e.g., At(Plane1, Verona) ^ At(Plane2,Malpensa) closed-world assumption; i.e., any not mentioned condition is false goal is a partially specified state a state satisfies a goal if contains all the literals of the goal e.g. state At(Plane1, Verona) ^ At(Plane2,Malpensa) satisfies goal At(Plane2,Malpensa)

STRIPS actions (contd.)
Tidily arranged actions descriptions, restricted language Action schema: ACTION: specifies name and parameter list Buy(x) PRECONDITION: conjunction of positive literals At(p) ^ Sells(p, x) EFFECT: conjunction of literals (positive or negative) Have(x) [Note: no information on how to execute the action!] A complete set of STRIPS operators can be translated into a set of successor-state axioms

Example: Air cargo transport
predicates In(·, ·),At(·, ·) type predicates: Cargo(·), Plane(·),Airport(·) Start At(C1, SFO) ^ At(C2, JFK) ^ At(P1, SFO) ^ At(P2, JFK) ^ Cargo(C1) ^ Cargo(C2) ^ Plane(P1) ^ Plane(P2) ^ Airport(JFK) ^ Airport(SFO) Goal At(C1, JFK) ^ At(C2, SFO) Actions Load(c, p, a) Unload(c, p, a) Fly(p, from, to)

Example: Air cargo transport
predicates In(·, ·),At(·, ·) type predicates: Cargo(·), Plane(·),Airport(·) Start At(C1, SFO) ^ At(C2, JFK) ^ At(P1, SFO) ^ At(P2, JFK) ^ Cargo(C1) ^ Cargo(C2) ^ Plane(P1) ^ Plane(P2) ^ Airport(JFK) ^ Airport(SFO) Goal At(C1, JFK) ^ At(C2, SFO) Actions Load(c, p, a) Unload(c, p, a) Fly(p, from, to)

Example: Air cargo transport
Actions Load(c, p, a) PRE: At(c, a) ^ At(p, a) ^ Cargo(c) ^ Plane(p) ^ Airport(a) EFF: ¬At(c, a) ^ In(c, p) Unload(c, p, a) PRE: In(c, p) ^ At(p, a) ^ Cargo(c) ^ Plane(p) ^ Airport(a) EFF: At(c, a) ^ ¬In(c, p) Fly(p, from, to) PRE: At(p, from) ^ Plane(p) ^ Airport(from) ^ Airport(to) EFF: ¬At(p, from) ^ At(p, to)

Example: Air cargo transport (contd.)

STRIPS Planning STRIPS planning problem: State-space search
find a sequence of actions that lead to a goal states and goals are defined by a conjunctions of literals State-space search Forward search (goal progression) from the initial state try to reach the goal Backward search (goal regression) from the goal and try to project it to the initial state Plan-space search partial-order planning (POP) search the space of partially build plans

State-space search planning problem defines the search problem
initial state is the start state goal test checks whether state satisfies the goal actions define the operators step cost is usually 1 (a) forward or (b) backward search

Forward search main search loop
select an action and unify precondition with the state if precondition is satisfied, apply the action generating a new state check whether the new state satisfies the goal

Forward search with the Shopping Example
Start At(Home) ^ Sells(SM,Milk) ^ Sells(SM,Banana) ^ Sells(HWS,Drill)^Loc(Home)^Loc(SM)^Loc(HWS) Buy(x) PRE: At(store), Sells(store, x) EFF: Have(x) Go(x, y) PRE: At(x),Loc(y) EFF: At(y),¬At(x) Goal Have(Milk) ^ Have(Banana) ^ Have(Drill)

Forward search main search loop
select an action and unify precondition with the state if precondition is satisfied, apply the action generating a new state check whether the new state satisfies the goal state space is finite -> complete for complete search algorithms inefficient because of irrelevant actions -- needs good heuristics

Backward search idea: select relevant actions only starting from the goal action is relevant when it achieves one of the conjuncts (add-list) consistent when doesn’t undo any desired literal (delete-list) select a relevant and consistent action and generate new state 1. delete add-list 2. add preconditions terminates with a state satisfied by the initial state branching on relevant and consistent states

Backward search with the Shopping Example
Start At(Home) ^ Sells(SM,Milk) ^ Sells(SM,Banana) ^ Sells(HWS,Drill)^Loc(Home)^Loc(SM)^Loc(HWS) Buy(x) PRE: At(store), Sells(store, x) EFF: Have(x) Go(x, y) PRE: At(x),Loc(y) EFF: At(y),¬At(x) Goal Have(Milk) ^ Have(Banana) ^ Have(Drill)

State-space vs. plan-space
forward and backward search explore linear sequences of actions this is not necessary consider the solution for the air cargo transport Load(C1, P1, SFO), Fly(P1, SFO, JFK),Unload(C1, P1, JFK), Load(C2, P2, JFK), Fly(P2, JFK, SFO),Unload(C2, P2, SFO) the only required ordering is among Load, Fly and Unload connected by causal effects; e.g., Load(C1, P1, SFO) achieve In(C1,P1), used by the precondition of Unload there’s no need to put Load(C2, P2, JFK) after Unload(C1, P1, JFK) partial-order plan: graph of actions including Start and Finish

Example

Partially ordered plans
Partially ordered collection of steps with Start step has the initial state description as its effect Finish step has the goal description as its precondition causal links from outcome of one step to precondition of another temporal ordering between pairs of steps Open condition = precondition of a step not yet causally linked plan is complete iff every precondition is achieved precondition is achieved iff it is the effect of an earlier step and no possibly intervening step undoes it (conflict) plans cannot contain cycles

Define the Start State and the Goal State

Define the Start State and the Goal State
On(A,Table), On(B,Table), On(C,B), Clear(A), Clear(C) End On(A,B), On(B,C), On(C,Table)

Define the Actions

Use either forward or backward search to build the plan for this problem.