ABSTRACT A METHODOLOGY FOR SOLVING PROBLEMS IN ARTIFICIAL INTELLIGENCE by Suk In Yoo Chairman: Keki B. Irani For the development of a general and efficient approach for solving problems, a metholodogy for deriving a heuristic for the A' algorithm is discussed. A systematic approach for modeling a problem using the knowledge in the problem domain is frst presented in which a set of elementary units and a set of attributes of the problem are defined. Algorithms to derive a heuristic for A' are then developed for this problem model. The procedure for modeling a problem and deriving the heuristic for the problem is illustrated by several examples, namely, the 8puttle problem, the traveling salesman problem, the robot planning problem, the consistent labeling problem, and the theorem proving problem. For problems such as the 8-puzzle problem, the traveling salesman problem, the robot planning problem, and the consistent labeling problem in which the goal is completely defined, our problem solving approach results in good efficiency. For problems such as the theorem proving problem in which the goal is partially defined, our approach results in poor efficiency. For deriving the heuristic for A' which results in better problem solving efficieney, various other versions of the basic problem model are suggested. The 1

versions are given by partitioning the set of elementary units and the set of attributes of the problem. Some of these models are compared against each other for complexity for deriving the heuristic and for tightness of the derived heuristic. 2

A METHODOLOGY FOR SOLVING PROBLEMS IN ARTIFICIAL INTELLIGENCE by Suk In Yoo A dissertation submitted in partial fulfillment of the requirements for the degree of Doctor of Philosophy (Computer, Information, and Control Engineering) in The University of Michigan 1985 Doctoral Committee: Professor Keki Irani, Chairman Professor Kuei Chuang Associate Professor Ramesh Jain Professor Norman Scott Assistant Professor Paul Scott 1

In Memory of My Brother, Seek Yoon Yoo u

ACKNOWLEDGEMENTS The author wishes to express his gratitude to Professor Keki Irani, his thesis committee chairman, for his interest, guidance, and encouragement throughout the course of this work. Thanks are extended to other committee members, Professor Kuei Chuang, Ramesh Jain, Norman Scott, and Paul Scott, for their comments and suggestions. Financial support from Robot Systems Division in the Center for Research on Integrated Manufacturing (CRIM) under the AFOSR Grant F49820-82-C-0089 is gratefully acknowledged. The author wishes to thank his parents and parentsin-law for supporting and encouraging him to pursue this endeavor. Finally, above all, the author wishes to express his deepest gratitude to his wife, Hye-jung, his son, Raymond Soonwon, and his daughter, Ginnie Sujin. Without their endless patience and encouragement, this thesis would not have been possible. coo

TABLE OF CONTENTS DEDICATION........................................................ ii ACKNOWLEDGEMENTS..................................................................... iii LIST OF FIGURES...................................................................... vii LIST OF TABLES............................................................................................. ix LIST OF APPENDICES...................................................................... x CHAPTER 1. INTRODUCTION 1.1 Background............................................. 1.2 Motivation, Problem, and Approach...................................... 1 1.3 Literature Survey.......................................................... 1.3.1 Problem Representation............................................. 6 1.3.2 Search Methods....................... 7 1.3.3 The Generalized Problem Solving Process................. 10 2. REPRESENTATION OF A PROBLEM 2.1 Introduction.............................................. 1 2.2 State-Space Representation.................................................... 11 2.3 A Problem Model M............................................................... 13 2.3.1 Modeling Procedure.............................................. 13 2.3.2 Length of a Path between Two States....................... 28 3. HEURISTIC SEARCH ALGORITHM 3.1 Introduction...................................................................... 35 3.2 Search Algorithm A............................................................ 35 3.3 Heuristic....................................................... 37 3.3.1 Relaxed Successor Condition Formula....................... 38 3.3.2 Heuristic Derived using the Problem Model M.......... 47 3.4 Exam ples................................................................................. 61 Iv

3.5 Power of Heuristic.................................................................. 63 4. A PROBLEM MODEL M0 AND HEURISTIC 4.1 Motivation.................................................. 74 4.2 Goal Condition Formula........................................................ 80 4.2.1 Relaxed Goal Condition Formula............................... 81 4.3 A Problem Model Mo...................................... 83 4.4 Heuristic Derived using the Problem Model Mo..................... 85 4.4.1 The Case of Constant Rule Cost.............................. 85 4.4.2 The Case of Nonequal Costs of Rules........................ 88 4.5 Examples................................................................................. 86 4.6 Power of Heuristic............................. 90 5. AN EXTENDED PROBLEM MODEL 5.1 Motivation......................... 93 5.2 Partition of the Set EU............................................. 93 5.2.1 A Problem Model M............................................. 95 5.2.2 Heuristic Derived using the Problem Model M......... 96 5.3 Partition of the Set AT............................................. 106 5.4 An Extended Problem Model M........................................ 109 6. HEURISTICS 6.1 Introduction............................................................................ 117 6.2 Heuristic Derived using the Problem Model M2..................... 117 6.2.1 The Case of Constant Rule Cost.......................... 120 6.2.2 The Case of Nonequal Costs of Rules........................ 124 6.3 Complexity and Tightness of Heuristic................................. 133 6.4 Examples.................................................... 144 6.5 Discussion................................................................ 145 7. SEARCH ALGORITHM He 7.1 M otivation.............................................................................. 150 7.2 Algorithm H.......................................................................... 152 7.3 Exam ple................................................................................ 158 V

7.4 Search Efficiency of Algorithm H'......................................... 159' 8. CONCLUSION 8.1 Summary and Contribution................................................... 168 8.2 Future Research..................................................................... 19 8.2.1 Solving a Problem with Partially Known Goal Position Values.................................................. 169 8.2.2 Automated Problem Solving System......................... 170 APPENDICES.................................................................................................. 171 BIBLIOGRAPHY...............................2........................................ 220 vi

LIST OF FIGURES Figure 2.1 The 8-Puzle Problem...................................................... 14 2.2 The (5-city) Traveling Salesman Problem.............................................. 15 2.3 The Robot Planning Problem.......................................... 17 3.1 Search Tree for Solving the 8-Puzzle Problem...................................... 65 3.2 Search Tree for Solving the (5-city) TSP............................................... 8 3.3 Search Tree for Solving the Robot Planning Problem......................... 67 3.4 The (6-city) Traveling Salesman Problem.................................. 68 3.5 Search Tree of A using h(ej)................................................... 69 3.6 Search Tree of Al using ho...................................................................... 70 3.7 Search Tree of As using h................................................................. 71 3.8 Search Tree of A' using MST......................................................... 72 4.1 Search Tree for Solving the CLP using A.......................................... 91 4.2 Search Tree for Solving the CLP using Backtracking........................... 92 7.1 Search by Ho Based on Version M ).................................................... 160 7.2 Search by He Based on Version M223)............................................. 161 7.3 Search by He Based on Version ().................................................... 162 7.4 Search by Backtracking using Operator *+.......................................... 16 vii

7.6 Search by Backtracking using Operator *.......................................... 167 YUl *-II

LIST OF TABLES Table 3.1 Heuristics in the (6-city) TSP................................................................. 73 6.1 Heuristics in the Consistent Labeling Problem...................................... 147 6.2 Heuristics in the Robot Planning Problem............................................ 148 6.3 Heuristics in the (5-city) TSP................................................................. 149 ix

LIST OF APPENDICES Appendix A. Proofs in Chapter 3....................................................................... 172 B. Proofs in Chapter 6....................................................................... 185 C. Argument.................................................................... 216 x

CHAPTER 1 INTRODUCTION 1.1. Background Many human mental activities such as solving problems, learning, reasoning, and understanding language are said to demand intelligence. Over the past few decades several computer systems are claimed to have been built to perform tasks which need intelligence. Most of the work on building these kinds of systems has been done in the field called Artificial Intelligence (Al). As Al systems underwent experimentations, development, and improvement, several of those of wide applicability have been produced and refined. Of special interest in this research is the area of Problem Solving. A problem can be vieswed as a system which can be in one of a number of states. A problem can be moved from one state into another by appying rules. Solving a problem, then, is to determine a sequence of rules that can take a problem from a given initial state to a desired or goal state. 1.2. Motivation, Problem, and Approach In general, a problem is given by a quadruple, (S,R,c,,c), called a statespace formulation, in which S is a set of states, R is a set of rules, c,, E S is the initial state, and e fE S is the goal state. When the problem is given by 1

2 (S,R,,i,,e ), the solution is given by a sequence of rules which takes the problem from c,, to Cl. Determining a solution to a problem involves a search in the statespace. There may be many search methods for finding a solution to a problem. Search methods can be classified into two types, blind search methods and heuristic search methods, depending on whether or not the knowledge of the problem is used in the search. The biggest shortcoming of the blind search method, such as the breadth-firt or the depth-first, is that the required storage and time grow exponentially with the problem size. For solving problems, in most cases, a heursitic search method is thus preferred. A well-known heuristic search method is the algorithm A', devised by Hart and Nilsson [Hart88]. Algorithm A' is a bestfrst search, which selects the most promising path to the goal based on the numeric value assigned to each intermediate state generated during the search. The numeric value for each state c, is given by an evaluation function / (e,) = g(e ) + A (c,) where g (e, ) is the minimum cost of the path established so far from c,, to c, and A(e,-) is the heuristic estimate of the minimum cost of the path from e, to the goal ec. The most interesting property of A' is in the admissibility. It guarantees an optimal solution because for every c, E S, the value of h((e,) is required to be not greater than the minimum cost A'(e, ) of the path from c, to ec. Problem-dependent approaches for deriving A(c,) have been developed for some problems such as the 8-puztle problem and the traveling salesman problem. However, for the general problem solving procedure, a problem-independent approach for deriving hA(e) is necessary. Some results for problem-independent approaches have been published. Gaschnig [Gas79] introduced the notion of similar

3 ity of problems. As the heuristic of a problem to be solved, he uses the minimum cost of the path of a simpler problem which is similar to the original problem. There is, however, no systematic methodology for generating this similar version of the original problem. Guida and Somalvico [Gui7J] viewed a problem as a directed graph. According to their method, an auxiliary problem is created by adding arcs to the directed graph of the original problem. The minimum cost of the solution to the problem is then the heuristic of the original problem. It is not easy, however, to derive the simple auxiliary problem. Pearl [Pea831 suggested generating a set of relaxed problems by refining and deleting some of the predicates describing the rules of the problem or deleting some of the predicates describing the goal state of the problem. Of the set of relaxed problems which can be generated by his method, a simplified problem was characterized by the two properties, decomposability and semi-decomposability. The latter characterization can be detected by either commutativity of rules or partial order on rules. Although the simple problem with decomposability provides efficient computation of the heuristic using parallel operations, according to the author, its occurrence is rare and can be achieved by deleting a large fraction of the predicates. In this research, we suggest a methodology for modelling a problem which always leads to a simple problem with a decomposable goal. We will first suggest a systematic approach to represent a state-space of a problem in such a way that the heuristic A (c, ) is automatically abstracted. Based on the problem model we will then develop a procedure to derive A (c, ). A set of rules of the problem and the goal state of the problem are described by the first predicate formulas. As mentioned above, Pearl generates a set of relaxed models by deleting some predicates which are either the components of the formulas describing

4 the rules of the problem or the components of the formulas describing the goal state of the problem. We, on the other hand, generate one relaxed model by relaxing the formulas which describe the rules and the goal state, in such a way as to generate simplified rules and a subgoal for each of the elementary units of the problem. Each subgoal is then realized independently by applying the corresponding simplified rules. The independent achievement of each subgoal reduces the complexity of the derivation of the heuristic. The processing time is further reduced by parallel processing. To improve the effciency of the derived heuristic, various versions of the problem model are presented. Each version is given by partitioning the set of elementary units and partitioning the set of attributes of the problem. Each step of our procedure is illustrated by five examples, namely, the 8-puzzle problem, the traveling salesman problem, the robot planning problem, the consistent labeling problem, and the theorem proving problem. The rest of this dissertation is organized as follows. In Chapter 2 we formulate the problem model M in which a set of elementary units and a set of attributes of the problem are defined. In Chapter 3 we develop the general procedure, based on the problem model Af, to derive the heuristic A (e, ) of search algorithm A'. In Chapter 4 we formulate the problem model AMo, a more general version of At, in which the goal condition formula to represent the goal state of the problem is defined. The procedure, based on AfM, to derive A (c, ) is developed. In Chapter S we first formulate the problem model MA in which a set of objects of the problem is defined by partitioning the set of elementary units defined

6 for Alo, and then we formulate the problem model M2 in which a set of features of the problem is defined by partitioning the set of attributes defined for Mi. In Chapter 6 we develop the general procedure, based on M2, to derive heuristic A (e, ). The value of A (e, ) varies depending on the set of objects and the set of features defined. For a given set of objects and a set of features, the complexity for deriving the heuristic A(e,) and the tightness of the derived heuristic A(c,) are examined. In Chapter 7 we present search algorithm H', which is a slightly modified version of algorithm A'. Algorithm A' selects for expansion the state with minimum value of the evaluation function f. If more than one state has the same minimum value of f, A' selects the one with the maximum value of g. If more than one state has the same minimum value of / and the same maximum value of g, A selects any of these arbitrarily. Sometimes this arbitrary selection may result in a poor search efficiency which would be protected by some specific selection..1' algorithm further clarifies the selection strategy in the case in which more than one state has the same minimum value of / and maximum value of g. Search efficiencies of A' and H' based on the same heuristic A (, ) are illustrated by an example. One further feature of H' is that it detects, based on the heuristic A (e, ), the state e, which is not one of the intermediate states for solution, and prunes ec from the search tree. This feature improves the search efficiency, in case the problem has no solution, by preventing the fruitless expansion of the state such as ec which will not contribute to the solution. Finally in Chapter 8 we summarize the results of our research and discuss future research.

6 1.3. Literature Survey In this section several works concerning problem solving reported by other Al researchers are reviewed. Two key factors of problem solving are problem representation and the search method. The works related to problem representation are first reviewed, and the search methods developed so far are then discussed. Finally, some approaches to developing the generalized problem solving process are reviewed and their limitations are discussed. 1.3.1. Problem Representation A problem representation is simply a technique for conceptualizing a problem. Humans often solve a problem by finding a way of thinking about it that makes the solution easy. Likewise, a problem should be represented in such a way that the search for a solution is simplified or reduced, or that it permits a transformation to some other form which makes a more efficient search possible. A common representation scheme is the state-space representation [Bar81, Hun78, Jac74, Nil80]. In this representation, a problem consists of a countable set S of states and a set R of rules (operators), each of which map some of the states of S into others. A problem is solved when a sequence of operators is found so that some goal state is produced when this sequence of operators is applied to the initial state. A scheme which is often distinguished from the state-space reresentation is the problem-reduction representation [Bar81, Jac74]. In the problem-reduction approach, an initial problem description is given. It is solved by a sequence of transformations, defined as operators, that ultimately changes it into a set of subproblems whose solutions are intuitively clear, called primitive subproblems. An

7 operator may change a single problem into several subproblems. To solve the former, all the subproblems must be solved. The problem reduction representation consists of three components: an initial problem description, a set of operators for transforming problems to subproblems, and a set of primitive problem descriptions. 1.3.2. Search Methods A problem represented in the state-space formulation is commonly identified by a directed graph in which each node is a state and each arc is the application of an operator transforming a state to a successor state. The search for a solution is conducted to make the state-space graph contain a solution path. All the search methods may be classified into two search types according to whether or not the search uses some information embedded in the problem domain for efficiency. The search method not using such information is called a blind search method (or uninformed search method), and the one using such information is called a heuristic search method (or informed search method). A blind search method expands nodes in an order which uses no specific information about the problem to determine which is the most promising node which can lead towards a goal node. Although the blind search method, in principle, can provide the solution to a problem, it is often impractical for nontrivial problems. Typical blind search methods are either breadth-first search, depth-first search, uniform cost search, or bidirectional search [Bar81, Hun78, Jac74, Nil80]. Each of these search methods are briefly reviewed. A breadth-first search expands nodes in the order in which they are generated, while a depth-first search expands the most recently generated node first. A uniform cost search can be viewed as a generalized version of a breadth-first search in that

8 all the rules (arcs in the search graph) may have different costs. This search evaluates each node in the order of the cost of the path from the initial node to this node. The cost of a path is computed as the costs of all the arcs lying in the path, and the node on the minimal cost path is expanded rust. Each of the searches explained above uses forward reasoning, i.e. it works from the initial node towards the goal node and uses rules that each maps a node to a successor node. In some cases the search could use backward reasoning as well, moving from the goal to the initial node. The bidirectional search is based on both forward and backward reasoning, using any of the above search methods for each reasoning. Sometimes information embedded in the problem can be used to reduce the search. The heuristic search method uses information of this sort. Typically the heuristic information can be used in deciding which node is to be expanded next, or which successor node(s) is(are) to be generated in the course of expanding a node, or which nodes to be pruned from the search tree. The most studied and popular heuristic search is a best-irst search using some heuristic information for deciding which node to expand next [Gas77, Hart68, Harr74, Hun78, Jac74, Nil80, Poh70a, Poh77, San70]. The heuristic search in which each node is partially expanded or some nodes are pruned out was investigated by [Dor67, Mic70]. A best-frst search is the one that always selects the most promising node as the next node to expand. Thus the technique to measure the promise of a node is a key to the best-first search. The measure of the promise is usually called an evaluation function, f. An evaluation function has been defined in several ways. The best known definition

was developed by fHart88] in which, for a given node n, / (n)- (n) + A (n) where g(n) is the cost of the currently evaluated path from the initial node to the node n, and A (n ) is the heuristic estimate of the minimum cost of the path remaining between n and some goal node. Hart and Nilsson [Hart68] introduced algorithm A', which has been the most studied search algorithm for problem solving. Algorithm A', used for performing the best-irst search, with the evaluation function defined as above, includes the significant property that the optimal solution is guaranteed because the heuristic estimate A (n) satisfies the condition, called edmiasibility. The value of A (n) satisfies admissibility if it is not greater than the minimal cost of the path from the node n to the goal state. The value of A(n ) satisfies monotonicity if, for every successor node m of n, it is not greater than the sum of I(m) and the cost of the arc between the two nodes n and m [Hun78, Jac74, Nil80, Pea84]. Pohl [Poh70b] introduced algorithm HPA. HPA also implements the best-first search. For HPA, the evaluation function is defined as / (n) = (-w)gp(n ) + wt (n) where w is the weighting factor varying from 0 to 1. Thus HPA may implement several search algorithms by altering the value of T. For example, if wt 0, HPA becomes a uniform cost search, but if == 0.5, HPA becomes algorithm A'. A further flexible defintion of an evaluation function was suggested by [Poh73] who allowed the weighting factor I to be dynamically changed according to the given node n, i.e., I (n ) = (1-w(n ))g(n ) + (n )h(n ). Ther are also more algorithms for playing two or more person games [Bar81, Ber79, Hun78, Jac74, Knu7S, Nil80]. We will not be concerned with such games.

10 I.3.. The Generalised Problem Solving Process In this section some studies of the generalized problem solving process are reviewed. Search algorithms such as A' and HPA find a solution to a problem efficiently if a nontrivial heuristic estimate A (ec ) can be derived efficiently for each state e, of the problem. Some results of a general approach for deriving A (c,) were discussed in section 1.2. The General Problem Solver (GPS) devised by Newell and Simon [New72j employs mean.-end analysis for solving problems. Means-end analysis is a control mechanism using en operator-d cn tale to ind an operator which can reduce differences between the current state and the goal state. If the current state does not satisfy the conditions necessary for applying the operator which can reduce differences, a new subgoal is created to satisfy the missing conditions and mean-end analysis is again applied for achieving this new subgoal. This recursive approach may work well if no more than one operator affects the difference of the same object, or the difference affected by each operator is easily formulated. Otherwise it is not easy to derive the operator-difference table. For example, in the 8-puzzle problem the difference of each tile can be affected by every operator. For a given state, one operator should be selected based on the operator-difference table, which can reduce the difference o; each tile from its goal position. The formulation of the operator-difference table in this problem can then be viewed as the derivation of the heurstic A(e, ) for each state e,. The approach using GPS may be one level higher than the approach using heuristic A(c,). Thus even based on GPS, a general approach for deriving h (c, ) is still necessary for efficient problem solving.

CHAPTER S REPRESENTATION OF A PROBLEM 2.1. Introduction The representation of a problem is one of the basic and important aspects of a general problem solver. Generality and efficiency of a problem representation may be trade-offs because of the variety of problems. If a representation scheme involves a broad class of problems, it tends to bear few special features which characterize problems, so that some useful information for problem solving may be lost in such a representation scheme. In this chapter, one abstract structure representing a problem is presented from which a heuristic for efficient problem solving can be systematically and automatically abstracted. First in section 2.2 a well-known state-space formulation for representing a problem is briefly reviewed and its short coming is pointed out. In section 2.3 one mathematical structure representing a problem is formulated, which bears a more detailed version of the state-space formulation and in which the short coming of the state-space formulation is overcome. 2.2. State-Space Representation A state-space formulation is the well-known representation scheme of a prob lem for graph search [Bar81, Hun78, Jac74, Nil80]. It consists of four components: a 11

12 Aet of states each of which is a data structure describing the condition of the problem at each stage of its solution process, a set of rules each of which is a specification of transformation of one state into some other state, the initial state of the problem, and the goal state of the problem. Dermftion 2.1: A problem is a quadruple, <S,R,ei,,e >, where - is a set of states, - R is a set of rules, - c,, is the initial state, - c is the goal state. When a problem is formulated in a state-space, its solution is given by a sequence of rules which takes a problem from the initial state to the goal state. In order to find such a sequence the state-space is searched starting from the initial state. The initial state is expanded by applying all the applicable rules to it. All the resulting successor states are marked unexpanded. If the.goal state does not exist among the unexpanded states, then one of the unexpanded states is again selected for expansion and all of its applicable rules are applied to produce the successor states. This process is repeated until the goal state is produced as one of the successor states of some expanded state. Once the goal state is produced, the sequence of rules forming the solution is then retrieved from the search space. Each state of a problem from the state-space formulation is, however, arbitrarily represented so that a heuristic for the efficient search can not be systematically derived. We suggest in the next section a methodology to represent a statespace of a problem in such a way that the heuristic is systematically and automati

