[Next] [Up] [Previous]
Next: Frames and Scripts Up: Styles of Knowledge Representation Previous: Semantic Networks

Production Systems

Another mechanism that has acquired great popularity is the production system. A production system has a set of production rules, usually of the form

IF <condition> THEN <action>

and a control mechanism which searches for rules to apply in a given situation. Several rules may apply in a given case and the control mechanism will contain a method for choosing one of the various competing rules to apply (or fire). When a rule fires, its `action' part is carried out and this typically changes the situation, making new rules available to fire.

As a sample illustration of a production system, imagine that an air travel firm offers discounts on its trips for certain age groups: children under 12 go half price; senior citizens (that is, females of 60 or over, and males of 65 or over) have a 25% discount.

Consider how a computer program might embody the knowledge about these ticket discounts, and how it might handle customers' enquiries. In order to know what discount, if any, applies to a particular passenger, the system may have to ask for information. But, for reasons of efficiency as well as politeness, the system should avoid asking unnecessary questions.

The following rules presuppose that the system can consult a database (or working memory) as it goes along, and can add information to it, or delete information from it as needed. The system can also ask questions, and can record the answers in its working memory. Here are some sample production rules, expressed in an English form.

 Rule no condition: Print: ¯Rule 1  		 condition: 		 [age of passenger unknown]

action: print: What is the passenger's age ?

read: AGE

add: [age of passenger is AGE]

Rule 2 condition: [age of passenger is AGE] where AGE < 12

action: print: The passenger travels half price.

stop

Rule 3 condition: [age of passenger is AGE] where AGE >= 65

action: print: The passenger has a 25% discount.

stop

Rule 4 condition: [sex of passenger is unknown] and

[age of passenger is AGE] where Age >= 60

action: print: Is the passenger male or female?

read: SEX

add: [sex of passenger is SEX]

Rule 5 condition: [sex of passenger is female] and

[age of passenger is AGE] where AGE >= 60

action: print: The passenger has a 25 % discount.

stop

Rule 6 condition:

action: print: The passenger has to pay the full rate.

stop

You must imagine that the above rules are processed on a `first-come first served basis' by matching the the conditions of each rule in turn against the database until a match occurs and the rule fires.

The production system will repeatedly cycle through the rules starting at Rule 1, looking for one to fire. This cycling will continue until it is told to stop. (In this simple example, there are at most three cycles through the rules: for instance, for a female passenger aged 62, the following will fire in succession: 1,4, and 5.) The order of the rules ensures that questions are asked only when necessary. The final rule offers a `default' option. As can be seen, it carries no conditions at all, but because of its position in the set of rules, it will fire only if no other rule is applicable.

Production rules are useful where the knowledge consists of many loosely related facts and independent actions, and we shall devote a whole chapter (chapter 7) to them.


[Next] [Up] [Previous]
Next: Frames and Scripts Up: Styles of Knowledge Representation Previous: Semantic Networks

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