[Next] [Up] [Previous]
Next: Production Systems and Artificial Up: Production Systems: Simulating the Previous: The Rulebase

The Production System Interpreter

The third component of a production system, the production system interpreter, is the program that applies the rules. It repeatedly performs the following steps:

  1. Match: find the rules whose conditions are satisfied by the current contents of working memory.
  2. Conflict resolution: decide which rule to use. If the condition part of none of the productions is satisfied, then halt the interpreter.
  3. Act: perform the actions in the rule's body.
  4. Go to step 1.

The cycle is usually repeated until either no rule can be found whose condition part is true -- that is, whose head matches the database -- or some rule is fired which has the action part `stop'.

If more than one rule is triggered, then the interpreter will have to decide which of them it will fire. The choice of conflict resolution strategy may well depend on the nature of the task for which the particular system is being used. Three examples of possible conflict resolution strategies are

  1. To select the first rule in the rulebase that matches the contents of the database. We might further stipulate that after it has been fired once, the same rule cannot be used again.
  2. To use that rule amongst those triggered whose conditions for firing include all those of another plus some further conditions, on the grounds that it is more specialized. For example, there is little point in applying suntan lotion if you are still wearing your street clothes:

     
    Rule 1
    

    condition:

    [temperature in sun hot]

    action:

    add: [apply suntan lotion]

     
    Rule 2
    

    condition:

    [temperature in sun hot] and

    [clothes on] and

    [swimsuit off]

    action:

    remove: [clothes on]

    remove: [swimsuit off]

    add: [clothes off]

    add: [swimsuit on]

  3. To give priority to special case rules over more generally applicable rules. It may happen, perhaps, that two rule heads can be matched to the working memory, one fully specified and the other containing variables which might match a number of patterns. In this case the more specific rule would be applied first. Even when both rule heads are fully specified, one may be more general than the other. Consider, for example, rules 1 and 3 where rule 3 covers the more specific case of the sun being too hot for sunbathing:

     
    Rule 1
    

    condition:

    [temperature in sun hot]

    action

    add: [apply suntan lotion]

    Rule 3

    condition:

    [temperature in sun greater than 100]

    action:

    add: [stay in the shade]


[Next] [Up] [Previous]
Next: Production Systems and Artificial Up: Production Systems: Simulating the Previous: The Rulebase

Cogsweb Project: luisgh@cogs.susx.ac.uk