13 cally derived. 2.3. A Problem Model M In this section we first show how to construct an abstract model of a problem. We motivate each step of this construction by drawing upon three well known problems, namely, the 8-puzzle problem, the traveling salesman problem, and the robot planning problem. Next, based on the problem model we evaluate the upper and lower bounds of the length of a path between two states of the problem. These values will be the basis for deriving a heuristic for efficient problem solving search, which will be discussed in the next chapter. 2.3.1. Modeling Procedure For the illustration of the procedure for modeling a problem the following three problems are considered. The 8-Pussle Problem [Gas77, Nil80, Pea83J: Given two configurations on a 3x3 board, the initial and the goal shown in Fig.24, the problem is to reach the goal configuration starting from the initial configuration by pushing one of the tiles adjacent to the blank space either up, down, left, or right. The Traveling Salesman Problem [Nil8O, Pea83]: A salesman must visit each of the cities on a map. The problem is to find a minimum distance of the tour, starting at one city, visiting each city precisely once, and returning to the starting city. One instance of this problem is, as shown in Fig.2.2, the (5-city) traveling salesman problem in which the 5 cities are denoted by A, B, C, D, and E, and the starting city is A.

14 2 8 3 I i I 6 4 7__5_ 1 2 8 4 7 Sc ~ _ i -- Figure 2.1 The 8-Puzzle Problem

16 E Figure 2.2 The (5-city) Traveling Salesman Problem

16 The Robot Planning Problem INil80]: A robot has a reportoire of primitive actions, picking up some obejcts and moving them from place to place. The problem is to synthesize a sequence of robot actions that will achieve some goal state starting from the initial state. One instance of this problem is, as shown in Fig.2.3, to find a sequence of robot actions for a robot which is able to pick up and move a block from location L, to location Lj, i j-1,2,3. In what follows we introduce the components of a problem before we give its formal definition: A Set EU of Elementary Units: We rust notice that a problem, in general, involves some basic units which we choose to call elementary units. We designate the set of the elementary units by EU = (*{1,2,..., * ). In the case of the 8-puzzle problem each a, is a tile or the blank, in the case of the traveling salesman problem an i, is a city, and in the case of the robot planning problem an ei is a block. A Set AT of Attributes and a Set S of States: Next, a problem is characterized by one or more attributes whose values determine the state of the problem during a process of solution. We designate the set of attributes of a problem by AT - (Abl,Ab2,..., Ab }. We designate the set of all possible values of an attribute A, by Dom(Ab,). Thus the state space S of a problem can be written as S = X Dom(Ab,). The 8-puzzle problem has only *i=1 one attribute, namely, the arrangement of the tiles and the blank. When the arrangement is strung out, each element of Dom(Ab ) is a 9-tuple each component of which is the tile or the blank in that position. If each tile i, i E (1,...,8), is

17 Robot c - 8L A 6 C L, LI LI LI L^ L3 Figure 2.3 The Robot Planning Problem

18 denoted by t, and the blank is denoted by It, then <t(,tl,tl,t2,t4,t6,tt3> is one element of Dom(Ab ), and hence a state of the 8-puzzle problem. The traveling salesman problem has two attributes, namely, (1) the set of cities already visited, and (2) the city currently being visited. Thus, in this case Dom(Abl) = Pw(EU) where Pwt(EU) represents the power set of EU, and Dom(Ab 2) - EU. Finally the robot planning problem has four attributes, namely, (1) the arrangement of block(s) on location LI, (2) the arrangement of block(s) on location L2, (3) the arrangement of block(s) on location L, and (4) the block held by the robot arm. Thus 4 S - X Dom(Ab,) where each Dom(Ab ), i 1,2,3, is a set of ordered tuples of k ig=1 blocks, 1< <3, and the empty tuple NULL, and Dom(Ab4) EU U {() in which the element 4 means that the robot arm holds no block. For example the initial state ei, and the goal state eI from Fig.2.3 are, respectively, e, -C <(A,C ),(B ),NULL,> and e - <NULL,NULL,C,B,A ),#>. A Set P of Position Values: One can then talk about the "position value in a state" of an elementary unit. It is an m-tuple, where m is the number of attributes of a problem. Each component of the m-tuple will be called the position value of the elementary unit with respect to a particular attribute in that state. Thus in the above example of the 8-puzzle problem, the position vlue of the tile 1, tII, with respect to the only attribute Abl is 2, and the position value in that state of 1t is <2>. The set P(Ab1) of the position values of an elementary unit with respect to the attribute Ab1 for the 8-puzzle problem is {1,2,...,9}, and the set, P = X P(Ab,), of all position values is i=1

19 P -(<1>,<2>,...,<9>). For the traveling salesman problem the set P ( (<T,I>,<T,NJ>,<F,I>,<F,NI/>) where T and F mean that a city has been already visited and not visited respectively, and I and NJ denote that a city is identical and not identical to the city currently being visited. The robot planning problem has the set P - (<ni,n2,ns,> >: nk E (0,1,2,3), -1,2,3, E (H,NH}}. For each k -1,2,3, each nonzero value of nI means the position of a block on location Lk and the value 0 of nk means that a block does not exist on location L^. The values, H and NH, mean that a block is held and not held by the robot arm respectively. A Position Function f: We now define a position function p: EUXS -. P and a set of subposition functions *pfIA,: EU XS - P(Ab,), i = 1,2,...,m, such that for each es E S and for each af E EU, p/(af,e,)= <pf Ab,(,e,C), sp/f At(,e ), **..PlA* (a,Ce )> where p/ (a.,e, ) is the position value of a, in the state ec, and p/Al, (af,e ) is the position value of As with respect to the attribute Ab, representing e,. For example, let, <{A,B}, D > in the (5-city) traveling salesman problem. Then for the city B, PI (B,C ) <Pf A^,(B,C, ), Pf^Ab{(B,, )> = <T,ANl>. A Set R of Rules: During the process of solving, a problem is transformed from one state into another by the application of a rule of the problem. The transformation from one state into another is brought about by the change in the position values of elementary units in the two states. Let s be the maximum number of elementary units thus

SO affected by a rule for a problem. We shall represent the name of a rule by an s-tuple where each component of the name is the name of the elementary unit affected by the rule, the names appearing in the order of the indices of the elementary units. If a rule affects less than s elementary units, its s-tuple name is filled up by any arbitrary but fixed symbol such as "". For example, suppose for a given problem s - 3, and a rule affects only two elementary units a, and *j, then the name of the rule is <ei,ai,> where i < j. In the two problems, the 8-puzzle problem and the traveling salesman problem, each rule affects two and only two elementary units. However in the robot planning problem only one elementary unit, which is the block either to be picked up or to be put on by the robot arm, is affected by each rule. In general, then, we will represent a rule, r, by <Zl,2,...,, > where,'s are the names of the elementary units or arranged in the order stated above. We will denote the set of rules by the symbol R. A Successor Relation SUCCR: If a rule r, = <Z1,2,..., 2 > is applicable in a state ey and when applied takes the problem from the state ei to eC we say that the succeaor condition formula, SCF, which is a first-order predicate formula, takes the value true for the argument (.,., ip, (al,Cj ),(...,p (., e ),(...,pj (,Ce )). A ternary relation SUCCR C R XS XS is defined as follows: SUCCR = ((<l,...,>,c,ei): <l,...,z > E R, e, E S, el E S, SCF(l,...,,, ( ),...,p (i1,e..., ),pf (seCk),...,pf (,,eC )) true. The first predicate formula SCF is given by the disjunction of rule-formulas, r_.1 I * * P, < z,..., > E R. Each rule-formula r_. * * * z, for a particular

21 rule < X1,z,..., > is specified without explicit reference to the states e and e. It provides the condition which some states e and ec must satisfy for <1,-2,'...., > to be applicable in state ei, and when applied, for it to take the problem to the state ce. From now on, in the expression for an SCF, pf (i,,e) will be designated by Le, and pf (f,,e ) will be designated by _..i. For example, in the case of the 8-puzzle problem, the rule <s1s2> which affects the position values of the xi and the tile 2 assuming sX is the blank, the successor conditon formula, ef, can be written in PROLOG-like-languaget as follows: (rt t 1( *z, * 2 y-t6, _t -1 *.. L ft, y..t,, * * * ); r.._ t2( 1 (*z 2, *yL1,y, -t *, s-, *-f, -t,*...1, * * _t); rtt(*z1( t( *z l,,*z. *,_t, ~... ~, *gt.., t, t l,..... *t )):r rs (,z,,:qlt,<jti,...,ll, *: 6,-,:_..,...,,). (2.1) where for every lt E ({ l,2,..., t), rt6 (*~ i 2,* *z * _, ~ ~ ~, * *1 _t * *..tb *. _,..t,):- =(l 1'*.^!). 1 (2.-):- ([ * ~,.] = [1t,,t ]), pO,, ( u_t,,,t_t~,. _t, o:_,~ ), member ( _tl,[..t 1,..., * -_tj-l, -, _t< +1..., ztsl), (:_tl = *.tt ). t In this language, the variable starts with the symbol "", the function starts with the lower ease letter, the symbol "," between two predicates stands for the logical AND, and the symbol ";" between two predicates stands for the logical OR. The two-argument function member is the built-in function which returns the value true if the first arument is the element of the second argument IClo8).

22 poOv ( Y_-L,,yt, _ 4,,_t ):- member (I [_Lj,,Ltj, t,r zt. ],[[2,1,1,2],[4,1,,4],J3,2,2,3],[1,2,2, ], [5,2,2,6],[2,3,3,2],[8,3,3,6],[5,4,4,5], 7,4,4,7J,[1,4,4,1J,[O6,,5.6],[4,5,5,4], 18,5,6,81,12,5,5,2],5,6,,51],(o,6,,o9l, (3,,O,3],([8,7,7,8],[4,7,7,4,][9,888, 9J, [7,8,8,7],[s,8,8,s.,8,.9,98,8],[o,o,o,eJ). As another example, we give below the formula, cf, for a (5-city) traveling salesman problem of Fig.2.2. Each rule <l1,22> affects the position values of two cities z1 and:2 where z2 is the city currently being visited and Z2 is one of the nonvisited cities (:2 becomes the original starting city A if all the cities were visited). (r.AB ( *z, z 2, ^,A,'y.B,....E,,, E,:BA,*z.., *. E ); rBA ( 1,,*, *..A, L B,.,. _JE,*z_A,*t_B,..,:J.E); rAC(, 1,* 2,9, _A,*j._B,... E,Ez_*A,zB,... z_); r_CA (z i, 2,,1_A,e pB,..., jE,:_A, z2_B,..., E); r_DE ( *Z I, 2, LA, _B,..., Z_ E, A, _B,..., _E ); rED ( I, *Z2, *LA, ILB,..., _E, _A, _B,..., *z_E )):-,e (,z,.2,, LA,*..BB,... E.Ew,Ez-A,,zB,...,, _E). (2.2) where

S3 (1) for every e, E {B,C,D,E), r_, A ( *z l, *z2 A,. /_,,.. *, _E_, zA,..., z_a,..., EzE ):- ( [l... Z2]I.,A 1), (*L.-|[T,AN]), (./_-, lr(F, ]). (._A - =[T.Nil), ( *_.. =[T,NI ). ( _A -IT,11), (,.,- z_.,). in which at E {B,C,D,E, s*7 a,, (2) for every i* E {A,B,C,D,E}, and for every *i E {B,C,D,E }, a, *), r._. i (a* (:2, *s *. * L2,,.., ~*Ly, * z., _,.~..,..,:_E ):- (I,, *2] laj,j ]), ( *^,'1[F,I]), ( lj -'F,NIl), ( z_, I[T,NI1), ( ~-, -[F,1I), ( * -z. - ). in which l, E {A,B,C,D,E), azi, *i5ji. For the robot planning problem the successor condition formula eel is as follows: (r_A (,*,, _A, *yB, qLC,*z_A,*"_B,- -C); r_B ( * i, iLA, *Y_B, *y_C, *_A,, _B,,_C ); rC( *1,z,A,'*LB, LC,*,-A,*.B, *_C)):- (c/ (I*,.A,*y_B,,t~C,.* A, *z_B,*zC). (2.3) where rA ( *z i, *ILA, *L.B, -C, zA, *LB, ez_C ):- ( *z - A ), ( iB <O,O,O,H >), ( _C O <0,0,0,H >), ( 3k E {1,2,3}X E {(,2,3 }X m E {1,2,3}X(0 > * +1), (m > k +1), ((( y-A = <k,O,O,NH >), (,._B = <I,O,O,NH >), ( y_C - <mO,O,NH >));

24 (( lA - <O,,O,NH >), (-lB - <0,1 O,NH > ), ( _C 8= <0,m,O,NH >)); (( - <_A <0,,k,NH >), (i.B - <O,O,I,NH >), ( jfC! = <O,O,m,H >)))), ( zA <O,O,O,H >), ( *._B - *LB ), ( z_C yC ). r.A ( z,,y.,A, *_B, *C, z_A,A z_B, B *C): ( A ), (*yA - <O,O,,H >), ( 3k E {1,2,3}X Y E {1,2,3)X mn E {1,2,3}X(I > k +1), (m > k +), (((*,A = <kt,O,O,NH >), (z..B - <I,,O,NH >), ( zC <m,O,O,NH >)); (( z-A = <O,0k,O,NH>), (*zB <0,1,O,NH >), (ozC = <O,m,O,NH>)); ((.A -- <,O,k,NH >), ( *..B <O,O,,NH >), (z_C - <O,O,m,NH >)))), (*ZB = *LB), (z C = I.LC). rB ( *z I, *ILA, y_B, e*L C, z..A,.*_B, z -C ):- ( *z - B), ( _A 7 <O,O,O,H >), ( *_C 7 <0,0,O,H >), ( 3 E {1,2,3)X 1 E (1,2,3)X m E {1,2,3)X(/ > k +1), (m > +1), ((( -_B == <k,O,O,NH >), (*A = <1,0,O,ONH >), ( y_C - <m,O,O,NH >));

26 (( B - <o,k,O,NH >), ( LA - <0,,O,NH >), (_C - <O,m,0,NH >)); (( *VB - <0,O,,NH >), (LA - <0,0,I,NH > ), (yC - <O,O,m,NH >)))), ( _.B -<O,O,O,H >), (,z._A -'LA ), (,zC --..C). r B( *,* LA,* _B,* LC,*,_A,zB,,*z-C) -(:- ( B), ( B,B - <O,O,,H >), ( 123}X E {,2,3X X 3m E ({,2,3)X(1 > I +1), (m >_ > +1), (((*zB = <k,O,O,NH >), (._A - <,O,O,NH >), ( _ - < m,O,O,NH >)); (( _B = <ok,O,NH >), ( tA a= <O,l,O,NH >), (*_C - <0,m,O,NH>)); ((,zB <0,0,k,NH >), ( _A <0,0,,NH >), ( _-C - <,0,m,NH >)))), (*.A - ILA ),( -zC -._C). r,-C( *z1, tA, *LBB, - C, zA,,zB, -C):- ( = C), (,yA S <O,O,O,H >), (,LB 7 <,O,O,H >), (3k E (1,2,3}X)( E (1,2,3}X nm E (1,2,3)X(l > k +1), (m k +1), ((( - -c < k,O,O,NH >), (A <I,O,O,NH >), ( yB = <m,O,O,N >));

20 (( YC - <0,*,O,NH >), ( tA - <0,1,O,NII >), ( _yB - <O,m,O,NH >)); ((V-C - <0,0,k,NH >), ( *A - <0,0,1,NH >), ( _.B - <0,,m,NH >)))), (0zC - <,O,O,H >), (( _A - JA ), ( *_B a -B). r_C( *1,,IA,",LB, yCtC,*A,e*zB,*:-C):- ( = C), (*s, C = <O,O,O,H >), ( 3* E ({,2,3)X ( {l,2,3)}X 3m E {1,2,3)X( > * +1), (m > +1), ((( z_C <k,O,O,NH >),( z.A <I,O,ONH >), (*oB - <m 0,0,,NH>)); ((*z_C - <O0,,0,NH >), (:_A <0,,O,NH >), ( zB - <0,m,O,NH >)); (( oC - <0,0,k,NH >), (:_A - <,O,I,NH >), ( *B - <O,O,m,NH >)))), (*_A - *L.A), (*zB - IB). Finally, we define a problem, M, as an ordered ten-tuple. Definition 2.2 A problem, M, is an ordered ten-tuple, AM = (EU,A T,P,S,pf,R,SUCCR,e,ce.,e,), where

27 EU is a set of elementary units, EU - ({s1, 2, ~ ~. 3), AT is s set of attributes, AT - (Ab,Ab2,..., Ab ), P is the set of position values of an elementary unit with respect to the m attributes, given by the cartesian product of P(Ab,), i=l,...,m, P - X P(Ab,) i-=1 where P(Ab,) is a set of position values of an elementary unit with respect to the attribute Ab,, S is the set of states, given by a cartesian product of Dom(Ab, ), i=l,...,m, S = X Dom(AJ,), AI, EAT -=i where Dom (Abi) is the domain of the attribute Ab,, pJ is a position function, p: EU XS -, P, such that, for any (,e, ) in EUXS, P/ (.,c, ) <iP/AA,((S,c ),.,pf Ab, (t,,, )>, where each sub-position function, spfA,: EUXS -. P(Abj), i1,2,...,m, returns the position value of each elementary unit with respect to the attribute Ab, representing the given state, R is a set of rules in which each rule, r,, is represented by an ordered tuple of s elementary units, R - {r,:(r, E (EU)') <, < E I, i-,2,...,1), SUCCR C R XS XS is a ternary relation such that for any (re,,e^) in R XS XS, (ri,,e e) E SUCCR if and only if eC is the state in which the rule r, is applicable and e is the state resulting when r, is applied to ci,

28 SUCCR - {(<s,..., >,e,,c ): (<j,, > E R ) n (e, E ) n (ej E ) n (SCF(,,,...,,,p; (41,,e),'...,p (.,'e ),p; (',,ej),',P! (',,e^ )-r,, ))} where SCF(z,...,,, -, 1. - L -. IL,,.., r, ) is a sucesor conD dition formula, c is a cost function, c: SUCCR -- IR where R is a set of reals, such that, for any (r,i,ej ) in SUCCR, e (r, e,ej ) - w if and only if w is the cost of the rule, ri, between the state, ic, and its successor state, ek, c,, is an initial state, c. E 5, e- is a goal state, ce E S. 2.3.2. Length of a Path between Two States As will be shown in the next chapter, the estimation of the cost of a path, if one exists from the state e, to the goal state e,, is the key to using the heuristic search method for efficient problem solving. In this section we define, based on the problem model AM, the upper and lower bounds of the length of a path between two states e, and ec. In the next chapter, a heuristic for the efficient search i derived based on these values. Definition 2.3 A patl from the state e, to the state cl, in which c, 7 el, is an ordered pair (p, ql) of two nonempty sequences, p = r, * - rl E R and es=, e e' _lIe E 5', in which (rl,e,,el)E SUCCR, (rle, e,)E $ SUCCR, and (r,,e l,,e ) E SUCCR, i =2,...,-1.

29 Definition 2.4 For two states e, and ce of the problem, if there is a path (p,rj) from e, to ce, then cl is a descendent state of es. Further if the number of rules in p is one, then descendent state ec is called a succesor state of e,. Definition 2.5 For a given path (p,,) between two states e, and e,,, the length of (p,) is the number of rules in the sequence p. The cost of the path from one state c, to some other state ec is then determined recursively. Derfintion 2.6 Let (p,'), in which r, * I r E R' and q c= ~ e 1- lc E S', be a path from the state e, to the state ec. Then the cost of (a, lq) is 1. COST(p, i)= c(rl, e,,ce) if = r E R, 2. COST(p, n) c(r,e,,e1) + COST(-, B) if I P r f j, es, aand (f7,) is a path from el to e. The upper bound of the length of a path between any two states of the problem is given in Lemma 2.1. Lemma 2.1 If K is the cardinality of the set P of position values, and n is the cardinality of the set EU of elementary units of the problem, then Ks is greater than the length of any path between two states of the problem.

s0 Proof By definition, each state of the problem is given by a set of position values of all n elementary units in the set EU. Since each elementary unit assumes up to K position values, the maximum number of states of the problem is not greater than K. Thu the minimum number of rules of the path between any two states is not greater than K' - 1. Q.E.D. Before presenting the lower bound of the length of a path between two states e, and ec, let us define the subpath (p(aj ),(a, )) for the elementary unit a, from Ce to e. Definition 2.7 Let (p,s) be the path from the state e, to the state e, where r,'= rl * rE R' and 9 - el e'''.. clc E S'. Then a subpath for the elementary unit a, E EU from c, to ef, which alters the position value of a, from Pf (,,e ) to pf ( i,, ), is (p(s. ),f(a, )) such that (1) p(,/) =rl * * *r, r,* E {r,.., r, }, j=1l,...,t, (2) q(a,) c,lei I' e c e,d" C,,c,i' E {(e,cI,..., et-le), j1l...-,k, (3) (rj,e,,e;,,) SUCCR, j-l,...,k, (4) p/ (a,,i) =e p/ (f, ) p (,, e, ), )= p/ (,, e,) Pf (,,cii ) 5 Pf (a,'i, ), j =,1,...,k, and pf (,,er ) - pf (j,,il+), I.1,...,*k-1.

31 Each rule, when applied to a state, changes the position values of at most s elementary units from their current values to some other values. The lower bound of the length of a path (p,q) from the state c, to the state ec may then be derived by deriving the lower bound of the length of a subpath (p(e, ),q(, )) for each d, E EU in which pf (si,e, ) 7 p/ (a,,c). The lower bound of the length of the subpath ((, ),q(mi )) is gven by Lemma 2.2. Definition 2.8 The pair (ql,Qii ) E P2 of position values of an elementary unit a. is computable if there exist a sequence of position values qj2' * * i-i E P' such that for each i E 1,...,k-1), there exist two states ii, ej,-.+1 where pf/(e,,i ) qj, PJ (a,eji,+) " qij+, and Ci+l is the successor state of je.. Definition 2.9 For each elementary unit a, E EU, and for each computable pair (q,,qk) of position values of r,, 1. Afin_LEN (<q,q >, ) - 0 if qj - q 2. MAin_LEN(<qj,qj >,a, ) 1 if (gqj qt ) and there exist a path (p,t) from one state e, to some other state ec such that p - r E R, qj - pl (a,,e ), and q = P/ (a,e,), 3. Otherwise, AfinjLEN(<qi,q >,.) = 1 + min({Min._LEN (<,qk >,, ): (q E P) n (AMinLEN( <q,q >, ) = 1)

32 n (< q,qj > is the computable pair of, )}). Lemma 2.2 Let (p(, ),(a, )) be the subpath for the elementary unit a, from the state e, to the state e%. Then Min_LEN(<pf (a,e, ),pf (a,,e )>,, ) is not greater than the minimum number of rules in p(a ). Proof Let (p(a,),r,(a)) be the subpath for *a from e, to ec where p(a,) == r,l... and q(a) "= cilel * * e. c. Then we will show Min_iLEN(<pf (a,,c, ),p/ (j,c )>,e,) < k by induction. Suppose k - 0. By definition of (p(a, ),,7(a,)), pf (a,c, ) pJ (a,c, ). Then by definition of MinLEN, Min_LEN(<pf (a,,e, ),pf (a,,c )>,a. )= 0. Thus MinLEN(<pf (a,,e, ),pf (a,, )>,ai) < k. Suppose k = 1. By definition of (p(a ),q(a, )), p (a,,e,,) = pf (a,,e,), PI (a,, il ) = P (a,,e), and.(r, l,Ce,,e, ) E SUCCR. Then by definition of MinLEN, Mi.n_LEN(<pf (a,,es ),pf (a,, )>,, ) = 1. Thus Min_LEN(<pf (a,,c, ),pf (a,,, )>,a,) < k. Suppose k = n +1. By definition of (p(a,),l(a, )), pf (a,,e,1) = pi (a,,e,), p/ (a,,c,1 ) = p (a,,c), and p (a,,e, ) = / pf(,,,,), m =l,...,n. By definition of MinJ.LEN, for each m E (1,...,n }, Mfin_LEI( (<pf (a,,ej' ),pJ (a, e)>,a ) + 1 > Ain_LEN(<pf (a,,e,. ),pf (a,,c, )>,a,)

33 and by induction hypothesis, Min.LEN(<pf (.,C,2),pf (,C, )>,aJ) < n. Then since pf (as,e 2) = Pf (s,cle ) n +1 I MinJEN(<pf (,,e,2),pf (a,,w )>,,)+ I >Min_.LEN(pl (,,c, l),pl (a,,c, )>,s, ). Thus, Min_LEN(<p! (e,,e, ),pl (S,eC )>, ) < k. Q.E.D. Corollary 2.2.1 For every two states e, and es, Min_LEN(<pf (a,,es),pf (a,,e )>,ad), a, E EU is not greater than the length of a path (,qj) from c, to c. Proof Let (p,t) be the path from the state ec to the state Ce, and (P(a,),7(,)), a, E EU, is the subpath for a, from es to ce. By defintion of (p(a,),(a, )), the length of p(a,) is not greater than the length of p. From Lemma 2.2, AMin_LEN(<pf (,,e, ),pf (a,,ce)>,a ) is not greater than the length of (^(a, ),ra, )). Thus AfinpLEAN(<pf (a,,c, ),p/ (a,,e,)>,as) is not greater than the length of (p,r). Q.E.D. Lemma 2.3 For every two states, e, and c,, the length of a path (p,r) from e, to ce is not less than - AMin.LEN(<pf (a,,c, ),p (a,,c )>,a,) where Bs, is the set e, EBI of elementary units each of which has two different position values in the states c, and P C, B,, - {,: (- E EU) nf (p (,e ) 9 p! ((,,,))}. Proof

34 Let (p,qv) be a path from the state c, and ce, and B,, be the set of elementary units which have two different position values in e, and e~. Suppose the cardinality of the set B,, is k. Then the path (p,q) contains at least k subpaths (p(. ),(, )), i* E By,, each of which alters the position value of ej from pf (a,e,) to p/(.,,c,). The value of each MinLEN(<pf (.,e, ),pf (iis,c)>,.;) is not greater than the length of the subpath (^(*),~(,)). By defintion, any rule in the sequence p affects the position values of at most s elementary units. Thus, the value of 1 Min.LEN(<pf (a,,e, ),pf (a,,% )>,, ) is not greater than the length of the path (p,qr) from c, to e, in which B,, -:(d, EU) n (P (^A,,e, ) p/ (,e, ))}. Q.E.D.

CHAPTER 3 IHEURISTIC SEARCH ALGORITHM 3.1. Introduction In this chapter we present, based on the problem model M, a systematic approach to derive a heuristic for the A' algorithm. In section 3.2 the search algorithm A' is briefly reviewed, and in section 3.3 algorithms to compute the heuristic for A' are developed. In section 3.4 the heuristic generated by our approach is illustrated by three problems, the 8-puzzle problem, the (5-city) traveling salesman problem, and the robot planning problem. In section 3.5, the power of the derived heuristic is compared against other problem-domain heuristics reported in the literature for the 8-puzzle problem and the traveling salesman problem. 3.2. Search Algorithm A' A heuristic may be applied at several points in a search to improve its efliciency. Typical points are (1) selection of a node to be expanded next, (2) selection of successor(s) to be generated from a node selected for expansion, and (3) selection of nodes to be pruned from the search tree. As discussed in section 1.3.2, the search technique which selects the most promising node as the next node to expand is called the best-first search. 36

as Algorithm A is the most studied version of best-first searches. Each state e, of the problem is evaluated as the sum of the cost, (e, ), of the best currently established path from the initial state eJ, to c,, and the heuristic estimate, A (e, ), of the minimum cost of the path from e to the goal state ce. The value of the evaluation function of a state e, is 1 (e, ) 9 (e) + A (es ). Among all the unexpanded states, A selects for expansion one state with the minimum value of f (e ). Algorithm A' Begin /* Initialize three sets OPEN, CLOSED, and AC G* OPEN:= CLOSED:- AC:= A; /* Generate a tree TREE where a root is the initial state e,. */ AC: AG U {(,.}; OPEN:= OPEN U {e, ); CHOOSE: If (OPEN e- ), then return (No Solution); Compute the evaluation function f (c,) for each state e, in OPEN where / (c,) - g(e ) + (e ); Select the state e, in OPEN such that for each ce in OPEN, I. / (c, ) < I (),) or 2. (e,)- (e,) and g()(e > g(e,). /* Update the sets OPEN, CLOSED, and AC */ OPEN:- OPEN - {, ); CLOSED:= CLOSED U {es}; AG:- OPEN U CLOSED; If (e, = the goal state c ), then return (Solution Path on TREE from e,, to el); /* Expand the selected state e, */ W(c, ):= {(e: c is the successor of e ); If( )(e) ), then jump to CHOOSE; /* Establish a path on TREE from e, to each ej of its successors,/ For each et E W(e, ), if (ejt AC), attach to ck a pointer back to es and update OPEN, OPEN:= OPEN U (e };

37 if (ek E AC ), direct its pointers along the path on TREE yielding the lowest g (e ); if (eC E CLOSED required pointer adjustment), reopen e, OPEN:- OPEN U (e{); Jump to CHOOSE; End-algorithm The significance of A' is in its admissibility. It guarantees the optimal solution, if one exists, because A(e, ) A'(c, ) for every state c, E S where'(c, ) is the minimal cost of the path from,e to the goal state e. If the heuristic A (e) satisfies the condition of monotonicity that A (e, ) < (e) + c (r,,e,,e,), then A can reduce its processing time by not reopening a state already in the set CLOSED. The heuristic A (e,) satisfying the admissibility and monotonicity has been developed for several problems. For example, in the 8-punle problem the value of A (c,) can be the number of misplaced tiles as compared to the goal configuration, or it can be the sum of the Manhattan distances that each tile is from its goal configuration IGas77, Nil80, Pea84]. However, a heuristic such as these is typically dependent on the problem. Although literature is full of suggestions about how to use a given heuristic A (c, ), not much has been proposed about how to find A (e,) itself. In the next section we present a general approach, based on the problem model M, to compute a heuristic A (e ) of a problem. 3.3. Heuristic The difficulty in computing the minimal cost A^(c,) of the path from the state e, to the goal state e. comes from the fact that the number of constraints to be satisfied for evaluating a state and its successor states grows exponentially with

S8 the length of the path from e, to e9. One of the most general ways to reduce this difficulty is to simplify the problem and estimate A'(e,) from the simplified problem. The efficiency of computation of A (e,) depends on the method of simplification of the problem and the degree of simplification. However, with increasing simplification the estimated heuristic may drift further away from the actual minimum cost. We base the computation of our A(e, ) on two simplification steps: (1) the cost of the path (p,17) from the state e, to the goal state e is estimated in terms of the minimal costs of the subpaths (p(a ),q(i )), di E EU, and (2) the cost of each subpath (p(i ),,(,)) is estimated using relaxed successor condition formulas SCFR' and, for the case of nonequal costs of rules, also, SCFRI,,>.,)' defined later. We will call SCFR':, the relaxed successor condition formula for an elementary unit.i, and SCF(eI,,, >*,,, ), the relaxed successor condition formula for the s elementary units an,,..., 6,. We rfit define two relaxed formulas SCF.FtI and SC, and discuss the way to derive SCF.Re and SCF(<,,>,.. ). Finally we discuss the way to compute A (e,) based on these relaxed formulas. 3.3.1. Relaxed Successor Condition Formula As defined in section 2.3, the value of a successor condition formula SCF(z,.., s,L._ l, I._. -,z_. IL,.., - _9. ) depends on a rule <1,.., d, >, the position value L.., of each elementary unit it in a state c;, and the position value az. of each elementary unit a, in a state j.

39 A set of n relaxed formulas SCFR(iLat,., ), *, E EU, is derived. Each SCFRI(v;,z.ci;) constraints only two position values La, and z^, assumed by the elementary unit e* in ci and ej, respectively. Defimition 3.1 Let SCF(:x,...,,(l1,.. t91.*_^i..., 9 *m..) be the 2n+s variable g ~ I I successor condition formula of a problem. Then for each d; ~ E(, the relacd succecsor condition formula for, is the two-variable formula SCFR'1(,L,Z_,) such that for every (zl,...,*,,qg,...,,,...,q5,q1,-.,q,,..,qg ) in RXP" XP", if SCF(z,...,,ql..., qi,,...,q,ql,..., qi,. ) = true, then SCFR'(q,q, ) - true, and no other pair of argument values satis fies SCFR'. There are various ways to derive each relaxed formula SCF.R'(yV_,,z_,), a, E EU. It is especially easy if the formula SCF is given in PROLOG. PROLOG holds the following fact [Clo81]. Fact 1 Anonymous variable, denoted by "", in PROLOG is the variable which does not bear explicitly its corresponding value. Assertion 3.1 Let cl(v,..., vK) be a clause with K variables, v,..., v -, given in PROLOG. Then for each 1 < K' < K, the relaxed clause el(t1,..., vK,_,...,_) derived by substituting anoymous variables,, for the variables, vi.'.... ^ is

40 such that for each argument <l,.., qK',..., qK> of the variables <vP. ~ K. r K,..,K >, if Clg(q...,... fqK) am true, then cl(ql,., K,,...,_ ) - rue and no other set of K argument values satisfies the clause el(v,. -, K',', — )' Proof Let cl(vl,.., K',...,K) be the clause with K variables, and cl(v,..., V,..., ) be the relaxed clause derived by substituting anonymous variables,, for the variables v tl,..., vK' First, suppose the argument <ql, * Q K' qK - - > satisfies the clause cl(vl,, K,... K), i.e. c(l(ql. * ~. qK', * ~ qK )" true. Then by Fact 1, cl(q1, * * qK' P —-,*..- )' true with qK' +1..* * K corresponding to the values of the K-K anonymous variables. Next, suppose for the argument <gq..., qK > (, cq..., q.' —..) true. Then, by Fact 1, there exist some K-K' values qK' +'.., qK corresponding to the K-K' anonymous variables such that cl(ql..., ~q~ qK' 1',..' qK) = Ktrue. The argument < ql, ~ ~ ~ 9K q K' +1, * * qK > satisfies the clause c (v,., K' "K' +1''.', v ) Q.E.D. Using the property in Assertion 3.1, the relaxed formula SCF1,R is easily derived when the formula SCF is given in PROLOG. Let the successor condition formula sef in PROLOG be given by the disjunction of rule-formulas rl * * * a, <a^.. * *, > E R, where each ra^lt *- * d, is given in the conjunctive normal form with I4 clauses, clki, j=l,...,I.

41 (r_all' 1 e 1( e I,* *,,*- ~,... * *,-, ~ *,. *.. * ); *-4 I K d#K ( *Z Ito *. *,V *0) r-e;l * * *.K(*~f( *.., ~-,,_ l,.,, *L..., ~g~~,...,)):-,cl (-*"t -*,f z,," **l..., *L".,-*1,* * *, -"). where for each tI,...,K, rl I *., ( e* t, ~. f, *t,. *IL, I, *s. *,* I, ~i. ~ P - z.0 ):- c4,(. ),-,~,( ** * ) Then, the relaxed formula cf/_, _rel for i is given by the disjunction of relaxed rule-formulas r_lc * * * a,^rel, < al,.,.,, > E R. Each r_l. *~.. *jrel is derived by substituting anonymous variables, _, for the variables other than *.R_, and *:_a, in the I clauses cl4,, j-l,...,l. (r_** * ~, *_rl ( (y_d,,*z ); _e IA'' * K -CI el( *,, e*_, )):- c/_d _rte( *Ji, J*_. ). where for each I =1,...,K, r.t 1, _tc ( t y_,,,_,i ):- ~,1(-_,...,_, *L,_,...,_,,z_,_,...,_ ), cis(_-,...,_,'_a, _,...,_.,,, ). For example, the relaxed formula (3.1) is derived for the tile t5 from the formula SCF in the equation (2.1) for the 8-puzzle problem, and the relaxed formula (3.2) is derived for the city B from the SCF in the equation (2.2) for the (S-city)

42 traveling salesman problem. (tr_t t _tel('*Kyl,,z,_t );...; rt t &rcl( *Lt(s, e-z_); see; r_t6 trcl( *Lts, *z_t s,)):- c/_trel( ets, (z _t). (3.1) where (1) for every tt 7 t1, r_ t _trl ( *l 6, zt 6):- (L, )=[t,' 1), PO (-_ - -_ - ), member ( _,....,_, 2_t,_,...,_ ]), ( z.-t = *yt ). (2) for ts, rt t &rel ( (*t t, *_.t s):- (L,- ]=[,,t i), po (v,,-_t s,_-,;- t 5), member ( z_t,L,...,_ ), ( *zt = *jt ). The relaxed formula derived for the city B from SCF in the (5-city) traveling salesman problem is as follows: ( r_A B_rel ( *_B, *,B ); rBA_rel ( y_B, z_B ); rA C_rcl ( j_B, *_B ); r-CA_rcl ( _B, *zB );....

41 r.BEjrel ( *tLB, e_B); rEBrcd ( *LB, *z_B); rDE_rct ( ILB,,_B); r_EDrcl ( uB,,_B )):- *cf_B_relt( y.B _B ). (3.2) where (1) for every. E {A,C,D,E, and for every E { C,D,E,., 5 a,, r_,j,i _rel ( *LB,z_B ) - (L_-]=I.,, ]), ( —_ =[F, ), (_-CFNIl), (_ IT,Nil), (_ IF,I]), ( *.B-' _-B), (_ - ) and for every a, { C,D,E}, r_s; A_rel ( sitB, *zB ):- (L,-_=. >,A I), (_- =T,NI), (_-C=(F,), (_=[rT,NI]), (_ =[T,NIl), (_-=[TT,]), (*,B B), (_ _) (2) for every *i E C,D,E), r.Bad _re (y_B, *z...B ):- (L,-_ leB,,,]), (*o_ LB-IF,]), (_ lrF,NI), ( z_B =IT,N/l), (_[F l,]), (_-_ ). and r_B.4_rcl ( y_B, *z_B):- (L,_]-I,^A 1), (_-LTN]), (~_B=[F,]). (_-T-r,NI]), (eB [Tr,N]), (_, l.[T,lj), (_=_). (3) for every i E (A,C,D,E}, rrr B rc ( *ILB, oz_B )

44:- (L-',_ll-[,,, l), (_-[F,]), ( oLB-[F,N]J), (_[T,NIl), (o_B iB[F,/]), As discussed above, the relaxed successor formula is given by relaxed ruleformulas. The rule corresponding to each relaxed rule-formula will be called the simplified rule. Thus, for given two states e, and cy, if SCFo'(pf (.,e, ),p/ (.,,c )) -true, pf (,,e, ) p/ (ai,c ), then we can say that *, can be moved from its position value pf (e,,e,) in e, to its position value pf (.,,e ) in cy by one and only one simplified rule. As will be discussed in the next section, a set of relaxed formulas SCFR'1, *- E EU, is sufficient to derive a heuristic for a problem in which the costs of rules are equal. For a problem in which costs of rules are unequal, however, one more relaxed formula with less relaxation is necessary to derive the heuristic. Derfiition 3.2 Let the successor condition formula SCF(z1,..., zg_6 1-,,- V 1,., a... t, 1J. Io.,:.. 9 ) be in the disjunction of rule-formulas, r_..^'* *' e, < l,..., *a > E R, where each r..l * *~ is the conjunction of some clauses. Tben the relaxed formula SCFc >,R) for the s elementary units, i,...,, is given by the disjunction of relaxed rule-formulas, rzl * * sa, I * j e ^_rel, < IkI,..., > E R, where each r.2 * * *, a s *-, _jretl is derived from r_.t * * *. a by substituting anonymous variables,., for the variables other than x:, sLei, and:_l, I 1,...,.

45 For example, the relaxed formula SCF,'S, >.D E) for the two cities, D and E, in the (&5eity) traveling salesman problem of Fig.2.2. is given by the following: (rz I 2A B_-rl(, *2,2,.D, *LE,*fz_,D, *z.E ); r_z l 22A Crfl( *z l, *z 2 LD,'LE, zD, *_~E ); r z2 CA.rtel( ez,* z2, ijD, tLE,,zD, zD_E ); r_S I 2 DE_rCI ( *z i, * 2, 2SD, *ILE, *zD, szE ); TZ 1z 2ED_rc l( *z, *2 2, *LD, *LE, *D, _E )):- *s _(< zl,2>,D,ELrel( _D, LE,* zD,*z_E). where (1) r_.1zz2DE_cel(*sz,Iz2, 2_D,L..E,*zD,*z_E):- ([o. 1o.=Iv,E]), ( _vD F,1]), ( ~_Lr-F =,N7 ]), (.~_D [T,Nz]), ( z_E = IF,), (_ _ ). fZ 12 2EDrcl *sz 1, z 2, jlD,,.LE,*_D,zE) - ('i,'* 2]-E,D 1) ( ~rE =F,I ]), ( *._D lrF,NI]), ( *._E =lT,Nz ]), (;_vD =IFl 1), (__). (2) r...z 2DA_rel ( 1 2', *eD,I L.E,;,D,,_E):- ([e.,*.[TD,A ]), (.y_E-[T,NI]), (y_D =rF,I]), (_E-T,Ai1), ( o~_-'T,Nl]), (_ T,]), ( oz_E= o*y_E).

46 rs i 2EA._rel( *, t*z 2,.. sD,LtE,,,_, szE ):- (I*zi,,zJ -IE,A 1), ({ D -[T,Ni]), (*{E -[F,l]), (_ i[T,NIl), (.tE-I[Tr,Nt]), (.-[T,Il), (_:D _.D ). (3) for every in E (A,B,C), -rS 2si Dr- ( *2, 3, 1 D I, *-E, I, zD,E ):- (l[*,, -2J^lD ), (. IF,11), ( LD IF,NJl), (_ - T,NI ]), ( z- -IF,I]), ( z..E _ ). rz l 21i Ercl ( 2 1, Iz2'L2 D, sE *,zD, *zE ):- ([1s*l,21]-d.,Ei), (_-IF,I), (o —EiF I,NIl), (_T-T,N]), ( oE -[IF,), (~_ —D -_ D). (4) forevery i E {B,C), rfz s 2Dj, rel( e*, 2, Y-D, JLE, z_D,:,E ):- ([*l, 21=[D,., I), (tD- -F,I), (_-F,NI), (*o_D I-T,NI]), (. -[F ^,), (z;E - *LE ). rz 12 2Ej _rel ( *2 1, *z 2, LD, *L.E, z.D, *_E ) - (['i *, 21E,. ), (.LE-[FIL), (. i,NI/), (*_r-rT,NI), (_ =F,I]), (_D LtD ). (5) for every; E {B,C), r.. I 2. A_rcl( *z1, *2, eD,jE, *zD,*JzE):- ( [*, *l2J=[.,A I), (ILvD IT,NI), ( _LE [t,NI]), (_ [F I l), (_ [T,NIJ), (_ =T,NI ), (_ =T,I]), ( aD = L*D ), ( z,_E = _E ). (8) for every E A,B,C }), and for every a, E (B,C,,,.,, _- 1s 2. Ij _-el ( *2 I, * 2, /D, _E, zD,,z. E )

47 - (lo,* 2l-I,,.,J l), (_- lF,I), (_ l[F,NI), (_ m[Tr,NlI), ( _c[F,]l), (J-D =.*LD ), (._E -. = E ). 3.3.2. Heuristic Derived using the Problem Model M In this section we describe the procedure to derive the value of the heuristic A (e,). We rwst discuss the case for which each rule has the same cost w. 3.3.2.1. The Cae of Constant Rule Cost Suppose (p,q) is the path from the state e, to the goal ce. The problem then reduces to estimating the minimum number of rules in a sequence p. Let Bs, be the set of elementary units whose position values in the state c, and the goal ce are different, B, = (a,: (,., EU) n (pf (.,ej,)p(.,e, ))}. If (p(a, ),(il, )), a, E B,, is the subpath of (p,q), then the minimum number of rules in the sequence p is not less than the minimum number of rules in the sequence p(i ). Further the minimum number of rules in p(si) is not less than the minimum number of simplified rules required to take a, from its position value pf (e,,c, ) to pf (a,,ce). (This is proven by Lemma 2.2 in Chapter 2 and Lemma 3.1 in Appendix A.) The minimum number of simplified rules to take a, from pi (.,c,e) to pf (a,,e, ) is recursively derived from the fact that for every two distinct position values q, and q, of a,, if SCFR',(q,,q, ) true, then one and only one simplified rule is required to take a, from q, to q, Let Ldi t(<pf (a,,c, ),p (a,,c )>,a ) be the minimum number of simplified rules to take a, from pf (a,,e, ) to p (l,,c ). Then the value

48 A'(,) - max({w Ldist (<pf (,,e, ),pf (.,,c,)>,.,): *, E B,,)) (3.3) is an admissible and monotone heuristic. (The proof is given by Lemma 3.3 in Appendix A.) If the set B,, has more than one element, then the value,(e, ) =1 w- Ldit(<pf (ai,e,),pf (.,e,)>,a ) (3.4) a EB, is also an admissible and monotone heuristic. (The proof is given by Lemma 3.2 in Appendix A.) Further, if the problem such as the 8-puzzle problem has some elementary unit(s) whose position value(s) is(are) affected by every rule, another admissible and monotone heuristic, as proven by Lemma 3.4 in Appendix A, is given by ^"(, )E wLdist(<pJ (a,,e ),p/ (4,,c' )>,a, ). r-ln I11!.~B,, I3(5) The set 0 is the collection of elementary units whose position values are affected by every rule of the problem: n n X, o { —,. }- {}<s,..., a, >ER For example, in the 8-puzzle problem 0 {- (t)}. The best admissible and monotone heuristic A(e,) can then be given by the maximum value of A'(e,), I'(e,), and A'"(C ): h(e ) max(('(e ), A' (e, ), A'(e ))). (3.6) The admissibility and monotonicity of A(e,) is proven by Lemma 3.5 in Appendix A.

49 Algorithm HEU, presented later, computes the heuristic A(e,) in (3.6)-based on algorithm DIFF. Algorithm DIFF generates the sets DIST (1,r,,pf (a,e,)), I=1,..., P -1, for each 4, E EU. For each pair <qj,pf (a,,c)> in the set DIST(I,,pf (a;,e )), Ldist(<q,pf (a,,e )>,,) = I. DIFF also generates the set of two distinct position values, pf (a,c, ) and pf (c,,e,), of d, in which there is no path from the state c, to the goal c,. Each of these pairs, contained in the set DIFF (s LIMIT,,pf (a,c, )), LIMIT - P I I, will be called a noncomputable pair. The input I.,(d,) for each a, E EU to algorithm DIFF below is given by I,, (d ) {p (a,,c )}. Algorithm DIFF (P, (SCF (y., _.,.): *, E EU), {I,0,(aj): i E EU)) Begin For each *i in EU do begin For each q, in I,, (a ) do begin P2(.,q, ):= {<q,q, >: (q E P) n (qk q, )); /* Find every pair of position values of i, between one state and */ /* its successor */ LENl(ai):u {<q,qk' >:(qp EP) n (qk EP) n (qj q' ) n (SCF,'t(q,q' )- true )); /* Generate the set DIST(I,,,q,) */ DIST(l,i,q, ): { <qj,g, >: (<q,, >E P2(a., )) n (<qk,q > LEN 1(., )); /* Update P 2(;,q, ) and LEN 1(-i) /1 P2(.,q, ): P2(,,q, ) - DIST(l,e1,, ); L (): LEN 1( LEN l() - DIST (1,a,g ); n:= 2; Whle (P2(.,q,g) d and n < IP -1) do begin DIST(n,,,q ):= <q,q >: (< q,q > E P 2(a,q ) n (3<qkt,q' >X 3<fq',q >X(<q,qi' > E LENI(a, )) n

60 (< qj,q > E DIST(n -I, )))); /* Update the set, P2(ai,q ) */ P 2(,q, ):= P2( a. q, ) - DIST(n,a,,, ); If (DIST(n,e,,qj) ), then go to NEXT; n:= n + 1; end-while NEXT: If (n < IP -1), then DIST(k,r,q)::-, -n +1,..., P -1; /* The length between each pair of position values left in P 2(.,,q ) */ /* is not computable */ DIST(e -LIMITi,q): P2(,,q,), here LIMIT:, P I IEU l; end-for-do end-for-do Return DIST(k,i,qj), for k E 1,..., P -1, L LIMIT), a ~EU; End-algorithm Although the complexity of algorithm DIFF depends on the cardinality of each set DIST(/k,.,q ), kl,..., | P I -1, a, E EU, it is easily shown to be bounded by O(n I P I')when the binary search is used. For example, each set DIST(k,a,,pf (,j,el)) derived for the 8-puzzle problem, the (5-city) traveling salesman problem, and the robot planning problem given in the section 2.2 is as follows. The 8-Puztle Problem The goal state from Fig.2.1 is given by c == <tltst7t2t4 t6tatqt6>. By definition of the position function pf, pf (t,e,) = 5, pf (tl,c) = 1, pf (t2,cf ) =e 4, p/(13,Ce^)7, pf(t,e)8, p(t), pP(t6e,) =, pf(t6e,)= 6 pf(t7,t,) 3, and pJ (tg,e) = 2. Then by algorithm DIFF, for each t E {t,t,.., t}, LEN 1(t ) = {(1,2),(2,1 ),(2,3),(3,2),(4,5),(5,4),(5,8),(6,5),(7,8),(8,7),(8,9),(9,8),

51 (1,4),(4,1),(4,7),(7,4),(2,5),(,2),(5,8),8,5),(3,6),(6,3),(6,9),(9,6)}. DIST(1,,,pf (t,,5c ))- DIST(1,t,5) {(4,5),(6,5),(2,5),(8,6)}. DIST(2,t,,6) - (1,),(3,5),(7,6),(9.5)). DIST(k A,,) 5)-, - 3,...,8. DIST(l,tl,pf (t1,c )) - DIST(l,t,,l) = {(2,1),(4,1)). DlST(2,t,,1) -{(3,]),(5,),(7,])}. DIST(3,t,1) = {(0,1),(8,1)). DIST(4,t,,1) {(9,1)). DIST(k,t,,) -, k 5,...,8. DIST(l,t2,pf (t2,C )) DIST(1,12,4) - {(2,4),(6,4),(8,4)). DIST(2,2,4) ((2,4),(6,4),(8,4)). DIST(3,t2,4) {(3,4),(9,4)}. DIST(k,t2,5) -, k 4,...,8. DIST(l,ts,pf (t3,e )) = DST(l,t,7) - {(8,7),(4,7)}. DIST(2,tS,7) ((5,779),(1,7)}. DIST(3,ts,7) ((2,7),(6,7)). DIST(4,t3,7) ((3,7)). DIST(k,t1,7), 5,...,8. DlST(l,t4,pf (t4,, ))= DIST(1,t4,8) = {(7,8),(9,8),(5,8). DlST(2,t,8) = {(6,8),(4,8),(2,8)). DIST(3,t4,5) = ((1,8),(3,8)}. DIST(k,t4,5) =, k =4,...,8. DlST(I,t,spf (tce, )) = DIST(l,ts9) = {(8,9),(6,9)). DIST(2,t.,9) {(5,9),(7,9),(3,9)}. DIST(3,t6,9) {(2,9),(4,9)}. 4 j

62 DlST(4,t,t9)- ((1,9)). DIST(k,t6,9), k =5,...,8. DlST(l,t,,pf (t,,e,)) - DIST(I,,t,6) {(,(3,),(,6)}. DIST(2,t,,8) {(2,6),(4,6),(8,6)). DSTr(3,t,,6) - (1,o),(7,6)}. DIST(k,t6,), k =4,...,8. DIST(l,t7,pf (tt,e, ) DISTr(l,t7,3) {(2,3),(o,3)}. DIST(2,t7,3) {(1,3)(5,3),(9,3)). DIST(3,t7,3) - ((4,3),(8,3)}. DIST(4,t?,3) ((7,3)}. DIST(k,t7,3) -~, k =5,...,8. DIST(l,tg,pf (t,,e,)) - DIST(l,ts,2) = ((1,2)(3,2),(3,2))}. DIST(2,ts,2) = {(4,2),(6,2),(8,2)}. DIST(3,ts,2) - ((7,2),(9,2)}. DIST(k,t,,2) -, k =4,...,8. As shown above, for each elementary unit t^, every pair of position values of a, is computable in this problem. The (5-city) Traveling Salesman Problem From Fig.2.2, the goal state el in this problem is that the salesman visited each city once starting the city A -and came back to A. Then by definition of the position function pf, pf (A,e,) = < T,1 >, pi (B,ce) -< T,NI>, pf(C,,)= <T,NI>, pf (D,e,c)= <T,N>, and pf (E,e ) -<T,NI>. By algorithm DIFF, for each city a, E (B,C,D,E}, LEN' I(sl ) ~((<F 91 > q<T tNI >)(<F pNI > 9<F vl>)).

63 DIST(l,e,,pf (,,e ))- DIST(l,,;,<T,NI >) ((<F,I>,< T,N >). DIST(2,,,<T,NI>) ((<F,NI>,<T,NI >)}. DIST (3,e,< T,NI >) /. There are some noncomputable pairs of position values of a, which become the elements of DIST(a.LIMIT, ) where - 2 and LIMIT = 46 = 1024. DIST(.'LIMIT,ei,< T,NI >) {(< T,I < T T,NI >)}. For the city A, LENl(A ) ((<F,I >,<T,NI >),(<T,NI >,<T,I >)}. DIST(1,A,pl (A,e, )) DIST(,A,< T, >) = {(< T,NI >,< T,I >)) DIST(2,A,< T,I >) } ((<F,I >,< T,I >)). DIST(3,A,< T, >) -. The set of noncomputable pairs of position values of A is DIST (L LIMIT,A,< T,I >) {(<F,N >,< T,I >)}. The Robot Planninz Problem From Fig.2.3, the goal state eI is <NULL,NULL,(C,B,A ),NH >. The goal position value of each block is pf (A,e) = <0,0,3,NH >, pJ (B,e,) = <0,0,2,NH>, and p/ (C,e,) <O,O,1,NH>. Then by algorithm DIFF, for each block o, E {A,B,C }, LEN 1(o, ) - {( <n 1,O,O,NH >,<O,O,O,H >),( <O,n2,0,Nlt >,<O,O,O,H >). (<O,O,n 3,NH >,<O,O,O,H > ),(<0,O,O,H >,< n l,0,0,NH >), (<0,0,0,H >,<0,n2,0,NH >),(<0,O,O,H >,<O,O,n 3,N >): n E {1,2,3},,==1,2,3). DIST(1,A,<0,0,3,NH >) = {(<O,0,0,H >,<0,0,3,NH >)). DIST(2,A,<0,0,3,NH >) = {(<n,O,O,NH >,<0,0,3,NH >),

64 (<O,n2,O,NH >,<0,0,3,NH >), (<O,O,n3,NH >,<0,0,3,NH >): nj E (1,2,3), k=1,2, naE (1,2)). DIST(k,A,<0,0,3,NH >) -,* -k3,...,9. DIST(,B,<0,0,2,NH >) - {(<O0,,O,H >,<0,0,2,NH >)}. DIST(2,B,<0,0,2,NH >) - ((<n,O,O,NH >,<0,0,2,NH >), (<O,n2,0,NH >,<O,0,2,NH >), (<O,O,n3,NH >,<0,0,2,NH >): nt E {1,2,3}, =1,2, n E {1,3}))}. DIST (k,B,<0,0,2,NH >), * =3,...,9. DIST(1,C,<O,O,,NH >) -= ((<0,0,0,H >,<O,O,1,NH >)}. DIST(2,C,<0,0,1,NH >) (- (< n,O,O,NH >,<O,O,1,NH >), (<O,n2,0,NH >,<O,O,I,NH >), (<O,O,n3,NH >,<0,0,I,NH >): n, E {1,2,3}, -1,2, ns E {2,3}). DIST(,C,<O,O,1,NH>) =, k =3,...,9. 3.3.2.2. The Case of Nonequal Costs of Rules In this section, we discuss the procedure to derive the heuristic A(e, ) for the case of nonequal costs of rules as in the traveling salesman problem. Let (p,v7) be a path from the state e, to the goal state el. We will estimate the cost of the sequence p by estimating the cost of minimum number of rules in the sequence a, ), a, E Bs, where (p(, ),Vj(a )) is the subpath of (p,)). Suppose Ldit (<pf (ai,, ),pf (a,,e )>,a,) = Ki. Then as mentioned before, the number of rules in the sequence p(, ) is not less than Ki. Furthermore, for each

66 n E 1,...,K;, there exist at least one rule <ca&,...,*,. > with some *^" a,, which will be denoted by <^,..,,..., a >, in the sequence p(,a) and two corresponding states, e. and c,', in the sequence (a, ) such that (< *.- -, a....,,.k. >,c,^., ) E SUCCR, Ldit (<pf (a,,e. ),pf (i,c, )>,;) - n, and Ldit (<pf (a,,c,, ),pj (,e, )>,*i) - n -1. (The proof is given by Lemma 3.6 in Appendix A.) We first determine a lower bound of the cost of such rules for each n. Then the cost of minimum rules in the sequence p(s,) is not less than the sum of Ki such lower bounds. Let this sum be given by LOCS(a,,e,pf (a,,e )). Then the heuristic A (, ) is given by A(C,) max({A'(e ), A'(c, ), " (e,)}) (3.7) where A'(,) = max({LOCS(a.,,,pf (a.-,e )): a, E B, )) (3.8) A'(c) } 1 LOCS(a,,,e,pf(.,, )), (3.9) I t ~ LOC tageOCS,,,p,% )). *., A"(s, I )o,,, (3.10) Although the way to generate the value LOCS(a,,e,pf (a,,e,)) is formally described by algorithm LOCS, we will briefly explain it here. As mentioned above, LOCS(a,es,pj (a,,e )) is the sum of K, lower bounds of c(<la,,,....., >,,c. ), nl=1,...,K,. Then it suffices to explain the way the lower bound of c(<aa.,....., 6... >,eka,e>,' ) for each n E {1,...,K, } is derived.

