140 likes | 348 Views
match WM with LHS of rules. select one rule (conflict resolution). match WM with RHS of rules. select one rule (conflict resolution). put deductions into WM. put premises as sub-goals into WM. put facts into WM. put goal into WM. Conflict Resolution.
E N D
match WM with LHS of rules select one rule (conflict resolution) match WM with RHS of rules select one rule (conflict resolution) put deductions into WM put premises as sub-goals into WM put facts into WM put goal into WM Conflict Resolution • what to do if there is more than 1 matching rule in each inference cycle? Forward Chaining Backward Chaining
Conflict Resolution (Recap) • conflict set • the set of rules which match the WM content in each cycle • not just rules, but rules with variable instantiations • deterministic rule set • at most 1 rule matched at each cycle (i.e. 0 or 1) • non-deterministic rule set • more than 1 matching rule • inference engine (interpreter) must select one rule to apply using its conflict resolution strategy
Choice of Conflict Resolution Strategy • determine how the ES search in the problem space • how quick to find the solution • if the system will find a solution • and if found, which solution • should be chosen to fit your application • desirable properties • stability • follow a line of reasoning • sensitivity • react quickly to any change in WM
Common Conflict Resolution Strategies • textual order • refractoriness • recency • breadth • MEA • specificity • LEX • simplicity • priority (salience) • strategies can be combined!
Textual order • assume that rules are ordered (linearly) • fire the first matching rule • most important rules should be placed early in the KB
Recency • rules that use recently added data are favoured (depth-first) • if >1 rule use the same (most) recent data, the next most recent data used in each of the rules is used to determine which one is preferred • pursues the current line of reasoning rather than being side-tracked by other deductions
Breadth Strategy • rules which have been activated for a long time are preferred to newly activated ones • i.e. rules that match old facts are preferred than rules that match new facts • tends to search in a breadth-first manner
MEA • "Means-Ends Analysis" • an early AI technique for backward reasoning • rules whose 1st condition uses recently added data are favoured
Specificity (complexity) • more specific rules are preferred to more general rules • rules with greater number of conditions • rules with fewer variables are more specific • more instantiated by the WM are more specific • more specific rules should be applied earlier because they use more data and so can be used for special cases or exceptions to general rules
LEX • apply recency • if there is still conflict, apply specificity
Priority (salience) • in some systems, rules can have a priority (salience) attached, indicating how likely the rule is to be a good solution • fire rule with highest priority • priority should be used to: • emphasise the importance of a rule • delay firing of a non-promising rule • NOT to establish the order in which all the rules should fire
Conflict Resolution in CLIPS • CLIPS fires rules from the agenda in order of their salience. • Salience is normally defined implicity by the conflict resolution strategy. • CLIPS offers a variety of CR strategies. • recency (depth), breadth, LEX, MEA, complexity, simplicity & random strategies. • default is recency. • You can also explicitly set the salience of a rule • In the CLIPS IDE you can set the CR strategy: • Commands -> Option -> Salience Evaluation • You can also set it at the prompt. It will return the previous strategy. • CLIPS> (set-strategy breadth) • depth • CLIPS>
Lab exercise 1: • Download “newsnow.clp” from the class webpage. This is a slightly modified version of the snow program. • Start the CLIPS IDE and load the newsnow.clp file. • Watch the facts and agenda windows and step through an execution (using Run 1). • Change the salience strategy and do it again. Try several strategies. • Which seems like the best choice? Worst? Why?
Lab Exercise 2: • Modify the newsnow program using salience to force all the user input questions to be first. • What form of conflict resolution is this most similar to? • Now modify it to reach a conclusion as soon as possible. • What form of CR do you have now?