pattern-matching in search problem solving · pdf filepattern-matching in search problem...

9
Proceedings of the 29th Annual Hawaii International Conferenceon SystemSciences - I996 Pattern-Matching in Search Problem Solving Mladen StanojeviC Sanja VraneS The Mihailo Pupin Institute The Mihailo Pupin Institute Belgrade, Yugoslavia Belgrade, Yugoslavia DuSan VelaSevicZ The Faculty of Elect&al Engineering Belgrade, Yugoslavia Abstract Search problems generally fall into the class of NP-hard problems. Many real problems including planning, diagnosing, allocation tasks, classification tasks and scenario-making, require examination of large search spaces. These problems canno: be solved directly (i.e., without searching) by simply applying the appropriate algorithms. Expert systems are usually applied to solve diyerent search problems. Honever, only a few expert systems with the truth maintenance capability are able to solve them esficiently. A truth maintenance system is used to organize data into data abstractions that represent points in search spaces, and to maintain data consistency, while inference engine is used to examine problem states and to guide search process. Knowing that expert systems spend about 90% of time in each recognize-act cycle performing pattern matching, it is obvious that the pattern-matching algorithm represents one of the most critical component of inference engine. Two most popular pattern-matching algorithms, TREAT and RETE, are applied in almost all expert systems. Although these algorithms are very efJicient in applications which do not require the examination of search spaces, they perform some futile work in search probiem solving. In this paper’ we propose a pattern- matching algorithm, specially tuned for the solution of searc*b problems, which override.; the drawbacks of TREAT and PJTE algorithms, and incrtiases the efficiency of the Overilll system. Introduction Various kinds of constraint satisfaction problems such as allocation, diagnostic and classification tasks, but also problems concerning planning and scenario-making can be solved using different AI techniq res. Constraint satisfaction problems [4] can be solved using one of the constraint- satisfaction techniques, but also using an expert system with the truth maintenance capability. However, planning and scenario-making problems can be solved only using expert systems with the truth maintenance capability. Search problems are characterized by the corresponding sets d states that describe different opportunities. The solution of a constraint satisfaction problem requires finding a point in the search space that satisfies all the inherent constraints, while planning and scenario-making problems require determining a path of state transitions which transforms the initial state into the goal state. Expert system shells are able to solve different kinds of problems, but of them not all are capable of solving search problems. Classical expert systems use their working memories 1.0 represent single problem states. However, expert syste:ms aimed at solving search problems must be able to represent and work on state spaces, therefore their working memories must be modularized. Such working memory contains many problem states at the same time (not only one as in classical expert systems). Truth maintenance systems (TMSs) [7] encompass functions needed for the solution of search problems. They organize data that correspond to different problem states, perform belief revision, contradiction handling, and non- monotonicily handling. Belief revision enables creation of a new problem state, so that some previously believed data become disbelieved, while some previously disbelieved data become believed. Contradiction handling is used to recover the search Iprocess which comes to a dead-end, due to the generation of an inconsistent problem state (i.e., the problem state in which some inherent constraints are violated). Non-monotonicity handling makes it possible to solve problems with the incomplete information, when we have to make guesses in the absence of some data. However, pure truth maintenance systems are not able alone to solve search problems. They must be coupled with the corresponding inference engine (problem solver). Inference engine invokes TMS functions to obtain currently believed data, performs reasoning using these data, and calls again TMS function to write conclusions and signal contradictions. A pattern-matching algorithm represents the essential component of each inference engine. Two most popular pattern-matching algorithms are RBTB [2] and TREAT [5]. However, there are some other pattern-matching algorithms that use neural networks [6], or represent modifications of basic RETB [3] and TREAT [S] algorithms that work on parallel computers. All these pattern-matching algorithms use data that correspond to the single problem state 201 1060-3425796 $5.00 0 1996 IEEE Proceedings of the 1996 Hawaii International Conference on System Sciences (HICSS-29) 1060-3425/96 $10.00 © 1996 IEEE

Upload: phamdan

Post on 06-Feb-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Pattern-Matching in Search Problem Solving · PDF filePattern-Matching in Search Problem Solving ... guide search process. ... the search Iprocess which comes to a dead-end,

Proceedings of the 29th Annual Hawaii International Conference on System Sciences - I996

Pattern-Matching in Search Problem Solving

Mladen StanojeviC Sanja VraneS The Mihailo Pupin Institute The Mihailo Pupin Institute

