Q 1991 CWComp
METAKNOWLEDGE
0045.7949/92 53.00 •t 0.00 Ltd and Pergaman Press plc
REASONING IN CIVIL ENGINEERING EXPERT SYSTEMS A. OKI and D. LLOYDSMITH
Department of Civil Engineering, Imperial College, London SW7 2BU, U.K. Ahatract-The ability of a Civil Engineering Expert System to utilize in an intelligent manner the knowledge it possesses is 5 feature still sadly lacking in most present-day working systems. A system designed for a civil engineering application tends to attract an extensive knowledge base; the size of the base therefore demands selective use of its contents for efficient decision making. This paper presents a simple, yet potentially powerful, method of enabling metaknowledge reasoning within a logic/procedural programming environment for civil engineering expert system applications, with minimum repair work to existing data structures. Examples of the use of the approach are presented using some preliminary design knowledge. Limitations and possible future extensions to this approach are also discussed.
out earher, knowledge bases in civil ~~n~~ng applica~ons tend to be very large. There is, therefore, a need to give priority (focussing) to relevant parts of the knowledge base, in this case through the use of metarules. In addition to establishing this priority, such metarules can also enable lines of reasoning to be constructed. Metarules can also be used to reorder rules and facts in the knowledge base so that those with a higher assessment of relevance are treated first by the inference mechanism. Finally, during the inference stage itself, metarules can provide further focussing; or they may enable the construction of additional metarules which are generated d~amitally; that is, in response to specific circumstan~s in the inference. The process represented in Fig. 1 has three stages. In this report, attention is concentrated upon the matters of stage 1, focussing on relevant parts of the knowledge base and choice of lines of reasoning. Some discussion of the concepts involved in stages 2 and 3 is undertaken in reference to future extensions. The basic idea of the method can be set out as follows. Under some certain situations occurring in the problem-solving process associated with an expert system, certain rules may prove to be either useful or useless to the process. Therefore, one could invoke metarules which can activate or deactivate such rules in these situations. As a result, the size of the knowledge base would be temporarily reduced and the saturation effect consequently diminished. In this technique, metarules would operate on rules by content reference [4], i.e. they would refer directly to the contents of the rule. An obvious example is taken from the domain of preliminary roof shell selection. Suppose the user of an expert system in this domain has made the decision that a particular roof shell should be constructed using timber rather than any other mate~ai. In this sit~tion, all rules that refer to reinforced concrete, prestressed concrete, and any other material
Any serious implementation of a knowledge-based expert system in a civil engineering domain would probably possess hundreds of rules. A programming environment which is not well designed would tend to select many irrelevant rules in searching for solutions to any specific problem addressed to the system. Davis [l] refers to the preponderance of such rules in the solution process as saturation. Even a well designed environment like XLOG[2] could still experience the saturation effect, in spite ofits containing a m~hanism for defining the search criteria. However, if the system were to possess knowledge about its knowledge base (me~knowIedge) and could reason using this knowledge, the saturation effect could be significantly reduced. Metaknowledge reasoning, also known as metarule reasoning, is not a new method in artificial intelligence. In spite of this, there are very few implementations which permit extensive experimentation with its use. This situation is even more acute in civil engineering programming environments. This paper presents a simple, yet potentially powerful, technique For coupling metaknowledge reasoning with existing pro~amming environment. The method is essentially based on Davis’ ideas but they are used in a simpler fashion. Such as approach can be used for selecting amongst individual rules, as well as for enabling the choice of lines of reasoning [3]. Simple uses of this technique within a civil engineering expert system are illustrated. A METHOD
TO ENABLE METAKNOWLEDGE REASONING
A probably complete metaknowledge reasoning process in a civil engineering system is represented in Fig. 1. The knowledge base, which consists of rub and facts, could be organized into ‘knowledge areas’ and structured according to some criteria. As pointed 7
A. OKI and D. LLOYDSMITH
8
INFERENCE
METARULES STAGE 1
Fig.
1.
MRARULES
DYNAMIC METARULES
STAGE 2
STAGE 3
u
Metaknowledge reasoning process.
than timber are not relevant to the solution of the problem. By deactivating these rules, the user would purposefully and substantially prune the search tree. Therefore, in a logic/procedural programming environment, a metarule could be written as: metarule(1) if material(timber) and jindset(reinforced-concrete prestressed-concrete:
OH)
where jndset( ) is a built-in predicate that, in this case, makes ‘invisible’ or deactivates rules containing any of the terms in the list of arguments. The invoking of metarule(1) enables the deactivation of these irrelevant rules. Details of how this method could be implemented in a logic/procedural programming environment are presented in the next section. More examples on the use of such a mechanism are also presented there. COUPLING
I
WITH EXISTING PROGRAMMING ENVIRONMENTS
Although the programming environment employed for this work is XLOG, the technique could be ported to any programming environment (from programming languages like C, LISP and PROLOG to hybrid AI toolkits like ART and KEE). It is our belief, at the moment, that environments which are closely aligned to mathematical logic provide a good foundation for civil engineering applications, especially for metaknowledge reasoning, as these environments are essentially rule-based. PROLOG could have been used; however, metalevel extensions of PROLOG tend to be cumbersome, slow and memory consuming. Furthermore, it cannot cope with classical negation which could be useful in consistency tests. XLOG is a logic/ procedural programming environment which is flexible enough to overcome the above shortcomings of PROLOG and to take advantage of the approach proposed here. As it is desirable to organize the knowledge base into areas, a simple mechanism for area demarcation is required. A mechanism is suggested whereby every rule and fact is labelled. For example, a rule in the
above mentioned written as:
domain of application
could be
recommended shell(hypar) if structurepurpose(socia1); L@reliminary function rule) P(high)
That is, the roof shell recommended by this rule could, with high credibility, be a hyperbolic paraboloid shell if the structure were intended for social use. The arguments of the label L( ) identify this rule as one of a set of rules associated with preliminary design of roofs using function as a criterion, thus providing a simple means for demarcation. One advantage is that the label can be used to give a supplementary description which may aid the user in identifying and comprehending the rule. Additionally, such labels can offer a possibly more intelligible sequence of explanations during problemsolving sessions. Metarules may also employ labels as a mode of reference (see below). In XLOG, the parameters L and P impose no overhead on the logical inference mechanism since they are merely properties of the rules. A built-in predicate, or extra-logical predicate in the sense of Sterling and Shapiro [5], called findset( ), an acronym for find... and set . . . . would be used by metarules. The function of this predicate would be: (i) to search for rules with the specified label specified predicates and terms with location specified as one of the following: -head (left hand side of the if connective) -tail (right hand side of the if connective) -any; (ii) to switch these rules to the specified statuson or off. As far as the location of the predicates and terms is concerned, findset( ) is restricted to rules of the following form: L,ifL,andL,and . . . . . andL,; (rule properties)
Metaknowledge reasoning in civil engineering expert systems where Li is a positive or negative literal. A full syntax offina!set( ) could be written findset(L~label’)(predicates and (location)(status>).
9
programs. For example, a dummy knowledge base might comprise the following facts, rules and metarule:
terms >:
This method imposes little repair work on existing data structures since each rule only requires a mechanism for indicating whether it is active or not. Also, the inference mechanism would need to be amended so that deactivated rules are not used as candidates for the problem-solving strategy. The saturation effect could then be reduced by writing appropriate metarules usingJindset( ) and invoking them when appropriate. Examples of metarules that could be added to the knowledge base of the above domain are metarule(2) ifdon ‘tknow material(timber) and findset(L@relim function rule) timber: tail off) metarule(3) ifstructurepurpose(socia1) and $ndset(L@relim function rule) industrial: any off) where don’t-know represents negation-as-failure in XLOG. Negation-as-failure is represented in PROLOG by not; in XLOG, not is reserved for classical negation. These metarules are self-explanatory. Their effects are achieved by invoking metarule(x), which in XLOG is done by ask(metarule(x)). These examples are essentially metarules for refining the invocation of object-level rules. Choosing lines of reasoning could be achieved in a manner suggested by the following example. Suppose, in the same domain of application, there are rules for the selection of a type of construction material using function and construction as criteria. The user of the system may wish that rules using function as a criterion should not affect the system’s line of reasoning. This could be achieved by having the following in the knowledge base: shouldn’t determineflinction material) metarule(4) if shouldn ‘t determine(x y) and jindset(L@relim x rule) y : any o&r,). The invoking of metarule(4) ensures that rules labelled as being related to function as a criterion, and which contain material as a term or predicate, are deactivated and are consequently irrelevant to the problem-solving process. Metarules for most domains of application can be designed in a fashion similar to those given in the above examples. The findset( ) procedure should be able to preserve the non-monotonic nature of knowledge bases and also allow restricted forms of non-Horn logic
A(a) E(a) C(x) tfdon’t-know E(x) G(x) ifnot E(b) metarule(5) if. . . . andfindset
(E: Any o&I.
The findset( ) procedure should be so constructed that the invocation of metarule(5) would only cause the fact E(a) to be deactivated since the two rules which immediately follow this fact may be useful in the problem-solving process. Also, a mechanism for detecting predicates and terms with the same name is advisable so as to warn of the possibility of unwanted effects. Furthermore, metarules should only affect each other in restricted cases. Possible extensions to this technique are discussed in the next section. FUTURE EXTENSIONS
As already pointed out, the labels attached to the rules offer the opportunity for generating more intelligent explanations using metaknowledge. This is a very attractive feature which needs to be explored extensively. Presently, very few programming environments offer easily comprehensible explanations. Most environments merely indicate rules and facts used in the problem-solving process. An extension of the technique is the utilization of metarules to reorder a set of rules so that some are accorded priority over others (Fig. 1, stage 2). This is comparable with the need for the reordering of rules in an analogical reasoning process to establish priority for those rules which have been employed by the system in previous problem-solving episodes [6]. One method by which reordering might be achieved is through the use of a built-in predicate, as suggested in the following example: metarule(6) if. . . . andjndset(. and reorder(. . . . )
. . .)
The ease of implementation of this extension would depend substantially upon the manner in which rules are indexed in the programming environment. Another important way in which the present work may be extended is through the development of some sort of truth maintenance. Initially irrelevant rules may prove to be useful, or vice versa, as the problem-solving process proceeds. This situation usually arises when facts are continuously added to, or deleted from, the knowledge base during an interactive problem-solving session. Such situations can be handled by the use of ‘dynamic’ metarules (see Fig 1, stage 3). Doyle [7J and De Kleer [8], among others, have been particularly active in connection with truth
10
A. OKI and D.
LLOYD SMITH
maintenance systems; their efforts might well provide inspiration for the further development of this extension. Also as Davis [9] points out, dynamic metarules may be constructed through the utilization of information obtained from the failure of a problem-solving strategy. Although classical negation is seldom used in practical logic programming environments because of occasional theoretical difficulties, it has some potential for application in metaknowledge reasoning, particularly in regard to consistency testing. For example, suppose the knowledge base contains the rule
However, there is little reason to doubt that it could be implemented in other environments. Some possible extensions to the method have been suggested. Certainly, metaknowledge reasoning has not yet acquired a consistent theoretical structure. Such a development would at least establish the theoretical limitations of the method. On the other hand, there still remains the urgent need to mould relevant AI research to suit the specific and often practical requirements of civil engineering decision making. The method presented herein is being tested, in synergy with analogical reasoning, on the domain of preliminary structural roof design.
structure cost(cheap) if structure purpose(domestic) and....
Acknowledgements-During the progress of the work de-
and also the fact not structure cost(cheap).
A test of consistency should verify that the fact contradicts the rule. Consequently, the rule could be deactivated by a metarule which incoporates such a test.
scribed herein, one of the authors (A.O.) has been fortunate to hold a Peter Dunican Scholarship, instituted by the Directors of the Ove Arup Partnership to honour a distinguished colleague. Their generous support is greatly appreciated by both authors. It is a pleasure to acknowledge the influence that extensive discussions with Dr Bruno Feijb, Ponificia Universidade Catolica do Rio de Janeiro, and with JoHo Bento, Instituto Superior TCcnico, Lisbon, have had in the shaping of this communication. REFERENCES 1. R. Davis, Metarules: Reasoning about control. Art@cial Intelligence IS, 179-222 (1980).
CONCLUSION
The ability of a civil engineering Expert System to utilize in an intelligent manner the knowledge it possesses is a feature still sadly lacking in most present-day working systems. A system designed for a civil engineering application tends to attract an extensive knowledge base; the size of the base therefore demands the selective use of its contents for efficient decision making. This is the principal function of metaknowledge reasoning. For engineering problems, there is a need for a practically oriented method which is easy to implement and to use. In addition, the method should be largely independent of the AI environment in which it is implemented. A simple, yet potentially powerful, method of metaknowledge reasoning has been described in the context of the above desiderata. The method has been developed through the medium of XLOG, a particular logic/procedural programming environment.
2. B. Feijo, XLOG-A logic programming environment. Technical Report ESL l/86, Expert Systems Laboratory, Department of Civil Engineering, Imperial College, London (1986). 3. D. W. Hasling, W. J. Clancey and G. Rennels, Strategic explanations for a diagnostic consultation system. Int. J. Man-Machine Studies 20, 3-19 (1984). 4. R. Davis, Content reference: reasoning about rules. Artificial Intelligence 15,223-239 (1980). 5. L. Sterling and E. Shapiro, The Art of Prolog. The MIT Press, Cambridge, MA (1986). 6. A. Oki, Analogical reasoning in civil engineering expert systems. Technical Report ESL 4/88, Expert Systems Laboratory, Department of Civil Engineering, Imperial College, London (1988). J. Doyle, A truth maintenance system. Artificial Intelligence 12, 231-272 (1979). J. De
Kleer, An assumption based truth maintenance system. Artificial Intelligence 28, 127-162 (1986). R. Davis, Application of meta-level knowledge to the construction and use of large knowledge based systems. In Knowledge Based Systems in Artificial Intelligence (Edited by R. Davis and D. Lenat). McGraw-Hill, New York (1982).