developing and implementing planning heuristics ... - Semantic Scholar

2 downloads 0 Views 134KB Size Report
stallation, and a ballast tank system for o -shore platforms. This work on planning has been embed- ded in a comprehensive approach towards knowledge-.
DEVELOPING AND IMPLEMENTING PLANNING HEURISTICS IN PROLOG Klaus P. Jantke and Daniel Matuschek Hochschule fur Technik, Wirtschaft und Kultur Leipzig (FH) fjantke,[email protected]

Abstract The present paper is based on an implemented planning system running in Quintus Prolog under SUN/OS on Sparc Stations. This one has been developed to compete another system previously implemented in Allegro Common Lisp. There have been three essentially di erent prototypical applications for generating technical therapy plans: a ood prevention system, a chemical bre production installation, and a ballast tank system for o -shore platforms. This work on planning has been embedded in a comprehensive approach towards knowledgebased process supervision and control within the joint project Wiscon which has been funded by the German Federal Ministry for Research and Technology under grant no. 413{4001{01 IW 204 B. The paper developes a collection of planning algorithms lucidly derived by formalizing algorithmic ideas and heuristics within the logic programming paradigm. This is based on the second author's student's project work.

1 INTRODUCTION The present paper is intended to exhibit the usefulness of the logic programming paradigm for planning, at least for therapy plan generation in complex dynamic environments. In some more detail, we are going to illustrate how applying a logic programming approach may lead to disciplinary insights in the area of planning. As a return, one gets a couple of hints to higly desirable metaprogramming features. Although we are investigating logic programming for planning, the ideas extracted on the basis of our approach may be implemented using any other programming paradigm. In technical terms, the aim

of this presentation is to investigate and illustrate the possibilities of deriving heuristics, algorithmic ideas, and approaches to machine intelligence from the use of the logic programming paradigm. In particular, the endeavour undertaken leads to a hierarchy of planning algorithms and, even more interesting, it provides ideas for enriching the algorithms developed with the ability to learn during planning and plan execution. From a bird's-eye view, we are interested in bridging the gap between programming paradigms and algorithmic ideas for knowledge processing including learning. At a rst glance, programming paradigms seem only to serve AI by providing methodologies, guidelines, and tools for implementation. A closer look exhibits interesting potentials for the deduction of algorithms and problem solving ideas. There are further planning approaches using the logic programming paradigm like [Sau93], e.g. However, the applications domains are essentially di erent. This di erences has a serious impact on knowledge processing methods as discussed in [AJ94b]. Although we started with a logic programming approach to planning, naturally, the implementation of our ideas described below does not essentially depend on logic programming.

2 A PEEP AT PLAN GENERATION We clearly focus on planning throughout this paper. Nevertheless, the application of planning ideas and implementations inevitably needs an interaction with the surrounding knowledge processing environment. Our approach belongs to a comprehensive endeavour towards knowledge-based process supervision and control (cf. [MAM92] and [AJ94b], e.g.). Planning is investigated in an area where classical Strips-like approaches (cf. [FN71]) usually fail. The application domain is therapy (i.e. repair) for complex dynamic processes. The pecularities of this domain

are discussed in [AJ94b]. Plans are intended to be run for process therapy. Thus, plans are programs. Because of the unavoidable vagueness and uncertainty of information about complex dynamic processes in the case of disturbance, therapy plan generation turns out to be inductive program synthesis (cf. [AJ94a]).

Diagnosis

Therapy Planning and Execution

Interface

Technology

(static)

Representation

(dynamic)

Conventional Process Supervision and Control System

Figure 1: The Simpli ed Overall Knowledge Processing Architecture A therapy control in engineering is some { possibly partial { ordering of control actions (a therapy plan) in order to in uence the technical process in timely response. It's aim is to remove the causes of a detected disturbance, to perform a new control regime to minimize the losses of production, and to adapt the situation recognition which monitors alarm boundaries. These tasks should be done by both sending new setpoint values, control values, and alarm boundaries Goal Specification

Therapy Planner

Choice

including

Critics

Action Operators

Plan Revision

Plan

Constraint Monitoring

Failed Operators

Plan Execution Rule Bases

Control Sequences

based on

Activations

Rule Interpreter

Constr. Violations

Values of Quantities

Figure 2: The Therapy Control System to a conventional supervision and control system and informing the operator about some mechanical measures. Therefore, the corresponding control synthesis modules have to be embedded into comprehensive knowledge-based systems integrating process supervision, diagnosis, simulation, planning, and plan execution, among others.

The control synthesis which consists of a planner und an execution module is triggered by disturbance analysis. The underlying knowledge base is called a technology representation. It contains all information which is available about the technological equipment necessary for automated reasoning. There are certain hierarchies representing essentials of the underlying process. Knowledge about diagnosis and therapy (action scripts, in particular) are attached to nodes of the hierarchy describing technological objects. Inheritance is fundamental for searching this knowledge base. Further issues of the underlying knowledge representation are discussed in [Arn94b]. The planning approach itself is based on graphtheoretic fundamentals (cf. [AJ94b] and [AJ94c]). The unavoidable logical reasoning, in fact, implements the deduction operator of some modal temporal logic (cf. [Arn94a]). The key planning concept is a hierarchy of planning formalisms:  hierarchically structured families of graphs, i.e. a nite collections of nite, directed, and acyclic graphs with certain regulations how to substitute one graph for a node of another one (in fact, some context-free graph grammar concept),  rooted families, i.e. hierarchically structured families of graphs enriched and speci ed by a particular graph representing a goal speci cation,  hierarchically structured plans, i.e. rooted families having a uniquely determined expansion (in a sense, de ning a singleton language), and  plans, i.e. at graphs being the normal form of certain hierarchically structured plans, where every node has a clear operational semantics. The outlined logic programming approach is implementing these concepts together with inference mechanisms realizing planning based on these formalizations. [MJA95] is a rst publication of these ideas.

3 LOGIC PROGRAMMING FOR PLAN GENERATION 3.1 Knowledge Representation

In our target domains, we are faced to very di erent kinds of knowledge classi ed reasonably into static and dynamic knowledge. The static knowledge re ects the structure, organization, and implementation of the target process as well as essentials of the knowledge processing modules like action scripts for planning, e.g. Dynamic knowledge partially and vaguely represents the state of the supervised process.

To get process values, we use an interface to the technology representation, but action scripts and plans must be expressed using Prolog. As Prolog does not support global variables, action scripts will be stored in clauses. As a consequence, hypothesizing and possibly revising therapy plans requires a exible and ecient changing of the clause base. An action script is identi ed by some name. It mainly consists of a set of partially ordered actions subacts. It may contain some further information

complex(name,subacts,p in,pref,constr) where subacts is the list of all names of subactions, p in represents the graph-theoretic knowledge of nodes without predecessors, pref is some numerically expressed preference value, and constr is a list

of logical constraints. During planning, every intermediate plan conceptually understood as a graph is represented by its nodes called actions. Actions will be stored as clauses, too. There are two di erent kinds of actions : compound actions, which describe goal speci cations to be substituted lateron, and elementary actions. Both types of actions will be represented as action(name,successors,substitutions,constraints), where the list of substitutions is empty, if the action is elementary. The resulting therapy plan consists of a set of actions of the form action( , ,[], ) indicating that nowhere in the plan further substitutions are possible.

3.2 Main Planning Algorithm

For briefty, we leave a discussion of our basic algorithm's structure to the reader: 1 2 3 4 5 6 7 8

planner : ndall(Act,compound action(Act),[]). planner :compound and active(Act), action(Act, ,Sub, ), member(Gra,Sub), subst(Act,Gra), planner.

A few remarks on metaprogramming shall complete the top-level description.  Backtracking of Hypotheses As therapy plans generated may be refused later, backtracking must be applicable to plans generated. This is implemented in the predicate subst/2 which rectracts all inserted action clauses of Sub and asserts intermediately deleted actions Act), if the goal planner fails.



Metalevel Sorting For exibility in represent-

ing certain heuristics based on preference relations, metalevel sorting in dependence on some given partial ordering is desirable.  Self-Modi cation for Learning For preferring successful alternatives to less successful ones during learning, there has to be identi ed parts of the logic program where incremental modi cations may implement learning. The simple approach above is mainly intended to provide a launching pad for developing and implementing interesting heuristics. Clarity is prefered to eciency. It will be exploited below.

4 PLANNING ALGORITHMS The intention of the main chapter is to introduce a number of fundamental algorithmic ideas for changing the overall behaviour of a planning system essentially. The declarative programming approach makes the changes easy to understand, easy to implement, and easy to analyze. If necessary, the prototypical programs can be rewritten under any other programming paradigm. [JA95] is investigating a collection of similar algorithmic approaches without exploiting peculiarities of a particular programming paradigm.

4.1 Planning with Preferences

The initially introduced basic version of the planning algorithm did not use the preference values available. For shortness, we are listing only the changes to be introduced: 5

5(1) 6

action(Act, ,Sub, ), predsort(higher preference,Sub,Sorted Sub), member(Gra,Sorted Sub),

This version di ers in only one line (5(1)), which sorts the list of possible substitutions by preference. Note that predsort/3 is a built-in predicate in SWI-Prolog, which can be easily simulated in other Prolog versions. However, it re ects a rst step towards using metaprogramming concepts. member(Gra,Sorted Sub) rst selects the substitution with highest preference. Learning is deemed important to make planners more e ective and hypothetically generated plans more trustable. Our key idea is to change preference values within the course of planning. When one alternative among others during graph expansion has lead to a point where backtracking became necessary, this may be registered by decreasing its preference value. For implementing the details, a considerable number of bookkeeping strategies may be easily implemented.

4.2 Consistent Planning

1

Based on the underlying modal temporal logic (cf.[Arn94a]), checking the constraints of action scripts during planning is used to refute those actions which are provably inconsistent with respect to the given knowledge base planner :2 ndall(Act,compound action(Act),[]). 3 planner :4 compound and active(Act), 5 action(Act, ,Sub, ), 6 member(Gra,Sorted Sub), (1) 6 consistent complex(Act,Gra), 7 subst(Act,Gra), 8 planner.

3 4 5 6 7

shorter([],[ j ]). shorter([ jT1],[ jT2]) :shorter(T1,T2). better(Act1,Act2) :action(Act1, ,Sub1, ), action(Act2, ,Sub2, ), shorter(Sub1,Sub2).

The few lines above implement the heuristics to expand graphs rst at nodes where a minimal number of operations yield an irreducible form. In many applications, it is important to refute inconsistent alternatives as early as possible. Other heuristics may be directly plugged in via another predicate better.

1

The test of consistency is performed in line 6 . (1)

consistent complex(Act,Gra) means: If the node Act is substituted by Gra, the plan will turn out to be

consistent. However, this concept of consistency is more involved than the usual consistency concept in inductive inference (cf. [Wie92], e.g.). The knowledge base, i.e. the dynamic part of the underlying technology representation, is dynamically changing over time. In dependence on the mechanisms of updating the clause base, the notion of consistency refers to di erent stages of the process.

4.3 Planning Using Heuristics

Developing and implementing heuristics appropriate for particular problems under particular circumstances is one of the key issues of AI. It is one of the basic intentions of the present paper to illustrate the suitability of the logic programming paradigm (1) to nd appropriate positions where to invoke some heuristics and (2) to implement these heuristics easily. This applies to plan generation in several environments, at least. As the search space of all plans is usually huge, it is recommended to use heuristics to increase performance. The logic programming approach is pointing directly to crucial steps of the planning algorithm. By using the predsort idea, one gets the following version: planner :4(1) ndall(Actions, compound and active(Actions),All), 4(2) predsort(better,All,Sorted Actions), 4(3) Sorted Actions=[Actj ], 5 action(Act, ,Sub, ), better/2 is any predicate provided such that its semantics for better(Act1,Act2) suggests to substitute Act1 before substituting Act2. 3

2

5 APPLICATIONS For illustration, we are depicting two small partial plans. They are part of therapy plans generated for a disturbance of the chemical bre production installation. A student of us has done an enormous amount of work in acquiring and representing therapy knowledge (cf. the Master's Thesis [Zsc95]) underlying the planning experiment reported here. store carefully

stabilize VE1

VE1

store carefully

stabilize VE2

VE2

monitor temperature VE-A1

isolate PM

shut down VE1

decrease temperature VE1

Figure 3: A Partial Plan of Highest Preference These two plans are di erent in their right hand sides, where they consist of di erent expansions of one compound node. The rst plan results from the algorithm described in chapter 4.1 above. shut down SP-A1 store carefully

stabilize VE1

VE1 tide over heating failure VE1

shut down RSR

store carefully

stabilize VE2

VE2 shut down VK

Figure 4: A Consistent Plan of Lower Preference Generated via Consistency Checking The second plan results from the algorithm of chapter 4.2, as some constraint of the action \monitor temperature" has been disproven. In dependence on the

actually given data about the target process, the consistent planner may generate another plan. In numerous application cases, consistent plans are refuted later because of other reasons. Thus bookkeeping to increase the preference value of actions which are more likely to be successful than others may qualify consistent planning algorithms.

[Arn94b] Oksana Arnold. Towards structure and management of knowledge bases for controlling. In Eberhard Kohler, editor, 39.

Internationales Wissenschaftliches Kolloquium der TU Ilmenau, Band 3, pages 30{

[FN71]

6 ACKNOWLEDGEMENT The comprehensive approach towards knowledgebased process supervision and control has been developed within the joint project Wiscon funded by the German Federal Ministry for Research and Technology under grant no. 413{4001{01 IW 204 B. The conference participation of the rst author has been supported by the German Research Fund (DFG) under grant 477/378/96. Our colleague Oksana Arnold (called Oki) did a pioneering work in therapy plan generation for complex dynamic systems. We are deeply indebted to Oki for all her support.

References [AJ94a] Oksana Arnold and Klaus P. Jantke. Therapy plan generation as program synthesis. In Setsuo Arikawa and Klaus P. Jantke, editors, Algorithmic Learning Theory, Proc.

4th International Workshop on Analogical and Inductive Inference (AII'94) and the 5th International Workshop on Algorithmic Learning Theory (ALT'94), October 10-15, 1994, Reinhardsbrunn Castle, Germany, volume 872 of LNAI, pages 40{55.

Springer-Verlag, 1994.

[AJ94b] Oksana Arnold and Klaus P. Jantke. Therapy plan generation in complex dynamic environments. ICSI Report TR{94{054, International Computer Science Institute, Berkeley, California, October 1994.

[JA95]

8th Australian Conference on Arti cial Intelligence (AI'95), November 13-17, 1995, Canberra, Australia, pages 531{538. World

Scienti c Publ. Co., 1995. [MAM92] Volker May, Oksana Arnold, and Uwe Metzner. Wissensverarbeitung in dynamischen Prozeumgebungen { Eine Anforderungsspezi kation. WISCON Report 01/92, HTWK Leipzig (FH), Fachbereich IMN, March 1992. [MJA95] Daniel Matuschek, Klaus P. Jantke, and Oksana Arnold. Generierung von Therapieplanen mit Mitteln der logischen Programmierung. In Peter H. Schmitt, editor, Logik in der Informatik, 3. Jahrestagung der GI-Fachgruppe 0.1.6, pages 75{ 78. Universitat Karlsruhe, Fakultat fur Informatik, Bericht 23/95, Juni 1995. [Sau93] Jurgen Sauer. Wissensbasiertes Losen von Ablaufplanungsproblemen durch explizite Heuristiken, volume 37 of DISKI, Dissertationen zur Kunstlichen Intelligenz. in x,

1993. [Wie92] Rolf Wiehagen. From inductive inference to algorithmic learning theory. In Shuji Doshita, Koichi Furukawa, Klaus P. Jantke, and Toyaki Nishida, editors, Proc. 3rd Workshop on Algorithmic Learning Theory, (ALT'92), October 20{22, 1992, Tokyo, volume 743 of Lecture Notes in Arti cial Intelligence, pages 13{24. Springer-

[AJ94c] Oksana Arnold and Klaus P. Jantke. Therapy plans as hierarchically structured graphs. In Fifth International Workshop

on Graph Grammars and their Application to Computer Science, Williamsburg, Virginia, USA, November 1994.

[Arn94a] Oksana Arnold. A logic of constraints for dynamic process control. WISCON Report 09/94, HTWK Leipzig (FH), Fachbereich IMN, December 1994.

36. Techn. Universitat Ilmenau, 1994. Richard E. Fikes and Nils J. Nilsson. STRIPS: A new approach to theorem proving in problem solving. Arti cial Intelligence, 2:189{208, 1971. Klaus P. Jantke and Oksana Arnold. Variants of plan generation for complex dynamic systems. In Xin Rao, editor, Proc.

[Zsc95]

Verlag, 1992. Christoph Zschiesche. Erstellung und Analyse von Wissensbasen der Prozesicherung und -optimierung zur Verbesserung und Erweiterung geeigneter Wissensreprasentationen. Master's thesis, Leipzig University of Technology, August 1995.