Belgrade, Yugoslavia Belgrade, Yugoslavia

DuSan VelaSevicZ The Faculty of Elect&al Engineering

Belgrade, Yugoslavia

Abstract

Search problems generally fall into the class of NP-hard problems. Many real problems including planning, diagnosing, allocation tasks, classification tasks and scenario-making, require examination of large search spaces. These problems canno: be solved directly (i.e., without searching) by simply applying the appropriate algorithms. Expert systems are usually applied to solve diyerent search problems. Honever, only a few expert systems with the truth maintenance capability are able to solve them esficiently. A truth maintenance system is used to organize data into data abstractions that represent points in search spaces, and to maintain data consistency, while inference engine is used to examine problem states and to guide search process. Knowing that expert systems spend about 90% of time in each recognize-act cycle performing pattern matching, it is obvious that the pattern-matching algorithm represents one of the most critical component of inference engine. Two most popular pattern-matching algorithms, TREAT and RETE, are applied in almost all expert systems. Although these algorithms are very efJicient in applications which do not require the examination of search spaces, they perform some futile work in search probiem solving. In this paper’ we propose a pattern- matching algorithm, specially tuned for the solution of searc*b problems, which override.; the drawbacks of TREAT and PJTE algorithms, and incrtiases the efficiency of the Overilll system.

Introduction

Various kinds of constraint satisfaction problems such as allocation, diagnostic and classification tasks, but also problems concerning planning and scenario-making can be solved using different AI techniq res. Constraint satisfaction problems [4] can be solved using one of the constraint- satisfaction techniques, but also using an expert system with the truth maintenance capability. However, planning and scenario-making problems can be solved only using expert systems with the truth maintenance capability.

Search problems are characterized by the corresponding sets d states that describe different opportunities. The

solution of a constraint satisfaction problem requires finding a point in the search space that satisfies all the inherent constraints, while planning and scenario-making problems require determining a path of state transitions which transforms the initial state into the goal state.

Expert system shells are able to solve different kinds of problems, but of them not all are capable of solving search problems. Classical expert systems use their working memories 1.0 represent single problem states. However, expert syste:ms aimed at solving search problems must be able to represent and work on state spaces, therefore their working memories must be modularized. Such working memory contains many problem states at the same time (not only one as in classical expert systems).

Truth maintenance systems (TMSs) [7] encompass functions needed for the solution of search problems. They organize data that correspond to different problem states, perform belief revision, contradiction handling, and non- monotonicily handling. Belief revision enables creation of a new problem state, so that some previously believed data become disbelieved, while some previously disbelieved data become believed. Contradiction handling is used to recover the search Iprocess which comes to a dead-end, due to the generation of an inconsistent problem state (i.e., the problem state in which some inherent constraints are violated). Non-monotonicity handling makes it possible to solve problems with the incomplete information, when we have to make guesses in the absence of some data.

However, pure truth maintenance systems are not able alone to solve search problems. They must be coupled with the corresponding inference engine (problem solver). Inference engine invokes TMS functions to obtain currently believed data, performs reasoning using these data, and calls again TMS function to write conclusions and signal contradictions.

A pattern-matching algorithm represents the essential component of each inference engine. Two most popular pattern-matching algorithms are RBTB [2] and TREAT [5]. However, there are some other pattern-matching algorithms that use neural networks [6], or represent modifications of basic RETB [3] and TREAT [S] algorithms that work on parallel computers. All these pattern-matching algorithms use data that correspond to the single problem state

201 1060-3425796 $5.00 0 1996 IEEE

Proceedings of the 1996 Hawaii International Conference on System Sciences (HICSS-29) 1060-3425/96 $10.00 © 1996 IEEE

Page 2: Pattern-Matching in Search Problem Solving · PDF filePattern-Matching in Search Problem Solving ... guide search process. ... the search Iprocess which comes to a dead-end,

Proceedings of the 29th Annual Hawaii International Conference on System Sciences - 1996

represented in the working memory. They must detect each change in the working memory and modify accordingly the corresponding conflict set of rules whose premises are currently satisfied.

solution requires examination of the search spaces, fall into this category.

These algorithms (with necessary modifications) can be used to solve search problems too. However, in search problems a pattern-matching algorithm need not detect each change of the currently considered problem state. A new problem state is created starting from the ascendant problem state by changing the belief states d data that define the ascendant problem state. This change cannot be performed in a single step, but in as many steps as needed to disbelieve some previously believed data, and to believe some previously disbelieved data. The pattern-matching algorithm should be invoked when all these changes are performed, otherwise it will pe&rm some futile work.

