Presentation is loading. Please wait.

Presentation is loading. Please wait.

Planning in Answer Set Programming

Similar presentations


Presentation on theme: "Planning in Answer Set Programming"— Presentation transcript:

1 Planning in Answer Set Programming
Lecture Notes for Cmput 366

2 Objective Planning method as seen in Situation Calculus and STRIPS becomes alive General methodology of planning in ASP Examples

3 Planning Find a sequence of actions that leads from an initial state to a goal state. Complexity: The problem is NP-complete when we fix the length of a plan whose existence is to be determined.

4 Answer Set Programming: Review
Programs are collections of rules: A  B1, …, Bm, not C1, …, not Cn Stable model semantics Language enhanced by new constructs (we will use Smodel as an example) -Cardinality constraint: L {a1, …, am, not b1, …, not bk }U -Choice rule has a special card. Constraint in rule head {h1 ,…, hn}  body. which is equivalent to 0{h1 ,…, hn}n  body.

5 Planning in ASP Steps in a plan E.g. time(0..steps).
To solve a planning problem, we need to represent a number of things. First, the setup: Steps in a plan E.g time(0..steps). next-state(T2,T1)  T2=T1+1.

6 Representation Fluents
Properties, particularly those that may hold across states E.g. on(a, table, T) object a is on table at time (step) T Actions E.g. move-to(a,b,T) move a onto top of b at T

7 Representation Initial state E.g. on(a,b,0). on(b,table,0).
on(c,table,0).

8 Representation Goal state goal(T)  time(T), on(a,c,T), ….
Remember we have to say goal must be satisfied. This can be done by goal  time(T),goal(T).  not goal.

9 Representation An action system
-Action choice: what actions may be chosen -Affected objects: what objects are affected by an action -Effects: if affected, what are effects on the affected objects -Frame axiom: if not affected by an action at a state, the fluents that hold in current state remain to hold in next state.

10 Scheme for representing an action system
{action(Obj,T)}  pre-conditions.  action(Obj,T),conflicting-action(Obj , T). affected(Obj,T)  action(Obj,T). property2(Obj,T+1)  action(T), property1(Obj,T). Property(Obj,T+1)  not affected(Obj,T), property(Obj,T).

11 Example: Elevator Problem
There is an elevator which transports passengers from initial floors to goal floors. The elevator can move up and down to any floor. When it stops at a floor, any passenger in it can be unboarded, and any waiting passenger can be be boarded onto it. The goal is to transport all passengers to their destination floors. Program at: (All programs can be accessed from course web page.)

12 Example: Ferry Problem
A popular planning domain with actions board onto/unboard from a single ferry. The ferry can only transport one car at a time and a move action moves the ferry between any two locations The goal is to transport all cars to their destinations. Program at:

13 Gripper Problem The goal is to transport all the balls from one room to another. The robot is allowed to move from one room to the other, and use its two grippers to pick up, and put down balls. See Interests in this problem: there are too many symmetries.

14 Blocks world See program at http://web.cs.ualberta.ca/~you/
courses/621/Smodels-programs/ bw.lp

15 Domain Dependent Knowledge
STRIPS aims at a language for domain independent knowledge To increase efficiency, domain knowledge must be added - as part of program - in the solver engine

16 Types of Domain Knowledge
State relationship knowledge: How are the properties of two or more states related. E.g. in the gripper domain, the effect, “return a ball back to is original room can be expressed by a relation among three properties: at(A,R,T), not at(A,R,T+1), at at(A,R,T1) where T1 > T+1 Procedural knowledge -information about sequence of actions in final plan

17 Types of Domain Knowledge
Relationship about state conditions and actions: E.g the following makes blocks world program extremely efficient: if not goodTower(X,Y,T) then not move(X,Y,T)

18 Types of Domain Knowledge
Procedural knowledge: Info about sequence of actions in final plan E.g. A gripper must pick up a ball before putting it down If a gripper picks up a ball at T, it must put it down at T+2, and vice versa.

19 Types of Domain Knowledge
Procedural knowledge E.g. - If a ferry boards a car at state T, it then must move to its destination. - Do not stop at a floor if the lift does not board or unboard any passenger at the next state.

20 Types of Domain Knowledge
Symmetry knowledge: Info about check and break symmetry. Distance knowledge: Are there enough steps left for having a plan.

21 Review of Situation Calculus (cf. Russel and Norvig, Ch10
Review of Situation Calculus (cf. Russel and Norvig, Ch10.03 page )

22 Actions, events and situations

23 Describing change Simple Situation calculus requires two axioms to describe change: Possibility axiom: when is it possible to do the action At(Agent,x,s)  Adjacent(x,y)  Poss(Go(x,y),s) Effect axiom: describe changes due to action Poss(Go(x,y),s)  At(Agent,y,Result(Go(x,y),s)) What stays the same? Frame problem: how to represent all things that stay the same? Frame axiom: describe non-changes due to actions At(o,x,s)  (o  Agent)  Holding(o,s)  At(o,x,Result(Go(y,z),s))

24 Representational frame problem
If there are F fluents and A actions then we need A*F frame axioms to describe other objects are stationary unless they are held. We write down the effect of each actions Solution; describe how each fluent changes over time Successor-state axiom: Pos(a,s)  (At(Agent,y,Result(a,s))  (a = Go(x,y))  (At(Agent,y,s)  a  Go(y,z)) Note that next state is completely specified by current state. Each action effect is mentioned only once.

25 Other problems How to deal with secondary (implicit) effects?
If the agent is carrying the gold and the agent moves then the gold moves too Ramification problem How to decide EFFICIENTLY whether fluents hold in the future? Inferential frame problem Extensions: Event calculus (when actions have a duration)


Download ppt "Planning in Answer Set Programming"

Similar presentations


Ads by Google