6s Let each set C(e,c, ), a* E EU, contain every pair of two position values of al which can be assumed in a state and its successor state which result when a sequence of simplifed rules is applied to e,. First we derive every rule <<ey,..' - > E R with some w4=.,, which will be denoted by <a i,,,.., ii >, such that for some <qi,q4l > E C(a, e, ) for each I, (1) SCFRIl (I) SCF^^,>(<I,>,;.. * *, *^.. >..,jqi. P alQ -~,~,;,(,,"' -, ~ ~' -'", - I,, ",q l<,q * *i, ~ ~', i, ~ ~ ~ q, ) = true, the s elementary units ai,,...,,,..., ay, and (2) Ldist (<q;,p (,c )>,^ ) - n and Ldit (<q',pf (i,c, )>,ai) n-l. It is easy to see that the original rule <,,...,,..., > satisfies the above conditions (1) and (2) because for each I E (,..., }, <P/ (<.,,. ),pJ (,.,L., )> E C (a.',F, ), SCF^,t,..,,,t!,...,,.. Y,,p/ (fl;i,t ),...., PJ ( sCek ),..,^Pf (^, CekI ),Pf ( i k,C.' ), —,pf (C,C.,e ),...,Pf (a-k.'e )) = true Ldiat(<pf (ai,e, ),pf (i,e, )>,; )= n, and Ldit (<pf (a.,e,, ),pf (.,,e, )>,a,) = n-1. Next, for the fixed i, we select the lower bound of the costs c(<<;i. ~*, -i,,,...,,>,ctieC, ) of all the rules < lj,.., *,, -,.. j > derived above.

67 Algorithm DESC below generates the set C(c,e,) for each a, E EU when the state e, is given. Each set DIST(la,,q ), qt E P, used for DESC is generated by algorithm DIFF with the input I,, (a,) - P. Algorithm DESC (c,) Begin For each a, in EU do begin C(.,c,):{ (<q^, >:(gt EP) n (q' EP) n (SCF.'(q(,qf )l true) n ((qk - p (,,c,)) U (3iX(i E (1,., IP I-i}) n (<pf (,e, ),qt > E DIST(j,,a,,q ))))}; end-for-do Return C(;,,), a, E EU; End-algorithm For example, when the state e <{A,C},D > in the (&-city) traveling salesman problem, the value of LOCS(B,e,,pf (B,e)) for the city B is derived. Since pf (B,e, ) <F,NI and p/ (B,ec ) <T,NI>, Ldi;t ((<F,NI >,< T,N > ),B) - 2. Algorithm DESC generates C(A,c,) {(<TNI >,< T >),(<TNI >,< T, >),(< T >,< T1r.>). C(B,c, )= ((<F,NI >,<F,I >),(<F,I >,< T,NI >),(<F,NI >,<F,NI >), (<F,I >,<F, > ),(< T,Nl >,< T,NI >))}, C(C,e ) {(< T,NI >,< T,NI >)}, C(D,c, ) (<F,I >,< T,N > ),(<F,I >,<F, >),(< T,N >,< T,N >)}, C(E,e ) ((<F,NI >,<F,I >),(<F,I >,<rT,NI >)(<F,NI >,<F,NI >), (<F,/ >,<F, >),(< T,NI >,<T,NI >).

68 First we derive the lower bound of the cost of rules for n -2. Two rules <D,B > and <E,B > satisfiy the conditions (1) and (2) given above: for the rule <D,B>, there exist (<F,NI>,<F,I>)E C(B,c,) and (<F, >,< T,N>) E C(D,c, ) such that SCF(<,,>.DB) (D,B,<F,Nl>,<F,I>,<F,I>,<T,N>) = true, Ldsit((<F,NI >,<T,NJ >),B) - 2, and Ldt((<F,I >,<T,NI >),B) = 1. For the rule <E,B>, there exist (<F,NI>,<F,I>)E C(B,e,) and (<F,I >,< T,NI >) E C(E,e, )such that SCF R,,> (E,B <F,NI >,<F,I >,<F,I>,< T,NI >) = true Ldiat((<F,NI >,<T,NJ >),B) - 2, and Ldist((<F, >,< T,NJ >),B) = 1. The lower bound for n =2 is then given by the minimum cost of <D,B > and <E,B>. Similarly for n -1, two rules <B,A > and <B,E> are derived. For the rule <B,A >, there exist (<T,NI >,<T,I >) E C(A,e, ) and (<F,I>,<T,NI >)E C(B,e,) such that SCF,, >.BA )(B,A^,<T,NI >,<F,I>,<T,I>,<T,NI>) true, Ldist((<F,I>,<T,NI >),B) - 1, and Ldit((<T,NI >,<T,Nl>),B) = 0. For the rule <B,E>, there exist (<F,I>,<T,N/>)E C(B,e,) and (<F,NI >,<F,I >) E C(E,e, )such that SCF(<s>.B.E)(B,E,<F,I>,<F,NJ>,<T,NI>,<F,I>)} true, LdiA t((<F,I>,< T,A >),B)= 1, and Lditt((< T,NI>,<T,NI >),B) = 0. The lower bound for n =1 is then the minimum cost of <B,A > and <B,E>. The cost of each rule < ai,da > is given by the distance between two cities a, and at. Thus, from Fig.2.2,

0o LOCS(B,e,,pf (B,e,)) - mn((10,10}) + min({7,10}) 10 + 7 - 17. Algorithm LOCS (k,e,,pf (cI,e,)) Begin /* Find the length from p/ (ca,, ) to p/ (a^,c) */ d:-:= Ldit(<pf (a,, ),p/ (k,C )>,e ); /* If the pair <p/ (a,e, ),pf (k,e, )> is noncomputable, */ /* do not go further */ If(d - I P I lUl), then begin LOCS:- t, va"d, where tw is the maximum cost of the rule; Return LOCS; end-if /* At each of d intermediate stages, refine the set C(at,e ) */ /* which is generated from algorithm DESC */ While (d' 7 0)do begin /* Find all position values each of which has the length of d' from */ /* the position value, p/ (ji,e ), of * with respect to the goal state, e, */ D (,d',p/ (.i,P )):- {j ( q ~ EP) n (<qi,P/ (s,e )> E DIST(d',e,pf (s,e,))}; /* Refine the set C(aq,e, ) at the stage of distance d' from pf (dt,c ) */ CC(,~,,d',p/ (,e,, )): {<q;,g' >: (<qi,q,' > E C(a, e.,)) n (q, E D(.,d',pf (ej,)) n (Ldi t(<q,,pJ (i,p )>,i ) d' - 1)}; /* Update the intermediate stage */ d': d' - 1; end-while; /* At each of d stages, select every applicable rule */ v =l; While (1l < v < d)do begin (r,,e,,pJ (),) )):= {c (<,,,..., a, >fey,I): ( 3<q,q' > E C(.,e, ), I =1,...,J, l7 k ) ( 3< q,g' > E cc(,,c,,,pj (,,e, ))) (( = P! (et,~e), I=,...,J ) n (t' = P! (to,e ), I=l,..., ) n

80 (S$CF<l..... >.e,...,.,) ( 1, *~~ ~,,, q;,q,, q, ) true ) == V+l; end-while; /* Derive the lower bound of the cost of minimum rules in p(a ) */ d LOCS:- min(W(,i,c,,p/ (a,c ))); *=1 Return LOCS; End-algorthm The complexity of DESC(e,) and the complexity of LOCS(a,,e,,pf (,,e, )) are given, respectively, by 0 (n I P I ) and max((O( I R I I P 12'), 0( I P 1s)}) where IR I is the cardinality of the set R. The proof of the admissibility and monotonicity of the value of A(c,) in the formula (3.7) is given by Lemma 3.9 in Appendix A. Algorithm HEU below describes the procedure for deriving the heuristic A (e, ) for either case of equal cost of the rule and nonequal cost of the rule. Algorithm HEU (,) Begin B,,:- {,: ( ~ EU) n (p/ (,,e,) pf (,,, ))}; If (the cost of each rule of the problem is the same ), then begin (c, ) )- IP *LdiAt(<p (;,c, ),p (a,,C, )>,a, );' aEB,, A'(c,) max(({t Ldit(<pf (,,c, ),pf (a,,e, )>,i ): a, E B,, ); If( >2), then begin ^' (C) l S CrL p/(;,Ldi)r d,(<p; (a,,c )>,ej ); a-I E*,~B, /* Return the maximum of (e, ), A' (, ), and A (e,) */ return max((A{'(e,), A'(e,), A"(c,)}); end else return max({h'(c ), A'(, )}); end-if;

61 If (the cost of each rule of the problem is not the same), then begin call DESC(e, );'(c,):- l LOCS(i,C,pf (.,e, ));, E B,,'(e -) max(LOCS(a,,ec,pJ (e,e,)): i E B, )); If( > 2), then begin "^(e,} - n tOCS(e,e,,p; (E.,,^)); /* Return the maximum of Ah (e,), A'(e,), and A"(e,) */ return max({ (c,), A'(, ), hA (es))); end else return max(( (c,), A' (,)); end-lf; End-algorithm 3.4. Examples In this section, the heuristic A(e,) computed by the algorithm HEU is illustrated by three examples, the 8-puzzle problem, the (6-city) traveling salesman problem, and the robot planning problem. The 8-Puzzle Problem Let the state e, = <t2,tl,t?,ts,t,tSt4,1t> where the goal state e. of Fig.2.1 is given by e e= <tl,tst7,t2,t,t6,tst^,s>. Then the set B,J of elementary units whose position values are different between c, and ce is B,, e {t2,1,tlttt). For the elementary unit t2, Ldit(<pf (t2,e,),pf (t2,e )>,t2) = Ld;t(<1,4>,t2) = 1. Similarly, Ldiat(<pf (t,e, ),p/ (tl,c, )>,tl) 1, Ldsit(<pf (ts,e, ),pf (t,c )>,t,) = 2, Ldat<p (,e, ),pf (e)>,t)= 1, and Ldi t(<pf (t e, ),pf (tb,c )>,t ) = 1. The cost of the rule in this problem is 1. Thus,

O2 h'(c, )- _ Ldi t (<p (a,,e ),p (,,, )>,,, ) 4 eEB,, - 1(1+1+2+1+1)-3. 2 In this problem, the set l - {(, ). So, by definition of A'(e, ) and A (e,), A'(c, ) max(Ldit (< p (x.,, e,),p (a,e, )>,,):,; E B, }) max({l,2))- 2. A" (cs ) 1 Ldit(< pf (,,c, ),pJ (s,,,')>,' ) (-e'1,,,,-{(,)) l (1+1+2+1) -. The maximum value of A'(es), A'(e, ), and A (c,) is given by the heuristic A (c,). Thus, A (c, ) - 5. The search tree for solving this problem is given in Fig.3.1. The (5-citv) traveling salesman problem Refer to Fig.2.2. The goal state c= = <(A,B,C,D,E, A >, and the cost of each rule, <,,c. >, is given by the distance between the two cities, a- and yj, on the map. Let the state e, = <A,B), C>. Then, by definition, B, - (A,C,D,E }, and s - 2. From the algorithm DIFF, Ldit (<pf (A,e, ),pf (A,, )>,A ) Ldirt(< T,Ni' >,< T,I >>,A ) 1, Ldiat(<pf (C,e),pf (C,e, )>,C) - Ldit(< <F,I >,<T,NI~ >,C) 1, Ldit (<pf (D,c, ),p (D,c, )>,D)=Ldirt(<<F,N1 >,<T,Ar~>>,D)= 2, Lduit(<pf (E,e, ),pf (Ee, )>,E) = Ldiat(< <F,NI>,< T,NI > >,E) = 2. Based on this, the algorithm, LOCS, provides the following: LOCS(A,e,,p/ (A,e )) = LOCS(A,e,< T,S >) = 6.

683 LOCS(C,e,,pf (C,e, ))-LOCS(C,,,<T,NS >) 5. LOCS(D,,,pf (D, e)) LOCS(D,c,,<T,NS >) - 5 + 6 - 11. LOCS(E,,,pf (E,c,)) - LOCS(E,c,,< T,NS >) = 6 + 6 12. In this problem f --. Thus A (c,) A (, (,). Then, 1'(e,) - - E LOCS(,,e,,pf (ai,e,,))- (6+5+11+12) 17.,EB,, 2'(c,) ) max({LOCS(i,e,p/ (i,e,)):.i E B,,)) = 12. By algorithm HEU, A(e,) - max({h(c,), I'(e,)})) 17. The search tree for finding the optimal solution to this problem is given by Fig.3.2. The Robot Planning Problem The goal state of Fig.2.3 is c e= <NULL,NULL,(C,B,A ),>. Suppose the state e, - <(A ),(B),NULL,C >. Then B,, - {A,B,C}. For each block of B,, LdUit(<pf (A,e, ),pf (A,e, )>,A ) Ldiat(<(1,O,O,NH),(0,0,3,NH)>,A ) = 2. Ldist(<pf (B,c, ),pf (B,e,)>,B) e Ldstrf(<0,1,0,NH ),(0,0,2,NH)>,B) 2. Ldit (<pf (Cc, ),pJ (C,e )>,C) Ldit (<(O,O,O,H ),(O,O,1,NH)>,C) = 1. This problem has the value 1 of * and 11 - #. Thus A'(c,) - max((2,2,1)) = 1, and A (e, ) = 2 + 2 + 1 - 5. The heuristic A (e,) = max(({'(c, ), A (e,)}) = 5. The search tree for solving this problem is given by Fig.3.3 3.5. Power of Heuristic The power of the heuristic computed by the general algorithm HEU is illustrated by two problems, the 8-puzzle problem and the traveling salesman problem. In each case we compare our heuristic (e, ) against the respective problem-oriented heuristics given in the literature.

84 The 8-Pu zle Problem Two well-known admissible heuristics for this problem (Gas77, Nil80, Pea83, Pea84] are (1) A I(e,) - the number of tiles out of their goal places, (2) A (e,) = the sum of Manhattan distances that each tile is from its goal place. It is not difficult to see that A2(c,) is the better heuristic than A (c,). The value of A (e,) given by algorithm HEU is the same as A2(, ): A (c,) 2(Ce ) VC, E S. The Traveling Salesman Problem Three well-known techniques for generating an admissible heuristic are Maximum of the aump of the row and column minima of the Reduced Mileage Matrix, ho, [Harr741, In-out estimator, A,,,., [Poh73], and Minimum-Spanning Tree, MST, [Hel71l, Pea83]. Each of these bears its own advantage over others depending on the given instance of the problem. The value of our A (e, ) is comparable to any of these three, A0, A-,,.-, and MST, in that there are instances of the problem for which A(e, ) is better than any of Ao0, h_.=, and MST. As one example given in [Poh731 and shown in Fig. 3.1, we solved the problem completely using A(c,) and the three heuristics mentioned above. The number of nodes expanded with h (e, ) was 10 as shown in Fig.3.5; with AO was 10 as in Fig.3.8; with A,,-, was 9 as in Fig.3.7; and with MST was 12 as in Fig.3.8. Further, for the purpose of comparision, we have Table 3.1 showing the values of the four different heuristics for the states generated during the solutions of the problem.

65 7> Wm>" > qB > 4s;> > -/\ lU7\3s> 2fSED4> <I7EDR34B> Figure 3.1 Search Tree for Solving the 8-Puzsle Problem

so6 <IA) > <(A).C < (A)J <( IA) ^> <(AJ> <{,cAJ)J)> <(AOBC.,C(A.C)> 4cA.J)> <( C (Aq> <c(ABq.C> <({BA,> <(AACJB > <{AAqE> <(AAD. OC> Figure 3.2 Search Tree for Solving the (5city) TSP

87 OLU4~A~(Q5LL ^40> <WMUAn> <WWII.M~I^>,4)l*,> APAj4C^> A C> /4dg)LAILCA> Figure 3.3 Search Tree for Solving the Robot Planning Problem

68 Figure 3.4 The (8-City) Traveling Salesman Problem

69 <(A).B> 4A)C> <(A).E> c(A. ) C<A.MC> C(ApJ> <(ArBmC> ~AA|t> <(Ar3> <(Aw).<,> <AY)l^> <(A.Fats> <<(AcIq.> c( q c(A.alC > <(A.!~ C> <(,AA)PJ> <(AAD) <(AJn).> D <(A.C> <(AD).B> <(ARAC..D> <(AACJCr > I <{A.CA.r}.A> <(c A^> Figure 3.6 Search Tree of A' using A (s )

70 MA> <(j. <(cj.> <<(AA <(A)P> <({A>^ <(AJX> <^|x <A( <A> <A> <(ASez <(Any,>q > <(lAac)D> <Aq> <(A.Rq> <(AW).0> <(AIDY)<D> JK> A <l(AJ> <(ADnw)> <(AJDt> <{ACJ)> <{uABCUP> I <fCac-A > <ABcJ)~P^> Figure 3.6 Search Tree of A' using Ao

71 <(A).> <(A).C> <(aO.> <{A).> <(ARCl> <(A.tlP> <(Aj.:> <(AF L > <(A.)B> <(AJ,c> <(AJI)D> <AJY)J> /-. /-. /-, <(A.{C).:> <(AC C q, c(A,).C> g(A>> <(A(r)..B(A.D7).." > <(ADI) C> c<(A)nX> <<AACJD> <<(AACE.P> I <(AC,WD, 4JP> <(I <(AACPD2T).> Figure 3.7 Search Tree of A' us'ig A,,

<M> <(,A).> <(),o> <(A).t <(A)r> <(A.C> <(A."D> <(A..R> <(A^> <(A).r> <(Ar).o> <AMn> <(AJF)r> lxAnn <lA.nc..> <(,RnC).W><( (Ar,C> A.J> <(A. Rr.'C.> <(A.C.).IB> <(nA.<CJE> <(A.^,D> <(AJDfJI.D> e<(A.JD.C > <(AXf.t> K^,I A ~ rA.t ).r-,.A.nr.n ).-> <(A.Rnc.nJD> -(A.nC.nrJ> <(A.CJ,).l <!A. al.:> (A.Cr).n.f > <(A.Inn.r,,> Figure 8.8 Searcb Tree of A' using MST

7S I I I Values of Heurbitics State.,. A MS 3 m ff <, A>12 10 10 9 <{A), B> 10 10 9 10 <(A), C> 10 10 10 9 <{A), E> 9.5 10 9.6 9 <(A), F> 11 11 10.5 11 <{A,B), C> 7.5 8 7.5 7 <(A,B), D> 7.5 7 7 7 <{A,B), E> 7 7 7 7 <{A,B), F> 7.5 7 7 7 <{AF), B>9 8 8 9 <{A,F), C> 9.S 10 9.5 9 <(A,F), D> O 9 8.5 9 <{A,F), E>9 9 8.5 9 <{A,B,C), D> 6.5 7 7 6 <{A,B,C), E> 6 6.5 6 <{A,B,C), F> 7 7 6.5 <{A,B,F), C> 8 8 8 8 <{A,B,F), D> 8.5 8 7 8 <{A,B,F), E> 7.5 8 7 8 <(A,F,D), B> 7.5 6 6 7 <{A,F,D}, C> 8.5 10 8.5 7 <{A,F,D), E> 7 7 7 7 <{A,B,C,E), D> 3 3 3 3 <{A,B,C,D,E}, F> 1 1 1 1 <{A.B,C,DE.F). A> O 0 0 0 I Table 3.1 Heuristics in (8-city) TSP

CHAPTER 4 A PROBLEM MODEL M, AND HEURISTIC 4.1. Motivation In Chapter 2, we formulated the mathematical structure M which can model a problem and we illustrated it by three examples, the 8-puzzle problem, the traveling salesman problem, and the robot planning problem. Some problems in which the goal state ce is not completely defined in advance cannot be modelled by the structure M. Consider two well-known problems, the problem of theorem proving using resolutions [Nil80] and the consistent labeling problem (the constraint satisfaction problem) [Hara78, Hara76]. Theorem Proving Problem using Resolutions: Given a set of well formed formulas, another well formed formula, called the goal, is to be derived. For the resolution method, the negated goal formula is added to the set of given formulas and the expanded set is converted into a set of clauses, called the set of initial clauses. The problem is to derive a contradiction, represented by the clause NIL, by applying a sequence of resolutions to the set of initial clauses. One example of this problem considered in this chapter is given by the four initial clauses, A U B, A U -B, — A U B, and -A U -B. 74

76 The Consistent Labeling Problem: When a set of partial consistent labels is given, each of which is allowed for A, units, A, < n, the problem is to find the consistent label for all the n units. According to Haralick et c1 [Hara78, Hara79], this problem can Je given by a compatibility model (U,L,T,CT). U is the set of units, L is the set of labels, T C UN is the set of all N-tuples of units which mutually constrain one another, and CT C (U XL )N is the set of all 2N-tuples (uv,l,..,,Njv^) where (1,.., IN) is a permitted label of units (ul,.., uN) in T. A label (li,..., K^) is a conasiecnt label of units (I,,..., UK) with respect to the compatibility model (U,L,T,Cr) if and only if {i,... iN) E 1,... K} and (ui,,..., u) E T imply the 2N-tuple (,,Il^,,,..., El.,) E CT; that is, the label (l,...,,,) is a permitted label of units (ui,,..., %i,). When U and L are understood, such a label (,..., IK } is a (T,CT )consistent label of (ul,..., K). The problem is then to find a consistent label of units (u1,.., u, ), where U = (iu,..., ), }, with respect to the compatibility model (U,L,T,C ). One example of this problem considered in this chapter is given by a compatibility model ( U,L,T,CT ) such that U {1,2,3,4), L {,, }, T {(1,3),(1,4),(2,3),(2,4),(3,4)}, and CT r c, n c, n C23 n C24 n c34 where C13 = {(1,.,3,c ),(1,6,3,b ),(1,c,3,c )), C14 = {(l,.,4,. ),(1,,4,c )}, C23 = {(2,,3,a ),(2,,3,b ),(2,6,3, ),(2,c,3,c )}, C24 = (2,.,4,c ),(2,6,4,e ),(2,c,4, ),(2,c,4,b )}, C34 - {(3,a,4,a ),(3,b,4,r ),(3,c,4,6 )}.

76 Suppose each of two problems, the theorem proving problem and the consistent labeling problem, is modelled by the structure M in Definition 2.2. Theorem Proving Problem using Resolutions In this problem a set EU of elementary units is the set of initial clauses and all resolvent clauses which can be generated by applying a sequence of resolutions to the initial clauses. From the above example, EU ({NIL,A,-A, B, -B, A U B, A U -B, -A U B, A U -B}. The cardinality of the set EU is then 3# where # is the number of symbols apprearing in the initial clauses. Next, this problem has only one attribute Abl, namely, the status of each clause as to whether or not it has already been generated by resolutions: AT = {Abl}. Thus the state-space S of the problem is S = Dom(Ab ) = Pw(EU) where Pw(EU) is the power set of EU. For example, if four clauses, A U B, A U ~B, ^A U B, and'A U,B, are given initially, then the initial state e,, -(A U B, A U UB, -A U, U B). A set P of position values is P = P(Abl) where P(Ab1) - {T,F). The values T and F mean that a clause has been and has not been generated respectively. Each rule (resolution) in this problem affects the postion value of only one elementary unit which is the clause to be the resolvent. Thus R is the set of unary tuples of all resolvents. For the above example, R == (<NIL >,<A >,< —A >,<B >,<-B >), and the successor condition formula SCF defining the relation SUCCR is (r.NIL ( *2, NIL,,l. A,..., L-_ ^ A U.~B, _...NIL, w.A,..., z.._ A U ~B ); r_A ( s 1, y_.NIL, jyA,..., ~_ A U B, z._INIL,._A,..., _ ^A U — B);

77 o..; r_ -B( e,,tNIL, *yA,..., LK yA U ^B, zNIL, *_A,..., z_'A U -B)):-cf ( z1, *yJNIL, *ytA,...,L "A U ~B, zNIL, *z.A,...,z "'A U -B). where (,i- NIL), (((* NIL- ),( A FT) ( T, ( A T), ( NIL T), (ecli_=..l, cl Z NIL, cl E EU)); (( LNL-F), (y.B =T), (.y_ —B-rT), (._NIL Tr), ( *ejcl- _cl, cl c NIL, cl E EU))):- r_NIL (*ez i, NIL, A,..., t ~A U ~B, *_NIL, *zA,..., *z_ A U ^B ). ( *z = A ), (((-,_A=F),(* _A U B=rT), ( t. -B=), ( _A-rT), ( yLe- -.cl, cl 7 A, c E EU)); ((.A =F), ( LA U ~B=T), ( B T ), (zA T )), ( *C _t-Cl,_, Cl A^, Cl E EU))):- r_A (,,.lNIL, *LA,..., y_.A U -B, *z_NIL, z_A,..., z_. A U B ). (J )t I B) ((((jL -_ BF), ( *SLA U — B= T), (*tA = T), (*2_ -B=T), ( _.l- *z._cl, cl 7 ~B, el E EU)); (( z ~B — ), (.A U-B- T ), (L rA =T), )( B r T), (t.et=c _ cl, cl i.-B, el E EU))):- r._ -B ( z I, y_NIL, *y_A,..., y_ -A U -B, _etNIL,, *z_A,..., *t_ ^A U -B ). The goal state ec of this problem, if it exists, is then a set of some clauses including the initial claues and the empty clause NIL. This set for c is, however, not known in advance before a solution path, a sequence of resolutions generating NIL, is found. At the time when the problem is modelled for solving, the goal state is only partially known.

78 The Consistent Labeling Problem Suppose the problem is given by a compatibility model (U,L,T,Cr). A set EU of elementary units of the problem is then the set U of n units to be labeled. This problem has only one atrribute Abl, namely, the labels of the units. Thus, each element of Dom(Ab ), and hence a state of the problem, is given by <1,11..., It," > where each 1,, il-,...,n, is either the label of the unit u, or the value nl if u, is not labeled. A set P of position values is then P = P(Ab1) where P(Abl) is the set of labels to be given and the symbol nl. P L U (nl). From the example given above, P - f,&,c,nl). Each rule in this problem affects the position value of only one elementary unit which is the unit to be labeled. Thus, from the given example, R = (<1>,<2>,<3>,<4>), and the successor condition formula SCF is given by (r... 1( *,t 1,..., Z4); r_2(*zl, L1,..,. 4); r_ 3(4 *z, 1,.., *z_ 4);..4( *z IL 1,p...,,, z4)):- eel (ez1,*, 1, 2,*y3,_L4,*_ 1,*_.2,.z_3,*z._4). where, for each k ({1,2,3,4}, rk(*zp 1,;_1..., *,;4) - (* = k),(,yJk = nl),(*e Ij =,,, t-i,...,4, k), member (:._k,[,b,c ]), Cg_ 13( _ 1, t_. 3), Cg_ 14( *z 1, _ 4),C_23( z_ 2, _3), Cg_ 24( _ 2, Z.4),C g_ 34( _ 3, *_ 4).

79 Cg 13(: 1, t_3):- member (_ 1,_3 c 1,,],[(.,, 1,[b,b,C, n 1,,nl ], l[,nl,[ l, [n.,c ],[nlr,b J,[nlt,e [nl,nl ]). Cg_ 14( ez_ 1, z._ 4):- member ([ (_ 1, o._ 4],[a,b6,[b, c ],l,nl, b,nl[],nl,b ],[nl,c ], [nl,rl]). Cg_ 23( *z_ 2, z 3):- member ([*_ 2, t_ 3],ll.,., ],b l,,c ],c,c J,[a,nlj,lb,n ], IC,n"],[n". ),Inl,b ],[n,lnl,nl.nl). Cg_ 24( *z_ 2, 4):- member ([. 2, *t, 4],[[a,c ],lb,c J,[c,a ],[e,b ],[a,nlJ,,d, lc,nl,[nl,c,[nl,( ],[nl,b J,[nl,nl l). Cg_ 34(,_ 3,,_ 4):- member ((*_ 3,. *_ 4l,[(Ia, 1,[6,c ),[c,b ],(.,nJ ],(6,nl],c,nl], [n.,a ],[nl,c j,[nlr,b Jl,nl nl). A goal state c of this problem, if exists, will be given by C- <,111,...., s,/ > where (/l,...,t,) is the consistent label of units (1,..,.,) with respect to the compatibility model (U,L,T,CT). This labeling (i,...,,) is, however, determined only after a sequence of consistent unit-labels is derived. At the time when this problem is modeled for solving, the goal condition can only be described by the conjunction of partially defined consistent labels for k, units, k, < n. As shown in the above to examples, the model Af is inadequate for some problems because the goal state e. is not known. Such an inadequacy can be over

80 come by representing the goal by the first-order predicate formula, which will be called the goal condition formula. 4.2. Goal Condition Formula We first define the goal condition formula as follows. Definition 4.1 The goal condition formula Goal(p_^l,.., p_% ) is the first predicate formula with n variables ps,, i 1,...,n, such that each p_.l, stands for the goal position value of the elementary unit e,. For example, the goal formulas for the theorem proving problem and the consistent labeling problem from section 4.1 are given by (4.1) and (4.2), respectively. god ('pNIL,p....A,..., pp_..A U B) (4.1):-( pNlL T), ( pA U B= T), (,_A U — B rT ), (*p V-A U B8=T), (*p_^A U ~-B=T). goal('*p 1,,p_ 2,.p_ 3, *p_ 4):- C_13( ep lp,_3), C_ 14( p._ 1,'p_4), C_ 23(.p_ 2,.p*_ 3), C_ 24( pp_2, op 4), C_ 34( _p. 3, _p. 4). where C_ 13( *p_ 1,p_ 3):- member ([*p, 1,*p.3],[a,e ],[b,b ),[c,c C_ 14( p_ 1, p._ 4):- member ([ p_ 1, p_ 41][[a,b ],[b,c ]]). C_ 23( *p_ 2, op_ 3):- member ([ p_ 2, p_ 3],[[a, 1,[,a,b ],[b, C_ 24( p_ 2, *p_ 4):- member (['p_ 2, pp_ 41,[[,c ]',[b,c l,[l, (4.2) 11). ll[,c I-).,M,b l]).

81 C_ 34( p_ 3, p_ 4):- member ( p_ 3,._ 41j,[[, J,lb,c J,[c,b 11). 4.2.1. Relaxed Goal Condition Formula As discussed in Chapter 3, in order to compute the heuristic h (e, ), for each elementary unit *,, its position value pj (ea,,) in the goal state e was derived and compared with its position value pf (a,,e,) in the state c,. If the goal is given by the formula Goal, however, a goal position value pf (a,,ec) of each elementary unit a, is not derived directly. It is derived by relaxing the formula Goal with respect to a,. A goal position value of each elementary unit ai is derived by the corresponding relaxed goal condition formula Godl.R(p_ c). Defmiition 4.2 Let Goal(pl,..., p_,) be the goal condition formula. Then for each a, E EU, the relaued goal condition formula for a, is the one variable formula GoalR'(pa, ) such that for every (ql,...,,,..., q.) E P if Goal(q,...,.,,. q,) = true, then GoalRl(q) = true, and no other value of the argument satisfies GoalR'. For each elementary unit Aj E EU, the goal set G (a) of position values of a, is given by GC(i) {q,: (q EP) n (GoaIR'(q) true) Since the G(a,) is derived from the relaxed goal formula, every value of G(at) is not necessarily the position value of *, in the goal state although all the postion values of a, in the goal state are elements in G (a, ). This will be shown later by

82 one example. The way to derive GoaldR from Goal is similar to the way we derived SCF.R' from SCF. Let goal be the goal formula given in PROLOG and let it be in the conjuctive normal form with I clauses cli, j-l,...,I. goa( P,_.,, P-6 ):- c~l(...),...,cl (...). Then the relaxed formula goal_^arel for *, is derived by substituting anonymous variables "" for the variables other than opa., in each of the I clauses cli, i 0l,...,:. goalT, trl ( Op_, ):ll P- (_,...,_-, _,,-,...,- ),...,fi(_,..., -_, ~,...,_ ). For example, the relaxed goal formula goalNILjrel in (4.3) is derived for the clause NIL from (4.1) for the theorem proving problem. The relaxed goal formula goal_ _rel in (4.4) is derived for the unit 1 from (4.2) for the consistent labeling problem. goalNILrcl ( *p_NIL) (4.3):- ( pNIL r), (_ r), (_ r), (_ r), (_Lr). goal Ijrcl( p_ ) (4.4):- C_ 13( p_ 1,_), C_ 14( p_ 1,_), C_23(,.), C24(_,_), C_ 34(_,_). From the formula (4.3), the goal set G(NIL)== {T} is derived. Similary, using a corresponding relaxed goal formula, each goal set for the theorem proving problem is derived as follows:

83 G(A ) - G(~A ) - G(B) C(-B) -= (T,F), and G(A U B) CG(A U -B)- C(~-A U B)- G(.A U -.B)- {IT}. For the consistent labeling problem, from the formula (4.4) the goal set G(1) - (, ). Similarly, for each unit k E {2,3,4}, G(2) ({^,s,c), }G3) -{ (,c), and G(4) (b,c). We mentioned above that every value of the goal set G(a, ) is not necessarily the position value of e, in the goal state. This is easily observed from the above example of the consistent labeling problem. A goal state el in this example will be e E{(1,b,2,,3,b,4,c ),(1,.,2,e,3,c,4,b)}. A goal position value of each unit k {(1,2,3,4) in e is then p/(l,e ) E b (,, pf (2,e,) E {,}, pf (3,e,) E {b,c }, and pj (4,e,) E {,c }. Thus, we can see that for the unit 2, its position value 6 is in the goal set C(2), but is not the actual goal position value, P/ (2,e, ). As explained in Chapter 3, our approach to compute the heuristic A (e,) is based on the minimum number of simplified rules which takes each elementary unit a, from its current position value pf (a,,e ) in the state e, to its goal position value p (a,,ce) in the goal state ec. Thus, the closeness of A(e,) to'(e,) strongly depends on whether or not there is a solution path which takes each afrom pf (a,,e, ) to each element of G(, ). 4.3. A Problem Model M, In this section a problem model M0 with a goal condition formula is presented. The problem model Af0 is a slightly modified version of the problem model Af in Definition 2.1 in that the goal state c, is replaced by the goal condition formula

84 Goa. Definition 43 A problem, Mo, is an ordered ten-tuple, Mo - (EU,A T,P,S,pf,R,SUCCR N,eV,,,Goal), where EU is a set of elementary units, A T is s set of attributes, P is the set of position values of the elementary unit, S is the set of states, p/ is a position function, pf: EU XS -. P, R is a set of rules, SUCCR C R XS XS is a ternary relation describing the rule, its applicable state, and its resulting state, c is acost function, c: SUCCR -I i c,, is an initial state, e,, E 5, Goal is the goal condition formula with n variables, p_l,..., p_a, where each pe, stands for the goal position value of the elementary unit $,. The formulation of the model Mo was illustrated by two examples, the theorem proving problem and the consistent labeling problem, in the prevoius section. In the next section, the heuristic Ah(e,) computed on the problem model Mf0 is discussed.

85 4.4. Heuristic Derived using the Problem Model M, Based on the model Mo, the formula to compute the heuristic A(e,) is developed for the case where the rules have equal costs as well as for the case where the costs of the rules are not equal. 4.4.1. The Cae of Constant Rule Cost In Chapter 3, the formula in (3.6) to compute A (e,) was developed based on the actual goal position value pf (,i,e,) of each elementary unit e*,. As explained in section 4.1, when a problem is modelled by Mo, a possible goal position value of each elementary unit *e is given by the goal set G (a,). Thus the formula in (3.6) is slightly modified for the model Mo as follows. Let the set B(c,) ( {e: ( E EU) n (p/ (,i,,) G (,))}. Then the heuristic A (, ) is given by A(e, )max({'(c, ), A'(c,, "(c, )}) (4.5) where h' (c, ) max({min((t w -LEt (<pf (,c, ),q >,*,): q E (a )}): *a E B(c, )}), A'*(c,) - - min({tpoLit(<pf(a,,e,),qg>,e,): q E G(,)}), * - *IEB(c),) ~ e, CB( 6, ) amin({ w.Lit(<p! (,,,e,), >,a ): ( a, )}). Each value Ldiet(<pf (a,,c,),q >,p,), k E G(a,), is derived by algorithm DIFF with the input lo, (a,) - (a,).

so 4.4.2. The Cue of Nonequal Costs of Rules For the case of nonequal cost of a rule, the formula in (3.7) to compute A (e, ) is modified as follows: A(e )- max((^' (,e), A'(c, ), e (c, )) (4.6) where i'(c, ) max(min({LOCS(,,e,,qj ): qg E G(e,))):, E B(e, ))), Ib'(cs ) l E min({LOCS(,,es, q): qk GC(i)}), * E.B(e.) I^" T ~n min({(LOCS(,,e.,q,): q, E G(,)}). The heuristic (e in each (4.5) n and (4.) satisfies the conditions of admis sibility and monotonicity. This will be discussed further in Chapter 6. 4.6. Examples In this section the heuristic A (e,) computed by the formula (4.5) is illustrated by two examples of the theorem proving problem and the consistent labeling problem given in section 4.1. Theorem Proving Problem using Resolutions The initial state of the problem is cis,. (A U B,A U ~B,~A U B, A U -~B}. As derived in section 4.1, every clause cl in the set EU except the initial clauses and the empty clause NIL has the goal set G (el) = (T,F) = P. Every nongoal state c, is given by some subset of EU-{NIL including the initial clauses. Thus by definition, B(es,)-(AIL} because pf (NIL,e ) = F and G(NIL) - T }. The value of s is 1. Then

87 A'(e, )'(e, ) - LdiAt(<F,T >,NIL) I1. Thus, the heuristic A(e,)- I for every nonequal state c,. For the goal e., A(c,) = O. The Consistent Labeling Problem Consider the state e, given by e, - (l,,2,nl,3,nl,4,nl). First each relaxed goal condition formula Goal,' (p_, ), e, E {1,2,3,4), i derived. goad_ Ircl( p,_ 1):- C13(*p_l,_), C 14(*p_,_), C.23(._), C_24(_,_), goal 2_rel( p_ 2) - C13(_,_), C_14(_,_), C_23( p.,2,_), C_24(*p_2,_), fgoa 3_rel('p_ 3) - C. 13(,,,p_ 3), C 14(_ ), C 23(_,,p_ 3), C_24(,_ ), goal_ 4_rel( p_ 4):- C_13(, ), C_ 14(_, *4), C_ 23(_,_), C_24(_, p_ 4), C 34(_,_ ). c 34(p_3,_ ). Then each goal set C(a), a, E (1,...,4}) is G(1){= (,b), G(2) (,b,c }, G(3) = b,c), and G(4)= {b,c}. The minimum length Ldist (< q,g>,a ) between every two position values qj and q, of each unit a,, in which q, E P and q, E G(~,), is derived by algorithm DIFF. Ldift(<q,q, >,a,)=- if <qg,q, > E DIFF(k,a,q ). For the unit 1, G(1) = (,b ). Thus DIST(1,a) = {<nf,a >}, DIST(1,,b ) = {<nib >} DIST(k,1,.) - DIST(Ik,,b) k-, =2,3. The noncomputable pair <qj,g > of position values of the unit I is given by the

88 sets DIST(.LIMIT,1,~) and DIST(e LIMIT,I,b) where - and LIAIT - 44 8 258. DIST(256,l,,) = {<b,c >,<c,. >), D/ST(258,1,b) (<,b >,<c,b >}. For the unit 2, G (2)= {,,c }. DIST(1,2,)- {(<nl, >), DIST(1,2,b)- (<n,b >), DIST(1,2,) { (<nl,c >). DIST(k,2, ) DIST(k,2,b) DIST(k,2,c) )-, ik 2,3. The noncomputable pair <qg,q > of position values of the unit 1 is in DIST(25~,2, ), DIST(258,2,b), and DIST(258,2,c): DIST(256,2, )- {(<b, >,<c, >), DIST(256,2,b) - {<, >,<c,b >}, DIST(256,2,c) - {<,c >,<,e >}. For the unit 3, G (3) (b, }. DIST(1,3,b)- (<nl,b >), DIST(1,3,c)- <nl, >} DIST(),3,b ) DIST(k,3,c) -, A -2,3. The noncomputable pair <qi,q,> of position values of the unit 3 is in DIST(258,3,b) and DIST(25,3,e ): DIST(256,3,b) {<,b >,<c,b >), DIST(256,3,c) =( {<, >,<b,c >}. For the unit 4, C (4) {b,c }). DIST(l,4,b) -{(<nl,b >), DIST(l,4,c) - (<n,c >) DIST(k,4,e) - DJST(k,4,6 ) = A, t =2,3. The noncomputable pair <,q, > of position values of the unit 4 is in DIST (258,4,b) and DIST(258,4,c):

89 DIST(256,4, )- (<,b >,<,b >), D/ST(256,4,c)- (<, e >,<b,c >). Then, for the state e, - (l,,2,nd,3,nl,4,nl), the position value of each unit a, (1,2,3,4} in e, is pf(l,c,)- a, p(2,e,)= n, p (3,e,)= rl, and p/ (4,e,) - nl. Thus by defintion, B(c,) - {2,3,4). (C, ) - min({Ldi t ( <p/ (*,c, ),q9 >,* ): (9l, G( ))}) k E(2.3,4) - 1+1+1 3. A'(, ) max((min((Ldirt(<p/ (k,es ),q, >,k ): (q, E C(* )))): k E (2,3,4)) -max({l,,l,}) - 1. Since the value of s is 1, A (e,) is not defined. Thus, the heuristic A (e,) is A(e, )- max({A (c, ),'(c, )}) = max({3,1)) 3. As another example, suppose the state c, is (l,c,2,nl,3,,4,nl). Then B(,e ) {(1,2,4}. For the unit 1, each pair <pf/(,ej),q, >, gq E G(1), is not computable where p/ (l,e,) - c and G(1) - t {(,b). Thus min({Ldirt (<pf (l,c,),qg >,1): qj E G(1))) - min((Ldit (<c,I >,1), Ldit (<c,b >,)}) = 256. For the units 2 and 4, min((Ldist (<nI, >,2), Ldiut(<nl,b >,2), Ldat(< nl,c >,2)}) =e 1, min((Ldit (< nl,b >,4), Ldist(< nl, >,4)}) = 1. So, A (e, ) = 258 + 1 + 1 - 258 and h'(c. ) max((256,11}) = 256. The heuristic A (e,) is then 258.

90 4.6. Power of Heuristic In this section, we will discuss the efficiency of the heuristic A (e,) for solving the two problems, the theorem proving problem and the consistent labeling problcm. Theorem Proving Problem usinr Resolutions For every nongoal state e, the heuritic A(e,) is computed to be 1. Thus, A using A (e, ) results in the breadthf-irst search. The Consistent Labeling Problem A simple and well-known search technique for solving this problem is the backtracking algorithm with specific unit-labeling order [Hara80]. (More efficient and sophisticated techniques will be discussed in Chapter 7.) Although the order in which each unit is labeled affects significantly the search efficiency of the backtracking algorithm, the best unit-labeling order is not known in advance. We will compare the worst case results for the two methods when applied to one example given in section 4.1. As shown in Fig.4.1, A' using A (e) expands 10 nodes before the solution is found. The backtracking algorithm expands 11 nodes with the unitlabeling order such as 2-1-3-4, which is shown in Fig.4.2.

91 I I I I 0 b I 6 I 0 4' * * I 3C I I I 0 aO~~.~IC4L Figure 4.1 Search Tree for Solving the CLP using A'

92 I to I I 0 0 1 1 I * I 0 0 0 0 I I I 0 0 I S 0 I I I S S S 0 3c I..2...c... c.. b> Figure 4.2 Search Tree for Solving the CLP using BacLtracking

CHAPTER 6 AN EXTENDED PROBLEM MODEL 6.1. Motivation In Chapter 4, we presented the problem model Mo and developed the general formula, based on the problem model M0, for deriving the heuristic h (c,). The overall search efficiency of algorithm A using the heuristic h(e,) depends on the complexity for deriving h(e,) and the tightness of the A(e,) derived. in this chapter, a more general version AfI of the problem model M0 is first suggested for improving the tightness of the derived h (e, ). For Af1, a set of objects of a problem is defined to be a partition of the set EU of elementary units. Next, for reducing the complexity for deriving h (c, ), a more general version Atf of the problem model AlI is suggested. For M2, a set of features of a problem is defined to be a partition of the set AT of attributes. 5.2. Partition of the Set EU Let (p,r) be the path from the state e, to the goal state c%. The heuristic h(e, ) is then, by definition, the estimated minimum cost of (p,q). In Chapter 3, we suggested A (c, ) computed in terms of the estimated minimum cost of the subpath (p(a, ),q(a, )) for each elementary unit a, E EU. The subpath (p(a, ),~( a, )) takes the 93

94 elementary unit a, from its position value in the state co to its position value in the goal ec. Suppose the heuristic (e, ) is computed by estimating the minimum cost of the subpath which takes simultaneously more than one elementary unit from their position values in e, to their position values in e. Then a tighter value of A (e, ) may be expected because the relaxed constraint considered for evaluating the subpath becomes closer to the original constraint. Let r(EU) be a partition of the set EU. Each block o, in x(EU) will be called an object of a problem and the ordered tuple of position values of all elementary units in an object o, will be called the position value of the object o,. For each object o,, let (p(o, ),'(o, )) be the subpath of (p,il) such that (1) p(o,) = r * * rK, each ri is one of rules in p, and ij(o,) = Ie,' e e K', each et, Cje is one of the states in 9, (2) each rj in p(o,) affects the position value of the object o,, and each (rt,cj,c^ ) E SUCCR, and (3) the position values of o, in the states e and es are the same, and the position values of o, in the eK' and the goal e1 arc the same. The heuristic A(e, ) is then estimated by estimating the minimum cost of the subpath (p(o, ),r(o, )) for each o, E V(EU). As shown in Chapter 6, in most cases, for a given partition of the set EU, the complexity for deriving A (c, ) and the tightness of the derived A (e, ) are trade-ofTs. Two partitions ir,(EU) and rf(EU) of EU which provide, respectively, the least complexity for deriving h(e,) and the bct tightness of the derived A (c,) are r.(EU)= {(o: ol=EU} and rl(EU)= {(o: ok (o=-{, t E EU}). For deriving the heuristic A (e, ) based on the partition r(EU) of the set EU, a problem model MA is first formulated in which a set of objects is given by r(EU). A general procedure for deriving A (e, ) based on Afl follows.

95 6.2.1. A Problem Model M, Definition 6.1 A problem, AM1, is an ordered tcn-tuple, A - (r(EU ),A T,,S,ff,R,SUCCR,c,e,., Goal), where x(EU) is a set of objects, given by the partition of the set EU, A T is s set of attributes, Q is a set of position values of an object, Q = U Q(o) = U p1., (E U),.Es(tEU) where Q (o, ) is a set of position values of an object o, assumed in a state, and | oi I is the cardinality of the set o,, S is a set of states, ff is a position function, ff. r(EU)XS - Q, such that for every o, E r(EU) and for every e, E S, if o, = (al,I,,. Ofi,,e, ) <pl (a,,e, ),..,* * P a,,s, )> where ij < il ifj < I for j,ll=,...,k,, R is a set of rules, SU;CCR C R X S XS is a ternary relation, c is a cost function, c: SUCCR -- R ei, is an initial state, ec, E S,

98 CGoal is the goal condition formula. For example, suppose the set r(EU) of objects in the consistent labeling problem in section 4.1 is given by xEU) { (,01,02,03: o01 (1), 2 = {2), o4 ({3,4)}- Then, the set Q(o,) for each o, E n(EU) is Q( o) Q (o2)= P = (nl,,b,). Q(o4) P X P = {<nl,nl >,<nl,c >,<nl,6 >,<nl,c >, < a,nl >,<p,i >,<,b >,<,c >, <b, nl>,< >,<b, b,b >,<b,c >, <c,nl>,<c,g >,<c,b >,<c,c >). The position value of each object in the state c, is given by the position function f. For the state c, = (l,,2,nl,3,c,4,nl), o 34,cs ) = <,nl > and ^O,es ) = <a >. 6.2.2. Heuristic Derived using the Problem Model M1 As mentioned before, when a problem is modelled by M,1, the heuristic A (e, ) is computed in terms of the estimated minimum cost of the subpath (p(o ),(o, )) for each object o, E r(EU). The procedure to estimate the minimum cost of the subpath (p(o,),r(o,)) of the object o, is very similar to the one to estimate the minimum cost of the subpath (p(a, ),V(e,)) for the elemetary unit a, discussed in Chapter 4. The formal algorithms for estimating the minimum cost of (p(o, ),T(o, )) based on M1 will not be presented here because in Chapter 6 the corresponding formal algorithms are developed based on the problem model Af2 which is a more general version of M1. In this section, we will briefly explain the procedure, using one

97 example, for the case of constant cost of rules. First, for each object o, E r(EU), the relaxed successor formula SCF.R1 and the relaxed goal formula GoalRt are derived. SCFRI describes the constraints of two position values of each elementary unit of o, assumed in one state and its successor state. GoalR'd describes the constraint of the position value of each elementary unit of o, assumed in the goal state. Suppose an object 0i = 0(,.., i}) C EU. If the successor formula SCF in (5.1) is given by the disjunction of rule-formulas r..a it <. a.., t, > E R, where f.ti* * * 2^ is given by the conjunction of some clauses, then the relaxed formula SCF,' in (5.2) is given by the disjunction of the relaxed rule-formulas r_, * * a,_rcl. Each relaxed rule-formula r_^l * * * a, is derived by substituting anoymous variables,, for the variables other than y_si and z_ai, jy l,...,t,. i (t- 11 —' * *. ^ _.%); ( Ir K a, ('K 1, l,. _... Z_.*y,,_, -..., *,,,.. * )):- l ( *:, ~, * z.,, " z_,. *, * y_.I. L,_...*,,z:.a ). (5.1) where for each k E {1,...,K }, t:- tk l(..),..tl, (...). The relaxed formula is then, ( r.-a a. * * * are(ya, _l,,, ^, *_ai,., ~ ~,:_ a,f.); I.;

98 r_. IK''' K_tCl( lil_ I ~* ~*., li-p - *l, ~ ~ -l )):- *c_o, _rCl(,* l, ~ ~-, I,,,, za,,. I, *._,, ). (5.2) where for each k {(1,...,K}, r. * * * ~,~_~l(t _l * *, ~ ~~,'Y-a.(,^ * * *. *_ tI,):- l(, ~.,,':..,, l. _, * * * * * *, _ ) CL (_,..., _, * * ~ ~ _,,... _,,, ~ ~,..,,* l.. *,_,, _., ). Similarly, the relaxed goal condition formula Goal,'t for the object o, is derived from the goal formula Goal. Let the goal formula goal in PROLOG be given by the conjunction of I clauses clf, j 1,...,l. goat( pa l,..., Pl,.., *P ai,.~, pa. ):- c:i(...),...,c:,,(...). Then, the relaxed goal formula goal_.,_rel for the object o, is derived by substituting anonymous variables, _, for all variables other than *pa,^, ak E o,, in each clause cl,,, j=l,...,l. goao,_rcl( *p_,,..., p_, ) e:l, 1i(_,,_ *..,, p, P-i P,.. * *,-) cI(,, * *,-. *.,- ) The goal set G(o,) for each object oa E (EU ) is defined from the corresponding relaxed goal formula Goal.d:

99 G(o )- {<q,1,..., q,>: (<q,,,..., q,> E P') n (k, I- I o l) n (G Ood."(qq,,,..., q ) - true)}. Then, the heuristic A (e ) for the case of constant cost I of a rule is given by b(c, )- max({h'(c, (e), h'(c, A"( )) s (5.3) where hA(e, ) max( {min({ W Ldit (< o,e, ),< >,o,): 9 E G (oi)}): o, E B( (e)}), h(c,) l - min((w Lst(<(o.,, e),, >,o,): q, E G(o,))), e eEB(e,) ht(e, ) = - r) S1 min({r w Ldist( < fo,, e),, >,o ): q, G(o, )). -fl(n(EU)),EB(,).,e (r(ZEr)) The value of; is the maximum number of objects in x(EU) whose position values are affected by any rule. The set B( c,) is the collection of all the objects such that for each o, E B(e, ),,o,,e) a G(o,). The value Ldit (<f^o,,, ),,q>,o,) is the lower bound of the length of the subpath (p(o, ),q(o, )) for the object o,. This value is recursively derived from the fact that Ldit( ( <ff(o, ),eg >,o,) = 1 if and only if lio,,e) P qk and SCFR'(fflo,.c, ).q t = true. Finally the set l(r(Et )) is the largest subset of xr(EU) such that for each object in fl(ir(EU)), its position value is affected by every rule of the problem. For example, consider the consistent labeling problem modelled by Af,. Let r(EU) = {oo.,os: = {1}, o= {(2). 04 = {3,4}}. First, each relaxed goal formula Goatl"R, o, E r(EU), is derived as follows: goalo _rcl ( *p_ 1)

100:- _13( p_1_), C_ 14( p_ I,_ ), C_ 23(_, ) C_ 24(_,_) C_ 34(_,_). goalo 2..re ( p_ 2):- C 13(__), C_ 14(_,), C_ 23( *p_ 2 ), C_ 24( *p_ 2,_ ), C 34(_, ) goal_o 3_rel('p_ 3,'p_ 4): C_ 13(_ Sp_ 3), C_ 14(_, p_ 4), C. 23(,, p_.3), C_ 24(_, Ip 4), C_34( *p_3, op_ 4). rwhere C_ 13( p. l,,p_ 3):C_ 14( p _ 1, p_ 4):C_ 23( *p_ 2,pp_ 3):C_24( *p_2, p._4):C_ 34( p_ 3, p - 4): member ([ p_ 1, sp_ 3,[[a,e ],[b,b.,[c,e ] ). member(l[p_ 1, p_.4],(, ],[b,c cl). member (['p_ 2,'p_ 3],[[, J],[a,b l,[b,. ],[c,c ]1). member ([ pp_ 2, p_ 41,1[i,e l,[b,c l,[c,.,[c,b 1). member (|[p_ 3, *p_ 4,[[a,a ]J,b,ec,[,b ]]). Each goal set G(o,) is then given by G(o,) = (,6b), G(o2)= (a,b,c, G(os4)= {<b, >,<c,b >). Next, three relaxed successor formulas SCFR'(y_o,,z..o,), o, == o, o,, o4, are given as follows: (r_ 1( j_ l, 1_ 1); *r 2( *_. 1, *._ 1); r_ 3( *l., ); r, 4(. I,:*_ 1)):- che_I rre(_ 1, _ 1). where r- 1( *y 1. *Z 1)

101:- (_.l). (yIl _ ] -. ), (_ (_ ) ( —_). mcmber ( o_. 1,a,b,e ]), Cg_ 13( o_ 1,_ ), Cg_ 14( z_ 1,_ ), Cg_ 23(_,_ ) Cg_ 24(_,_ ), C_ 34(_,_ ). rk(ey_ 1,ez 1) for k==2,3,4,:- (_-k).(_- nlt ), (.u_]I — ).(_- ) -( ) member (_,1s,b,c 1), Cg_ 13( *_ 1,_ ), C= 14( *_ 1,_ ), Ca_ 2(_,_ ), Cg 24(_,_), Cg_34(_,_ ). (r, 1( *y_ 2, o 2); r_ 2( oy_ 2,, 2); r_3( *a_2, e, 2);. 4( *L 2,,_ 2)):- c/_o 2_re ( *_ 2, *z_ 2). where r_ 2( *y_ 2, z_ 2):- (_=2).,(L2-n),(_.), (__), (__). member( *, 2,[a,b,c J), Cg_ 13(_,_ ), Cg_ 14(_,_), Cg_ 23( * 2,_), Cg_ 24( *z_ 2,_ ), Cg_ 34(,_ ). r* ( *y_ 2,.. 2) for k= 1,3,4,:- ) (_ c —;, (nt _ * =,), (_, 2- oz 2)(_), (_ =_ ), member (_,[a,b,e 1), Cg_ 13(_, ), Cg_ 14(_, ), C',g 23( *_ 2,_ ), Cg_ 24( *_ 2,_ ), C9_ 34(_,_ ). (r_ I( iy_ 3. y_ 4,:. 3, *:_ 4); r_ 2( ey_ 3, i*_ 4,.._ 3.:_ 4): r_ 3( *L 3 *y_ 4,* * _ 3,...4); r_ 4( *y 3, *y_ 4, *_ 3, *_ 4)):- e_<o 34_rel ( /y_ 3, *y_ 4, *_- 3, z_ 4). where

102 r_ 3( O(_ 3, *- 4, _ 3, t_ 4):- (_=3) ( 3- 3 l), (. 4I_4), (_ _ ), (_- ), member ( z_ 3,[a,b,c J), Cg_ 13(_,,z_ 3), Cg_ 14(_, *,. 4), Cg_ 23(_,,z 3), Cg_ 24(_,,.. 4), Cg_ 34( *,_ 3, *z_ 4). r_ 4( sy_ 3, *IL 4,:_ 3, *z_ 4):- (-4), ( -L 4 n ), ( L3. o 3), ( _ ), (-_), member( n_ 4,[1,6,c ]), Cg_ 13(_, * 3), Cg_ 14(_, z_ 4), Cg_ 23(_, _ 3), Cg_ 24(_, z_ 4), Cg_. 34( n_ 3, *2_ 4). r_ ( _ 3,* i _4, _.. 3,;.. 4) for k el,2,:- (_c),(_ = i), (Ly3-=z_.3),(qy_4= *-_4),(_=._), member (_.,[,b,c 1), Cg_ 13(_,,z. 3), Cg_ 14(_, oz. 4), Cg_ 23(_, _ 3), Cg_ 24(_,, * 4), Cg_ 34( z_ 3,,_ 4). For each object o,, the value Ldit (< q,q >,o,) is I if < gj,qk > is the element of the set DIST(l,o,,q^). Each set DIST(l,o,, ), 1l,..., | Q(o,) | -1, is recursively defined from the fact that for every pair <qj,q > of position values of o,, <q,qj > E DIST(l,o,, ) if and only if SCFlR(q,, ) = true. (For details, refer to algorithm GDIFF in Chapter 8.) Every pair <q, q >, qJ - qt of position values of o, which is not included in any of the sets DIST(I.o,,qt), /=1,...,] Q(o,)-l, becomes the element of the set DIST(K,o,,q), K=; | P | E; I. Each pair in the set DIST(K,o,,, ) is called a noncomputable pair. For the above example, DIST(l,o,a )- {<nl, >}, DIST(l,o, ) = {<nl,b >), DIST(k,o a ) = DIST(k,o,,6 ) =, k =2,3.

103 DIST(l,o2,.)- (<nl, >), DIST(L,o2,b) ={< (n,b >), DIST(1,o2c ) - (<nl,e >). DIST(k,o2, ) =, k=2,3, - ab,c. DISTr(,ol,<b,c >) ((<nl,c >,<b,e >),(<b,nl >,<b,e >}. DIST(2,,o4,<,c >) - {(<nl,n >,<b,c >)}. DIST(l,os4,<c,6 >)- {(<nl,b >,<c, >),(<c,n >,<e,b >)}. DIST(2,oe,<c,b >) - ((<,nI >,<c, >)}. DIST (k,o,z ) -=, k =3,...,15, =<b,e >,<c, >. The set DIST (K,o, ^), K = 1 258 = 258, of noncomputable pairs is given by DIST(256.,ol, ) ) {<b, >,<c, >}, DJST(258,0o,&) =( {<,6 >,<c,b >). DIST(256,02, ) = {<b,. >,<c,a >}, DIST(258, 2,b ) = {<,b >,<e, >}. DIST(256,o2,c) {(<,c >,<b,c >). DlST(256,0oS <b,c >) -e {(<nl, >,<b,e >),(<nl,b >,<b,e >), (<a,nl>,<b,c >),(<c,nl>,<b,c >), (<,a >,<b,e >),(a <,b >,<b,e >), (<a,c >,<b,c >),(< b, >,<b,e >), (<b,b >,<b,c >),(<c, >,<6,c >), (<c, >,<b,c >),(<c,~ >,<b,~ >)} DIST(2508,o,A I,<c,b >) {(<n/l, >,<c,A >),(<nl,c >,<c,b >). (<a,n>,<c,b >),(<b,nl>,<e,b >). (<a,a >,<c,b >),(<,6b >,<c,6 >), (<a, >,<c,b >),(<b, >,<c,b >), (<b,b >,<c,b >),(<b,e >,<c,b >), (<c,, >,<c,b >),(<e, >,<c,b >)}.

104 Based on each set DIST(k,o,,q ) derived above, we can derive the heuristic A(e, ) of the formula (5.3). For example, let e, =(,a,2,nl,3,b,4,nl). Then h(ec) = I + I - 2. If e, — (l,nl,2,n1,3,a,4,nl), h (es )= 1 + I + 256 = 258. In section 6.4, the search efficiency using A (e,) derived on the model Ml will be compared with that using h(e, ) derived for the model Mo. Next, for the case of nonequal costs of rules, the heuristic for e, is given by the formula (5.4). (e, ) max(h'(e, ), A'(e ), A"( )(e}) (5.4) where'(e ) - max((min({LOCS(o,ej,, ): q, E G(o, )}): o E B(c,)}), *h' (C) )-, min({LOCS(o,,e,,qj,): j, e G(o,)}),,.B(e, ) **O(~.S - )(E A min({LOCS(o.,,,,): q, e G(o)}) ) -n(f( rEU)) eE B(e,).0 n( l(EU)) The value LOCS(o,,e,q,) is the estimated minimal cost of the subpath (p(o, ),V(o,)) for o, which takes o, from its position value fio, e,) to its position value 9 E C(o,). As discussed in section 3.3.2.2, we need one more relaxed successor formula with less relaxation for deriving LOCS(oe,q,,). For each rule <a I,,,,., > E R, let the set Z(,,,...,,) be Z(a...,., )= { o:. o~ (~(EU ), {,,,...,a, } n o,^, }. Then, we can derive the relaxed successor formula SCF"I.,. 1,S >.Z(s.. L * )) which describes the constraints of position values of only those objects in the set Z( l,..., g, ). The detailed procedure for deriving this relaxed formula and gen

105 erating the value LOCS(o,e,,,q ) based on this relaxed formula will be given in Chapter 6. Here we show the value of LOCS(o,,es,) by one example. Let (EU) o {oA,D,oE:,A =(A,B },D (C,D ), ={E)) in the (5-city) traveling salesman problem of Fig.2.2. The goal position value of each object o, E r(EU) is ^oAB,e ) (< T,I >,< T,NI > ), ^OCD,c ) (<T,NI>,<T,NI>), and f o,e, ) = (<T,NI>). Suppose c, <(A ),E>. Then, based on the relaxed successor formula SCFRI for each object o,, we can derive the following: Ldist (<fK oB,c, ),^ OAB,ei )>,oAB ) - Ldit (<(< T,Nl >,<F, NI >),(< T, I >,< T,', >)>,oAB) - 2. Ldist ( < OCD,es, ), OCD PC, )>>OCD ) = Ldi t(<(<F,NI >,<F,NI >),(<T,NI >,<T,NI >)>,ocD ) 3. Ldit ( <^. of,e, ),^ OE,C, )>,fE ) = Ldit (<(<F,I >),( < T,NI >)>,E) e= 1. Based on each value of Ldist and the second relaxed successor formula SCF(<ts. s>.z(w,.r,)), we can derive the following: LOCS(oA,e,( OAB,c, )) = 7 + 6 = 13. LOCS(ocD,e,, OCD,e, )) 6 + 5 + 7 = 18. LOCS(OE,, J, OE,, )) = 6. The heuristic A (e, ) is then A(e,) = max((h'(e,),'(e)}) = {18, 18.5} = 18.5 In this problem, the value h (e,) is equal to A (e,) because ir(EU) =. The search efficiency of A' using (e, ) will be discussed in section 6.4, and the value of

108 (e, ) for each state e, generated during the search will be given in Table 0.3. In this section, we have discussed a prrblem model Ml and the procedure to derive the heursitic h (c,) based on the model MI. The problem model Af1 is a more general version of the problem model Mo in that the valve of the heuristic A (, ) derived using Mo can be also derived using Ml with (EU.) ):{{f, a, E EU)}. 5.3. Partition of the set AT In the previous section, we suggested a partition x(EU) of the set EU of elementary units for improving the accuracy of the heuristic A(e,). For a given r(EU ), however, we may need to reduce the complexity for deriving A (c, ). In this section we suggest a partition x(AT) of the set AT of attributes for reducing the complexity for deriving h (, ). As discussed in the previous section, when a set x(EU) of objects is given, the heuristic A (e, ) is computed in terms of the estimated minimal cost of the subpath (p(o, ),(o, )) for each object o, E r(EU). Suppose the problem has m attributes: AT = {Ab,,...,Ab,}. Then the position value of each object o,, o = (a,i,..., }, is given by the ordered m tuple, <p,.,..., p Each p,, jil,...,m, is itself given by the ordered A, tuple, pj = <q,,..., qj >; in which each gq,, 1=1,...,k,, is the position value of the elementary unit Jl with respect to the attribute Ab,. It is obvious that as the value of m becomes large, the complexity for estimating the cost of the supath (p(o, ),rj(o,)) becomes large. (For details, see Section 8.3.) To reduce the estimation complexity, the position value <p,,...,p> of each object o, can be partitioned into several blocks,

107 <(P, * * Ps,), * * *,(P, * * P* )>, in which each block is the position value of o, with respect to the set A, of attributes, A, C AT. For each Ay C AT, let (p(o.,A ),vJ(o,,Ai)) be the subpath of (p(o, ),r( o,)) such that (1) p(o,,Ai) r r, each r, is one of rules in p(o,), and ( o,,Ai ) c l' * * * CNC, each c, ct is one of states in (o, ), (2) each rule rk in the sequence (o,,A,) affects the position value of oe with respect to Aj, and each (rk,c,c, )E SUCCR, anu (3) the position values of the object o, in the states c, and c with respect to Ai are the same, and the position values of o, in the state eN' and the goal ec with respect to A, are the same. Then, the subpath (p(oi )rX(oi)) can be estimated with a reduced complexity by estimating each subpath (p(o,,Ai ),(o,,Ai)), Ai C AT. Let r(AT) be some partition of the set AT of attributes of the problem: f(AT) (A,...,AL). Each block in r(AT) will be called a feature of the problem. The position value of the obejct with respect to each feature A, is defined by the subposition function, ffA: i(EU)XS -. U Q(o,A ), where Q(o,,Ai) is the set of position values of o, with respect to Ay: Q(o.,Aj) [.,X P(Ab, ) in which P(Abj), /=1,..., I A j, is the set of position values of the elementary unit with respect to the attribute Abl. For each object o, in r(EU) and for each feature Ai in x( AT), if o, = {(.,,...,. and A, = (Ab{,, 1. *Ab, }), then,ffA,(o,,C ) = (< pf Ab, ( ^, 1 ), s.,Pf (, I.e,)>(, ~ ~ ~, ~ Aj

108 < *PI Ad).,,,,..., P/- (- A,,C )>). in which each pf,, "l,...,dlj, is the subposition function which returns the position value of the elementary unit with respect to the attribute Abit. The cost of the subpath (p(oi,AJ),j(o,,A)) for each object a, and each feature Aj is estimated using the corresponding relaxed goal formula and relaxed successor formulas. To derive the relaxed goal formula and the relaxed successor formula for each a, and A,, the extended versions the goal formula Goal and the successor formula SCF are formulated. In Chapter 2, we defined the successor condition formula SCF, when the problem has n elementary units and each rule is given by the ordered s elementary units, to be the 2n+s variable first predicate formula. The first s variables i....,, stand for the rule r = <z1,.... s >, each -z, 9 i=l,...,n, of the next n variables stands for the position value of the elementary unit a, assumed in the state es in which r is applicable, and each _.a,, i=l,...,n, stands for the position value of a, in the state e- resulting when r is applied to e,. Suppose the problem has m attributes, Ab1,..., Ab, Then each position value of the elementary unit a, in the state will be given by the ordered m tuple, in which each element p,, j=l,...,m, in the tuple is the position value of a, with respect to the attribute AbL. The 2n+s variable successor condition formula SCF can be converted into the 2mn+s variable formula by replacing each L., and oa,, i=l,...,n, by <ia.._Abl..., _aiAb,, > and <z..._Abl,..., ze,_Ab, >, respectively. Each variable yL^Abo i=l,...,n and j=l,...,m, in the newly formed formula stands for the position value of a, with respect to Abl in the state e,, and each z.,,AbJ stands for the position value of a, with respect to Ab, in the state Cl.

109 This newly formed 2mn+s variable formula will be called an extended successor condition formula, denoted by ESCF. Similarly the n variable goal condition formula, Gol(ps1,..., p_a..), can be converted into the mn variable extended goal condition formula, denoted by EGoal. 6.4. An Extended Problem Model M, In this section, we present a problem model M2 in which a set x(AT) of features of a problem is given by a partition of the set A T of attributes. The problem model M2 is a more general version of the problem model Ml in that the heuristic A (e, ) derived on M1 is also derived on M2 with r(A T) = (AT}. Definition 6.2 A problem, M2, is an ordered ten-tuple, M2 ( r(EU),(A T ),Q,S,F,R,SUCCR,e,e,,,EGoal), where r(EU) is a set of objects, given by the partition of the set EU, x(EU) — {o,..., o}, o, C EU, i=l,...,/,, - v(A T) is a set of features, given by the partition of the set A T, x(AT) {A,..., l,}, A, C AT, j=l,...,l,. - Q = <Q(ol,A ),..., Q(ok,A,)> in which each Q(o,,A,), =i-,....,. jl1,..,l/, is the set of position values of the object o, with respect to the feature Ai, Q(o,,A' ) [A*LX P(A61)] )~EA&

110 where P(Abj ) is the set of position values of an elementary unit with respect to the attribute A bi, and | o, | is the cardinality of the set o,, S is the set of states, - F F <8SfA,,. *, ffA. > in which each ffA,, jl1,...,1,, is the subposition function, ffA': sr(EU)X S -Q J Q(o.,A,), such that for every e, E U) o, E sr(EU) and for every e, E S, if o, l,,...,, } and A, - {Abj,,..., Abi, then *f^A,(o. ) e <fl, *., > where each Iq, I l,...,k,, is q = < oPIf A,,,(.,e ),...,'P/IA,, ('^,. )> in which each subposition function PIAf, V =l,...,di, returns the position value of an elementary unit with respect to the attribute A b,, R is the set of rules, SUCCR C R XS XS is a ternary relation such that for each (r,,es,,cJ)E R XS XS, (r, e,e,, )E SUCCR if and only if e, is the state in which the rule r, is applicable and e is the state resulting when r, is applied to c,: SUCCR = {(<z 1,...,, >,eCj,t ): (<:.., Z, > E R) n (e, Es) n (c E s) n (ESCF(1,...,,,,< pf/A,,(lCj I),..o., PAP/A.(OiC)>, o - ~ <,P/It(* (,t )- * * *'./ f A (.,c )>,< *P/Al (,C* ),*,*PA ^. (oitc )>,

1ll ~-..,<P/Ab,(C, et ),.-^,lAb. (,,eC )>) - true ))) where ESCF(...) is the extended successor condition formula, c is a cost function, c: SUCCR -R?, R the set of reals, such that, for any (r,,Cei ) in SUCCR, c (r,i,e c) w if and only if w is the cost of the rule r, between the state ei and its successor state ec, e, is an initial state, ei E S, EGoal is the extended goal condition formula with n m variables, p_e,_A6i, i=l,...,n, j=l,...m, where each paA6Abi stands for the goal position value of the elementary unt si with respect to the attribute Ab,. In Chapter 6, we will discuss the procedure for deriving the heuristic ((e,) based on the model M2. In this section, we explain the derivation of the relaxed goal condtion formula EGoal'. A, ) and the relaxed successor condition formula ESCFR(., ) for each oi E r(EU) and A E r (A T). Let the object o, be given by o, = {al,..., *. },,, E EU, v =,...,k,, and the feature Aj be given by Aj {Ab,...,Abj ), Ab, EAT, tr=l,...,d,. Suppose the extended goal condition formula egoal in PROLOG is given by the conjunction of I clauses cl, il=1,...,I, egoatl( p_a Ab l..., *p_.l A b., *paAb.... p_ _Ab^, *p_<,lAbl-,...,'Pal_-Ab,..., p_-a,IAbd..., Ip_.il_Ab6, t, * _

112 p_*,._A b, -,..., Ppa,._A bi j,., ps.A b,, 4 *, A b.. pa-Ab,,..., *p_._Ab...,,pa._Abj,.., epa._Ab, ) Then, the relaxed goal formula egoat (o,,A )Lrel for the object o, and the feature Aj is given by the conjuction of the I relaxed clauses cl^ _rel, k =1,...,I, in which each cl^ _rel is derived from the clause clk by substituting anonymous variables, for all variables in cl^ other than pp__,_Abij, il,...,k,, w l,...,di. egoaL (o,,Ai )_rel ( p_oa,.Abj 1,...,,,_Abj, P-_sit _A bi, *., pai,_^,A bid,) P-^, l-Ab,..., p_, _Abjd6, CIt,, *. ^ * * *, t,(_^, * *, _, *pa, I_Ab l, ~..p-, IAb-d,, p-_,A bj..., -,p_'.A bl, Similarly, the relaxed successor condition formula ESCF AI, ) ()yo, _Ab,.z_o _,Ab ) for o, and Aj is derived from the extended suc

113 cessor condition formula ESCF. Let the extended successor condition formula ecf in PROLOG be given by the disjunction of rule-formulas r_ al * i.,, < it,.- *, et > E R, where each r_.el * * * aJ is given by the conjunction of some clsuses. Then the relaxed successor formula ecf _(o,,AA )_rel for each o, and Ai is given by the disjunction of relaxed rule-formuals rt.. ad _rel, < Ik... - *.. > E R, where each r_, 1* * * *- jrel is derived by substituting anonymous variables, _, for all variables other than *j _a,_Ab, and *z_a,,_Abj6, v =l,...,ik,, tw l,...,d. For example, the extended successor formula escf of the (5-city) traveling salesman problem of Fig.2.2 is given by (r^AB({^^^, *22 tAAbh,, gAAb^g...^:EA,, *tEAb2, tAAb,^*_A Ab- 2..., E_E AAb,* E_Ab2); r_BA B( Iz, 2, A -A l, AAb 2,.,,y_E_A b, gE_A b, *zA_Ab l, ezA_Ab 2,.., z...E_Ab l, b z._E_Ab 2); r_DBA ( z,, tz2..AAb 1,'g..AAb2,.., yEAb1, gEAb2, *zA_Ab 1, zA_Ab,..., s_E_Ab, *2_E_Ab )):- crD ( * i, e, LA_A. 6, *LAA b 2,..., LE_Ab A, _EA 2, *,z4_Ab 1, *z._AA 2,..~, E_Ab 1,,_E_Ab ). where (1) for every a, E {B,C,D,E}, f_,,A(I, 2, (., dA, i, A2,., (a..A. _= T, ( e.a, _A b 2,...):- ([,*zl,]-=l a[, A {]), ( al_Ab=T)}, (,jLa_Ab I.1), ( oa, _Ab =F ), (. a, _Ab2=l ), ( *_A_Ab = T ), ( _A_Ab 2= l' ),

114 ( z,..., b- T), ( t., _A b 2-NI ), ( z_AA b,I T ), ( AA b 2I ), ( *..,l_..Abl *Li.A bi), ( z..-.Ab-2= *iL-_Ab2). in which at E (B,C,D,E}, * aI,, (2) for every, E {A,B,C,D,E ), and for every a E (B,C,D,E }, *, a, r_, ji(, 21,*t2,.., * b iAl,. jA b2,...,L -Ab., I,L _AbA2, *z_,c,_Ab, *z_^._Ab2,.. *, *z_^-_Ab,z_.i _Ab2,...):- ((i2.... 2li, j.), (,i _bAI'F), (._. _AS2=), ( l, _Ab I-F ), (,La -_Ab 2-NI), ( *.._ _Ab 1 T ), ( z_s, _Ab 2=Nl), ( *z..._ A b l^=F), ('z.,^_Ab l21), (,_a,_A b I='lt^,_A6 ), ( *zl-_A 2= *tyi-Ab 2). in which *, E (A,B,C,D,E), g74., I*lat'i. Then, for the object o, = (A,B) and the fearure AJ = (Ab, ), the relaxed successor formula ecf /_ (o,,Ai )_I is given by (r_A B_rel ( AA_A b, *IyB_Ab i, *z_A_Ab i, z_B_A 6 I); r_BA_rel ( *y_AA b I, qLBA 6, _,AA b 6, z_B_A b ); rEDrcl( yA_Ab 1, LB_A b, *_AAb 6, *z.B_Ab )):- c/_ ( o,,A )_rtel( qLA_A b, _B_A b I, z_A_A b. JyB_A b I). where (1) r_.AB_rel( *jLA_Ab1, eqB_Ab i, *_A_Ab i, *_B_Ab1):-(L - -[A,B ), ( *LA_Ab i=F), (_ = ), ( *y_B_Ab -F ), (_ =NI), ( zAAb1=T ), (_ -= ),

116 (.BAb,-F), (. _-1), (_-_) (_ —) (2) r.BA_rcl( *A.A_Ab,, *y.B_Ab i, *_AAb6, *zB_ Ab ):- (L,=[B,A ), (_T), (_ —N ), ( tB_Ab-F ), (-), (_ (AAb,- T ), (_ -NI), ( z..BAb,= T), ( =NI), (,_.AAb 1 T), (._ =1 ), (_ 1= ), (_ =_- ). (3) for every E {C,D,E }, r_, A_rcl( *t.A_Ab 1, IAB_A6b, _.A_Abj, *z_B_Ab l):- (L,_ ].,A 1), ( LBAb 1,- T ), (_ -NI), (_ -F ), (_ -IC), ( LAAb6,- T), (. =N/I), (_ = T), (_NI ), (*z_AAAb T ), (_ = ), (.BA bl = Ki-.B_A b61) (4) for every, { C,D,E ), r_Ac _rtel( A-A_A b l, *LBAb l, *_A_Ab l, *_BA b 1) - (L,_1-IA,wi ]), ( LA_A6b, F ), (_ l ), (_ =F ), (_ ='), ( *LBAb iF ), (_ N.I ), ( *_AAb 1= T ), (_.NI ), (_ -F), (_ =1), (*:.BAb,- LB_A6,), (__). (5) for every *j {(C,D,E}, r_Bai _rcl ( *yA_A b 1, *LBAb 1, zBA_A b,, *z_BAb 1):- (L,_]=BIs, 1), (,vBAbl,=F), (_ ~=), (_ =F), (_ =N;), ( *-_AAb, T ), (_ =NI ), ( z_B_Ab 1= T ), (_ =NI ), (_ =F), (_ =1), (*._A_Ab..*y_A_Ab 1), (_ _ ).

110 (6) for every a E { C,D,E), rsrcl JL, B. re( _FA) ), _B _A, *_Ab,, _BA)b 1):- (L,-_ ]-o,B 1), (_ -O), (_ ad ), ( _B_Ab OF ), (_ I-NI ), (*_AA6T ), (_-N), (,_B.A b,-F), (_-), (_ - T), (. -NI), (_AAb,- tA-Abl), (_ -).

CHAPTER S HEURISTICS 6.1. Introduction In this chapter, we will first discuss a general procedure to derive the heuristic A (e,) based on the problem model Af2 suggested in section 5.4. This procedure is similar to the procedure for deriving A (e,) we have developed and which was based on the problem model M in section 3.3. Each algorithm necessary for the procedure is derived by generalizing each step of the associated algorithm developed based on the model M. We will further discuss the complexity of the procedure for deriving (e, ) and the tightness of the derived A (e, ). 6.2. Heuristic Derived using the Problem Model M, Let a problem be modelled by the structure M2 in which AM2 ( EU),r( A T ),Q,S,F,R,SUCCR,c,e,,,Eoa ), where ir(EU) is a set of objects, given by the partition of a set EU, xr(EU) = {ol,....., o}, o C EU, i,...,t, 117

118 r(A T) is a set of features, given by the partition of a set A T, x(AT) {A,...,}, A, CAT, ij,...,l,, Q - <Q(ol,A)..., Q(o,A^)> in which each Q(o.,Ai), i-1,...,l, jl-l,...,(,, is the set of position values of an object o, with respect to a feature A, Q(oi,,A) [^A, P(Abi,) where | o, is the cardinality of the set oi, I Ai I is the cardinality of the set A, and P(Abil) is the set of position values of an elementary unit with respect to the attribute Abil, S is the set of states, F = < 1 ~ ~ ff ~.. ffAs, > in which each subposition function, sffA,: EU)XS- -* Q(oAi), j=,...,l, is such that for every E U) o, E x(EU) and for every c, E S, if o, = {a,l,..., a } and Ay {Abji,...A, then BfAI,(O, C. <, ~ ~..> where each Ig, l 1,...,k,, is q = <.p/Al(, ( li, ),..,^pf A&,,(l,C )> in which each subposition function *pf4 v =l,...,dj, returns the position value of an elementary unit with respect to the given value of the attribute A bj.,

119 R is the set of rules, SUCCR C R XS XS is a ternary relation such that for every (r,cs,,y) E R X S X S, (ri,,,e w ) E SUCCR if and only if c, is the state in which the rule r, is applicable and c< is the resulting state when r, is applied to es,: SUCCR - {(< fl..., f,, >,ei,e, ): (<f,..-,, > E R ) n (ec Es) n (ek Es) n (ESCF(ai,..,,,<eP/A(alCji )'...PfASPAi( li )>,..., <'P/A,(".I,ej ),...,Pf A. (,.,C )>,<'P/A,1(,C^, ),..,p/A,. (le P )>, **~.,< P/fA( (,ck ),...,apf/A (, ek)>) = treC ))} where ESCF(1,..., z, L1_Abl,..., IL.eAb,,...,._^Ab,..., tLJ,,_Ab,,,.t., f_ Abfl,..., t-^_Ab,, A...At_ ^-_Ab,,..., _,,_Alb, ) is the extended successor condition formula, c is a cost function, c: SUCCR -. R, Rthe set of reals, such that, for any (r,ej,ey ) in SUCCR, c (r,,e,e ) = t if and only if o is the cost of the rule r, between the state eC and its successor state ek, e,, is an initial state, e,, E S, EGoal is the extended goal condition formula with m -n variables, p_ a,Abw, = l,...,n, j=l,...,m, where each pa,_Ab, stands for the goal position value of the elementary unit a, with respect to the attribute Ab,. We now explain the procedure for deriving the heuristic (e,) based on the problem model Mt2.

120 Let (p,qj) be the path form the state c, to the goal state e. of the problem, and (,(o.,A,),i7(o.,Ay)) for each o. E w(EU) and A, E r(AT) be the subpath of (p,v,). We will estimate the heuristic h (e,) by estimating the minimum cost of each subpath (p(o,,AJ),r(o,Aj)). First we consider the case for which the rules have the constant cost to. 6.2.1. The Case of Constant Rule Cost For a problem in which the rules have the same cost wo, the estimation of the minimum cost of the subpath (p(oi,Ai),l(o,,Aj)) is reduced to the estimation of the minimum number of rules in the sequence p(o,Aj). The sequence p(o,Aj) takes oi from the position value SffA,(oi,e )to the position value ffA,(o,Ce). Let ESCF4,^,) be the relaxed successor formula for the object o, and the feature Ai. Then, the estimated minimum number of rules in the sequence *(o.,Ai ), which will be denoted by Ldit (<ffA, (o,e, ),^f (,,eC )>,o,A, ), is 1 if and only if ffA,(o,e,) s fA,(S,eI )), and ESCF,,) (ffAj(os ),^,(o, )) true. We frst determine a set LEN'l(o,Ai) of two distinct position values <q,q, > of o, with respect to Ai such that Ldit (< i,qj >,o,,A,) = 1. Based on the set LEN 1(o,,A ), we recur sively derive the value of Ldist(<(ffA,(Oi, ),eA(o,,C )>,oi,Aj) for any arbitrary state c, and the goal ec. Algorithm GDIFF generates the sets DIST(I,o,,Aj,,), 1=l,...,l Q(oAj)j-1. For each pair <gqt,,> in the set DIST(,o,,Ai,g ), Ldist (<j^,, >,oi,Ai) 1. Each pair <i,, > of distinct position values of o, with respect to Ai, which is not included in any of the sets DIST(l,,Ay,i ), 1=l,..., I Q(o,,A, ) I -1, is called a noncomputable pair. All the

121 noncomputable pairs will be contained in the set DIST(K,o,,Aj,g), K; IP I JEI Let EGoalfR1, )( *pO,_Ai) be the relaxed goal condition formula for o, and Ai. Each position value iq E Q(o,A ) of oi with respect to Ai satisfies the formula EGoal1(~A, )(Ai) if jp is the goal position value of o. with respect to Ai. *Thus, the gal set GA, ( ) which contains all the possible goal position values of o, with respect to Ai is given by CA,(Ai) { (i:( E Q~(o.,A,) n (EGoalAt,,)( j) true)). Then, the heuristic A (, ) is given by A(. )-max({'(e, ), A(cs ), A(e, ))) (6.1) where' (C, ) - max({min({w'Ldit (< A,(o,,c ),i >,O,Ai ): E aA (oi ))): o BA,(e,), Ai E a(AT)})) A* (c) = max(( m in({w *Ldrt(<j A,(o,., ),, >,.,A, ): * eEBA (e,)'((e) - max((,,,,( - I n(r(EU )) EI *,(A, ),, f(r(Eu)) min({w -Ldirf (<ffA,(o.,c ),i >.i,A ): A E C, (oi )}): Aj E xA T)}). The set BA,(Ce) = o,:(o, E i(EU)) n (^fA,(o,e, ) CA,(o)). The admissibility and monotonicity of the heuristic h(e,) in the formula (6.1) are proven by

122 Claim 3 in Appendix B. Algorithm GDIFF Begin For each oi in (EU/) and each Ai in r(AT) do begin /* Find every pair of distinct position value of o, between one state and */ /* its successor */ LENl(o;,,Ai):- (<{<,q >:(qr, q" E Q(o.,Aj)) n ( & P t ) n (CsCF tA,)(k,' k ) true)}; For each q, in G, (oi) do begin Q2(oi,Ai, ):: {<iAi,>: (q E Q (oAi ) n (q f,)}; /* Find the set DIST(1,o,,A,,j,) */ DIST(l,o, ),, ):- { (<&, >: (<k,j, > E Q 2(o,,A,g,)) n (<ij,f > E LEN l(o.,A ))); /* Update the set, Q 2(o,,A,,, ) */ Q 2(o,,Ai, j):- Q2(o,,Ai, j,) - DIST(l,o,Ai,,); /* Update the set, LEN 1(o,,Ai) */ LENl(o,,Ai): LEN 1(o,,Ai)- DIST(l,oI,A,q ); n:- 2; While(Q2(o;,Aij,,,)7 and n < IQ(o(,A,)I-1)do begin DIST(n,o,,Ai,, ):= {(<q, >: ( q,, > E Q 2(o,,Aj,q )) n ( 3<q,qi >X 3<q,f, >X< q,q> > E LEN/_ (oi,Ai )) n (<jj g> e DJST(n-i,o,,Ai,.j)))}; /* Update the set, Q 2(o;,A,,Q) */ Q 2(o,Aj,,):= Q 2(oi,A,q) - DIST(n,o,,Ai, ); If (DIST(n,o,,Ai,q, ) = ), then go to NEXT; n:= n + 1; end-while NEXT: If (n < Q (o,,Aj) -l), then DIST(1,o,,A,q ):=, I=n +1,..., Q(o,,A, )-1; /* Every pair left in Q 2(o,,A,,i ) is noncomputable *l DIST(K,o,A q, ) — Q 2(.,A,q,), K = i |P I E I;

123 end-for-do end-for-do Return DIST(l,o,,A,g ), where I E (,..., I Q(o,,A, )-l 1, I P I EU 1), and E G A(o,); End-algorithm The heuristic h(e,) derived from the formula (6.1) can be illustrated by the robot planning problem of Fig.2.3, where EU = (A,B,C and AT - (Abl,Ab2,AbS,Ab4}. Let this problem be modelled by Mf2 in which w(EU) -{ (o: o. (i), i-=A,B,C} and r(AT) (Ai: A = {(Abj, j =1,2,3,4). From Fig.2.3, the goal state e% = <NULL,NULL,(C,B,A ), >. Thus'ffA,(o,,e,) =, i=A,B,C, j=1,2. fBA <A(oAe, ) S A, 3,(oB,C),2, 2ffa(Oc,e,) = 1. *ffAj, o,, ) = NH, i =A,B,C. Algorithm GDIFF then generates, based on the relaxed successor condition formula (,ES.A ) for each o, E r(EU) and A, E xrAT), LEN' (l,o,,Aj) = {<1,0>,<2,0>,<3,0>,<0,1>,<0,2>,<0,3>)}, LEN 1(1,o,,A 4) { < NH,H >,<H,NH >)}, where i=A,B,C, and j=1,2,3. DIST(l,o,,Aj,O)= (<1,0>,<2,0>,<3,0>), i=A,B,C, j=1,2. DIST(l,o,,A 4,NH) (<H,NH>), i=A,B,C. DIST(1,oA,A.3)= {<0,3>}, DIST(2,oA,A,3)= (<1,3>,<2,3>). DIST(l,oB,A,2) = {<0,2>}, DIST(2,oe,A,,2) = <1,2>,<3,2>).

124 DIST(l,oc,A o,1) -{<0,1>)}, DIST(2,oA,A s,1) {<2,1>,<3,l>). Suppose the state e, <(A ),NULL,(C),B>. Then by definition BA^(eC, i) ( OA)^, BJC) =, B c) = {OA,OB, and BAJ^(C ) = {OB). Since; = 1, fn(r(EU)) =, and w = 1, from (8.1) A(e.,) max({('(e,), h'(e), " (c,))) c 2 where A(e(, ) h (e,) - max( 1,0,2,1}) 2 and'(e, ) = max({l,l,l,l}) = 1. As another example, if e, - <(A,C),NULL,(B ),#>, then h (e, ) = 4. 6.2.2. The Case of Nonequal Costs of Rules In this section, we consider the heuristic A (e,) in the case for which the costs of rules are not the same. As before, we estimate A (e,) by estimating the minimum cost of the subpath (p(o,,A,),J(o,^,A,)) for each o, E {(EU) and Ai E r(EU). However, for the case of nonequal costs of rules, we need one more relaxed successor formula to estimate the minimum cost of each (p(o,,Aj ),,q(o,,Ai)). We first discuss this newly defined relaxed successor formula and then explain the way to estimate the minimum cost of (p(o,,A ),q(o,,A )) using this relaxed formula. For each rule <a,..., o > R, let the set Z(al...,, ) be Z(fal,,..-. )- )=: o^ E (EU), {a,,,..., * f} r n oi 7 }. Suppose the extended successor formula ESCF is given by the disjunction of ruleformulas, rdll ~ ~ at <6al * * at > E R, where each r_al * ~ *, is given by the conjunction of some clauses. Then, the relaxed successor formula ESCF(, >(....)) for the objects in Z(al,...,,a) and the feature Ai is given by the disjunction of relaxed rule-formulas, r_..l II... _l,

126 <al,.., a, > E R. Each relaxed rule-formula r._l * * * _.rel is derived from r_all * * a, by substituting anonymous variables, _, for the variables other than z, for i=1,...,e, and yaliAbI _, _^,.Ab, for *,~ E o, t E Z(ag,..., a O, E Ab, E Ai. The derived relaxed formula ESCF R.... >, ) will describe the constraints of two position values of each object ot in Z(a^l,.., i, ) with respect to the feature A, in two states c, and c,. e, is the state in which the rule <^,..., a > is applicable, and e, is the state resulting when < a I.,,, > is applied to e,. We now explain how to estimate the minimum cost of the subpath p( o,,Aj ),( o,,A )) for the object o, and the feature A. Let *Ldis ( <ff^A, (Oi, )O, A, (O,,tC)>,oi,A,) be K,i. Then, it is obvious that for each n E {(I,.,K1- )~, there exist at least one rule <aln,,..., a I.> in the sequence p(o,,A ) and two corresponding states, e, and ch, in the sequence r(o,,A ) such that (1) (a6;,.* *. t }) n oi,, (2) (<,,...,:k. >,ca,e. ) E SUCCR, (3) Ldit (< sffA, (o,,e. ),8ffA (o,e, )>,o.,A,) i n, and (4) Ldit (<ffA (o,,e^ ),ffA,(o,,e )>,o,,Ap) = n-l. By determining a lower bound of the cost of such rules for each n, we can estimate the minimum cost of rules in the sequence p(o,,A). Let this estimated value GLOCS(o,,Acs,14 (o,,?e)) be given by the sum of Ki such lower bounds. Then, the heuristic Ah(e,) is given by (, ) —max((h'(e ), h'(c, ). "(e, )}) (6.2) where A'(, ) — max((min((GLOCS(o,A^,,'q ): q~ E GA,(o)}): oBA, (e ), A, er(AT)}),

128 hA'(c, ) max({( min({GLOCS(o,,A,,e,,, ):, E,(o ))): S.',EBA (CS) A, E (AT ))), h'(e,) -max(( E min((GLOCS(o,,Ai,,,e ):,- n(,.r(EU)) I.,EB,(..),, ~ (*EU)), E A,,(o, )}): A, E ~(AT)}). The set BA,(C,) ={o,:(o, E x(EU)) n (affA,(,,e, )~ GA,(o,))}. Each step for deriving GLOCS(o,Ai,e,A,, (o,,A, )) is given by algorithm GLOCS. Here we briefly go over the step to derive the lower bound of C(< l;., e * I, > te >,'C.P )in the sequence p( o,A,) for each n E (1,...,K,j } For two states,e and c3, if ESCF,,,t As) )(afA,,,, ),sffA.( m,,,))= true, where ESCF (.A,) is the relaxed successor formula for the object ot and the feature Al, then we will say that ec is the resulting state when a simplifed rule with respect to o, and Ai is applied to ec. Let the set C(o,,AI,e,) for each eO E r(EU) and Al E r(AT) have every pair of position values of o, with respect to A, which can be assumed in one state and its successor state which result when a sequence of simplified rules with respect to o~ and Al is applied to e,. First, we derive every rule <at,..., a,' > E R such that (1) {s;,, a),,} n o, C,,and (2) for some (,,., )E C(oA,c,, ) for each o, E Z(,..., a), m 1,...,,..., T,

127 ESCF^^ # >( -,I,!9qI q, 9' _q, f pq If,....,;*,-. )( a,j''',9T) true, and Ldist (< 9,,JA, (0.,eC )>,o,Ai ) = n, I~ Ldi t (<, f,fA,(o,,c, )>,O,,A ) - n-1. It i obvious that the original rule <a ^,,..., ak,.> in the sequence p(o,,A) is also included in the above. Next, for the fixed i, we select the lower bound of the costs f (< a;*,,..., as, k. >.C,eks',) of all the rules < i1,..., a'> derived above. Algorithm GDESC below generates the set C(oh,Aj,e ) for each ok E ir(EU) and Ai E ~r(AT) when the state c, is given. The set DIST(l,o,,A,qi ) for each q9 E Q(o,,Ai) used for GDESC is generated by algorithm GDIFF with G,(o.) Q(o,,A,). Algorithm GDESC (c, ) Begin For each o, in r(EU) and each A, in r(AT) do begin C(o,A,c, ):- {<,,P' >: (Q e Q(o.,A,)) n (g' e Q(o,,A,)) n (CSCFf,A)(Qt q ) ru) n ((iq =" ^A,(o e, e)) U ( 3X(: e {l..., I Q (o,A,)I-1}) n — (< A, (o,,c, ),st > E DIST(l,oI,A,o, ))))}; end-for-do Return C(o,,A,, ) for o, E x(EU), A, E;r(.4T); End-algorithm

128 Algorithm GLOCS below generates the lower bound, given by GLOCS(o,, A,,q, ), of the cost of the subpath (p(o,,Ai ),v( o,,A )) from e, to c in which, = jffA, (o,c ). Algorithm GLOCS (o,,A,,c,q ) Begin /* Find the length between two position values, effA,(o,,C ) and q */ d:=: Ldi i(< ffA,(o,,c, ),qe >,o,,Aj); /* If the pair <ff, (oi,es ),i > is noncomputable */ /* do not go further */ If(dr -I| P | IEU1) then begin GLOCS:= w nu^d, where twAx is the maximum cost of the rule; Return GLOCS; end-if /* At each of i intermediate stages, refine the set C(o,,A ie, ) */ /* generated by algorithm GDESC */ While (d' 0)do begin /* Find all position values each of which has the length of d' from q, */ D(o,,A,,,/,A ):- {,:(- Qe (^,A )) n (Ldi t (< t, I, >,o,,^A) ) d )}; /* Refine C(o,,A,e, ) at the stage of distance d' from the value qg'/ CC~(o,,A,,c,,,,, ):- {<l, >: (<q, > e C (o,,A,, )) n (g e D(o.,A,4d',i,f ) n (Ldt(<gj,,g,>,o,A,) - 1)}; /* Update the intermediate stage */ d':= d' -1; end-while; /* At each of d stages, approximate all the applicable rules */ r==1; While (1 <r < d)do begin W'(tv,o,,A,,e,,, )= {c (<,.., a, >,~,ek ): (o, E Z(<l(,...,, >),

129 z(<aI,...,, >) - {o- E HEU): {II,..., as} n ot, 7 )) n a I ( 3<, t' > E C(o:,A -,e, ), ol E Z(<t,,..., >),,'I,...,,,, o, ~ O.) ( 3< q,,q > E CC(o,,A,,,e,q,, )X( e fA,{ (, ), l =1,...,;,...,p, ) n (,' -^,(e,,ek ), i=1,...,i,...,, ) n (ESCF (<....,, >.j(<,,.,,, >),. )(,, * *...,,, q,.,,,.q.,' ) tru ))}; v v +1; end-while; /* Generate the lower bound of the cost of the subpath (p(o,,Aj ),r(o,,A,)) */ 4 GLOCS:= i min( W(v,o,Ai,c,,g,)); *-1 Return GLOCS; End-algorithm The admissibility and monotonicity of the heuristic (e,s ) in the formula (6.2) are proven by Claim 4 and Corollary 4.3 in Appendix B. As one example of the heuristic (es ) in (6.2), the (5-city) traveling salesman problem given of Fig.5.2 is considered. Let this problem be modeled by Af2 in which x(EUt) ={o: o i, iA,,B,C,D,E) and x(AT) = (A, A 2:Al= {Abl}, A^ ={Ab})). Then from the goal state e, - <{A,B,C,D,E }, A > ffA,(o,e,) = T, i-.,B, C,D,E. *ffA, (o,C,) A,,f2(o, e,) = N. i =B,C,D,E. By algorithm GDIFF,

130 DIST(,o,,A,T)- (<F,T>), iA,B,C,D,E. DIST(l,oA,A 2,1) (<NI,1 >), DIST(l,o,,A 2l,NI) { I,N> }, =B,C,D,E. Suppose the state e, = <{A,B),C>. Then by definition BA,( ) - {oCOD.o E and BA,(c ) {OCA }) By algorithm GDESC, C(OA,AI,,)= {<T,T>}, C(oB,A,,c,)= (<T,T>}. C(o,,A,c, ){ (<F,T >,<F,F >,< T,T >), i=C,D,E. C(o,A2,e) - (<NI,NI >,<NI,I>,<,NI >,<I,I >}, iA,B,C,D,E. By algorithm GLOCS, GLOCS(oc,A i,e~,T) == min({<C,A >,<C,D >,<C,E >}) = min(({,5,9}) = 5. GLOCS(oD,A,c,e,T) ==min({<D,A >,<D,C>,<D,E>) = min({10,5,}) = 5. GLOCS(oE,A,e,,T ) e min({<E,A >,<E,D >,<E,C >)) = min({(13,,9}) = 6. GLOCS(oc,A 2,,,NI) = min( <C,A >,< C,B >,< C,D >,< C,E >}) == min({6,7,5,9)) = 5. GLOCSoA,A2,e,,I) = min({<B,A >,<C,A >,<D,A >,<E,A >)) = ((7,8,10,13}) = 6. Thus by the formula (6.2), h (e )= max((h{(c,, ), A'(c, ), A "(e )) = max((8,6,8}) = 8 where h (e,) = " (, ) = max({ (5+5+6),.(5+6)) = 8, and

131'(c ) - max({S,5,6,5,6)) - 6. Finally we present two algorithms SNUM and OMEGA. SNUM generates the value of * when the set r(EU) of objects and the set R of rules are given, and OMEGA generates the set n(rr(EU)) when the set r(EU) of objects and the set n are given. Algorithm SNUM ((EU), R) Begin /* Initialize the value of */ a:= 0; While (R # and i < ) do begin Select one rule <i,.., > from R; OSET:- {o,-:(o, E x(EU)) n (oi n (a{I,...,*.} ^ )}; If (; < the cardinality of the set OSET), then;:- the cardinality of OSET; end-while Return a; End-algorithm Algorithm OMEGA (r(EU), n) Begin n(x(EU)):= {o:(o, E r(EU)) n (o. cn)); Return fl(r(EU)); End-algorithm Algorithm HO below computes the heuristic A (e,) based on two formulas (6.1) and (8.2). Algorithm HO (e) Begin /* Find all goal position values of each object with respect to each feature */ For each o, E r(EU) and A, E i(A T) do

132 begin GA,(0).:- (,: (i E Q(o, A,)) n (Co..'A,)( ) - true)}; end-for-do For each A E r(AT)do begin BA,(C, ):= (,: (o, E (EU)) n (e^A,(o.,e,) CA,(o,))); end-for-do If (the cost of each rule of the problem is the same o ), then begin'(, e.) max({l min((w *L"dt (< (o,,eC. ),q > o,Aj ): 9, E G,(o))): A, E (AT)); A (C,) = max({min(({w Lda (< ffA(o,,e, )uq >,o,A, ):, E GA (o,)}): A, E x(AT), oEBA,(Ce)}); If(; > l and n((EU))U ) then begin (e" (,) max(({ -I li|n(r(EU))|I.EB^(e,),, n(t~'E)) min({w -Ldirt (< sf, (o,,c, ),C, >.o,,A, ): q, E GA,(o,)}): A, E r(AT))): return h(es) =max({Ah (e ), h' (, ), "(e )}); end else return A(es) = max({h(e, ), A*(e,)}); end-if; If (the cost of each rule of the problem is not the same), then begin' (c,) =- max( {! S min({ GLOCS(o,,A),c,q, ): EB, EBA (s) ), E G,^(o,)}): A, E t.4T)A); h'(, ) = max({min({GLOCS(o,,A,c,,e ): q E CG o, )} ):

133 A, E r(AT), oEBA (e )}); If(; > 1 and fn((EU))' ) then begin A"(C ) max((. I- ln((EU)) I.EB,(A1),, * (fEU)) min((GLOCS(o,,A,e, ): E GA,(., ): A, E x(AT))); return (c,) - max((hA (e ), A'*(e ), A "(. ))); end else return h(e,) max({'(e, ), A'(c, ))); end-if; End-algorithm 6.3. Complexity and Tightness of Heuristic In this section we examine the complexity of the procedure of deriving the heuristic h (c, ) based on the problem model Af2. Also the tightness of the heuristic (e, ) is derived. The complexity of the procedure for deriving the heuristic (e, ) is given by the complexities of the following algorithms: algorithm GDIFF in the case of equal cost of the rule, and algorithm GDIFF, GDESC, and GLOCS in the case of nonequal cost of the rule (the complexities of the procedures for deriving the relaxed formula, the value of i, and the set fn(r(EU)) are neglected). The complexity of each algorithm, when the binary search method is used, is given by the following O-function: 1. Cs(GDIFF)= O( E l Q(o,,A)14). *, r(<EU )A, fr(A )

134 2. C:(GDESC(e,))- O( S E IQ(., 6) e, E(EU)A, E(A T) 3. Cz (GLOCS(o,,A,,,,qs )) O( E I Q(o,,A,)1 n IQ(o^,A,)12). <,..., >ER n {...,, n{ {.i....). }4 Si E(U), e. #,, Thus, the complexity of the whole procedure for deriving the heuristic h(ce), which will be denoted by Cz (HO (e )), is 1. in the case that the costs of rules are equal, Cz (HO (e, )) = Cz (GDIFF), (6.3) 2. in the case that the costs of rules are unequal, C2 (HO (e, )) = C( GDIFF) + Cz (DESC(, )) + E E E Cz(GLOCS(o,,A,,, )). (6.4) ~, E(EU)A, E(EU)j, ECGA(o.) Let APM"J) denote the version of Af2 which has the set of objects i,(EU) and the set of features rj(AT). Then from the equations (6.3) and (6.4), we can easily see that C:(HO(e,)) derived using A1{(1,) is less than or equal to Cz(HO(e,)) using Af(KL) if the set wl(EU) is the refinement of the set WK(EL), and the set,j (A T ) is the refinement of the set xL (A T ). Theorem 1 Let Mtf"') and Af(K'L) be two versions of the problem model Al. If the set r,(EU) of objects defined for M{"']) is the refinement of the set irK(EU) of objects defined for MAfKJ) and the set r(jAT) of features defined for Af''J) is the refinement of the set k 4tL) of features defined for AI$fAL), then for every state sc Cz(HO(e,)) derived using Af IJ) is lee than or equal to Cz(HO(e, )) derived

135 using A^fKL) Let us then consider the accuracy of the heuristic HO(c, ) derived wing each version of the problem model M2. First consider the value of A (e,) derived on the model version M'J'') in which rl(EU) = {EU) and rj(AT) {AT). If the goal condition formula EGoda defined for AM2('J) completely describes the goal state ec and the cost of each rule is the same, then for every state c,, A (c,) = A (e, ), i.e., the value of h (e,) becomes the minimal cost of the path from e, to ec. This is easily derived from the fact that each state is uniquely defined by a set of given position values of all the elementary units. Next we will compare two values of the heuristic HO(e,) derived using two different versions M2:') and M^ L }) of the problem model M2. Lemma 6.1 Let M1t'1) and MlK.L) be two versions of the problem model M2 in which the set rl(EU ) of objects defined for M''1) is the refinement of the set rK(EU ) of objects defined for M2(^,oL). Then.;(K,L) iS less than or equal to ( j) twhere 8(KL) is the value of a derived on the model AM(K,L) 2. the cardinality of the set fn(nr(EU)) is less than or equal to the cardinality of the set n(ir (EU)). Lemma 8.1 can be directly derived from algorithm SNUM and OMEGA. The value of i;(. ) derived using the model Af('J') is equal to the value of a given for the problem model M0o if the set xr(EU) of objects defined for Af( j) is

138 rl{(EU) = (({,: a, E EU). Then by Lemma 8.1, in problems such as the consistent labeling problem and the robot planning problem where the value of * is 1, the value of; (K,L) derived on any version MK:.L) of the problem model Al2 is 1. Let AllJf ) and M KL) be two versions of A^2 such that xri(EU) is the refinement of efK(EU) and rwj(AT) - rL(A T). To compare the two values of A(e, ) derived using M2i'J) and M2K'L), we will first compare the estimated cost of the subpath (p(oK,Aj),r(O,,Ai)) for oK, E xK(EU) and Ai E xn(AT) derived using MiK') with the estimated cost of the subpath (p(eo,A ),r(oie,Aj)) for each o C oK,, Oi; E ~r(EU), derived using M2('). Based on the definition of the relaxed goal condition formula EGoal('A ) for each o, E x(EU) and Ai E ~r(AT), we can easily derive the property of Lemma 6.2 below. Lemma 8.2 Let AM(']J) and AM2(Kt) be two versions of the model M2 such that xl(EU) is the refinement of x'K(EU) and rj (AT) T L (AT). Then for each Ai E rj(AT), and for each oK, E xr-(EU) and each ol E xwr(EU), k=l,...,r, such that o*l C oKi, it holds that for every <q1.,l,* *,, > E Q(oK,,tA) where qgl, E Q(oj,Aj),t k=l,...,tr, if <q, l,., q > E GC(oK, ), then q t; E CGA,(o ), *],...,. For example, let the consistent labeling problem given in the section 5.2 be modeled by two structures AM('J) and MIK'J) in which t When qI is the tuple of I elements, jl is given by the sequence of I elements in ql^. For example, if ql, = < q,. ~, qgl >, then <...,qi,...> = <...,q 1,.,....

127 I( ) l}) - {}- (1),(2),)3),(4)), rK(EU) {{1),2,3),{4)), and,r(AT) rL(A T) (A,: Ai ( {Ab)). The goal set GC^(oK, ) for oh., = 2,3 in rK (EEU) is then GA (OK,) {<a,6 >,<c,c >), and the goal sets GA,(oI/,), GC (o,,) for oll = (2), o012 = {3) in I,(EU) are CA^(O i) = >,< >,< >), >,< >)), respectively. Then, for each <qK l,qK 2> E GAC({2,3}), qK. E C^,({2}) and qK2 E GA,({3)). However, not vice versa: <6 > E GA({2})) and <b >, <c > E GA,1((3)), but <,b >, <,e > * GA1({2,3}). Lemma 6.3 Let M'-J) and MHKLt) be two versions of the model M2 such that wr(EU) is the refinement of rK(EU) and rw(AT) rL(A T ). Then for each Ai E r,(A T) and for each OK, E r^K(EU) and om E ir(EU), k1l,...,o, such that oi C OKi, it holds that for each es E S and for each <q/,i,.. fl,,> E GAC(OKi), if (sffA, (oKc,e ),<h,..., l. >) is computable, then Ldist((sfA,(OK.,es ),</li,..., V,, >),OK, v,A ) > Ld;t ((offA(o,c, ),ga ),o,A ), k =l,..., W. Although Lemma 6.3 is proven in Appendix B, it is easily understood by one example. Let the 8-puzzle problem given in Fig.2.1 be modeled by two structures M'.",J ) and'2(KL) in which I,(EU )= {{,.: t, E EU}, I{K(Et) ({{1,,t)},t,: t, E EU, 1, j t,,, j tI,}, and rL (AT) —- r(AT) = {A1: A = {Ab}})). Suppose o`K, in WKA(E') is OaK = ({,t), and oI, ~ol2 in wi(EU) are il = (t ), 01 2 = {(1). Then. when

138 given two states e, and ce such that p (t,e,) 4, pf (l,e,) 2, pf (4,c )= 5, and pf (,,e,) 1, compare Ldisf((<4,2>,<5,1 >),{(,t, ),A 1) and each of Ldat((4,5),(t ),A 1) and Ldit ((2,1),(tI),A i). First from the relaxed successor formula ESCFr (1.,A for the object (I{,tI), (<4,2>,<1,2>), (<1,2>,<2,1>), (<2,1>,<5,1>) E LEN ({(rt,r},A,) is derived. Then, based on LEN 1l({(l,t,),A ), (<1,2>,<5,1>) E DIST(2,{(,t1),A 1,<5,1>) and (<4,2>,<5,1>) E DIST(3,{(t,tl),A 1,<5,1>) are derived. Next from each of two relaxed successor formulas ECSF(')^A) and ECSF( ^JA, (4,5) E LEN I(({t ),A 1) and (2,1) E LEN ({t}),A 1) are derived. Thus 1 = Ldit ((4,5),.{( })A 1) = Ldis ((2,1),{t},^A,) < Ldist((<4,2>,<5,1>),{t,1)},A^) = 3 in which Lemma 6.3 holds. Note that for the problem model M2, the cost of the rule <s,..,a > between two states e, and eC was given by c(< n,..., a^ >,e,,c ) for some function c. Suppose for a problem, such as the traveling salesman problem, it holds that for every (< a,..., a> >,es,e,) E SUCCR, (<,..., a, >,eC,e ) = J'f (a,...,, ) for some function f C,". Then, the estimated cost, GLOCS(oK;,A,e,<l,., ~ * >), of the subpath (p(o,,A ),r(o,,A)) is equal to or greater than the estimated cost, GLOCS(o,1,Aj,,es,<qt >), of the subpath (p(oJa,Ai ),ij(o,t,A)) for each olC oE,, olit E ri(EU). Otherwise, if the cost is not independent of e and c, then GLOCS(ofi-,Ai,es,<Tl,,. * *, />) may be less than or greater than

139 GLOCS(ol,A,,, l,j ) of (p(oli,Ai ),q(ol,Aj )). (for details, see ARGUMENT-I in Appendix C). Lemma 0.4 Let the cost of the rule c (<a1,.,., >,e,,e), (<6l,... e, >,c,,cy)E SUCCR, be independent of e, and c1. Then for each Ai E sr(AT) and for each OK. E WK(EU) and ol E ri(EU), k=l,...,tu, such that o;l C oK, it holds that for each e, E S and for each <',i, * * *,, > 6 GA,(oK, ), gi ~ GA,(o(, ), if (< AIA,(oKi,e. )t<.. <, q., j. >) is computable, then GLOCS(om,Aj,c,,<V"l,.., qlim >) 2 GLOCS(o li,A,e,, ), p =l,...,t. By Lemma 8.2 and Lemma 6.4, we derive Corollary 6.4.1 below. Corollary 6.4.1 For each A, E,r(AT) and for each ofK E rK(EU) and ol E Jr(EU), k =l,...,w, such that olj C oK,, min({GLOCS(o,A y,e,,<q",l, P...,, />): <qi,.,,, > E GA, {(o^K )}) > min((GLOCS(ol,A,e, Qga >): E G, (ol )}), - =l,...,tr. Based on Corollary 6.4.1, we can compare the two values of the heuristic h (e, ) derived using two different versions MIf("') and Mf (KL) of the problem model Af2. Theorem 2 Let the cost of the rule c(<,,... >,es,e ), (<*1,...,s >,,,e ) E SUCCR, be independent of es and eC. Let Af(tJ) and

140 ^f1K'L) be two versions of the problem model M2 in which ir,(EU) is the refinement of rK (EU) and wj(AT) xL (AT). Then for each state e,, the value of the heuristic HO(e,) derived using AfJIt'), denoted by HOt(I je,), is les, than or equal to HO (KL e, ) derived using MIKL) 1. if;(K.J) 1, or 2. if n(lrK(EU)) fl(wl(EU)) and, for each object oKj E rK(EU), each rule affects the position value of at most one object oKI E wI(EU), ~K.A C oKi, with respect to each feature Ai E xr(AT). The proof of Theorem 2 is given in Appendix B. Theorem 2 compares the values of HO(e, ) derived using two versions M2('J) and M^(KJ) Of M2, rspectively, where xr(EU) is the refinement of I (EU). Next we will compare the values of HO(c,) derived, respectively, using two versions M"'J) and MA(KL) in which xr,(EU) r= K(EU) and wrj(AT) is the refinement of RL(AT). As before, to compare two values of HO (e, ) derived uing M''"J) and M^(KL), we will irst compare the estimated cost of the subpath (p(oe,A^),ir(o,ALj)) for o, E wx(EU) and AL E Irj(AT) derived using Mf'-') with the estimated cost of each subpath (t(o,,A Jik ),( o,A jt )) for Ajl i AL, A ji E w (A T). Lemma 6.6 Let AfI'J) and AM2(KL) be two versions of the model Af2 such that j,(AT) is the refinement of rL(AT) and r,(EUI) = rK(EL). Then for each o, E ir(EU), and for each AL E rL(AT) and each AjL E srj(AT), k=l,...,t, such that Ajjk C ALj, it holds that for every <q,,..,, > E Q(o,,?-,) where qiij E Q (o,,AJj ), k 1,...,v, if < j, i..,,.> E GA (o, ). then

141 qjj e CA, (o), *k,...,v. As in Lemma 6.2, Lemma 6.5 is easily derived based on the definition of the relaxed goal condition formula EGoal'^) for each object o, E n(EU) and each feature Ai E (A T). Lemma 8.8 For each oi E nir(EU) and for each ALi E rL(AT) and Aji E irj(AT), k=1,...,v, such that Ajt C_ ALi, it holds that for each e, E S and for each <gJi *. G (, Qi, > E GA,, (o ), i E CA,(o ), if (<ffA,(o,e, ),< ji *., q, >) is computable, then *Ldi t((fA(,(o.,C, ),<-iC,..., fj, >),o,,AL ) > Ldit ((ffA,, (oi,e, ),qiJ ),o,,Aji,), k =l,...,r. The proof of Lemma 6.6 is given in Appendix B. One example in which Lemma 6.6 holds is given by the robot planning problem of Fig.2.3. Let this problem be modelled by MA2('-) and MKL) in which r,(EU) = K(EU) =o( A,~g,~: oA = (A ), o = {(B), c {C}})), xrj(AT)= {Aa (:A = (Ab^}, =1,2,3,4}, and (AT) = {AL: ALI, {A61,...,Ab6}}. Suppose two states es = <(A ),NULL,(C ),B > and e, = <NULL,NULL,(C,B,A ),~>. Then when modeled by MA'l'), from c,,'ffAA(,,e ) = 1, Jff,(oA,e ) =O,,,( oA,, ) = 0, and ffA,4( oA,c ) = NH; from ec, *AAA) Oe,,) 0,,,) O= 0,,A,3(^O,C ) = 1, and sffA4(oA,,) = NH. As given in the section 6.2, Ldist((l,),oA,Al) = 1 and

142 Ldit((O,l),O,AJ3) - 1. When modelled by MJK'L), from the state e,, ffA,,(A,e,) - <1,O,O,NH > and from c, ^A,(OA,Ce) <0,O,1I,NH >. Then Ldirst((<l,O,O,NH >,<O,O,I,NH >),~A,A) - 2. Thus, 2 = Ldist((<l,OO,NH >,<0,0,1,NH > ),A,AL 1) > Ldit ((l,O),o,,Aj) = Ldit ((O,(),oA,AJs) = 1. Lemma 6.7 Let the problem have the cost of the rule c(<a,..., o, >,e,,e), (<1,...,, >,e,,c, )E SUCCR, be independent of c, and ce. Then, for each o, E rl(EU) and for each AL, E L(AT) and Aji, E xr(AT), =1,..., —-, such that Ajji C AL, it holds that for each e, E S and for each <Wji e * *, j i9j. > E GC4,(o), o j.t GA(o,), if(<JffA, (o,,, ),<iilj,...,. >) is computable, then GLOCS(o,,AL,J,c< i,<,l ~.., fi >) > GLOCS(o,,Aji,e,qJi ), =1,...,v. The proof of Lemma 6.7 is given in Appendix B. To assist in the understanding, Lemma 6.7 is illustrated by one example, the (5-city) traveling salesman problem given in Fig.2.2. As before, let this problem be modeled by two structures MAf2(-) and Af2(KL) in which r,(EU) = rK(EU) = ({o: o; = (i), iA.4,...,E), rj(AT)= {An:An A (Ab }, k=1,2}, and rL(AT) = {ALI: AL'= {AbI,Ab2)). Suppose there are two states e, = <{A,B},C> and c == <A,B,C,D,E),A >. When modelled by A'.J'), for e, f )=force,, cff), ^fA,,(OD,C, F, ) and fA,(OD,Cs ) = NI; for e, ffA,,(oc,e ) = T, *ffA,(c,e,) = N1,

143 fAl(OD,C, ) T, and sffA,,(oD,,) = Nl. Then, as shown in the section 6.2, GLOCS(oc,A,,e,T) - 5, GLOCS(oc,A 2,e,,NI) - 5, and GLOCS(oD,A^l,ej,T ) 5. However, when modeled by M'L), for,e fA, I(OC,. e) = <F,I >, and 8ffAj (D,C, ) <F,NI >; for ffA,,( OC,) -P <T,NI>, and iffA,,(oD, ) - <T,NI >. Then by GLOCS GLOCS(oc,AL,e,,< T,NI >) = 5 and GLOCS(D,AL I,Ce,,< T,NI >)= 5 + 6 = 11. Thus, 5- GLOCS (oc,AL,c,,< T,NI >) > GLOCS(oc,Al,,e,T) = GLOCS(oc,Aj2,eC,NI). 5, and 11 = GLOCS(oD,ALIe,,<T,NI>) > GLOCS(oDt,A, e,, T) == 5. By Lemma 8.5 and Lemma 6.7 we can derive the property in Corollary 6.7.1 below. Corollary 6.7.1 For each o, E ri(EU) and for each ALi E rL(AT) and Ajik E rj(AT), k=1,...,v, such that Aj4k C AL,, it holds that for each ce E S and for each *<ji, j. i,, > E GA,,(O,), if (<ffAL,(o,esC),<jjI, * * *,) is computable, then min((GLOCS(oi,AL,C,,<Qj1,...~, j,. >): < ji, V...,;, > E GA,;(o.)}) *> min({GLOCS(o,A,^,,, >): ji E GA(o.f )}), =,.... Based on Corollary 8.7.1, we can compare the two values of the heuristic A(e, ) derived using two different versions Af (IJ) and Alf ('L) of the problem model A'2

144 Theorem 3 given below is proven in Appendix B. Theorem 3 Let the problem have the cost of the rule c(<i1l,..., a,>,e,,c), (<oI,..., a,>,c,,c,) E SUCCR, be independent of c, and ca. Let M2( ) and MIKL) be two versions of the problem model Af2 in which rl(EU) = (K(EU) and xr(AT) is the refinement of rL(AT). Then, for each state c,, the value HO(Ij es ) derived using M''J) is leI than or equal to the value HO(KL (e,) derived using Mi( L). 6.4. Examples In this section the search efficiencies of A' in terms of expanded states (nodes) are discussed using three examples, the consistent labeling problem, the robot planning problem, and the traveling salesman problem. We use the heuristics derived using various versions of the problem model M^2 The Consistent Labeling Problem Let the problem given in section 4.1 be modelled by three structures A (1'l), M2(2), and M(S33, respectively, in which wl(EU) = {{1},{2),{3),{4)), r2(EU)= {{1),2,3),(4)), 3(EU)= {{((1,4),{2,3)), and r,(AT) = {{A}), i=1,2,3. Then the number of expanded states until the solution is found is 10 when the problem is modelled by Af121), 5 when modelled by Af i-*), and 5 when modelled by MA 3). Table 6.1 contains three values of the heuristic derived on the three models. The Robot Planning Problem

145 Let the problem given in Fig.2.3 be modelled by MAI') and M 22), respectively, in which n,(EU) - I~EU) { ((A ),(B),(C)), irl(AT) - {(AbAb2,Ab6,Ab4)), and ir2(AT) = ((Ab),(Ab2),(Ab3},{Ab4}). The number of expanded states is 8 when the problem is modelled by either of Mjl'l) and Mj2'2). However, as shown in Table 6.2, the value of the heuristic used for A' varies depending on which of M i') or MI2'2) models the problem. The (&tcity) Traveling Salesman Problem Let the problem of Fig.2.2 be modelled by Ml(' ), M 22), and M13), respectively, in which I,(EU) =;(EU) ({{A ),(B),(C),(D },E))}},,r3(EU) = {{A,B}, C,D ),(E)),,,(AT)= {{Ab,,Ab2)), ir2(AT) ({{Ab},{Ab2)}, and r(AT) {{(Ab,,Ab2}}. Then the number of expanded states is 8 when modelled by AMI ); 20 when modelled by MI2'2); and 14 when modelled by M3'3S). For each model, the value of the heuristic A (e) for the state e, generated during the search is given in Table. 6.3. 6.5. Discussion We have suggested various problem models A, Mo. Ml, and M2. The problem models Al0, MI, and M2 are, however, related to one another by the values of the heuristic A (e,) derived for them. (The problem model At can be given by the model Alo when the goal state is described by the corresponding goal formula.) 1. The value of h(, ) derived uing the model Atf is equal to the value of h(, ) derived using the model Af, when a set r(EU) of objects for Alt is given by r(Er) =({{a, }:, EEU).

148 2. The value of A (e,) derived using the model M1 is equal to the value of A (e ) derived using the model M2 when a set r(A T ) of features for M2 is given by w(AT) {(AT). We have shown in section 8.3 that the complexity for deriving the heuristic A (c,) and the tightness of A (es ) derived depend on the set of objects and the set of features defined for the problem model M2. The number of attributes of the problem is in general much less than the number of elementary units of the problem. Thus in order to derive a fair heuristic with a reasonable complexity, the problem can be modeled by the sturcture Mj l) in which r1(EU) = { a,): a, E EU) and ir1(AT)= {AT}. The state-space of the problem is then searched based on the heuristic derived on M2(1'l). If the search efficiency is not satisfiable, then the problem of the same type is modeled by some other structure, based on Theorem 2 and 3, guaranteeing better search effciency.

147 v Values of Heuribtic State e. HO(lte) HO,22e.) HOI 5 (,nl,2,nl,3,nl,4,ni) 4 4 4 (l,a,2,nl,3,nl,4,nl) 3 3 3 (l,b,2,nl,3,nl,4,nl) 3 3 3 (l,c,2,nl,3,nl,4,nl) 259 259 258 (l,nl,2,a,3,nl,4,nl) 3 3 3 (,nl,2,b,3,nl,4,nl) 3 258 258 (l,nl,2,c,3,nl,4,nl) 3 3 3 (l,n1,2,nl,3,a,4,nl) 259 258 258 (l,nl,2,n1,3,b,4,nl) 3 3 3 (l,nl,2,nl,3,c,4,nl) 3 3 3 (l,nl,2,nl,3,nl,4,a) 259 259 258 (I,nl,2,nl,3,nl,4,b) 3 3 3 (l,nl,2,nl,3,nl,4,c) 3 3 3 (1,a,2,a,3,nl,4,nl) 2 2 2 (l,a,2,b,3,nl,4,nl) 2 257 257 (l,a,2,c,3,nl,4,nl) 2 2 2 (l,b,2,a,3,nl,4,nl) 2 2 2 (l,b,2,b,3,nl,4,nl) 2 257 257 (I,n,2,b,3,nl,4,c) 2 257 257 (l,c,2,a,3,nl,4,nl) 258 258 257 (1,c,2,b,3,n1,4,nl) 258 (l,c,2,c,3,nl,4,nl) 258 258 257 (l,b,2,b,3,nl,4,c) 1 256 256 (l.a.2..3.c.4.nl) 1 1 1 ~l met A. A Table 6.1 Heuristics in the Consistent Labeling Problem

148 I V lue of Heuristics State e. i Hi er, i ) O i O. <(A,C),(B),NULL,*> 6 3 <(A),(B),NULL,C> 5 3 <(A,C),NULL,NULL,B> 6 3 <(A),(B),(C)v#>4 2 <(A,C),NULLB), > 6 4 <(A,C,B),NULL,NULL, > 0 3 <NULL,(B),(C),A> 3 2 <(A),NULL,(C),B> 3 2 <NULL,(B,A),(C), > 4 2 < NULL,(B),(C,A), > 4 3 <(A,B),NULL,(C),>> 4 2 <(A),NULLC,B), > 2 1 <NULL,NULL,(C,B),> 1 1 <NULL,NULL,(C,BA), > 0 0 Table 6.2 Heuristics in the Robot Planning Problem

149 I State c, I /to i,j \ HO2 (2j(Cs) 2 d 13 1i.'=''', ff <{A),B> 22.6 11.5 17 <{A),C> 24 12 18.5 < {A),D> 25.56 14 19.5 <{A),E> 23 12 18.5 <{A,B},CB > - 17 8.5 14.5 <{A,B},D> 18.5 10 16 <{A,B),E> 16 8 14.5 <{A,C),B> 19 9.5 15.5 <{A,C),D> 23 11.5 19.5 <{A,C),E> 23 11.5 19.5 <{A,D),B> - 11 18.5 <{A,D),C> 11.5 21 <{A,D},E> I 11 17.5 < {A,E,B> - 8.5 18 < {A,EE},-C> I1 15 <{A,E},D> - 9 12 <{A,B,C),D> 19 13 19 <{A,B,C),E> 1 6 10 18 <{A,B,E),C> 15 10 15 <{A,B,E),D>11 116 < {A,B,D),C> - 13 22 < {A,B,D),E> 9 15 < {A,C,D},B>- 13 23 < {A,C,D),E> 10 17 < {A,C,E},B> 10 < {A,C,E},D>- 10 < {A,D,E},B> 7 13 <{A,D,E},C> -7 13 < A,B,C,D},E> 13 < A,B,C,E},D> 10 <(A,C,D,E},B> - 7 7 < {A,B,E,D},C > 6 6 < {A.B.C.D,E).A > 0 0 0 I * _-, _ * _ Table 8.3 Heuristics in the (6-city) TSP

CHAPTER 7 SEARCH ALGORITHM He 7.1. Motivation In Chapter 3, we discussed algorithm A' which searches the state-space of a problem for finding a solution to the problem. Algorithm A' evaluates the promise of each state to the goal state by means of the evaluation function. For each state c, the evaluation function I (c,) is given by (c, ) (c, ) + A (c,) where g(e,) is the minimal cost of the path established so far from the initial state c, to Cs,, and A (e,) is the heuristic estiamte of the minimal cost of the path from e, to the goal state e. During a search, A' selects the state for expansion which has the minimal value of /. If more than one state have the same minimal value of f, A' selects the one which has the maximal value of g since the state with larger value of g is probably closer to the the goal state. If more than one state has the same minimal value of f and the same maximal value of g, A' selects any of these arbitrarily. This arbitrary selection may result in the worst possible search efficiency. For example, if two unexpanded states e, and ce have the same minimal value of I and the same maximal value of g. but the selection of e, results in more states expanded than the selection of ey, then A * may arbitrarily select the less efficient state e, for expansion. 160

161 For example, consider the consistent Iabeling problem, given in the section 6.4, which is modeled by sjl,) where r,(EU) - ((1),(2,(3),(4) and wr(AT)- ((Ab}). As shown in Fig..1 and Table 6.1, when the state-space of this problem is searched through the tree, the initial state Ci - (1,nl,2,nl,3,nl,4,nl) has 12 successor states, three of which have the value 259 for, and nine of which have the value 4 for I. Since all of these nine states have the same value 1 for g, according to the arbitrary selection strategy, algorithm A may select for expansion any of the nine states. Suppose the state -, (1I,9I,2,b,3,nl,4,nl) is selected for expansion. Then 6 successor states of c, are generated: c, I = (,c,2,,3,nl,4,nl), =, 2 ( 1,,2,,3,n,4,,nl), s " (l,c,2,,3,n,4,nl ), c,4 = (l,nl,2,,3,a,4,,n), and,es = (I,nl,2,,3,nl,4,c). The two states e, and c,4 of these are then pruned out from the search tree because, based on the values of 1(c,3) and A (C,4), they are known to be states not on the solution path. Among c,, c,2, and cs suppose ~,I is selected for expansion. However, from the definition of the successor condition formula, no successor state of c,j is generated. Thus c 2 is next selected for expansion. The only one successor state e,21 Of C~2 is generated. The state c-21 is then, based on the selection strategy of A', selected for expansion. Since no successor state of c,^1 is generated, finally the state e,s is selected for expansion. However its successor state is identical to 0c,l which was shown to have no successor state. Thus A goes back to the fit level of the search tree and selects for expansion one of eight unexpanded successor states of e,, with the value of 4 for f. Suppose e, = (l,n,2,a,3,n/,4,nl) is selected. Three successor states of c% are then generated: cl =- (l,a,2,a,3,n,4,nl), el, = (1,6,2,.,3,n/,4,nl), and

16S cs (1,c 2,.,3,nl,4,sl). The state ct is frt pruned out because from its heuristic value A (e) it is known to be a state not on the solution path. The states e, and e,2 have the same values of for I md the me les of 2 or i. Suppose,cl is selected for expansion. However no successor state of e is generated. The state *C2 is next selected. Two successor states of c*2 re generated: j21 - (1,o* 22,.,3,4,n ) and 22 - (1,,2,e,3,4,C ). Selection of either of Cy21 and, 22 results in the goal state e (1,6,2,,3b, 4,c) generated as the successor state. Then in total 10 states are expanded until the solution is found if the state e, is rust selected for expansion among the nine successor states of cr, which have the value 4 for / and the value 1 for g. However, if the state c, is fist selected instead of e,, then at most 6 states are expanded until the solution is found. The same result is obtained if any state among the eight states except c, at the first level is selected for expansion. As shown in this example, sometimes, the careful selection of the state even in the case that more than one state has the same minimal value of / and the same maximal value of g can improve the search efficiency significantly. In this chapter we explore the selection strategy for expansion which clarifies further the basis of selection for the case that more than one state has the minimal value of f and the maximal value of g in the evaluation function. The search efficiencies based on this selection strategy and the arbitrary selection strategy will be illustrated by an example. 7.2. Algorithm H~ In this section, we present algorithm H' which is similar to algorithm A' except that two more properties are implemented: (1) the basis of selection of the

Is3 state for expansion is presented for the case that more than one unexpanded state have the same minimal value of I and the same maimal value of f, and (2) a state which is not on the solution path is detected during search and pruned out from the search tree. Algorithm H' results in better search efficiency than A' if the problem has no solution because, as in the property (2) above, it prunes out some of intermediate states in advance based on their heuristic values. If the problem has a solution, the search efficiency of H' compared with A' depends on the problem. As illutrated in the section 7.1, if the arbitrary selection strategy of A results in a bad search efficiency, then H' results in better search efficiency. If not, however, H' may result in a worse efficiency than A'. Suppose two unexpanded states c, and ec have the same minmal value of f: I (c,) / (c, ). Algorithm A' then compares the values of g (e,) and g(e, ), and selects ~, if g(e,) is larger than g(e,). This is based on the argument that the state c, with a larger value of g is probably closer to the goal state e,. Based on a similar argument a further clarified selection strategy for algorithm H' can be developed. Suppose the states e, and ec have the same maximal value of g: g(C, ) (= gC). Then the two heuristics A(e,) and i(e,) are the same. When the problem is modeled by the structure M2, the heuristic A (ce) for each state ec is derived on a set of the estimated costs of the subpaths each of which alters the position value of the object,, E r(EU') with respect to the feature A Ef r(AT) from fA (,(o,,e) to some q, E GA(o,). For each, E x(EU) and Aj E i(AT), the estimated cost of the subpath is given by min( {r Ldit (<,ffAj (o,,c ),q, >,o,,A ):, E GA, (o,))) if each rule has the same

164 **' cost, and in({(GLOCS(,,A,,c^ ):, ~ GA,( ))) otherise. The estimated cost of the subpath for each object e, and feature A,, however,,. becomes more accurate as (1) each position value in the set GA (e) is closer to the actual goal position value, and (2) the relaxed constraints of two states, where one is the successor of the other, given by the relaxed successor formula for e, and Ai are closer to the original constraints of the two states. Suppose for some object e, in x(EU) and some feature Ai in x(AT), each *-0 position value in GA,(o.) is very close to its goal position value, and the relaxed constraints of two states, where one is the successor of the other, given by the corresponding relaxed successor formula ESCF tA,) are very close to the original constraints of the two states. Then, for two states, and c, such that J (c,) - f (e,) and g(c,) - g(ce), if the estimated cost of the subpath for *, and Aj given for A (e, ), is less than that for h (e ), then the state e, is probably closer to the goal state e, because e, has the smaller value of the most accurately estimated cost of the subpath for o, and Aj than e,. If e, and cw have the same values of the most accurately estiamted cost of the subpath, then their values of the next most accurately estimated cost of the subpath are compared. However, for given a set x(EU) of objects and a set x(AT) of features, it is not easy to derive in advance a pair (o,,AI)E x([EU)X(AT) which has the relaxed goat formula generating the postion value very close to its goal position value and the relaxed successor formula generating two position values very close to its two positon values assumed in one state and its successor. We suggest below one way to approximate such a pair (o,,A,). We first define the partial ordering rela tion < r on the set Ar(A T ) of features of the problem.

166 DefiItion 7.1 The relation < S defined on the set i(A T) is the partial ordering relation such that for each (Ai,Ai ) E r(A T ), (A.,A) E <r if and only if (1) the cardinality of A, is less than that of Ai, or (2) the cardinality of A. is equal to that Ai and i < j. Corollary 7.1.1 The partial ordering set (r(A T), 5 r) is fotally oerdred. Based on the totally ordered set (x(AT), Or), we define the partial ordering relation <5 on the set PI which is the cartesian product of the set x(EU) and the set x(AT). The pair (o,,Aj) PI has the relaxed goal formula generating the position value very close to its goal positon value and the relaxed successor formula generating two positon values very close to its two position values in one state and its successor. (o,Ai) is then approximated by the least pper bound of the partial ordering set (PI,;1), which will be denoted by LUB(PI,,1). Definition 7. Let a set PI be the cartesian product of the set x(EU) of objects and the set i(A T) of features of the problem: PI = x(EU})Xw(AT). Then the partial ordering relation <I defined on PI is such that for every < o,,A > and < o,AI > in PI, (< oA >,<A o,Al >) E 5, if and only if (1) the cardinality of o, is less than that of or, or

156 (2) the cardinality of Se is equal to that of P and FLAG(<,,e >) — true, or (3) the cardinality of i is equal to that of e*, FLAG(< i,,.>) - / c, and i < k, where FLAG is the procedure which compares the cadinalities of two goal sets,(.,) and GA,(, ) for each Ai E -(AT) Algorithm FLAG (< *, ei >) Begin While (x(AT) d) do /* Select the Least Upper Bound of ((A T), < ) */ A. = LUB(w(AT), <r.. If the cardinality of GA, (i) i less than that of GA (A ), then return (true); /* Update the set a(A T) / s(ArT):- aAT)- {A ); end-while return (I /ec); End-alorithm Corollary 7.S.1 The partial ordering set (PI, _ ) i totally ordered. Algorithm SELECT below selects one state for expansion among all the unexpanded states given in the set OPEN. Algorithm SELECT (OPEN) Begin For each c, in OPEN do Compute / (e.)= g(cs) + A (e.); end-for-do MOPEN:= (e,: (es E OPEN) n ( (e,) is minimum)); If ( only one state is contained in AMOPEN), then return (e, E AfOPEN); /* Update AfOPEN in which each state e, has the maximum g(e,) */

167 MOPEN:- (,: (c, E MOPEN) n (f(e,) maximum)); If ( only one state is contained in MOPEN), then return (e, E MOPEN); WhUe (Pl / O) do begin (*,Ai) - LUB(PI, <;); If the problem has the same cost w of rules, then begin For each e, in MOPEN do d,:- min((w -Lf (<fA,(o,,c ),j >.,,A ): G (0,)); ad-for-do end-If; If the problem does not have the same cost of rules, then begin For each c, in MOPEN do 4,:- min({(LOCs(j,,A i,,,,., E C^,( ))); end-for-do end-if; /* Update the set MOPEN */ MOPEN:- {, (e, e MOPEN) n (, s minimum )} If ( only one state is contained in MOPEN ), then return (e, E MOPEN); /* Update the set PI */ Pl:= P.- {(o,,Aj)}; end-while /* Return any state in MOPEN */ return (e, E MOPEN); end-algorithm In algorithm H' the selection of the state for expansion is given by algorithm SELECT above and the state wbich is not on the solution path is pruned out in advance from the search tree. Algorithm H* Begin

Is$ /* Initialize three sets OPEN, CLOSED, and AC G/ OPEN:- CLOSED:- AG: —; /* Generate a tree TREE where a root is the initial state c,. */ AG:- AG U (eCi); OPEN:- OPEN U {er); CHOOSE: If (OPEN - d), then return (No Solution); Compute the evaluation function I (e, ) for each state e, in OPEN where / (c.) - (C. ) + i(c k); /* Remove the state e, from OPEN which holds that A (, ) > LIMIT./ OPEN:- OPEN - ({c:(ce, OPEN) n ( (e.) > LIMIT)); /* Select one state e, in OPEN for expansion / c.:-SELECT(OPEN); /* Update the sets OPEN, CLOSED, and AG / OPEN:= OPEN - {, ); CLOSED:- CLOSED U {c,); AG:= OPEN U CLOSED; /* If e, satisfies the Foal condition formula EGosl, then return the solution */ If (ECrGtl(p1A,(( e.1 ),...,P/Af.( A,. )) - tru ) where EU - {l,..., ) and AT {Ab,..., Ab ), then return (Solution Path on TREE from ec to e,); /* Expand the selected state e, */'(eC, ):- ({e: is the successor of e, }; If (W(e.) -), then jump to CHOOSE; /* Establish a path on TREE from es to each ec of its successors */ For each ej E W(e), if (eCi AG), attach to ej a pointer back to e, and update OPEN, OPEN:= OPEN U {, ); if (e E OPEN), direct its pointer along the path on TREE yielding the lowest ({e ); Jump to CHOOSE; End-algorithm 7.3. Example For illustration of algorithu t', the consistent labeling problen modeled by each of the three versions A ('1'), M (:"), and MAf('S) given in section 6.5, is

169 considered. Version Mjl): The set {(EU) of objects and the set o1(A T) of features are, respectively, r(EU) - (1),(2),(3),(4)) and,(AT) - (A: A, -(A,)). By definition of the partial ordering relation <1, (<{2),A,>,<(l),Ai>)E 5L, (<(1),A,>,<(3)A.4>) E <, and (<(3),A,>,<(4),,A,>)e <,. Then as shown in Fig 7.1, when the initial state is expanded and 12 successor states are generated at the frst level of the search tree, H selects for expansion the state in which the unit 4 is labeled by either b or c. At most 6 states are then expanded until the solution is found. Version M (22):,(EU)- {{1),{2,3),{4}) and,(AT) (A: A - (Ab,}}. By definition of,, (<(1),A,>,<(4),A >)I e and (<(4), 1>,<(2,3),A1>) <. Then as shown in Fig 7.2 at most 4 states are expanded until the solution is found. Version Ml3'): wr(EU) ((1,4),(2,3)) and r,(AT)= (A i: A, {Ab,)}. By definition of <I, (<(1,4),A >,<(2,3),A >) E <.e Then as shown in Fig 7.3, at most 4 states are expanded until the solution is found. As compared with the number of expanded states using A' for each version, 10 for Ml2'), 5 for M2(22), and 5 for M2(S), H results in better search efficiency than A. In the next section, we further compare algorithm H using the heuristic HO (, ) against other problem-oriented search algorithms. 7.4. Search Efficiency of Algorithm He The efficiency of algorithm H' is compared against the problem-oriented search approach for the consistent labeling problem The backtracking.scrch in

180 I I I I I a Ib w 4. 4 > < 1. 16. 2 - 4-3 - 0 Figure 7.1 Search by H' Based on Version Af (1l)

161 ( k \4C 41 < t.. z.. 3.b.. Figure 7.2 Search by H' Based on Version Af!'4)

168 I.. Ib 4c <(.^.. Figure 7.3 Search by H' Based on Version AfM3S)

1e1 which a look-ahead operator #K or I bs incorporated, by Haralick elt a. J1, is b well known heuristic search for olving the consistent labeling problem. As explained in section 4.1, let the consistent labeling problem be given by one compatibility model (U,L,T,CT) where U is te set of units, L is the set of labels, T C UN is the set of all N-tuples which mutually constrain one another, and CT C (UXL)N the set of all 2N-tuples (l,., ~,wN,IN} where (I,,..., IN) is a legal labeling of units (,.., IN) in T. One look-ahead operator *K, fN < K, when applied to CT, refines CT by removing some 2N-tuples which do not contribute to a globally consistent labeling [Harr78, Han79]: *Jr(^r)- ((*i;,1...,uvV ) E CT: for all N+...., K E U, there exist,...., I E L such that (,..., 1 ) a consistent label in of(W;,...,-K )}When the 4K operator is incorporated into the backtracking search algorithm, at each state e, during search, the refined constraint relation C is first generated from CT by removing some elements which are not compatible with the labeling given in e,. Next by repeatedly applying the operator #K to C;, the most refined constraint relation C;(ce,) for the state e, is generated. Based on C (C,), the next unit labeling for the successor state of e, is determined. The other look-ahead operator Ki, N < K, when applied to T, identifies (unit, label) pairs that are extendable to consistedn labelings, and refine4 CT by removing all 2N-tuples that do not conrist of such pairs.

184 * (T) ((uI) E T: for ah,,-..,xi E t, there exist i. -.., I E L such that (.,i.) T, I 5< < K-I, and (1,.., 1-x1,I ) is a consistent labeling of (v,..., x.-., ))When the *K operator is incorporated into the backtracking search algorithm, each state e, during search is represented as an ordered pair (1,,E ), where, is the set of (unit, label)'s done in e, and E, is the set of possible extensions to,. Each set of, and E, is then refined by applying t, repeatedly. Based on the pair (41,E, ) of two refined sets t' and E,, the next unit labeling for the successor state of e, is determined. Search efficiency increases as the value of K increases in both ases of *K and.K. However, a large value of K is not allowed in most cases because the complexity for applying *K and K grows exponentially with the value of K. Algortihm H' using the heuristic A (e,) is not, in general, comparable with the backtracking algorithm using a look-ahead operator *K or *K. The efficiency of H using A (e,) varies depending on what version of the problem model M2 is used, and the efficiency of the backtracking algorithm uing *K or tA varies depending on what value of K is used. We will just compare the efficiencies of two approaches by one example. Haralick et s1 illustrated two operators t2 and s by one consistent labeling problem [Harr78], which is the one given in the section 6.5. As shown in Fig 7.4, when the operator *2 is incorporated into the backtracking algorithm, 7 nodes are expanded, and as shown in rig 7.5 when 03 is incorporated, 5 nodes are expanded. However, the complexity for applying 4^ is much higher than that for applying <^.

166 As discussed in the *ection 7.3, when the heuristic A (e,) derived using the version M') i used for algorithm H', 6 nodes are expanded. When A (, ) derived usin either of Mi22) and Mid3 is used for', 4 nodes are expanded.

1io e r. 3,1 I It I' L'ad?'I.A' j,! 4t A.L.> <&.c.* t.i< "'T 1 \ <, <~.^ <t.t>' + ^+, a <I'c (..&? 4 Ie <C.)(<tL-'><'" 46 4 5^ (<!.~> <Z.~'><.<^ i) Figure 7.4 Search by Backtracking using Operator *2

167., s f,,ft IC I ri4 T4 a I, " IC. Zt 3C 4' |.(l.z.o.Zc.3.c, Figure 7.5 Search by Backtracking using Operator f3

CHAPTER 8 CONCLUSION 8.1. Summary and Contribution Heuristics have played an important role for efficient problem solving. Specially well studied are the admissible heuristics for the A' algorithm. A general technique to derive the heuristic for A' may thus contribute to a general and efficient problem solving procedure. In this research, we presented a methodology for deriving a heuristic for A' for a given problem. A mathematical model representing a general problem was for mulated in which a set of elementary units and a set of attributes of the problem were defined. The algorithm to derive the heuristic for A' Vas then developed for this problem model. To improve the efficiency of the algorithm to derive the heuristic, various other versions of the basic problem model were suggested using the notion of the partition of the set of elementnary units and the partition of the set of attributes. The complexity for deriving heuristic using each version of the problem model and the tightness of the derived heuristic were examined. Our approach for solving problems was illustrated by several examples, the Sr puzzle problem. the traveling salesman problem, the robot planning problem. the consistent labeling problem, and the theorem proving problem. For the 1problems, 168

189 the 8-puzzle problem, the traveling salesman problem, and the consistent labeling problem, the efficiency of our problem soving approach was comparable to those of other heuristic problem solving approaches which are specifically developed for each of these three problems. For the theorem proving problem, our approach resulted in the breadth-first search, the efficiency of which drastically reduces as the problem size grows. A better complete search method is suggested in [Nil8O]. As will be dis cussed below, the poor efficiency of our approach for solving the theorem proving problem is mainly due to the fact that the constraints of the goal position values of some elementary units are not known in advance. 8.. Future Research In this section we address the research issues which can be further developed based on the current result from our research. 8.2.1. Solving a Problem with Partially nown Goal Position Value The heuristic A (e,) for a problem was computed based on a goal position value of each elementary unit of the problem. A goal position value of an elementary unit a, was derived from the relaxed goal formula for S,. Some problem such as the theorem proving problem has the goal formula in which the constraints of the goal position values of some elementary units are not defined. If the constraint of the goal position value of of an elementary unit *, is not given, any position value of a, can be derived to be its goal position value. In most cases, the value of the heuristic h (c, ) derived based on this nonconstrained goal position value becomes so loose that the search using A (e, ) results in poor efficiency.

170 A new approach for deriving the tight heuristic for a problem with partially known goal position values should be developed..2J.2. Automated Problem Solving System We suggested several problem models for automatic problem solving with vaious search efficiencies. Once a given problem is modelled by one of our suggested schemes, a solution to the problem is automaticlly generated. Our problem solving approach is semi-automatic i that a modelling procedure is done by the programmer. If some technique is developed which automatically models a given problem into our suggested scheme, the fully automatic problem solving system can be formulated. This technique may be achieved by developing some formal language to represent a problem. When a problem written in a certain language is given to the solving system, the system would analyse it and formulate each component for our problem model.

APPENDICES 171

172 APPENDIX A PROOFS IN CHAPTER 8 Lemma 3.1 For each elementary unit i, E EU and for each computable pair (gj,g9) of e, in which qi P and q, - p/ (s,,ec), LAi t(< qj,Q >,, ) < Min_LEN (< j,q >,; ). Proof Let (q9,q,) be the computable pair of position values of the elementary unit., in which q9 E P and g, = pf (ej,e,). For simplicity, MinLEN(<q,q, >,ei) is denoted by M(qj,q,,o,) and Ldi t(<q,q9 >,ej) is denoted by L (,,q,,). Then we will show L(qi,qg,,e) < M(qi,q9,,,) by induction on MinLEN. Suppose M(qi,q,,,) l 1. By definition there exist some r - <z,...,,> R, and c,, e, S such that, q = pf (4i,C ),, = p/ (,e,'), and SCF(zi,.*..*,,pl (zae,),...,/p (e,,e, ),...,pf (as,p, ),pf (aIej),...,/P (M,', e),.... p! (ac )) = true. By definition of the relaxed formula SCFRct, SCFR'(q,,q) ) true. Then by definition of DIST, <q,,q > E DIST(1,,,q,) and L (q,q,,,) 1. Thus L(q,, q,,) < M(q,q,, ). Suppose M(q9,q, ). = m +1. By definition of M(q9,q9,) m +l,1 there exists some qj E P such that AM(qj,q,, ) = m and A(qj,q ) = 1. By induction hypothesis, however, L(q9,q,,&,) < A(qj,q,, ), and by the above result L(q,q ) =1. Then <qt,q > E DIST(l,,,q,) for some I < m, and <qg,qk > E LEN'(a, ). Tbus if <9,. > f DIST(n,a,,gq) for n =1,....I, then <q,.g, > E DIST(l+1,,,q ). Therefore

173 L (q,q,c, ) < I + I < m + I -M(,,,, ). Q.E.D. Lemma 3.2 Let w be the cost of each rule of the problem, and for each state e, the heuristic (e,) be given by A'(es ) -= w1 Ldft f (<p (,,c.),pl (C,,( )>,, ) a., eB,, where B, - {(:(a; E EU) n (pf (,e,) 7 pf (.,,))). Then the value of A (c, ) satisfies the admissibility and monotonicity. Proof Admissibility: Let e, be the state of the problem. For admissibility, we will show A'(e,) ^ A'(e,) in which A'(c,) is the minimal cost of the path from c, to the goal state e. From corollary 2.2.1 in Chapter 2, A'(c, ) > I E *'Min.LEN(<p/ (a,,e, ),pJ (i,,cI )>,, ) E, EBD where B,, = (a,: (, EEU) n (pl (,, e ) 7 pf (.. e,))}. From lemma 3.1 above, for each a, E EU and for each c, E S, AfinLEN (<pf (*,,e ),pl (*,.,~ )>.,2) Lit{ (<pf (a,,cp ),pl (*,,c, )>.,,). Thus i' (, ) > 1 tLLdit ( p ( e (.),p/ (,,)>,, ) =i (e.) a,. EBz $ *?where B., = {, (a,:, e EU) n (pf (a,,c.) pf (,,e, ))). Monotonicitv: Let c, and ce be two states of the problem such that for some rule r= <i,.., > E R (<al,...,,>,e,.e,) E S'CCR. For monotonicity. it suffices to show A (e,) < (< l......, a>.e,.e ) + A (e,) Suppose B,, i the set of elementar units each of which ha. two different position values in

174 e, and tbhe gol tate e. By definitio of the rule <,,...,*,>, the set B i ivten by B, B, U (s,..., *,). Tben A^(',) — ] m E asC-, w-Ld4t(<pf (ii-,c,),pf I I + I m.1. 4,~{~,,,....-.) w-Ldist(<Pf ('.,Cjpf By definition of Ldiat, for each a, E ({l,...,, ), if L&dt (<pf (,,c ),pf (s,,, )>,i ) - K > 1, then Ldit (<pf (,,c, ),pf (,,e, )>,, ) > K-I. Thus, ^(e2,) > a ad E., SI*,..., *J w-Lfist(<pf (a.,c,),pf 6 8 I I +m E 4,( =..., a.G~ej..... > L dl.,, El,., ({t..i...,, ] * [.it (<pf (a,,,e. ),pJ (I,, )>,,) ] *.) w -Ldet(<pf (a. ),pf (^,, )>,a,), -Ldi t (<pl (a,,c, ),p! (,,', )>,. ) - or -. *.) *' 4a, E,.E(11.... - A(C, )- wr. Therefore,' (e,) <'(c,)+ e(< z,...,, >,eC. ). Q.E.D. Lemma 3.3 For each state e,, the heuristic A(e, ) given by'(C,) a= max(u tr Ldirt ( <pf (a,.e, ).pf (,, t )>.a,): a, E B, }). wbere B,, - {,: (a, E Et') n (pf (,,e, ) 7 pf (a,., ))}. satsfie, the admnlsi

176 bility and monotonicity. Proof Admisibilitj: For the state c,, kt the set B., - {,: (l, E EU) n (pf (ec,,) 7 p1 (,,e ))). By Lemma 2.2 and Lemma 3.1, for each,i E B,,,.Lditf(<pf (.,,,e ),p/ (,,,e, )>,, ) _<'(c,.) vhere A'(c) is the minimum cost of the path from e, to c,. Thus,'(C. ) <'(.). Monotonicity: Let c, and c, be two states such that for some rule <, -..., -,>, (<a a,...,, >,ec,e,')E SUCCR. By definition of the rule <*,..,>, >, C B, U (i,...,*, } where B is the set of the elementary nits which have two different position values in ~e and ec. By definition of L; t, for each i E EU, if Ldi t(<pf (s,, ),pf (.,( )>,. )- K > 1, then Ldist(<pf (,,e,),pf (,i,e,)>,e ) > K-l. Let e, E B., be such that A'(c.) -w -Ldit (<pf (.,,c. ),p/ (i,,C )>,., ). Then by definition of Ldiet, L't( <pf (.,,e, ),p/ (., e )>., ) Thus, 5'(e,) > w -Ldiat(<pf (a.e, ),p/ (,,e,)>,, ) w Ldi;t (<p,.,e ),p (.,e )>,, ) - r A'(e,)- w. Q.E.D. Lemma 3.4

176 For every state c,, the heuristic' (,) given by "( "-'-?7I7 (<P/(0. ( )> Do where B - { (e:(i ( EU) n f (p (,e),) pJ (,e,))}, satisfies the admissibility and monotonicity. Proof dmigibilit:v Let e, be the state of the problem. For admissibility, we will show A(e,) < A'(e,) where A'(e,) is the minimal cost of the path from c, to the goal state e. Let the cardinality of the set B,-n be k. Then the path (p,q) from e, to e, contains at least k subpaths (p(j,),j(,)), for *- E B, -n. By Lemma 2.2 and Lemma 3.1, each Ldit(<pf (.,,e, ),p/ (.,,c9 )>,, ), *, E BW - n, is the lower bound of the ength of the subpath ((^,),i(s )). By definition of the rule, each rule in the path (p,q) affects the position values of at most a elementary units including all the elements in the set fl. Each rule in the path then affects the position values of at most ( - I 0 ) elementary units not contained in f. Thus, the value of - Ldsit(<pf (,,e ),pf (,,c, )>,, ) becomes the lower Ifil.,E(B,_O) bound of the length of the path (p,q) from c, to ec. Since each rule has the same cost r, A'()- -,E(,-n) Ldit (<pf (.,e, ),pf (S,,e)>,.,) < (c). Monotonicity: Let ef and ce be two states of the problem such that for some rule == <,..., a, > E R (< a I.., >,Ces., ) E SUrCCR. For monotoni

177 city it suffces to show A " (c, ) < (< a,... *, e >,C,,,) + A " (c ). By defni tion of the set 0, fn (.,,...,, ). Suppose B,^ i the set of elementry units each of which bs two different position Talues in e, and the goal state e1. Then by definition of the rule <:S,...,,, >, the set B, gi ven by 8! B, U (l*,...,, * ). Then' (e,) m -* 1 S w-Lita(<pf/(. j,e, ),pf (..,)>,j..-1)1 f 0..o~,, eN(f*, *...,,) + 1 w'Liat(<pl (i,c,),p/ (i,e,)>, - 1~.E.) By definition of Ldist, for di E EU, if Ldit (<p (a,s, ),pf (',C, )>,c* ) K > 1, then ui. (<pf (,,W ),pf (j,c, )>,sa ) > K-l. Thus, A (c,) + I- E W'Ldist(<p (<,, ),pf (,,e )>,a ). El.B,...) + I tr Ldist(<pf (s.,cs),pf (a.,e)>,.,) a.~{'l...} *.~{* ~. ~.,*)'- I"!.,~!? i),-.) -Inl) - h"(e,) - tr

178 - (e,)- c(<,...,*, >,,,e,). Q.E.D. Lemma 3.6 For every state e,, let (s,)- max(({'(e ), A'(e,), A (e,)). Then the value of A (c,) satisfies the admissibility and monotonocity. Proof Admisibility: Let e, be the state of the problem. By Lemma 3.2, Lemma 3.3, and Lemma 3.4, each of A (c,), A'(c,), and A"(c.) satisfies the admissibility. Thus A (e, ), the maximal value of A' (c, ),' (c, ), and' (c, ) satisfies the admissibility. Monotonicity: Let c, and ec be two states of the problem such that for some rule r, E R, (r,,,,e,) E SUCCR. For monotonocity, it suffices to show A(e,) A(C,)+ e(rj,e,,,C). By Lemma 3.2, Lemma 3.3, and Lemma 3.4,'(eC,) < )'(C) + c(r,,e ), )i(C,) < I'(e,)+ c (r,, cJ ), and (e,) < A(e) + c (r,e,, e,). Thus (e, ) - max((' (c, ), i'(e, ), (c, ))) < max({('(c), A'(c,), A(c,))) + (r,e,,c, ) (e,) + e (r,,e,,e). Q.E.D. Lemma 3.6 Let (p(a, ).(a, )) be the subpath for a, E EU from the state e, to the state ce where p(,) = r ri and (, )= C.. e,, * let. Then if Ldit (<pf (a,.e ),p (a,.e )>.a, )= hA, < m. for each n E (i....A, ). there exist a rule r^,. kn E {i,..., jm)}, in the sequence p(a,), and two corresponding

179 state, eh and,,,, in the sequence q(a,) such that (r,e,e,, ) E SUCCR, LUit (<Pf (.,,e,, ),pI (S,,< )>,. ) a, and UiLt(<pl (,,e,,. ),pl (.,c, )>,4 )- -1. Proof Let (^(o, ),q(; )) be the subpath for *e ~ EU from the state e, to the state e. where p(,j) jr, * - r and'(e,) e- ci,,.' Cji I C, By definition of (p( ),q(, )), p! (.,c, ) - p (,ej -1), k -2,...,m, p! (S,,i, ) - pl (.,e, ), and pf (,,e,,j ) -= p (,,c ). Thus, Ldist(<pf (a,,ei. ),pf (o,,, )>,, ) = Ki and Ldit (< p/ (, jei ),pJ (, )>,, ) 0.... (1) By definition of Ldist, for each k E {l,...,m}, if Ldit( <pf (e.,et ),pI (*;,e, )>,) - L, then Lilt (<pf (,, i, ),pl (,,,c, > )> ) > L -1.... (2) From (1) and (2), for each n E {1,...,K~), there exist at least one rule rj,, In E {jm,..., jl), and two corresponding states, eA. and e,,, such that (r, *.,,C*, ) E SUCCR, Ldit (<pf (*,,e, ),pf (a,e, )>,.,) - n, and Ldit (<pf (a,,c,, ),pf (,,e )>,, )- n -1. Q.E.D. Lemma 3.7 For each state e,, and for each elementary unit a, of the problem, LOCS(a,,e,,pf (a,,e )) is the lower bound of the cost of the subpath (p(a, ).j(a,)) for a, from e, to the goal state ec. Proof Let (,p(o),ri(a,)) be the subpath for a, fror. the state e, to e. If Ldit( <pf (a,,c,),pf (a,,c)>,a,) = A,, then by Lemma 3.8, for each

180 (I {,...,K,), there exist at least one rule r^, in (i,), and two corresponding states, c^, and *., in 4q(i ) such that (rh.,q.,eC ) E SUCCR, Li.tf(<pf (.,,e. ),pf (,e, )>,e) -, and LUit(<pf (,,e., ),pf (,,e, )>,u)- n -1. By aorithm LOCS, LOCS(s.,e.,pf (.,,e,)) -: min( W(v,,e.,pf (,,e, ))) *-i where W(,a*,,,,p! (,i, )) - {(<*..,,,.., *, >,',~jj ) (3< f,,' > ~ C(l,e, ), I -l,...,,,; X 3< q,If > e CC (,,,p/ (,,,,))) ((q, pf (,,ej ), I-1,...,) n (q,' - pf (i,,,), il,..., ) n (SCF.,....,, >,,,...,,,)(,,..., *i,...,, s * * * * * *. I t I I ) tr)). q 1*.., q,., q, ) trc )}. For each n E 1,...,K,), min(W(n,c,,c,,pf (.,e, ))) < c (r.,,.e,e,) becaue c (r,^,Ce., ) E W'(n,.,,e,,pf (,,,c )). Therefore K, LOCS(e,,e,pf (,,,, )) < E c (fr,,,,c,. ) 3=l < the cost of the subpath (p(a, ),V(a, )). Q.E.D. Corollary 3.7.1 For each state e, and for each elementary unit a,. LOCS(,,,e pf (a,.ce )) is the lower bound of the cost of the path (p,iV) from e, to the state es.

181 Lemma 3.8 For every two states, and cf such that for some rule r E R, (r,e,,ea,) SUCCR, and for every elementary unit *i E EU such that pf (d.e ) 7 pJ/(,,(c ), LOCS(.,,e,,pJ (,j,e,)) < LOCS(;,e,c,pf (s,e, )) + c (r,e,,e, ). Proof Let e,, e,, and ri be such that (r,e,,,,) E SUCCR, and for some c, P/ (,c,, ) & pf (.,e ) and Ld;it(<pf (s,e, ),pf (,,c )>,, ) Ki. Then by definition of Ldisa, Ldi;t(<pf (,,e, ),pf (j,c )>,*,) - Kj' > K-lI. By definition of LOCS, LOCS((,c,.pf (c,,c ) - miin(W(n,r,e,,pf (i,e)) + E min(W(n,,e,,pf (d,e )) "=1 -K., where W (v,*,,e,,pf ( ~,,C )):= { c (<,., *,,..., *, >,e,ejj ): ( 3< / 9,q' > E C(ol,,), I -l,...., XiX l3<g,,g,' > E CC (,,,.pl (.,c, ))) uiq = p (1,,), =l,..,) n (q' = p (l:,~e ), 11,..., ) n ) (SCF<, 1 -.... >.,.... )(1, *,, g,,q * *,,)rue ) )). Since C(a,c ) C (e,c,), a E EU, and CC(a,,e,,,,pf (, e, )) C CC (,,e,,n,pf (a,, )). for each n E {1,...,K,. W'(n,a,,e,,p ( a, e, )) C i'(n,a..e.pf (ae, )). Thu..

18t LOCS (;,c,pf (...,)) K,-i K,' > E min(W(n,i,e.,pf (.,c,)) + min(W(n,.,e,,pf (.,e )) "l- *-K, - LOCS(.,,c,,pf (s,,c,)) - min(W(Ki,,.e.,p (,,c, ))) K., (1) + min(W(n,.,,c,pf (.,,c)). 3-K, (A-I)... If Ki' Ki - 1, then from the equation (1) LOCS(,,c,pf (,c,)) > LOCS(. a,c,,p/ ('.,c )) - min W(Ki,.,,c,.,p/ (,c ))) > LOCS(.,,e,,p/ (,,eC )) - c (rt,e,C, ) becae min( W(K,,.,c,,pf (,j,c )) < c(r,c,,c,). (A-2)... If Ki' > Ki - 1, then from the equation (1) LOCS($,c,,p! (c.,v )) K,' > LOCS(.,,,,p (,, e)) + ~ min(W(n,a,e,,p (,,c,))) *=K, +1 becaue W(K,,.,,,,pf (a,,c )) C W(K,,,,.,p (.,,,)). Thus LOCS(a,,e,pf (.,e,)) > LOCS(a,,,e,pf (,, e,)) - (r,,,,,). From (A-l) and (A-2), for every (rj,c g,e,) E SUCCR, if pJ (a,,e, ) 3 p/ (a, e,) for some a, e EU, then LOCS(a,,e, p/, (a, e, )) > LOCS(a,c,pf (a,,c)) - c (r,es,e,). Q.E.D. Lemma 3.9

183 For each state e, of the problem, the heuristic A' (, ) given by'(e.) -1 LOCS(.,e.,pJ (,,e )), where d -{.:(. E EU) n (p/ (,c ) pf (^ie))), satisfies the admissi. bility and monotonocity. Proof Admissibility: Let e, be the state of the problem, and BJ be the set of ele. mentary units which have two different position values in c, and e~ as shown above. For admissibility, we will show A (e, ) A (c, ) where A' (c, )- S LOCS(,,e,,pf (,,c )), and A'(e ) is the minimal cost of the a oE B, path (p,r) from e, to ec. Let the cardinality of B., be K. Then by definition of the subpath, a path (p,q) from e.to ew has at least K subpaths (p(. ),q(.; )), t* E B,. By Corollary 3.7.1, each LOCS(,,Ce,pf (,c,, )),, E B,, is the lower bound of the cost of (p,q). Since each rule in the path (p,q) affects the position values of at most a elementary units, A(c,)- LOCS(~,,pf,p (,,c, )) <'(c,)., ~,EB,, Monotonicity: Let e, and ec be two states of the problem such that for some rule < l,.., o > E R, (< l, *, a, >,es,, ) E SUCCR. For monotonocity, we will show A^ (c, ) _< h (c ) + c(< (,...,, >,ce,cy). By definition of the rule <ai,..., O>, the set B, C B,, U {al,..,, }. Then ^A (c ) = l LOCS (o,e p( f,, e,c )) *.- 1.J.*B

184 1 ro~ E A 4.(a*,...,.,) LOCS(.,,e,,pf (a,,e )) 1 -J E. { eI,..., I LOCS ({,c,,pl (.,i c, )) LOCS(c,. i,y,p (., c,)). 6. } (1) +a E.. as EB., 4. t*, By Lemma 3.8, for each e, E BJ,, LOCS(,,c,,pf (s;,, )) < LOCS(,,e,,pf (,c e, )) + c(r,,e,e, ). Thus from Eq.(l) )t E *,'.{*......) [LOCS(e,e,pC (.,,,)) - c (r,,,e,)] - I > I E A, EB., ~,~ {(I,...- B.) LOCS(in,,e,pf (a.,c )) ( EB s. ~S LOCS(^,,e,pf (.,,e,)) - (r,,,c, )' I. 2 1 *.. EB.',If (',,.....'.) LOCS(,,,e,p/ (3.e, )) A (c, ) - c(r,c,c, ). Q.E.D.

186 APPENDIX B PROOFS IN CHAPTER 8 ClaIm 1 Let w be the cost of each rule of the problem, and for each state e, the heuristic A (,) be given by ()'max((1 t min((w Ldit(<ffA,(8,,C, ),j, >,,,Ai ): (e,) -* max({-. min( {(>), E GA,(oe ))): A, E (AT))) where; is the maximum number of objects which have two different position values in one state and its successor state, and the set BA,(C,) (:(O, G E rEU)) 0 (ffA,(*e,es) GA,())}. Then the value of A' (e) satisfies the admissibility and monotonicity. Proof Admissibilitx: Let (p,q) be the path from the state c, to the goal state ce of the problem, and (p(o,,A ),i(o,,A)), o, E 6(EU), A, E r(AT), be the subpath of (p,rs) which alters the position value of o, with respect to Aj from fA, (o,,,) to 4A,(o,,e ). The value of Ldirt(< ( fo,,e, ), ~o,C, )>,o,,A ) is the lower bound of the length of the subpath (p(o,,A, ),7(o,A, )). By definition of the set GA (, ), *fA, ( o,.e )E ) GA(, (o). Then min(({Ldi (<ffA(o,,C, ). j >O,,A, ): A, E GA (O )}) < Ldir ( < #, (o..c, )., ( o,,c, )>.o,,A, ).

186 *Let the set BA,(e,) for each Ai E (AT) have Ki objects: BA,(C, ) -- (,i,..., )- Then for each Ai E x(AT), the path ({,;) has st least Ki *ubpaths, (,(oej,AJ ),q(ej,,A )), -i,...,Kq, each of of which alters the position value of oi; with respect to Ai from fA,(oj,e ) to f,(oe,,e ). Thus the value of E min({Ldist (<^f (oi,e,),,, >,eiA): C^o E,()) can be the sum of *j. EB,(O. ) lower bounds of the lengths of the Ki subpaths, ((oji,Ai ),,(oi,,Ai )), i-=,...,,Ki. Each rule in the path (P,iq) affects the position values of at most i objects with respect to each Ai E~ (AT). Thus, the lower bound of the length of the path (p,i) can be max({ 1 minB({Ldit(<( A,(,,,e,, ), j, >,,j,,Ai): A, E GA^,(,)): A, E (A T))). If each rule has the cost w and A *(el) is the minimal cost of the path (,q7),'(c, ) > max({1 E min({r.Ldist(<rsf,,,e, ), t >,oi,Ai ): r EB^DA,(',), E G,(o, )}): A, E x(AT)))='(e,). Monotonicitr: Let c, and e, be two states of the problem such that for some rule r =<......., > E R, (<i,...,.a >,e,e,,) E S'CCR. For monotonicity, it suffices to show A'(e,) < e(<c....,, >.c,.e,)+' (ec). Suppose BA(C, ) is the set of objects such that for every object o, E BA (e), f.* (O, C, ) GA(o, ). For a given rule < a..., > let Z(a...., ) be Z(aI,... a,*) = {o:(o, E (EL: )) r, (o n {a,....,,, }I )}.

187 By defantion of the rule <..,,,>, the set BA,(c,)} B, (C ) U Z (l,.., *.). Then A' (e,) - ax 1m { ma0 E s EE (el,) min(( wIdst <,ffAI(j el t poir~ i *.t(, *,...,) j, E A,(o, ))): A, E r(AT))) I + max{4 ~,(e,) SoEDA)(el ) m in((w -Ldis I(< offA (o e, ),j, >,o- Ai ): *.EZ(e....) se, E A,(, )): A, E (AT))). By definition of Ldist, for each e, E Z(l,...,,), if Ldiet (<rffA,(o e ), I >,,Aij) - K > 1, then Ldit (<,, (oe, ),), >,o.,A) > K-1. Thus I A'(e,)> max({(- 1 *,B (,,),. (,E....,,) min(( v Idist (< off I(Ol te )v. >,O..4, ):, E GA,(o, ))): A, E x(AT)}) + 1 max({i a E ~*.,EB (, ) e.EZ(eI., e. )in({*[ dit (< (o, ) >,oA - 9, E GA i(Os))): Al- E jr(AT))) 1 > max({. t E *. E A (. ).,*'t j a. mint { tr Ldi t (< f ( o,,,e ).q, >,o,.A, ): I

188 E G, (,,))): A, E s(AT)))+ max({.. a E(e) el EDA4(C. ) *- U min({( wLdist (<,fA,(e,,e, ),, >,,,Aj ) - I O: )I, E GA^,(, ))): A, E r(AT))) -'(eC)- -w A'(eC) -c(< 1,...,, >,c,,Ce). Q.E.D. Corollary 1.1 The heuristic A (e ) given by A'(c) - max(min({( *L-d(<ff,(0,,e ),, >,,, A, ): E, E C,()}): Ai E x(AT),,EBA, ((e)}) satisfies the admissibility and monotonicity. Claim 2 The heuristic A (e, ) given by A" (ce )= max(({. I a-I nfl(A T )) I E *, B^ (e,) *, n(e (Ar )) iD(({Ldat(<<ff (o.,e ).q, >0 >.A,): E~ GA,(o,)) oA, min((Ldist(<f,'A (o,s,, ),qf >,O,,A,): jJ E GA (O, ))): A E f4iAT))) satisfrie the admissibility and monotonicity Proof

189 Ajdmisibiflit: Let (p,q) be the path from the state c, to the goal state et of the problem, and ( po(,Ai ),}(e,Ai )), o E x(EU), Ai E x(AT), be the subpath of (^,1q) which alters the position value of eo with respect to Aj from lA, (i, e, ) to *aA,(*e,c ). The value of Ldit (<o(,e,, ),oj,,e, )>,*j) is the lower bound of the length of the subpath ((o,,A ),q(,,Ai )). By definition of the set GA (o*), *A,(O.,e ) CA(, (). Then min({Ldit (<ffA,(o,e, ),j, >,,,Aj ): j E CA,(O.)}) *m < Ldi.t (<fA, (o,,c. ),,(o,,e, )>,o..j ). For each Ai E (AT), j=1,...,L, let the set BA,(,) have Ki objects: *BA,(eC)C (o,..., iK). Then the path (p,i) has at least Ki subpaths, (p(i,,Ai ),l(oji,Ai )), i-1,...,Ki so that the value of mmin({Ldi.t (<ff, (j,,,C. )., >,~.A, ): e CAG (. )}) can be the sum of lower bounds of the lengths of Ki subpaths, (p(9,,A,i ),1(o,,,A )), i =l,..I,K, - However, by definition of; and fln((EU)), each rule in the path (p,rq) affects the position values of at most; objects including each object oe E fn(r(EU)) with respect to the feature A,. Thus, the lower bound of the length of the path (p,ri) can be, for each A, E x(EU),.- fl(1,(E)), ~E min({Ldi~a(<ff^(o,,c )., >,o, A, ): j, E G (o,)}), - I fn(r(E )) I,EB, (,), e tn(Ec')) If each rule a the cost, and the of A ) is the minimal cost of the patb ({pj), then

100 A'(e.)>B~max(( C min( () _> m a(; -I jn((w(EU)) I,EB,(,..) *, (, ( )) (W,Ldit(<, f,,(,(,c. ), >,>,j,):, E Ca,(,.)}): A E (AT))) - A"(c.). Mopotonicitt: Let c, and c, be two states of the problem such that for some rule r = <,..., > E R, (<,...,, >,c,,e ) E SUCCR. For monotonicity, it suffices to show A (s) < c (<1,..., a, >,e,,e,) + A (c) where c(<, ~, -, e, >,es, ) I - w. For a iven rule <l,..., *,> let Z(,i,.-.,,- (o:(, e (,EU)) n (~, n {,,,..., ) )}. By defintion of the rule <l,..,, >, the set BA,(e,) BA,(c, ) U Z(al,..., ). Then A(e, )- ax({(- 1 - m n((EU )) |,eB (,,),0 ((EU))) min({ rw Ldiatr(<,LA,(o,e,),, >,O,,A, ): q, E CA,(o.))): A E (A T))) + m ax(({ 1 a- (I n((EU )) I e,E8 A,(,).,. nUE)) *.EZ(....) min({r -Ldrst(<, (o,c,),, >,o,,A):, E GA (o,)}): A, E (4T)}). BE- definition of Ldist, for each o, E Z(l,~. *, ),.o. if Ldit(<,. (o,,, ),q, >,o,,A,) = > 1, then

101 Lr ( < ffA,((o, e,),i, >,,,Ai) > K-l. Thus (<-)1 max({ —-I min( * - I fl(x(EU)) I *e.~o (.,)L, Io(s(eu))..4z(.1,..G) *I (. ({ Lirt (<fA,(o,,ew),gj >,,,Aj): G E CA,(o,))): Ai E x(AT))) + max(( 1 min( (w LdiaI(<effA vc.),ye, ) >,e~> A,)-1: q, E GA,(O,)D: A, E $AT))) 1 - l| n(x(EU)) I,E B, (e,),((<(EV)).~f t(,,*.. *.,) p... ~...))) ({ -Ldit (<,f^,(,.,. ),i, >,, A, ): i, E GC^,(A ))): A, G E(Ar))) + max({-. ( n( ~ - | fl~n(EU)) |,,(,.)., ~ (r(~Ey)) e,EZ(e.....) {r *Ldt(<f^f,(o.,ce ),, >,o,,A )-w.; ): gtC,G (o, )})): A, EAr)}) ='"(e,) - tr "k'(e,) - c(<l, - -, o >.,,e) Q.E.D. Claim 3 For every state e, of the problem, let h(e, ) = max((h(e, ). A'(c), A(e, ))). Then, the value of h(c,) satisfies the admi5sibility and monotonocity. Proof

102 Admisibilitv: By Claim 1, Corollary 1.1, and Claim 3, each of A'(c,),'(e, ), and A (e, ) satisfies the admisibility. Thus, A (c, ), the maximum Talue of'(, ), A' (c,), and' (c, ) satisfies the admissibility. Monotonicity: Let c, and c, be two states of the problem such that for some ri E R, (rj,,,,,)E SUCCR. By Claim 1, Corollary 1.1, and Claim 3, (1)'(c,)<'(c,) + c (r,e,e,), (2)'(c,) < ^'(c )+ c(r,e,ce,C), and (3)' "(, ) < "(~) + C(r,C,C ). Then A(c,) max({A'(c,),A'(c,), "(we))) < max({' (, ),i'(C, ), I(C, )})+ c (r,,c,, ) A (e,) + c (r,,c,,e,). Q.E.D. Claim 4 For every state c, of a problem for which the costs of the rules are unequal, the heuristic A' (e ) given by A' (, ) = max({ min({(LOCS(o,,A,~., i): 5,. GBEJ(C, ) j, E GA,(, ))): A, E (A T)}) satisfies the admissibility and monotonicity. Proof Admistibilitv: Let (p,tq) be the path from the state e, to the goal state cl of the problem. For admissibility, we will show A~(e, ) is not greater than A'(e, ). the minimal cost of the path (p,7)). Let each (p(o,.A. ).7(o,.Ai )). o, Ef E[' )..4A E r.4T), be the subpatb of (p,rj) which alters the position value of o, witb respect to A, from ffA (o,,e, ) to fAI(,,.e, ).

193 *Let q E GA,(o,) be F - I( (o,,e,). We will first show that the value of GLOCS(o,,A,,c,,s,) i the lower bound of the cost of the subpath (^(e,i ),q(o*,Aj )). The value Kj - LAdit(<fA (e,,. ),i, >,ej,Ai) is the lower bound of the length of the subpath (^(o,,A ),,j(,A, )). The cost of (p(o,,Aj ),(o,,Aj )) is then not greater than the value of A(*,,Aj,c,,j, ) where K,, A(o,,,,,q,) = rmin( W' (,o,,Ai,c,,)). I -1 The set W' (l,o,A,, ) {- (r(,,c^ ): (r,,eP,c ) E SUCCR, ct is the des*A cendant state of c,, and Lditf(<effsA(e,e ), j>,e,,Ai) l, and Ldit (< fA, (oe,e, u ),j >,, >j,Ai) - -1). By agorithm GLOCS, K,, GLOCS( o, A,,,, ) min( W(v,,,,Ai,e,, )) where U'(r,o,,A.,,c, j ): c (<,.., *, >,Ce,eC ): (~, E Z(,...,,, )) n (D<< ~l/ > E C(o0,A,...1*< ), lJaI...s,| vCO,) (3<,,, > E CC(o,,Aj,e,,q, ))((ql f, (oj,e), =l,...,i,...,,8) n (Q, *ff,(O1 i), I-sl,...,-,...,, ) n (ESCr''' " Sine.,,",>,,0,(<6. PC,,,>.A, I(es]q, I 1.KI) 0GLOCS(o,..,,,,q, ) = -true ))}. i, net greater than A(o,,e, A,.q ). Thus. min{i GLOCS(o,A,e,,q, ): qg E CA,(o, )}) can be the lower bound of thr cost of

194 the subpath (p(o,,A ),r( o,,A, )). Let the set BA,(e.) have Ni objects, BA,(e, ) - ({l,..., e,,). Then the path (^,v) contains at least N, subpaths, (p(o ji,A,i )(, jj )), i1,...,N,, and the *m value of S min((GLOCS(o,,Ai,c,,9,):, E GA,(,))}) is the sum of the *EDA (es ) lower bounds of the costs of the Ni subpaths. By definition of;, however, each rule in the path (p,it) affects the position values of at most objects with respect to each feature Ai E i(AT). Thus, *(e, ) given by max({_4 min({(LOCS(oi,Ai,,e,g,): E G C, (,))): Ai E (AT))) is not *,.ED,~ (.,) greater than the minimal cost'(e, ) of the path (p,q) from e to ce. Monotonicity: Let c, and c, be two states of the problem such that for some rule < 1,..., > E R, (<,..., >,C, )E SUCCR. For monotonocity, it suffices to show A*(c,) < A(e,) + e(<,..., e >,e,,e). Let the set Z(al,...,), <1, ~ --, > E R, be Z(p,,...,,){0:(.o E ~(EU)) n (oi n {,1,...,, )} )}. By defintion of the rule <,...,,>, the set BA,(eC) is given by BA,(e ) = BA(e ) U Z(al,...,. ). Then h'~ (c,,) = max({ min(( GLOCS (o,,A,,.C ):, *E( Ai.., ) -(o ))) ~, E CGA (o, ))}): A, e (A T)})

l15 + x=(!, miBn({(LOCS(. 1,,,<,,,): *EBil(, ) *,ff(,s,.... *,) j, E GA,(o )))): A E (A T ))) - max({"-. E min((GLOCS(e,,Ae,i,): a. Ae~ (<,).e,(o&.....T,), E ^ (o,))}): Ai E AT~))) + max({(- min({GLOCS(e,,A,e,,c, ): 8,,EB (~s,) (1).(,(,i. *....,,), ~,(.)))): A, E (AT))). Assertion 1: For each e, E x(EU), Ai E x(AT), and, E G, (o,), GLOCS(o,,Ai,,e,,,)< CLOCS(o,,Ai,,c,,j) + c(<l,.., * >,,,c). *To prove Assertion 1, let K;, = Ldit<(<f(o,,e, ),, >,o,,A,). Then by definition of Ldit, Ldist (<fA (o,(,,,e,),, >,o,A,) = K K,, >, -1. By algorithm GLOCS, GLOCS(o,.A,,,, ) *=1 -1=A',K where W'(r,o,,A e,, ): — {c(<a(,....,,;. >,C,ei ): (o. 6 Z(a(,....,,: )) n (3</qq,Q > E C(ol.A.e) o, o, Z (a,..., ).: *=1....,,. o o,.)

196 (3<,,q, > E CC(o,,Ai,,, v,q,)X(ql - * A, (I,), 1-,...,i,..., ) n (' - fA, (*,~ i),,...,i,...,, ) n (ESCF^!.2...s. >.(<......,,>).,A) a( ~ ~ ~,I ~ ~ ~ i f, -~ Q) - trc))). Since C(o^,Al,e,,) C C(oe,Aj,e,), e* E s(EU), Al E st(AT), and CC(,,,A,,e,n,, ) C CC(o,,A,,e,,n, a, ), n l...Kij, W(n,o,,Aij,c i, ) W(n,;,,Ai,c, ), n -l,...,Ki. Thus, GLOCS(o,,A,e,,,) K.,-I K., > E min(W(n,o,,Ai,e,,)) + min(W(n,,,Aj,c,q^)) * =1 - -K,, GLOCS(o,,Ai,,e, ) - min( W(Kj,o,,Aj,c, )) (3) K,; + E min(W(n,o,,A,,c,,j,)) a =KlJ (4)... If K = K,, - 1, then from Eq. (3), GLOCS(o,,A,,,,, ) > GLOCS (o,,A,c,,g ) - min( W(K,,o,,A,,e,,A, )) > GLOCS (o,,Ai,, ) - c(<,...,, >,c,, e) because min(W'(K,,,o,,A,.,,q ))< c(<, l..,, >,ey,, ) (5)... If K; > K,, - 1. then from Eq. (3). GL OCS (o,,, e,., )

197 > GLOCS (o,A,,c, ) + ] min( W(n,,,A,,, )) — K,,+1 because W(K,,o,,A,,c,, ) C W(K.j,,,j,,,e, ) Thus GLOCS(o,,Ai,,,q ) > LOCS(o,Ai,c,,) - c(< 1,...,,>,c,,, ). From (4) and (5), Assertion 1 holds. Q.E.D. of Assertion 1. Based on Assertion 1, from Eq. (1), A' (,) max({: min(J{ LOCS(o,,A,,,i ): *, *.B,(~,),,~Z(t,3....,,) q, E,A,(o,)))): A, E (AT)}) + max(({ min((GLOCS(eo,A,e,,q, ):,,B *, (,),.Z(,l.....',), e GA,(o, ))}): Ai E ~(AT)}) > max({(,,FBA (#,).in({ E LOC$(o,,A, )., ) >,e,, e)]:, e,^(o,))}): A, E.(AT)}) + max(({ 1 min{ CL OCS (o,,A,,e.q, ): e, EA (e,) e, fZ( I I.,,)

198 j, E GA,(, )))): A E s(A T))) > mnax({( 8 E I *. Et(... s,) min((GLOCS(o,,Aj,e,, ): 9, E CA,(e,))}): Ai E-(AT))) - (<,,..., >,,,c,) 1 + max(f a E I e.fi~ (e,.) min((GLOCS(ei,Ai,,,, q, E G,,(o ))}): Ai E x(AT)}) Q.E.D. Corollary 4.1 For each state e,, the heuristic given by I"(e,). mxw({min({GLOCS(coA,,,, ):,,f E G, (o, ))): Aj E (AT), oEB,(e,}) satisfies the admissibility and monotonicity. Corollary 4.2 For eachs state e,. the heuristic A (e, ) given by A'(e, )= max(({. I 1 min({GLOCS(o,,A,.,.. I- I n(r(E:i )) I -.L.,, e. E r IC' ))

199, E ^,(, )}). Ai E (AT ))) satisfies the admissibility and monotonocity. Corollary 4.1 For every state,, the heuristic liven by A(e (,) - max^(e,), A( ), A'(c ))) satisfies the admissibility and monotono city. Proof of Lemma 6J Let *Ki E rK(EU) and e*g E ar(EU), k-l,...,w, such that ^!C *K, and kt <hil - -, k. > E CA,(#K) uad E 6 GA,(Ol ). (A-l)... By definition of the relaxed successor condition formulas, ESCFP, ) and ESCFrj4.A,), for every <ql,..., i > ~E(K Q (,Ai), i E Q (e/,4), k-l,...,w, if ESCF,'F A)(<i.l,...,ir.>,<hli,...,, >)m truc, then ESCF% 1,) ^A,) ( j,) tr ue, k-,.., but not vice versa. Let <V., * * f > E Q (A,tAi ). Io E Q (oa,Ai ), -, —-,",w(1)... If (<it,"..., g, >~,<I,..., />) is computable, then tIhre exdst some <, I,...,:,r > E Q (O.,Ai ) and some nonnegative integer n such that (<IMi, *.. f <?r. >,w..A. >) E DST(n,oKi,A,< l,<.* *.,, >)? (<,i],.~ ~ ~, f >,<~", ~. I ~, j>) E LENI(oK,,A ), and (<i,.... f tg >x<qil/,...w >) f DIST(k,o;,,AK <A, - *..., q, >) for k Il,...,n. Thus (<-at..., i) >f,<orh. k.,?l,. >) E DST,(n+l,oA, ^A,<liA, l..,,, >), Based on (A-l), for each k ~ {l,...,r), if (gNq ) DIST(d,oj.A,Aq,J,

too d4 l,...,,t then (fa,ija) E DIST(n +l,e, jAi,j ). Otherwise, (9j,i, ) DIST(d,,, Ai, ia ) where <. (2) *.. If (<il, * * *. >t<iLl * *,i>) a *ot computable, then from (A-1), each (Aj,;j ),k -1,...,w, is either computable or mt computable. From (1) and (2), for each <il, a..., >E QO(eKmi A ), a E Q (lm,Aj), and each <ih..., i > C OA,(eK ), la E OA,(,e), -1,..,w, Ltfl ((<~, I.,.* Vi, >,<9i1, ~ i, il.i >), OKi ) > Liil ((t,Q.V ),rve,A),, k -.,w. Q.E.D. Proof of Lemma 6.4 Let *eKi C r(EU) uad eo E r,(EU), k-l,...,r, such that *i C *Ki, and let < b I, * * * ) w > E G^A, (r) and ja C OA,(em). From Lemma 6.3, for each e, E S and each Ai E.r(AT), *if Ldit ((8ff,(oKie, ),<i,,.'., f j,, >),oK,Ai) - N,, then for each k =l,...,w, *Ldit ((ffA,(el,e, ),jj ),#,a Ai ) - Ni - oa where a is the nonnegative integer. For each rule <,..., > E R, let Z(<l,...,, >,rA-(EU)) be z(<2,...,,>,rK(EU)) - {*oa E rK(EUv): O n {i,..., a } }. TLnD, by algorithm GLOCS, for the object oKi E XK(EU), GLOCS ( oK,,A^,Ce,,,<... v f, >) N,.= min( H'(lo^K,,Ai,e,,141,,. <, I q, > )) ==1 where U(.,o^.,,,,<,, < X., -,. > ) = {' (f a, o., G,):

301 (<,,...,, > E R) n (*K, E Z(<a,..., >,rK(~EU))) n (Vea E Z(<',,..., *, >,rK(EU)),k —1l,...,L) ( 3{(<fii, * * u qK, >,<QI ~ * * * * KC>) 6 CC(xK,A,j,e,,<., <,1,,,w >)) (3< K,It > e C(o{,,A,e, ))...( 3< a, IL > E C(, A,,e,)) (LESCFI,<lb >....^I >.s{<...S, >.., (U)).A,) (, *. *I -, >t * * * -, < ->,vooep - ~ *~<.# > a I true)). ~ <Wc1* ~ ~ ~, K >, —t,qKL,Qr ~ ~ ~ <qfK *- ~ C, >, —-,qKL) - true )} For each *j E xi(EU), k -,...,w, N,se GLOCS(ol,,A,c,,e l ) - min( W(I,,,,,A, )) I-i where W(tIe,Ai,e,,q ) (- {(*(,.~..,): (<~, ~ ~.,*> E R) n (e E Z(< 1,..., * >,,r(EU))) n (VO& e Z(<1,...,, >,or(EU)),tl,...,) - rl~a I ( 3< fii.iutf > E CC(o,Ay,<,/ l, )X 3<g/ I fi > E C (oliA,c. ))... ( 3<, *,,,.qJ> E C(ow,A,c, -)XESCFf(,,... >.Z(<e..., >,(EU)).A,).(>.. *..* * ~... **~ *, U. * * * mU il true )). (B-i)... For each k E {l,...)}, there exist nl,..., n- ( I,...,N,), where n, n, if i Z j, i,j e {1,...,N.-s), such that for each r E {l,...,N,-a,) (<f ln * * * i,~si >~< - I * * * i qn~>) CC(O^,A,c,,n, <l,,..., CA >) and (g,,ji)E CC(ol,,A,,e,,tql, ). The property of (B-1) is easily derived from the sequence of N, pairs from AffA (o,,.) to < g;,..,,,>. (B-2)... For each v E {l,...,N,-a }, k =l,...,ur,

102 and for every <,,...,, > E R, if J " ( 1,***, *) E W(n,,Ki,Ai, ~c ~ ~*, <N, >), then 1', (, 1,...,, ) E W(v,,.4i, cA,,j q ). To show the property of (B2), suppose there exists some <,,..., *,> E R such that J i ( l,... ) E W(n,,e,iAi,e,< g l,< i, h,:> >) but / " (*,...,*,) W(v,oa,4i s,e,s ), t E {I,..., ). (B-3)... Then by definition of the set W(v,M -,A,,e,,j ), it is not true that for the object *e and for each *, E Z(<i a,...,, >,rt(EU)), *,^ /a, i, ly...M, ( 3<iuat,qu > E CC(ol,Aij,s,l,tl )X 3< il,,ql > E C(o,,,Ai,c, ))... (3<ilMtqw> E C(ow Aj,e. )XE$CF....,,>.,)(,,...., t *, ~ ~ f QUt, ~ ~ ~, q ut -.. ~ U p, ~I, U)* q)1t ) where ZJ E Z(<,.,. *, r >, (EU)). (B-4)... However, by assumption that l/ I (,...,, ) E W(n,,*KS,A,,,,<e,..., il >), it is true that for the object oK, and for each OuK, Z(<,...,, >,w,-(EU)), *O., i A,, i,1,..., L, ( (<?~,ifi> * * * f 9",j<K > <q8. K * e * K? w >) ( ~3(~ ~<q..r, ~., g,. S </>,<.i, ~..,?~ >)).>) ( 3<) il',i l > E C(o,,A,,A, ))...(' 3<sK,Q^M-> ~ C(o.M.A,,,e )) (ESCF- I(<.., >.,Z.A,)( 6i * * * *,. ~'s', <s.A' I..., v.,A>. >.f.'.. **.< *. <, I * * *, t, A* >.**,-. fM > ) = <tru )

sO3 where ZK m Z ( <,..., a >,K (EU)). Then, by definition of the relaxed saccessor formula ESCF,,,, >,* Bnd ESCF (<..,, >,,.A4,) it is true that for the object *ju C K, and for each E. Z(<1, (<...,, > >,(EU)), i E I,...tL }, nsch that'A 0r I~~~~~~~~~~~~~~~ iftK. -- <...,q,- > qK,, ~-<...,q,...>, where 9x., qK. E Q(o..,AA) and ii,,I i E (oe,,i ), then (3< )a~, Kk> ~ CC(ijyK,AiCest,,ii)Xi3< ) l/it ~ C(olI.Ai,,e))... ( 3<lL i.L >E C(Eo,Ai,es )XESCF(....,>,.A,)(61... s ilt * *. i, Jl o * * x lL 1Qll, ~ * * * ~ ~K, lL ) tre ). Since (B-3) and (B-4) are contradictions, the property (B-2) holds. Then from (B) and (B-2), for each * E {l,..., ), GLOCS(os,,A,e,,<li,,... f,, >) > GLOCS(,^,A,,C,, ). Q.E.D. Proof of Theorem 2 To prove HO(Itjes5) < HO(KL(es) where xr(EU) is the refinement of Xr (EL) and irj(AT)= L (AT), it suffices to show (1) A &.j)(e,) A( LL)(eC), (2) A(/,J) (C ) < aAK.L) (e), and (3) hA() (, ) < A(.L)(e ) CaS (l): t.,)(c, )< A(^' L)(e ) From the formula (8.1), for each state e,, the values of A^KiL)(e ) and Ar. ) (e, ) are, respectively.

S04 A*,.L)(.- ) - "({. —I- min({GLOCS(,oK,A,,,,<ei,...,. > ): (Kl.) (.,ee, I,,) < l ~ e e9j, > E GA,(OK, n) Ai E r, (AT))) i, G..,(o A,))): A E (AT))) where BI () c:- { o (ol, E,(EU)) n (,(OffA, (. ),e GA(o, )). By Corollary 6.4.1, tK.J) (C.) -- max(({-.- i muin({GLOCS(eK Ai,c,,<l,,,...., fi. >): (1) <hlA...-,h. > ~ C,(o,)}): Ai E r,,(AT))) > max( 1 ___I I -;(Ky.I) S.ee,( (, ( (EU), r(ELI)), min({( LOCS(o 1,Ai,C,,j ): j e?A,(io )}) *: El (EU) where Q (oAfi,X^(EU ),wr(EU)) is the maximum number of objects o E rl(E'U) each of which is the subset of Ah. E wA(EtU) and has two different position values in one state and its successor state. Condition 1: Let (K.L) == 1. Then from Eq.(l),

106 A 11(K.L ) (CS )?! in a4 ( *,, (., r,E) (I, ( EU ),,(EU)) * D* s0^ (s) min({GLOCS(,Af,,eies ): e, E A,(, a ))): Ai E rJ(AT))). By defnition of;q.(2), K(E)),ri(EU)) <;(/,J). Tben from Eq.(2), AftK)(c,)>2 Imax({ e C S *(ij}).,.B (.,).,*, Eu(U) J *,C** min({ GLOCS(o,,Ai,c,,,a Y. j E GA,(O )})Y Ai E rj(AT)}) (.:) *ma., (.) min(( GLOCS(oe,Aj,c,,. ): j E GA,(O,)}): A, E r(AT))). e A (.i (A ). Condition t Let # (oK,,K(EU),i/(EU)) = I for oK, E xr(EU). Then, from Eq.(l), t(-.L) (Cs) > 1 max({. E S s (K. J) *, ElB) (e, )o,, E, (EU) ~ oC*,I (3) min({ LOCS(o,^,Ac,,q ): jl E GAI (oli ))-): A) E jrl (A T ))). From Lemma 6.1, (A,L) T;(I. ). Thus, from Eq.(3).'I (,K(l.J)

S06 - Bmax(({ s ) (;.),,,E18', E(,(U) min({(LOCS(e,,cA,es,,m): la E GA,(eM))): Aj E r(AT))) - if..)(..). Cax (2): i(/.])(C, ) < ^iK)(C ) The heuristics I(K.L)(C, ) and Al )(C) ) respectively, A(KL)(C, ) - mx({min({CGLOCS((K i c,,<gi,,...,,l >): and (i,.,) (c,) - max({min({ GLOCS(ole,A,,e,,ij ): g ~ G^{,(o,)}): A, E r(AT), o^ EB (c,)}). By Corollary 6.4.1, for each Aj x1(EU) and for each OA-, E IA-(EU), o,/t E ir(EU) such that o/t C oK, min({ GLOCS(ohi,AJ,e,,<g, I,. o ~,, >): < l,..., G,:> E G (O. ))) > m'in({GLOCS(o9,lAA,c,At, ( C A t,(o)})C Tbu,. h(',)(,s )( < A(.L)(es )(

S07 Cas ): Pa.@) (C. ) < rK. ) (C,. ) The valeus d AIr )(e, ) and IA;,j)(c ) re, repetively, Aiar~)( e)- "(({. E *(K. )- Infl(rK(EU))I,,El~ (..) *~,. fn(, (Er)) min((GLOCS(oK,,,A,c,,<q^,,...,, >): <il.., ~ ~. > E G^,(oKi))} Ai E~,(AT))) and A(,.,,) (C.) - a. (,.J )- n(r,(EU))I E,,BS (,) ~, o(,(eu)) min({GLOCS(o,Ai,,, ): iM E C,,(, )}): Ai E r,(AT))). Condition 1: Let;(KL) =. Then I ln(x (EU))I 1. If i(K.L)- Ifl(tK(EU))I =O, only A itKL)(e,) and A-tK.L)(es) are defined. If;(.J) - I n(r,(EU)) I 3 0, then by Corollary 6.4.1, &^', L ) (e,) =ma({ E rain({ GLOC$S(o/,,A,,e,,lm - ): qj E G~4 (o/ )}): ~*,EB. J,, (,,) A, E,(AT)}) > max({ 1 es.EP' (,,)'(. )- | r(t (~EU)) *| E,,l-(Et)'l, e,,. e', v, I'I El'))

S08 Bin((CLOCs(l,,~~.~): i( fe C~,(Y, ))): Aj ~ xi(AT))) -max(( I E * (I.J) |I n(r,(EU))I I*O a,(e.) l f,,f(I(u)) min(({LOCSos(e,Ai,c.,,): i E GC,^(.,i ))): Ai E r,(AT))) - i^('T) ( )-. Condition t. Let fn(rK(EU)) - n(r (EU)) and # (c.,r (EU),rz(EU)) = 1. I *(K.L) = I(K.L)- I|n(rK(EU)) I and iK.L) - (KL)- I n(WK(EU)) 1, then *(KL) < sy.])By Corollary 6.4.1 KL )(e, ) max({.-.- C s (K..),. EBE (, )o., (, (EU)) J min((GCLOCS(oK,,A *,<q 0 *.. g, <?], ly s o fir> E GA JOoK. )): Aj E jrj(A T ))) > max({,1 m ('.,) E E *.EBf (e,) *,t Et,(E!) I el es'. C *I*, *e (, (~Er)) min({GLOCS(oW,A.,~,, ja ): jfa E GA.(o], )}): A, E Ir (AT)}) > max({ — I ('I.;!, eB(. (t,) o"., q (r( (E'))

309 min((GLOCS(ejA t,eAj): j~, C C^A (m ))): A, E v(AT))) - ^.,)(c,). Q.E.D. Proof of Lemma 8. Let ALj E rL(AT) and Ai E *,(AT), kP1,...,v, such that Alj C Aj, and let <ij1,...,, > E GA,,(o), and jj E GA,,(o ). (C-l)... By definition of the relaxed successor condition formulas, ESCF(^ ) and ESCFr.,, ), for every <g. l, *., > Q (i,ALj ), qi EQ (iA. /,j), k=11,...,v,if ESCFp'L, )(<q, I...t ru >e< fy,..., jj,>) trYc,then ESCF;,,A)(id,jq t ) - ruC, k -1,...,, but not vice versa. Let <g,,..., A > E Q(~,,^yi)and E~ Q(o,.,A]~ ), *-l,...,,. (I) If (....if fq2>~<1j~ 1..., fJj >) is computable, then there exist some nonnegative integer n and some <q.l,., q, > E Q(e AL^) qi. E Q (o,,A jtj ), k l,...,r, such that (<Li1, * * *,.,,( ><fjj, * * * ji >) E DIST(n,o,AL,< Ji,'.., J >), (<ll, —,, jg >< q"-,~,* q, >) E LEN (o,,A ), and (<ll.' *, ql, >,<iJl, * *,*,J 2>) DIST(ko,,AL,,<jI,,I.,', >). k 5{ l,...,n. Thus, (<irt * * * g >,<li, * * *, j >) E DIST(n +1,,,AL,<i<q..,,*, >). Based on (C.-), for each k E {l,...,r}. if (Ua,,j ) ~ DlST(d,o,,A,.qj). d < ]1.....n, then (q'a,qj ) e D/ST(n +1,o,A..4,.j ). Otherwise, (q&.9,1 ) E DIST(d,o,.AJk,$qyJ ) where d < n.

210 (2)... If (<jr,,...., f, >,<j,,, i.. e, jj >) is not computable, then from (C-l), each (a,iJa ), k -l,...,v, is either computable or not computable. From (1) and (2), for each <i,,..f,i,> E Q(.ALj), 4L )a E (tAji) k-,...,,, and for each <,i,,-..., vi,> E GC A,(i), i~JA G,E (), k "',...,e, *Lit((<(,..., I T,, >,</..,,..?Jj >),ei, l ) *> Ldi t((~,,,, ),o,,'ij ), k 1-,...,. l Q.E.D. Proof of Lemma 8.7 From Lemma 6.7, if Ldt((,ffAJ,,(,,C ),<qjy,..., gj, >),e,, AL) - Ns, then for each k E {1,..., ), L^' f((^fA,, (O^,e ),ijj ),o,A it ) - N, - Uo where oi is the nonnegative integer. For each rule < l,...,, > E R, let Z(<l,...,* >,r,(EU)) be Z(<1,...,, >,ir,(EU))- {o. E t,(EU): o. n {(,, *..,.* ). Then, by algorithm GLOCS, for the object o, with respect to the feaure ALj E L (A T), GLOCS (o,,ALi,,,<>,..,, >) N, I — where 4'(l,o,..4z,C,,< i,...,,i >) {I ""( *I., t., ): (<,a,..,a, > E R) n (o, E Z(<1,.a a, >,ir(EU))) n (V. E Z(<,...,, >,/'(EU))n =1.....i...,Af)

211 3(<t ~Lit ~* ~ >,< a4, C.. L ~ (., >) ~ CC(o, ~L,,e,,<TJji,, ~, 5'i,J >)) (3<iL~,Lc > E C(,ALjA,,,))..~43<q,,E> E C(ouMALj,e,)) (ESCFS.....,>, (<....., >,,(J) ^,** *, L, * * * < fTL' * * -, r,i >~, —-~,L,.L * *, ~ ~ < tiL,~.*~,Lu >P-,.,Qw) " tre )). For the object e, with respect to each feature Aji E srj(AT), k -l,...,r, Ns..1 GLOCS(os,^Aj,c,,jr) - min(W(l,ol,Ai,C,,i)) I-1 where W(l,,Aji,t,, ji) - ({/ " (....,, ): (<..,.> E R) n (. e Z(<^,...,, >,ri.(EU))) n (Y. e Z(<., *, >,,r,(EUl)),n- 1,...,M) ( 3<ilj.iy, i> E CC(oi.,Ai,,.Ji,,ji )X3<,l;l > C C(,,lA,, ))... 3< lwm q/ > 6 C(oj,A ges )X~ESCFe., (3<q,;> e ^ (,cj )XESCF~(<J.. a, >,Z(<,...., >.I (EU')).Ar (*1,,^ -,, *: *,..-j,,.i...,l;,.. qJ, qM) = true )). (D-l)... For each ( {(l,...,t), there exist nl,...,*N,- E {,...,fN,, where n, 7 ni if i, i,i {l,...,N,-o }, such that for each w E (l,...,-,v~ } (<q.iy,.., - f, >,<q I,. ~.., q,, >) e CC(,,A^t,e,n,<9,J -- *, SJJ >) and (j.,gqi) CC(o,,Aj,,c,,trgjq). The property of (D-l) is easily derived from the sequence of N, pairs from ffA,, (,e, ) to < j,.., jQ, >. (D-2)... For each r {1....N.-a. --- 1,...,t, and <...,, > >ER. if f'(o (a.., )E'(n,.o,..4L A.e,,C <q.., g-J, >), then! ( 1, ~,, 0, )'(trvf,o..4. ~,,Je,, )

212 To show the property of (D-2), suoppose there exists some <*,...,,> E R such that / "'(,.., e*) E W(M,,,AL,PC,<s,.., -, >) but /', (..., ^ w) w(,w, /ji.k,,,iJj ), k 1,..., ). (D3)... Then by definition of the set W(w,e#,Ajj,,,fJji ), it ib not true that for each *, E Z(<l,...,, >,r,(EU)), i-1,...,/,...,M, (3<gji t > 6 CC(o Aji,cP, 4 j)X 3<Mff< l > E C(I,,Ali,c, ))... ( 3<jvw,j';:> E C(om,Ajij c, )XESCFt S s...>j,,)(1 **.. of, a true) ql, ~ * ~, 9 - *9W9I ~ * - - 9 lU99 * ~ ~- t iJtf,~ ) where Z, m Z(<^.,., *, >,, (EU)). (D-4)... However, by assumption that...,(.) E W(ne.,, AL,es,< ir<,..., ifj >), it is true that for each ~i E Z(<1 e,. *,, >,,r(EU)), j-,...,;,...,M, ( 3(<.L, * * * ~,.,L >.<QfLI,-, Le*, >) E ( 3< q L,L, > e C(o1,AL,Cs )).. 3< qLqL> E C(oALjeC )) (ESCF, Q.., >.ZA * * * <),Ll * =.s. >th*e iLM.qL 1 9 —-,< qF L., * * - 9 Q- L, >, —-,Q^J >) I truC ). Then by derfinition of the relaxed successor formulas ESCF<?,, >f, i ) and ESCF,, >, it is true that for each O,^ Z ( < ~,, >,(EU)), if gL' << >l.. ~,., > and qLI = <- q.,., qj-, > where 9L. qL E~ Q(~. ALj) and Jt,.i qiJ E Q (o,.A ), / =l,...,, then

213 ( 3< yi,,9,,ij > E CC(o,Ajj.c,,,e ij )X 3< jI~,ju > E C( (e,Aji,c, ))... ( 3(<j qJ,qa > E C(oM,A i,c, )XESCF ~.... >.,,s )('~, t...,., ~. * * f as SO s 9f]n,* * *, j~, * * ~ ~ ~~,I1 *, - fji ~ ~ ~,. -, - I'-~ ). Since (D-3) and (D-4) are contradictions, the property (D-2) holds. Thus from (D-l) and (D-2), for each k E {1,..., }, GLOCS (e,AL,,,,< Jj,,..., j, >) > GLOCS(;,,Ai,e,,qji ). Q.E.D. Proof of Theorem 3 To show HO(IJ,(c) < HO(K.LCe) where wx(EU) - EK(EU) and rJ(AT) is the refinement of rL{(AT), it suffices to show that (1) kft.,)(c,) < AfKL)(C), (2) Aft.)(sc ) k(K.L)(s ), and (3) Al.,() (C) Ar.L)(c,). Ca2S (): IJ1f.)(C, ) < AKL)(C.) From the formula (6.1), for each state e,, the values of. A'K,L) (e,) and i('.) (e,),are respectively, (K.L)(e, )== max({ l S min({GLOCS(o,,AL,es,,<jl,..., gJJ >): K(KL). EB, (,,) <gJ, *,- * *. J, > E G,,(o, )}): ALi E L (A T}) where BA, (e.) = (o.: (0 E WK(EUr)) n (fA(o...)~ GA, (o,)}: and (I'.;) (e,)- max({ S min({ GLOCS(o,,A, l,,,gi ): (, J)., EEB,# (e,) ji E G,,,(o, )}): Aj, E~ j(AT)}) where BJ,, (c) = (o,: (o, E il(E~U)) n (,ffA,,(o,,, ) G,,,(o, ).

314 Since;(.) -'(K.), from Corollry 6.7.1, S(X. ).Je,~ (e. ) <T v1..., L h ( > E d^A,(o )}): ALi E tL( A)}) > max({ (.C; Smi an({(cLOcS(o, jjc,,ijo, (I. Jl),.Ei, (,~,)AO~ (Ar);, E cA,, ( o,)}l): ALj E rL (AT))) - max({1( S min(GIOCS(;,A ^,cC jA ^) (I.J),o, EDA,, (s,),, E cA,,(o )}) ALi E rL (A T)}) - f/,.,)(,,). C.., (2): *,*'.,)(c, ) < I^'(.L)(,. ) The values of AJ j)(e, ) and A L )(eCs) are, respectively, ^(h'.L )( Cs )= miax({min({ GLOCS(o,,ALi,c,<il,..., iq-, >): <-j,,.-, fj >E CA,,(0,)}): AL EjrL (A T ).,,EB (, )}), Al.r) (es) = max({min((GLOC'S(o,,A ji, esj ): qjtj E GA,,( )}): Abj E ~ (A ), o) EB(, (,)}) Then, based on Corollary 6.7.1, A(i,)(C, ) < A(K.)(C, )~ CaMcI (3): hA J)(e, )h A^.,L)(e.)

216 The values of Ai;,)(c,) and k zKL)(e.) are, respectively, ArK.)(,.) m(( —,,..e *(K.,)- I n((rK U)) *.D',(.,) *, a(, (u)) min({LOCS(,, ij,, <. <i, v..., ij. >a) <ij,, *..,?, > GcA,,(,,))): ALj E rL(AT))), and A(I,) (C. ) -max((...E *,)- I f(ur )) O.; f'Jf(,,Eu)) mini {GLOCS(AK(E),i,e(EU),,(K):)qj nd E G^((E))): Aj E r(A T )}). Since K(~EU)- J,,(~EU),;(K.L)-;(/.) and f(~rK(EU~))- ftr(~EU)). Thus, by Corollary 6.7.1, A?,,/)(c. ) < A^.rK)(. ). Q.E.D.

218 APPENDDI C ARGUMENT.I Let *Ki E iK(EU) and eja E vJ(EU), k-I,...,. such that *m C Ki' aBnd *- ** let <F/i.-, *, t> A,(*Ki) and fi, E GA,(#,), -1...,w. Then from Lemma 6.3, for each state e, F S if Ldit((e^A,(oKi,es ),<gAil,...', >),oKj,Ai) m Ni, then for each k-l,...,w, Lift ((#ffA, (Oj,e, ),t1 ),eJj jA,) - Ni - 0i for some nonnepative integer oa. By algorithm GLOCS, GLOCS(K (OK, <,e<,, <,., i >) N. (A-l) -: min(W(l,o,Ac,,e<fl,. <.., I. )) I-i where W(l,oK,,Ai,e,<h > I., - ^I.~ >) {C (<' *,., *, >,C,C= ): (<,...,, >, c, e, ) E SUCCR n (oK, e Z(<,...,, >,r;(E~U))) n (Voa e Z(<a6,...,, >,WK(EU)), k =1,...,L) (. ( 3R<V-y, o* * *~. t' >~<fQiw *, * *, q'>) E CC(eK,,Aj,,e,<,l, *y *,?i/, >)) (ESCF ^<s^..,,.>.z(<,,....,, >.fs(EU)).A,) ( *,'..,,.*.. < l'l, ~ ~., Vi< >,,Q L,Q>'. ~ ~... <g'l ~, ~ ~ I, 95i~ >,-9KL ) = true ) here 2(<l,...., >, (E~J)) — {o, E h(ELt'): o, n {a. * *, }.) })

l17 GLOCS(, tAi,e,,a ) (A-2) N, - - S min(W(I,ea,Ajp,e,,jM)), k-1,...,w, I-1 where W(l:,o,Ai,e,,ai) - {~(<a,..).,- >,e,e.s k ) (< ~ *..,.>Ce, e )ESUCCR n (, Ez(<I,...,* >,I,(EU))) n (oa E Z(<^,...,, >,,(E1)), - 1,...,M) ( 3<,iQo, > ~ CC(oK,i,,s,,g )X 3<i,,,iv, > E C(ojAi, e))... (3<i lmiq> E C(ow,A,e, )XESCF..., >,<....,>.,(e)).A,),, < a,,., ~) (^...., ~,,, * * * ~~, i ~ * *, *IM*,qiU * * *, f9Ui *~. * = = true ). From Eq.(A-1), GLOCS (K, Ai,,<,,, **.. >) (A-3) N, - = S min(W(l,oK,A,esj,<q,..., Tq, > )) + 1=1 N.' S rmin( W(,Ogi,Aij,es,< -h 1, ~* * *,,, >)). I-= -, - +1l (A-4)... By definition of CC(oK,,Ai,es,<'l, I~.., q,, >), C(t,Ai,Ce ), o* E Z(< ~,.., * >,xK(EU)), and ESCF(se>^....A,), every element c(<sl,...,,>,c.,eC) in each set W(l,K-,,Ajes,<iql,.., / >) I E {I,...,-max({o: k =1,...,m})), is the element of either of w sets, T(I,o.oj,cA,,p j,/ ), k -l,...,w, for some I' {l,.E"^,, -- }0 (A-5)... Some element c(<a,,..,, >,e,,, ) in the set'(l.OA-,.A,c,,<,],..., q,, > ), t {I\;-min( {(^: k =1.....wr ))+1,...,..; }. is not the element of any of the tr-(, — ) sets W(1'(,o,AJ,,,ql, ),

1s I -1I,...,N, -^j, -l,...,rw, if e and c are two descendent states of c, such that Ldi;,((^fA,(xK,,e. ),< fli,..., fip >),.K, ) ) I and *Li ((,A,(*eM,c. ),f,el,Ai ) - I' where N,-min(({o/: k-,...,w ))+ I <. Claim: Based on (A-4), for each k E (1,...,w), if the element e(< ei,..., s*, >,c,,e,) which is to be min( W(lK,,Ai,c,,<,i,...,,kw >)) is the element of the set W(Il,,,Aj,CS, j ), t E {(,...,Nj-, ), then GLOCS(oK,,Aj,c,,< g.,,..l. >) > GLOCS(o{,Aj,e,qi, ). Claim 2: Based on (A-5), for each k E {1,..,)}, if (1) for each I E (1,...,Nj,-max(({u,,: i-1,...,w))), the value c(rj,,c,,,l) which is to be min(W(l,x(t,AIj,,,<ifl,...Ps,qi>)) is less than the value of Min( W(I,ojQ,A,c.,ia ), (2) for each I E {N -max((o{,: v =l,..., })+1,..., N.-min((o,: 1l,...,w })}, the value c (r.,e1,et) which is to be min( W(l,K,,A,es,,<( X, 1,- P, l,>)) is equal to the value of min( 4'(l,oi,A,,gCs li ), (3) for each l E {JV, -min({o,,:'=,...,r))+,..., A), the value c (rtl,.e,,eal) which is to be min( H'(IOAK. APs t, ~,<qll,,..,q,/ >)) iS not element of any of the tr sets IM'(,ol,,,A,,es,q,,), r =l....,t. and the value of ~ c(ru.ec,e,,,) where I' {N,-min({(,,: r=l....,tl })+l,..., ), is such that for some L E {,...,.,-max({(,,: =l,....t })}.

219 min( W(L,oK,,Ai,,e,<i, I..., l, >))+ E ~ (ru,A,e ) < min( W(L,,Ai, es,, Els ~)), then GLOCS(oK, Ai,c,,e<qz., ~.., go, >) 5 GLOCS(ol~,Aj,e,,pls ).

BIBLIOGRAPHY 220

.21 BIBLIOGRAPHY IAnd81l Anderson.J, Greeno.J, Kline.P, and Neues.D,' Acquisition of problem-solving skill", Cognitive SkilU and Their Acqugiition, Andersion.J (eds.), Lawrence Eri baum Associates Publishers, Hilsdale, N.J., (1981) B-r8l] Barr.A and Feigenbaum.E, Tie Handbook of Artificial Intelligence, Vol.1,3, William Kaufman Inc., Los Altos, Ca., (1981) [Ber79] Berliner.H,'The B' tree searching algorithm: A best-irust proof procedure, Artificial Intcligence, Vol.12, (1979) [Bun781 Buchanan.B and Mitchell.T,'Model-directed learning of production rules", Pattern-Directcd Inference System., Waterman.D and Hayes-Roth.F (eds.), The Rand Corporation, Santa Monica, Ca., (1978) iCar81] Carbonell.J,'A computational model of analogical problem solving", Proc IJCAI, (1981) |Clo81] Clocksin.W and Mellish.C, Programming in Prolog, Springer-Verlag Berlin Heidelberg New York, (1981) |Coh83] Cohen.P and Grinberg.M,'A theory of heuristic reasoning about uncertainty", Al Magazine Vol.4, No.2, Summer, (1983) [Dor67] Doran.J, "An approach to automatic problem-solving', /Machine Intelligence, Vol.1, Collins.N and Michie.D (eds.), New York, American Elsevier, (1967) 105-123 [Ern83] Ernst.G and Banerji.R,'On the relationship between strong and weak problem solver', Al Magazine, Vol.4, No.2, Summer, (1983) [Gas77J Gaschnig.J, "Exactly how good are heuristics?: towards a realistic predictive theory of best first search'. Proc IJCAI, Aug. (1977) [Gas.9a] Gaschnig.J, Performance Afeaturcment and Analysis of Certain Search AlgorithAm, Ph.D Thesis, Dept. of Computer Science, Carnegie-Mellon Univ.. May, (1979)

222 jGas79bJ Gaschnig.J,'A problem similarity approach to devising heuristics: first results", Proc IJCAI, (1979) [Gui79] Guida.G and Somalvico.M,'A method for computing heuristics in problem solving, Information Science, vol.19 (1979) pp.251-259 IHara78] Haralick.R, Davis.L, and Rosenfeld.A,'Reduction operations for constraint satis faction", Information Science, vol.14 (1978) pp.199.219 Hara79] Haralicl.R and Shapiro.L,'The consistent labeling problem: part I", IEEE trans. Patern Analysia and Machine Intelligence, vol.PAMI-1, No.2, April (1979) [Hara80] Haralick.R and Elliot.G,'Increasing tree search efficiency for constraint satisfaction problems", Artificial Intelligence, vol.14, (1980) 263-313 [Harr74J Haris.L,'The Heuristic Search under Conditions of Error", Artificial Intelligence, wdl.s, (1974) [HartBs] Hart.P, Nilsson.N, and Raphael.B,'A formal basis for the heuristic determination of minimum cost paths', IEEE trane. Spy. Sci. Cybernetic;, Tol.4, NO.2, (1968) [Hel711 Held.M and Karp.R,'The traveling salesman problem and minimum spanning tree", Operation Research, vol.19 (1971) [Hun78] Hunt.E, Artificial Intelligence, Academic Press, New York, (1978) jJac74] Jackson.P, Introduction to Artificial Intelligence, Petrocelli Books. Newr York, (1974) [Knu75] Knuth.D and Moore.R,'An analysis of alpha-beta pruing', Artificial Intelligence, vol.6(4), (1975) 293-326 [KowT ] Kowalski.R,'A proof procedure using connection graphQ'. J. Ass. Comput. Makh.. vol.22 (1975) 572-595 LeBn;.2] Lenat.D,'The nature of heuristics', Artificial Intellgence, vol.19, (19S2)

223 [Mai77 Maitolli.A,'On the complexity of admissible search algorithms', Artificial Intellifcenc, vol.8, (1977) [Mes701 Mesarovic,'Systems theoretic approach to formal theory of problem-olving", Theoretical Approach to Nonnumerical Problem Solving, Banerji.R and Mesarovic.M (eds.), Springer-Verlag, Berlin. Heidelberg. New York, (1970) [Mit82al Mitchell.T,'Toward combining empirical and analytical methods for inferring heuristics', Technical report, LCSR-TR-27, Univ. of New Jersey, Rutgers (1982) [Mit82b] Mitchell.T,'Generalization as search", Artificial Intelligence, Vol.18, (1982) 203226 IMic88] Michie.D, Fleming.J, and Oldfield.J, "A comparison of heuristic, interactive, and unaided methods of solving a short-route problem', Machine. Intelligence 3, Michie.D (eds.), Edinburgh University Press, Edinburgh, (1968) 245-255 [New721 Newell.A and Simon.H, Human Problem Solving, Prentice-Hall Inc., Englewood Cliffs, N.J., (1972) (N8ssoN Pric o At l Intign Co, Palo Ato, Ca., N-sson.N, Principles of Artificial Intelligence, Tioga Publ. Co., Palo Alto, Ca., (1980) [Pea83] Pearl.J,'On the discovery and generation of certain heuristics", Al Magazine, vol.4, No.l, WinterSpring, (1983) [Pea84] Pearl.J, Heuristics: intelligent search strategy for computer problem solting, Addison-Wesley, (1984) [Poh7Oal Pohl.l,'First Results on the effects of error in heuristic search', Machine Intelligence, Vol.5, Meltzer.B and Michie.D (eds.), Edinburgh Univ. Press, Edinburgh, (1970) [Poh70b] Pohl.l,'Heuristic search viewed as path-finding in a graph', Artificial Intelligence, Vol.l, (1970) [Poh73] Pohl.l,'The avoidance of (relative) catastrophe. heuristic competence, genuine

324 dynamic weighting and computational issues in heuristic problem-solving, Proc IJCAI, (1973) [Poh77j Pohl.1,'Practical and theoretical consideratio in heuristic earch algorithms', Mschine Intelligence, Vol.8, Ekock.E and Michie.D (eds.), Ellis Howard Ltd., Chi cbestr, England, (1977) [Ren831 Rendell.L,'A new basis for state-space learning systems and a successful implementation', Artificei Intelligence 11, (1983) [Sam591 SamuelA,'Some studies in machine learning using the game of Checker", IBM J. Research and Development, Vol.S, (1959) |Sam671 SamuelA,'Some studies in machine learning using the game of Checker 2: Recent Progress", IBM J. Research and Development, Vol.11, No.6, (1967) 601-617 [San7O] Sandeval.E,'Heuristic search: concepts and methods', Proc NATO Advance Stvy Irut., Menaggio, Italy, (1970) Iste82] Stefik.M and Conway.L,'Towards the principles engineering of knowledge", AI Magazine, Vol.3, No.3, Summer, (1982) [Wat70] Waterman.D, Generalization learning techniques for automating the learning of heuristics', Artificial Intelligence, Vol.1, (1970) 121-170