In this paper we propose EIS - Enhanced Indexing Scheme, as a pattern-matching algorithm (for a sequential computer) suited for search problem solving, implemented within BEST [S, lo]. It performs &Y pattern-matching and thus overrides drawbacks of RBTB and TREAT algorithms when applied in the solution of search probbems. EIS is invoked when a problem state is completely created, therefore it avoids futile pattern-matching. Basic indexing scheme is enhanced with the ability to control the invocation of the pattern-matching algorithm. RETE and TREAT lack this ability, therefore they perform some futile work.

Constraint satisfaction problems (CSPs) [4], comprising the first class, are those in which one has a set of variables each to be instantiated in an associated domain, and a set of constraints limiting the set of allowed values for specified subsets of variables. The solution of a CSP requires finding a point (or points) in a discrete hyperspace that satisfies all the constraints. The search process begins by assigning a value to the first variable. If any of the constraints is violated, a new value is assigned, otherwise the second variable is chosen and initialized. Now, the values of the two variables are checked against the set of constraints, and if any of the constraints is violated, we try to find a new pair of values that satisfies all the constraints. When such a pair is found, the process continues by assigning a value to the third variable and eventually terminates when all variables have values that do not violate any of the constraints. If such a point in a state space doesn’t exist, the corresponding CSP doesn’t have a solution. Various kinds of allocation, classification, and diagnostic problems (e.g., allocation of tasks on a distributed or multiprocessor platform) are all representatives of CSPs.

BEST (Blackboard-based Expert Systems Toolkit) is aimed at providing the ability to produce large-scale evolvable, heterogeneous intelligent systems. It incorporates the best of multiple programming paradigms in order to avoid restricting users to a single way of expressing either knowledge or data. It combines rule-based ptogramming, object-oriented progr=-nn&, logic programming, procedural programming and blackboard modeling in a single architecture for knowledge engineering, so that the user can tailor a style of programming to his application, using any or arbitrary combinations of methods to provide a complete solution. The deep integration of all these techniques yields a toolkit more effective even for a specific single application than any technique in isolation or collections of multiple techniques less fully integrated. Within the basic, knowledge-based prograrnmin,g paradigm, BEST offers a multiparadigm language (Prolog/Rex [9]) for representing complex knowledge, including incomplete and uncertain knowledge.

Search problems

The second class contains scenario and plan making problems (e.g., route finding problem), whose solution requires the search for a sequence of state transitions from the initial to the final point (which does not represent a solution of the search problem like in CSPs, but only a goal problem state) in the search space. Notice that a solution for a problem from the second class doesn’t contain the appropriate values for all state variables as in CSPs, but a path of state transitions. In the beginning, the initial and final problem states, defined by the sets of initial and final values of state variables, are known. Our task is to find a sequence of state transitions (by applying rules that describe and perform all permitted state transitions from one problem state to another one) from the initial to the final point (points) in the search space. This path must not contain inconsistent problem states (those that violate any of the constraints). During the CSP solution, the number of state variables changes incrementally until all state variables have the appropriate values, whereas the solution of a problem from the second class requires all the time the full number of state variables whose values are changing by applying the transition rules. A single step in the CSP solution is performed by assigning a value to a state variable, whereas in solving the problems from the second class, a single step is performed by executing a rule that will change the current problem state into another problem state.

There are many problems for which an algorithmic solution doesn’t exist. Two broad classes of probl.ems, whose

While a solution of the CSP is determined by a point in the state space, a solution of the problem from the second class is determined by a path that leads from the initial to the final point in the search space. Therefore we must use one approach to find a solution of the CSP and another

202

Proceedings of the 1996 Hawaii International Conference on System Sciences (HICSS-29) 1060-3425/96 $10.00 © 1996 IEEE

Page 3: Pattern-Matching in Search Problem Solving · PDF filePattern-Matching in Search Problem Solving ... guide search process. ... the search Iprocess which comes to a dead-end,

Proceedings of the 29th Annual Hawaii International Conference on System Sciences - 1996

approach to find a solution of the problem from the second class.

3. Pattern-matching

