All Manuals > KnowledgeWorks and Prolog User Guide > 6 Advanced Topics > 6.1 Control Flow

NextPrevUpTopContentsIndex

6.1.2 User-definable Conflict Resolution

A conflict resolution strategy is a list of conflict resolution tactics. A conflict resolution tactic is a function which takes as arguments two rule instantiations, and returns t if and only if the first is preferred to the second, otherwise NIL . A conflict resolution tactic may be defined by

(deftactic <tactic-name> {<type>} <lambda-list> [<doc-string] <body>)

where <tactic-name> is the name of the tactic and of the function being defined which implements it, and <lambda-list> is a two argument lambda-list. <type> may be either :static or :dynamic , defaulting to :dynamic . A dynamic tactic is one which looks into the objects which match the rule to make up the instantiation; a static one does not. For example, a tactic which prefers instantiations which match, say, truck objects to instantiations which do not could be defined as static. However, if it looks into the slot values of the truck object it should be defined as dynamic. Static tactics are treated more efficiently but wrongly declaring a tactic as static will lead to incorrect conflict resolution. If doc-string is given, then it should be a string. The value can be retrieved by calling the function documentation with doc-type function .

It is an absolute requirement that there exist no instantiations for which

(<tactic-name> <instantiation1> <instantiation2>)

and

(<tactic-name> <instantiation2> <instantiation1>)

both return t . Consequently, for any single given instantiation

(<tactic-name> <instantiation> <instantiation>)

must return nil .

The function which defines a conflict resolution tactic should be computationally cheap as it is used repeatedly and frequently to compare many different pairs of instantiations.

6.1.2.1 Examples


KnowledgeWorks and Prolog User Guide (Unix version) - 6 Dec 2011

NextPrevUpTopContentsIndex