Integrating Function Application in State-Based ... - Semantic Scholar

5 downloads 0 Views 321KB Size Report
Tower of Hanoi, and list sorting. We show that our planner can deal with constraint-logic problems and includes the use of resource variables as special case. 1.
Function Application in Planning

Integrating Function Application in State-Based Planning Ute Schmid Marina Muller Fritz Wysotzki

Fachbereich Informatik, Technische Universitat Berlin FR 5-8, Franklinstrasse 28, D-10587 Berlin, Germany

[email protected] [email protected] [email protected]

Abstract

We present an extension of state-based planning from a relational to a functional domain speci cation language. States are as usual represented as sets of ground literals { but relational symbols are de ned not only over constant symbols but over general terms. Operator e ects can be expressed by ADD/DEL lists and additionally by updates of arbitrary arguments of literals. Updating can involve the application of user-de ned and built-in functions of the language in which the planner is realized (in our case Lisp). Preconditions of operators are characterized as constraints with standard preconditions as a special case of equality constraints. We present the operational semantics of the extended language, and we give several example domains as the water jug domain, a functional variant of Tower of Hanoi, and list sorting. We show that our planner can deal with constraint-logic problems and includes the use of resource variables as special case.

1. Introduction The development of ecient planning algorithms in the nineties { such as Graphplan, SAT planning, and heuristic planning (Blum & Furst, 1997; Kautz & Selman, 1996; Bonet & Ge ner, 1999) { has made it possible to apply planning to more demanding real-world domains. Examples are the logistics or the elevator domain (Bacchus et al., 2000). Many realistic domains involve manipulation of numerical objects. For example: when planning (optimal) routes for delivering objects as in the logistics domain, it might be necessary to take into account time and other resource constraints as fuel; plan construction for landing a space-vehicle involves calculations for the correct adjustments of thrusts (Pednault, 1987). One obvious way to deal with numerical objects is to assign and update their values by means of function applications. There is some initial work on extending planning formalisms to deal with resource constraints (Koehler, 1998; Laborie & Ghallab, 1995). Here, function application is restricted to manipulation of specially marked resource variables in the operator e ect. For example, the amount of fuel might be decreased in relation to the distance an airplane ies: $gas {= distance(?x ?y)/3 (Koehler, 1998). A more general approach for including function applications into planning was proposed by (Pednault, 1987) within the action description language (ADL). In addition to ADD/DEL operator e ects, ADL allows variable updates by assigning new values which can be calculated by arbitrary functions. For example, the put(?x, ?y) operator in a blocks-world domain might be extended to updating the state variable ?LastBlockMoved to ?LastBlockMoved := ?x; the amount of water in a jug ?j1 might be changed by a pour(?j1 , ?j2 ) action into ?j1 := max[0, (?j2 ? ?c1 ) + ?j1 )] where 1

Schmid, Muller & Wysotzki

(a) Standard representation

Operator: PRE: ADD: DEL: Goal: Initial State:

move(?d, ?from, ?to) fon(?d, ?from), clear(?d), clear(?to), smaller(?d, ?to)g fon(?d, ?to), clear(?from)g fon(?d, ?from), clear(?to)g

fon(d3, p3), on(d2, d3 ), on(d1, d2)g fon(d3, p1), on(d2, d3 ), on(d1, d2), clear(d1 ), clear(p2 ), clear(p3 ), smaller(d1, p1), smaller(d1, p2), smaller(d1, p3 ), smaller(d2, p1), smaller(d2, p2), smaller(d2, p3 ), smaller(d3, p1), smaller(d3, p2), smaller(d3, p3 ), smaller(d1, d2), smaller(d1, d3), smaller(d2, d3)g

(b) Functional representation

Operator: PRE: UPDATE:

Goal: Initial State:

move(?p , ?p ) fon(?l , ?p ), on(?l , ?p ), car(?l ) 6= 1, car(?l ) < car(?l )g change ?l in on(?l , ?p ) to cons(car(?l ),?l ) change ?l in on(?l , ?p ) to cdr(?l ) i

j

i

i

j

j

j

j

j

i

i

i

i

i

i

j

j

i

fon([1], p1 ), on([1], p2 ), on([1 2 3 1], p3)g fon([1 2 3 1], p1), on([1], p2), on([1], p3)g

; 1 represents a dummy ; bottom disk

Figure 1: Tower of Hanoi (a) without and (b) with function application ?j1 , ?j2 are the current quantities of water in the jugs and ?c1 is the capacity of jug ?j1 (Pednault, 1994). Introducing functions into planning not only makes it possible to deal with numerical values in a more general way than allowed for by a purely relational language but has several additional advantages (see also Ge ner, 1999) which we will illustrate with the Tower of Hanoi domain (see g. 1)1: Allowing not only numerical but also symbol-manipulating functions makes it possible to model operators in a more compact and sometimes also more natural way. For example, representing which disks are lying on which peg in the Tower of Hanoi domain could be realized by a predicate on(?disks, ?peg) where ?disks represents the ordered sequence of disks on peg ?peg with list [1] representing an empty peg. Instead of modeling a state change by adding and deleting literals from the current state, arguments of the predicates can be changed by applying standard list-manipulation functions (e. g., builtin Lisp functions like car(l) for returning the rst element of a list, cdr(l) for returning a list without its rst element, or cons(x, l) for inserting a symbol x as head of a list l). A further advantage is that objects can be referred to in an indirect way. In the hanoi example, car(l) refers to the object which is currently the uppermost disk on a peg. There is no need for any additional uent predicate besides on(?disks, ?peg). The clear(?disk) predicate given in the standard de nition becomes super uous. Ge ner (1999) points out that indirect reference reduces substantially the number of possible ground atoms and in consequence the number of possible actions, thus plan construction becomes more ecient. Indirect object reference additionally allows for modeling in nite domains while the state 1. Note that we use pre x notation p(x1 ; : : : ; xn ) for relations and functions throughout the paper.

2

Function Application in Planning

Domains:

Peg: p1, p2, p3 ; the pegs Disk: d1, d2, d3 ; the disks Disk*: Disk, d0 ; the disks and a dummy bottom disk 0

Fluents:

top: Peg ! Disk* ; denotes top disk in peg loc: Disk ! Disk*; denotes disk below given disk size: Disk* ! Integer ; represents disk size

Action: Prec: Post: Init:

move(?p , ?p : Peg) ; moves between pegs top(?p ) 6= d0, size(top(?p )) < size(top(?p )) top(?p ) := loc(top(?p )); loc(top(?p )) := top(?p ); top(?p ) := top(?p )

Goal:

loc(d1 ) = d0, loc(d2 ) = d1, loc(d3 ) = d2, loc(d4 ) = d3, top(p3 ) = d4

i

j

i

i

i

j

i

i

j

j

i

loc(d1 ) = d0, loc(d2 ) = d1, loc(d3 ) = d2, loc(d4 ) = d3, top(p1 ) = d4, top(p2) = d0 , top(p3 ) = d0, size(d0 ) = 4, size(d1 ) = 3, size(d2 ) = 2, size(d3 ) = 1, size(d4 ) = 0

Figure 2: Tower of Hanoi in Functional Strips (Ge ner, 1999) representations remain small and compact. For example, car(l) gives us the top disk of a peg regardless of how many disks are involved in the planning problem. Finally, introducing functions in modeling planning domains often makes it possible to get rid of static predicates. For example, the smaller(?x, ?y) predicate in the hanoi domain can be eliminated. By representing disks as numbers, the built-in predicate \ 0, J > 0, K > 0, appetizer(A, I), main(M, J), dessert(D, K).

appetizer(radishes, 50). main(beef, 1000). dessert(icecream, 600). appetizer(soup, 300). main(pork, 1200). dessert(fruit, 90). Figure 11: Lightmeal in Constraint Prolog

Domain: variables:

Lightmeal (?x :range (radishes, soup) (?y :range (beef, pork)) (?z :range (fruit, icecream)

Initial State: Goal:

f g ; empty f(lightmeal(?x, ?y, ?z),

Functions:

calories(?dish) = cadr(assoc(?dish, calorie-list)) calorie-list := ((radishes 50) (beef 1000) (fruit 90) (icecream 600) (soup 300) (pork 1200) ...)

(calories(?x) + calories(?y) + calories(?z)) 1400g

Figure 12: Lightmeal in FPlan version (6 for three list elements, 10 for four, etc. versus only one literal for the functional representation).

5.6 Constraint Satisfaction as Special Case of Planning Logical programs can be de ned over rules and facts (Sterling & Shapiro, 1986). Rules correspond to planning operators. Facts are similar to static relations in planning, that is, they are assumed to be true in all situations. Constraint logic programming extends standard logic programming so that constraints can be used to eciently restrict variable bindings (Fruhwirth & Abdennadher, 1997). In gure 11 an example for a program in constraint Prolog is given. The problem is to compose a light meal consisting of an appetizer, a main dish and a dessert which all together contains not more than a given calorie value (see Fruhwirth & Abdennadher, 1997). The same problem can be speci ed in FPlan ( gure 12). The goal consisting of a conjunction of literals now contains free variables and a set of constraints determining the values of those variables. In this case ?x, ?y , ?z are free variables that can be assigned any value within their range (here enumerations of dishes). The ranges of the variables ?x; ?y , ?z are speci ed for the domain and not for a problem. The function calories looks up the calorie value of a dish in an association list. There are no operators speci ed for this example. The planning process in this case solves the goal constraint by nding those combinations of dishes that satisfy the constraint. 22

Function Application in Planning

For example a meal consisting of radishes with 50 calories, beef with 1000 calories and fruit with 90 calories.

6. Conclusion and Future Work

We have presented an extension of the Strips planning language to function application with the following characteristics: Planning operators can be de ned using arbitrary symbolical and numerical functions; ADD/DEL e ects and updates can be combined; indirect reference to objects via function application allows for in nite domains; planning with resource constraints can be handled as special case. The proposed language FPlan can be used to give function application in PDDL (McDermott, 1998) a clear semantics. The described semantics of operator application can be incorporated in arbitrary Strips planning systems. In contrast to other proposals for dealing with the manipulation of state variables, such as ADL (Pednault, 1994), we do not represent them as specially marked \ rst class objects" (declared as uents in PDDL) but as arguments of relational symbols. This results in a greater exibility of FPlan, because each argument of a relational symbol may principally be changed by function application. As a consequence, we can model domains usually speci ed by operators with ADD/DEL e ects alternatively by updating state variables (Ge ner, 1999). Furthermore, allowing arbitrary numerical and symbol-manipulating functions makes it possible to apply planning to a larger class of domains. Our planning system DPlan is used as a tool for inductive synthesis of functional programs (Schmid & Wysotzki, 1998, 2000b). In this context, we are interested in constructing plans for standard programming problems as list sorting or reversing of lists. Work to be done includes providing proofs of correctness and termination for planning with FPlan, and further empirical comparisons of the eciency of plan construction with operators with ADD/DEL e ects vs. updates. For future work, we plan to extend FPlan to a larger subset of PDDL, including typing, conditional e ects, and quanti cation.

Acknowledgments This paper was written while the rst author was visiting researcher at Carnegie Mellon University, funded by a DFG research scholarship and invited by Jaime Carbonell. The authors wish to thank Petra Hofstedt for helpful discussions and Laurie Hiyakumoto and Janin Toussaint for critical comments on an earlier draft of this paper.

References

Bacchus, F., Kautz, H., Smith, D. E., Long, D., Ge ner, H., & Koehler, J. (2000). AIPS-00 Planning Competition, Breckenridge, CO. http://www.cs.toronto.edu/aips2000/. Blum, A., & Furst, M. (1997). Fast planning through planning graph analysis. Arti cial Intelligence, 90 (1-2), 281{300. Bonet, B., & Ge ner, H. (1999). Planning as heuristic search: New results. In Proc. European Conference on Planning (ECP-99), Durham, UK. Springer. 23

Schmid, Muller & Wysotzki

Cimatti, A., Roveri, M., & Traverso, P. (1998). Automatic OBDD-based generation of universal plans in non-deterministic domains. In Proceedings of the 15th National Conference on Arti cial Intelligence (AAAI-98), pp. 875{881 Menlo Park. AAAI Press. Ehrig, H., & Mahr, B. (1985). Fundamentals of Algebraic Speci cation 1 - Equations and Initial Semantics. Springer, Berlin. Field, A., & Harrison, P. (1988). Functional Progamming. Addison-Wesley, Reading, MA. Fruhwirth, T., & Abdennadher, S. (1997). Constraint-Programming. Springer, Berlin. Ge ner, H. (1999). Functional Strips: A more exible language for planning and problem solving. Submitted. Earlier version presented at "Logic-based AI Workshop", Washington D.C., June 1999. Haslum, P., & Ge ner, H. (2000). Admissible heuristics for optimal planning. In Proceedings of the AIPS 2000, pp. 150{158. AAAI Press. Kautz, H., & Selman, B. (1996). Pushing the envelope: Planning, propositional logic and stochastic search. In Proceedings of the Thirteenth National Conference on Arti cial Intelligence and the Eighth Innovative Applications of Arti cial Intelligence Conference, pp. 1194{1201 Menlo Park. AAAI Press / MIT Press. Koehler, J. (1998). Planning under resource constraints. In Prade, H. (Ed.), 13th European Conference on Arti cial Intelligence. Wiley. Koehler, J., Nebel, B., & Ho mann, J. (1997). Extending planning graphs to an ADL subset. In ECP-97 and extended version as Technical Report No. 88/1997, University Freiburg. Springer. Laborie, P., & Ghallab, M. (1995). Planning with sharable resource constraints. In Proc. of the 14th IJCAI, pp. 1643{1649. Morgan Kaufmann. McDermott, D. (1998). PDDL - the planning domain de nition language. http://ftp.cs.yale.edu/pub/mcdermott. Newell, A., & Simon, H. A. (1972). Human Problem Solving. Prentice Hall, Englewood Cli s, NJ. Nilsson, N. J. (1980). Principles of Arti cial Intelligence. Springer, New York. Pednault, E. P. D. (1987). Formulating multiagent, dynamic-world problems in the classical planning framework. In George , M. P., & Lansky, A. L. (Eds.), Reasoning About Actions and Plans: Proceedings of the 1986 Workshop, pp. 47{82 Los Altos, CA. Morgan Kaufmann. Pednault, E. P. D. (1994). ADL and the state-transition model of action. Journal of Logic and Computation, 4 (5), 467{512. Russell, S. J., & Norvig, P. (1995). Arti cial Intelligence. A Modern Approach. PrenticeHall, Englewood Cli s, NJ. 24

Function Application in Planning

Schmid, U., & Wysotzki, F. (1998). Induction of recursive program schemes. In Proceedings of the 10th European Conference on Machine Learning (ECML-98), No. 1398 in LNAI, pp. 214{225. Springer. Schmid, U., & Wysotzki, F. (2000a). Applying inductive program synthesis to learning domain-dependent control knowledge { Transforming plans into programs. Tech. rep. CMU-CS-143, Computer Science Department, Carnegie Mellon University. Schmid, U., & Wysotzki, F. (2000b). Applying inductive programm synthesis to macro learning. In Proceedings of the AIPS 2000, pp. 371{378. AAAI Press. Sterling, L., & Shapiro, E. (1986). The Art of Prolog: Advanced Programming Techniques. MIT Press. Veloso, M., Carbonell, J., Perez, M. A., Borrajo, D., Fink, E., & Blythe, J. (1995). Integrating planning and learning: The Prodigy architecture. Journal of Experimental and Theoretical Arti cial Intelligence, 7 (1), 81{120.

25

Suggest Documents