To illustrate the work of different pattern-matching algorithms we will use the well known farmer’s dilemma example, which represents a simple planning problem. A farmer is on his way home from market. He has purchased a fox, a goat, and a cabbage. In order to get home, the farmer must cross the river. The only available boat is so small that the farmer can take only one possession with him each time he crosses the river. The farmer’s plans are complicated by the fact that some of his purchases cannot be left alone together. The fox will kill the goat if left alone with it. The goat will eat the cabbage if left alone with it.

Solution of the farmer’s dilemma requires finding a sequence (of state transitions) from the initial to the final state. One state is described by the positions of the farmer, fox, goat and cabbage. In the initial state, all of them are on the first shore, while in the final state they are all on the opposite shore. State transitions occur when the farmer takes some of his possessions from one shore to the other, or when he goes alone from the second shore. The farmer never goes alone from the first shore, because he doesn’t find paddling itself a pleasure.

To solve the farmer’s dilemma we must represent the problem states somehow. In Fig. 1 we propose a context model [9] that can be used to solve the farmer‘s dilemma, but also other constraint-satisfaction and search problems. We distinguish two context levels. The first level is meta - a level which contains only one context that exists during the nm time of the expert system, and also common facts visible from all second-level contexts. The second context level is the user defined level that may contain many contexts. Every context represents one state of a given problem. Contexts on the user’s level are created during the examination of the state space, where each context represents one problem state. When a new context is created, it inherits initially all facts from the ancestor context. Using context modification functions, some of these facts will be retracted, while some others will be asserted to represent properly the new problem state.

defforw:move alone; (farmer, on,-shore-2);

=> hypothesize:

(farmer, goes, back, alone); retract:

(farmer, on, shore-2); assert:

(farmer, on, shore-l);

To solve a search problem using BEST, a user should describe how this problem can be solved, and define the initial problem state. Prolog/Rex [9], BEST’s knowledge representation language, is used to define forward-chaining rules (describing all possible state transitions), and to define the initial problem state. Creation and examination of the state space (decision tree) is performed automatically by BEST’s truth maintenance system and inference engine. We till define forwarcl-chaining rules using Prolog/Rex, to describe possible state transitions. The move-done rule

The move-together rule performs a state transition in which the farmer takes one of his possessions to the opposite shore. A hypothesis is generated when this rule fires, describing such a transition. In a new context it removes the old farmer’s and possession’s positions, and then writes the new ones. In the initial state it can be matched with three facts representing the initial positions of the farmer’s possessions.

defforw:move_together; (farmer, on, ?shore); (position, ?not farmer, ?shore); (opposite-of, ?shore, ?shorel);

=> hypothesize:

203

describes a state transition when the farmer goes back alone. He is on shore-2 in one context, and on shore I in the new context. The positions of farmer’s possesSions remained unchanged. This rule generates a hypothesis about the performed state transition using the hypothesize action. This action creates a new context first, and then writes the corresponding hypothesis into it. The retract and assert actions are used to change the current context, hence it reflects the new problem state after the state transition is pXfOl-IIld.

mefa level meta

level used user6 Inhfuitanw

- links visibilii

-----. links

Fig. 1. Context model

Proceedings of the 1996 Hawaii International Conference on System Sciences (HICSS-29) 1060-3425/96 $10.00 © 1996 IEEE

Page 4: Pattern-Matching in Search Problem Solving · PDF filePattern-Matching in Search Problem Solving ... guide search process. ... the search Iprocess which comes to a dead-end,

Proceedings of the 29th Annual Hawaii International Conference on System Sciences - 1996

(farmer, takes, ?not-farmer, true, therefore they are asserted into the context on the meta to, ?shorel); level. Other facts define the initial problem state of the

retract: farmer’s dilemma, hence they are asserted into the root (farmer, on, ?shore), contextf-dl on the user's level. (position, _ ?not farmer, ?shore); After 96 rule firings, the context tree (Fig. 2) contains

assert: 44 contexts, while 27 were poisoned. There are four leafs, (position, ?not farmer, ?shorel), (farmer, on, ?shorel);

but only two of them contain the solutions. The other two contain consistent states and that is the reason why they were not poisoned.

The constraint rule goat-makes-trouble prevents further evaluation of undesired situations. The state where the goat is left alone with fox or cabbage, while the farmer is on the opposite shore, obviously isn’t on the path leading to a solution.

defconstr:goat-makes-trouble; (position, goat, ?shore); (position, _ ?not farmer & (fox; cabbage), ?shore); not:(farmer, on, ?shore);

The constraint rule circularqath will fire if the same state repeats, and thus stop the creation of an infinite loop. For instance, when initially the farmer takes the goat to shore-2, and then immediately takes it to shore-l, an infinite loop would be created if the circujaryath rule was not defined. The repeated precondition checks if on the path from the root context to the current context there is a context that contains the same facts as those matched with patterns in repeated precondition within the current context.

defconstr:circular-path; repeated: (farmer, on, ?shore), (position, fox, ?fshore), (position, goat, ?gshore), (position, cabbage, ?cshore);

The initial problem state is described by facts:

t-d1

pqT7-I

f-d2 t. g -> 2

c,x-1 f, B - 2

I 1

t -> 1 f-d4 r-i f, c, x - 1

cl-2 1 I

1, x, 3 2 1, c 3 2

f-d5 f, ;, ;1. 2 f 0” ;! 2 f-d24 * I

1, !J -> 1 1, g -> 1

, d6 f, cl. c - 1 x-2

‘* !$’ “; ’ t-d25

1, c -> 2 f, x -> 2 r f ,g ; ‘. 2 f-d26 * I

f-d16 t-d35

Fig. 2. Farmer’s dilemma context tree

deffacts: RETE algorithm

meta level: (opposite-of, shore-l, shore-2), (opposite-of, shore-2, shore-l);

user level; (position, goat, shore,-I), (position, fox, shore l), (position, cabbage, share-l), (farmer, on, shore 1); -

Pacts (opposite-of, shore-l, shore-2) and (opposite-of, shore-.2,. shore-l) are always

The basic idea of the RETE algorithm [3] is to minimize the effort during the pattern-matching phase, i.e., to record all partial matchings. In the case when working-memory contains only one problem state that changes in time, these partial matchings are used to improve efficiency of the pattern-matching process. When a new fact is added only the minimum number of matchings must be performed. However, in search problems, these partial matches are not needed at all, because when a new context is once created, it is never changed later. Partial matchings consume more memory, but also spend more time than it is necessary in the search problem solving.

204

Proceedings of the 1996 Hawaii International Conference on System Sciences (HICSS-29) 1060-3425/96 $10.00 © 1996 IEEE

Page 5: Pattern-Matching in Search Problem Solving · PDF filePattern-Matching in Search Problem Solving ... guide search process. ... the search Iprocess which comes to a dead-end,

Proceedings of the 29th Annual Hawaii International Conference on System Sciences - 1996

Like in ART [l], that uses the RETE algorithm to allow the solution of search problems, we will attach an extension to each fact to denote in which contexts this fact is valid. Each extension has two parts: a context where the fact is asserted, and a list of contextsdescendants where this fact is retracted.

When the f d25 context (Fig. 2) is created, three rule instances are inserted into agenda, two move-together instances (the farmer takes the fox to shore-2, and the farmer takes the goat to shore-2), and one move-alone instance. First, the move together rule, when the farmer takes the fox to shore-2, &l be fired. In Fig. 3 we can see the premise of the move-together rule compiled into the RETE network, before the move-together rule is fired. We can notice two join nodes that match partial matchings coming from the corresponding left memory with facts coming from the corresponding right memory. The figure is not complete, because we presented only the contents of left and right memories of the first join node.

Fig. 3. RETE network for the move-together rule

When the action part of the move-together rule is executed, first a new context (j”_d26) is created, and the hypothesis (farmer, takes, fox8 to, shore-21 is written into it. Then the fact (farmer, on, s bore-1 ) should be retracted fromf_d26. To retract this fact fromf_d26, all fact instances in the lefi memory of the

first join node must be examined to find the one whose extension is valid in the new context. The validation of extension concerns the check if on the path from the context where the fact is asserted to f_d26, there is no context from the list of contexts where the fact is retracted. When this fact instance is found its extension must be modified so that it becomes invalid in f d26. The same procedure must be repeated in the next join node, and then agenda must be checked for rule instances whose preconditions are no longer satisfied (though this can never happen). The retraction of the fact (position, fox, shore-l) fromf-d26 requires similar effort.

The assertion of the fact (position, fox, s bore-2 1 into f-d26 requires the validation of all extensions fo.r each fact instance in the right memory of the first join node, and then the creation of a new fact instance with the corresponding extension. Then the intersections of the new extension, and the extensions of all fact instances from the left memory, must be made to check whether there are some partial matchings or not. In our example no partial matches can be made, therefore the assertion is now completed.

The assertionofthefact (farmer, on, shore-21 requires a similar effort, except that now we can make two non-empty intersections (cabbage and fox are on shore-2 in

f_d26). Two lpartial matchings will be forwarded to the next join node, w:here they will be combined with the premise (opposite-of, shore-2, shore-l),thus making

the complete matchings. As a consequence, two new move-together rule instances, corresponding to these complete matchings, will be inserted into the agenda.

TREAT algorithm

The TREAT pattern-matching algorithm [5] doesn’t record partial matches as RETEl does. However, it also performs some futile work. It is unnecessarily invoked for each assertion and retraction before the definition of a new problem state is completed.

When the same move-together rule is tired in the context f-d25, a new context f-d26 will be created and the corresponding hypothesis that describes the performed state transition, asserted into it. In Fig. 4. we can see the activity of TREAT dluring the retraction of the fact ( farmer , on, shore-l ) . According to the current problem state, the precondition part of the rule goat-makes-trouble is now satisfied, because the fox and the goat are on the same shore (shore-l), while the farmer is not (he currently disappears; he is neither on shore-l, nor on shore-2). Therefore, the corresponding goat-makes-trouble instance will be inserted into the agenda.

205

Proceedings of the 1996 Hawaii International Conference on System Sciences (HICSS-29) 1060-3425/96 $10.00 © 1996 IEEE

Page 6: Pattern-Matching in Search Problem Solving · PDF filePattern-Matching in Search Problem Solving ... guide search process. ... the search Iprocess which comes to a dead-end,

Proceedings of the 29th Annual Hawaii International Conference on System Sciences - 1996

I I

Fig. 4. Activity of TREAT during the first retraction

However, the next fact to be retracted is (posit ion, fox, shore-l ) . In Fig. 5 we can see the activity of TREAT during the retraction of this fact. The precondition part of the goat-makes-trouble rule is no longer satisfied, because after the farmer, the fox also mysteriously disappeared. The rule instance that has just been inserted into agenda now has to be removed from it.

EIS algorithm

The main reason why PETE and TREAT require some futile effort lies in the fact that they perform pattem- matching for each change made in the current context (working-memory). For each working-memory modification a pattern-matching algorithm is called. EIS does not perform any futile work because it performs pattem- matching only when the definition of the current problem state is completed. For this purpose, Prolog/Rex offers two new working-memory modification fiuxtions, add and remove, which have the same functionality as assert and retract, except that they do not invoke the pattern-matching algorithm. EIS is invoked on the as needed basis. A user is responsible for the correct use of working-memory modification functions, i.e., when to perform pattem-

matching. If only retract and assert functions are used, then EIS is reduced to basic indexing scheme similar to TREAT.

The input to EIS is represented by a fact retracted from or inserted into the current context. Using indexes EIS finds all affected forward-chaining rules, checks their premises, and, as a result, gives a list of rules whose premises become satisfied, and a list of rules whose premises are no longer satisfied. Pattern-matching is automatically performed, and invisible to user.

-----L--------------------------------------- Add padrian

Fig. 5. Activity of TREAT during the second retraction

The move-together rule is slightly modified to use the advantages of EIS:

defforw:move-together; (farmer, on, ?shore); (opposite-of, ?shore, ?shorel); @ : !; (position, _ ?not farmer, ?shore);

=> hypothesize:

(farmer, takes, ?not-farmer, to, ?shorel);

remove: (farmer, on, ?shore), (position, _ ?not farmer, ?shore) ;

add: (position, _ ?not farmer, ?shorel);

assert: (farmer, on, ?shorel);

206

Proceedings of the 1996 Hawaii International Conference on System Sciences (HICSS-29) 1060-3425/96 $10.00 © 1996 IEEE

Page 7: Pattern-Matching in Search Problem Solving · PDF filePattern-Matching in Search Problem Solving ... guide search process. ... the search Iprocess which comes to a dead-end,

Proceedings of the 29th Annual Hawaii International Conference on System Sciences - 1996

The premise of the rule will be compiled into Prolog, where the get-fact predicate perhorms pattern-matching:

move-together([Shore,Shorel,Not_farmer) .- .

getfact(farmer,on,[Shore]), getfact(opposite-of,Shore,[Shorel]), 1 gLtfact(position,Not_Farmer,[Shore]),

When the move-together rule is fired in f d25, then a new context, f_d26, will be created. The creation of a new context in BEST requires copying of all facts from the ancestor context. After that, the hypothesis ( farmer , takes, fox, to, s bore--2 ) , is inserted into f_d26. Then facts (farmer, on, shore-l), and (position, fox, shore 1) are retracted from

f-d26, andfact (position, fox, shore-2) inserted into it. EIS will be called after the fact ( farmer, on shore-2) is asserted, i.e., the new problem state is completed. This fact acts as a control fact. When it is asserted, the definition of the problem state is completed. Using indexes, EIS is able to find the rules whose premises might be satisfied now. It checks premise by premise in a fail-driven loop, and finds all complete matchings. The inherent Prolog backtracking mechanism is used to examine all possible matchings, where partial matchings are saved on the internal Prolog stack, and discarded when not needed. The rule instances, that correspond to complete matchings, are inserted into agenda, and no futile work is done.

EIS does not save partial matchings that will never be used again, it does not look up in the agenda for rule instances that can never be there, nor tries to satisfy rule premises (when we know that they cannot be satisfied, because the problem state is not completed), nor inserts rule instances into the agenda, that will be immediately removed from it. EIS always minimizes the effort. When the problem state is completed, it checks the premises of all the rules that might be satisfied only once.

We have performed some measurements on a 50 MHz PC 486 DX with 8MB RAM to compare the performances of basic indexing scheme and EIS using the farmer’s dilemma example. It took 2.14 seconds to find both solutions when basic indexing scheme is used, and 1.48 seconds when EIS is used. When EIS is used, the efficiency of the overall system is increased for about 30%. For complex application, where more rule premises are examined for each modification of the currently considered problem state, we expect even better results.

Example

We have implemented an expert system for the off-line task allocation in a distributed or multiprocessor computer system. This expert system consists of 14 knowledge sources and 126 rules (14 Domain Knowledge Source Activation Rules, 83 forward-chaining rules, 33 backward- chaining rules and 6 constraint rules).

Each processing node is represented by the following characteristics:

l node id; l CPU speed; l local working memory size; 0 specific peripheral devices attached to the node; l speed of the communication line to other nodes; * utilization margin.

Tasks are described using:

* task id; l task static priority; l task importance; 0 task criticality; l task reliability; l task efficiency; l number of task instances; l dislocation demands; l task successors; 0 task predecessors; * possible allocation targets; 0 local memory request; l CPU speed request; * global memory requests; l resource requirements (local and global memory

requirements, UO ports, numeric coprocessor, otlher peripherals);

l cluster name; l number of operations; l communication requests; l task time limit.

In the allocation process we can use up to 13 different heuristics that concern:

l critical path, l labeling; l c0mmunication requests; 0 number of successors; l successors’ execution time; . tasks’ execution time; 0 local memory requests; 0 global memory requests; l clustering;

207

Proceedings of the 1996 Hawaii International Conference on System Sciences (HICSS-29) 1060-3425/96 $10.00 © 1996 IEEE

Page 8: Pattern-Matching in Search Problem Solving · PDF filePattern-Matching in Search Problem Solving ... guide search process. ... the search Iprocess which comes to a dead-end,

Proceedings of the 29th Annual Hawaii Interna ltional Conference on System Sciences - 1996

0 overall priorities; 0 execution time ratio of two successively

collocated tasks; l node demands; e explicit preference.

We can define up to five constraints:

l t ime limit for the execution of all tasks; l task time limit; 0 processor utilization limit; l mutual exclusiveness among tasks; @ load balancing.

the current context is then checked against the constraints,

The functions from the pattern-matching subsystem are called to determine a candidate task for the allocation

and if they are not violated, a new atomic allocation can be

(according to the specified heuristics) and the most appropriate processor node. For each atomic allocation (task

determined by the inference engine. However, if any of the

- processor node) that the inference engine makes, a new context must be created, and the corresponding belief

constraints is violated, then contradiction handling will be

revision must be done (task’s allocation status, node’s

invoked. The inconsistent problem state will be detected and

utilization, idle time, etc.). The problem state represented by

then removed from the context tree using, one of the constraint rules. The unproductive branch will be cut, and the allocation process will be continued by examining some other branch of the context tree. A solution is found whenever we reach a consistent context that contains the complete allocation.

Some measurements have been performed on a 50 MHz PC 486 DX with 8MB RAM. Our aim problem was to allocate 14 tasks to 3 processing nodes (Fig. 6). The solution space is really large and contains 14! *3 l4 W 4.2*1017 possible complete allocations. BEST found the first solution after 43 seconds. For these 43 seconds, 30 contexts were examined and 752 rules were fired. The overall tasks execution time was 14.1 seconds. The solution

Conclusions

Though all expert systems perform some kind of symbolic processing, not all of them are capable of solving

-

search problems. For these purposes a truth maintenance

of a new problem state.

system is needed, but also a specially tuned pattem- matching algorithm. In this paper we have presented some drawbacks of the two most popular pattern-matching algorithms TREAT and RETE, and proposed EIS-Enhanced Indexing Scheme which overrides these drawbacks. The enhancement of basic indexing scheme is reflected in the ability to control the invocation of the pattern-matching algorithm. The responsibility for the correct invocation is transferred to user. If correctly invoked, EIS increases the efficiency of the overall system for about 30% (compared to basic indexing scheme). When used for search problem solving, TREAT and RETE perform some futile work,

~:~::~

because they perform pattern-matching before the definition of a new problem state is completed, while EIS performs pattern-matching only after the creation of a new state. Thus EIS avoids futile pattern-matching, that will otherwise be performed in the intermediate stage during the creation

Fig. 6. Tasks graph

References .--

found after 1335 seconds is slightly better thau the first solution. The overall tasks execution time is now 11.69 seconds. This solution was found after 1117 contexts had been created, 411 of them had been removed, and 22 158 rules had been fired.

Having in mind the size of the solution space, 43 seconds represent an acceptable time needed tab find the first solution. Notice that the solution found after 22 minutes provides only a moderate improvement (the overall tasks execution time is 17% shorter).

1. ART - Automated Reasoning Tool User’s Manual, version 3.0, Inference Corporation, Los Angeles, CA, 1987.

2. CL. Forgy, “FETE - A Fast Algorithm for the Many Pattern / Many Object Pattern Match Problem”, Artificial Intelligence, Vol. 12, 1980, pp. 17-37.

3. A. Gupta, C.L. Forgy, A. Newell, and R Wedig, “Parallel algorithms and Architectures for Rule-Based Systems”, in Proc. Int. Symp. Comput. Architecture, 1986, pp. 28-37.

4. V. Kumar, “Algorithms for Gmtraint-Satisfaction Problems: A Smvay”, AI Magazine, Vol. 13, No. 1, 1992, pp. 32-44.

208

Proceedings of the 1996 Hawaii International Conference on System Sciences (HICSS-29) 1060-3425/96 $10.00 © 1996 IEEE

Page 9: Pattern-Matching in Search Problem Solving · PDF filePattern-Matching in Search Problem Solving ... guide search process. ... the search Iprocess which comes to a dead-end,

Proceedings of the 29th Annual Hawaii International Conferen:ce on System Sciences - 1996

5. D.P. Miranker, TMT: A New and Efficient Match Algorithm for AI Production Systems, London:Pitman Publishing Ltd., 1990.

6. M.A. &tori, KM. Passino, and P.J. Antsaklis, “A Multilayer Perceptron Solution to the Match Phase Problem in Rule-Based Artificial Intelligence Systems”, IEEE Transactions on Knowledge and Data Engineering, Vol. 4, No. 3, 1.992, pp. 290-297.

7. M. Stanojevic, S. VraneH, and D. Velagevic, “Using the Truth Maintenance Systems: A Tutorial”, IEEE Expert, Vol. 9, No. 6, 1994, pp. 46-56.

8. S. VraneS et al., “A Blackboard Framework on Top of Prolog”, Expert Systems with Applications, Vol. 7, No. 1, 1994, :pp. 109-130.

9. S. VraneS, M. StanojeviC, “Prolog/Rex - A Way to Extend Prolog for Better Knowledge Representation”, IEEE Transactions on Knowledge and Data Engineering, Vol. 6, NO. 1, 1994, pp. 22-37.

10. S. VraneS, M. Stanojevic, “Integrating Multiple Paradigms within the Blackboard Framework”, IEEE Transactions on Software Engineering, Vol. 21, No. 3, 1995, pp. 244-262.

209

Proceedings of the 1996 Hawaii International Conference on System Sciences (HICSS-29) 1060-3425/96 $10.00 © 1996 IEEE