Production systems
1 / 23

Chapter 6 - PowerPoint PPT Presentation

  • Updated On :

Production Systems. A production system is a set of rules (if-then or condition-action statements) working memory the current state of the problem solving, which includes new pieces of information created by previously applied rules

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'Chapter 6' - Faraday

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Production systems
Production Systems

  • A production system is

    • a set of rules (if-then or condition-action statements)

    • working memory

      • the current state of the problem solving, which includes new pieces of information created by previously applied rules

    • inference engine (the author calls this a “recognize-act” cycle)

      • forward-chaining, backward-chaining, a combination, or some other form of reasoning such as a sponsor-selector, or agenda-driven scheduler

    • conflict resolution strategy

      • when it comes to selecting a rule, there may be several applicable rules, which one should we select? the choice may be based on a conflict resolution strategy such as “first rule”, “most specific rule”, “most salient rule”, “rule with most actions”, “random”, etc

Production system cycle
Production System Cycle

  • Select a rule whose left hand side matches a pattern in working memory

  • Fire the right hand side

    • this usually manipulates working memory (removing item(s), modifying item(s), adding item(s)

We need an algorithm to match

conditions to working memory

As with predicate calculus, we

may not have an exact match

for instance, if working

memory stores


this does not match dog(X)

Conditions will often have multiple parts and-ed or or-ed together


  • The idea behind a production system’s reasoning is that rules will describe steps in the problem solving space where a rule might

    • be an operation in a game like a chess move

    • translate a piece of input data into an intermediate conclusion

    • piece together several intermediate conclusions into a specific conclusion

    • translate a goal into substeps

  • So a solution using a production system is a collection of rules that are chained together

    • forward chaining – reasoning from data to conclusions where working memory is sought for conditions that match the left-hand side of the given rules

    • backward chaining – reasoning from goals to operations where an initial goal is unfolded into the steps needed to solve that goal, that is, the process is one of subgoaling

Example system water jugs
Example System: Water Jugs

  • Problem: given a 4-gallon jug (X) and a 3-gallon jug (Y), fill X with exactly 2 gallons of water

    • assume an infinite amount of water is available

  • Rules/operators

    • 1. If X = 0 then X = 4 (fill X)

    • 2. If Y = 0 then Y = 3 (fill Y)

    • 3. If X > 0 then X = 0 (empty X)

    • 4. If Y > 0 then Y = 0 (empty Y)

    • 5. If X + Y >= 3 and X > 0 then X = X – (3 – y) and Y = 3 (fill Y from X)

    • 6. If X + Y >= 4 and Y > 0 then X = 4 and Y = Y – (4 – X) (fill X from Y)

    • 7. If X + Y <= 3 and X > 0 then X = 0 and Y = X + Y (empty X into Y)

    • 8. If X + Y <= 4 and Y > 0 then X = X + Y and Y = 0 (empty Y into X)

      • rule numbers used on the next slide

Solution space
Solution Space

Note: the solution space does not show cycles (for instance, the second (4, 0) on the left does not have a subtree underneath it, we assume we will not continue from that point because (4, 0) is in the closed list


  • We briefly explored Eliza in chapter 1, lets take a look at how it worked

  • The program would generate an English response/question based on a group of patterns

    • if the user sentence matched a pattern, this pattern would be used to generate the next sentence/question

  • Eliza algorithm

    • repeat

      • input a sentence

      • match a rule in the Eliza knowledge-base

        • attempt to perform pattern match (see next slide)

        • attempt to perform segment match (see two slides)

      • if rule found, select a response randomly (some patterns have multiple responses)

      • fill in variables, substitute values

    • until user quits

Eliza rules

(defparameter *eliza-rules*

'((((?* ?x) hello (?* ?y))

(How do you do. Please state your problem.))

(((?* ?x) I want (?* ?y))

(What would it mean if you got ?y)

(Why do you want ?y) (Suppose you got ?y soon))

(((?* ?x) if (?* ?y))

(Do you really think its likely that ?y)

(Do you wish that ?y)

(What do you think about ?y) (Really-- if ?y))

(((?* ?x) no (?* ?y))

(Why not?) (You are being a bit negative)

(Are you saying "NO" just to be negative?))

(((?* ?x) I was (?* ?y))

(Were you really?)

(Perhaps I already knew you were ?y)

(Why do you tell me you were ?y now?))

(((?* ?x) I feel (?* ?y))

(Do you often feel ?y ?))

(((?* ?x) I felt (?* ?y))

(What other feelings do you have?))))

Eliza Rules

If the input contains

*something* hello *something*,

Eliza responds with

“How do you do.”

If the input contains

*something* if *something else*

Eliza responds with

Do you really think its likely

that *something else*?

or with

Do you wish that

*something else*?

Eliza pattern matching
Eliza Pattern Matching

  • pat  var match any one expression to a variable

  • constant or to a constant (see below)

  • segment-pat match against a sequence

  • single-pat match against one expression

  • (pat . pat) match the first and the rest of a list

  • single-pat 

  • (?is var predicate) test predicate on one expression

  • (?or pat1 pat2 …) match on any of the patterns

  • (?and pat1 pat2 …) match on every of the expressions

  • (?not pat) match if expression does not match

  • segment-pat 

  • ((?* var) …) match on zero or more expressions

  • ((?+ var) …) match on one or more expressions

  • ((?? var) …) match zero or one expression

  • ((?if expr) …) test if expression is true

  • var  ?chars variables of the form ?name

  • constant  atom constants are atoms (symbols, #, chars)

Conflict resolution strategies
Conflict Resolution Strategies

  • In a production system, what happens when more than one rule matches?

    • a conflict resolution strategy dictates how to select from between multiple matching rules

  • Simple conflict resolution strategies include

    • random

    • first match

    • most/least recently matched rule

    • rule which has matched for the longest/shortest number of cycles (refractoriness)

    • most salient rule (each rule is given a salience before you run the production system)

  • More complex resolution strategies might

    • select the rule with the most/least number of conditions (specificity/generality)

    • or most/least number of actions (biggest/smallest change to the state)


  • By the early 1970s, the production system approach was found to be more than adequate for constructing large scale expert systems

    • in 1971, researchers at Stanford began constructing MYCIN, a medical diagnostic system

    • it contained a very large rule base

    • it used backward chaining

    • to deal with the uncertainty of medical knowledge, it introduced certainty factors (sort of like probabilities)

    • in 1975, it was tested against medical experts and performed as well or better than the doctors it was compared to

(defrule 52

if (site culture is blood)

(gram organism is neg)

(morphology organism is rod)

(burn patient is serious)

then .4

(identity organism is pseudomonas))

If the culture was taken from the patient’s

blood and the gram of the organism is

negative and the morphology of the organism

is rods and the patient is a serious burn

patient, then conclude that the identity of the

organism is pseudomonas (.4 certainty)

Mycin in operation
MYCIN in Operation

  • Mycin’s process starts with “diagnose-and-treat”

    • repeat

      • identify all rules that can provide the conclusion currently sought

      • match right hand sides (that is, search for rules whose right hand sides match anything in working memory)

      • use conflict resolution to identify a single rule

      • fire that rule

        • find and remove a piece of knowledge which is no longer needed

        • find and modify a piece of knowledge now that more specific information is known

        • add a new subgoal (left-hand side conditions that need to be proved)

    • until the action done is added to working memory

  • Mycin would first identify the illness, possibly ordering more tests to be performed, and then given the illness, generate a treatment

    • Mycin consisted of about 600 rules

R1 xcon

  • Another success story is DEC’s R1

    • later renamed XCON

  • This system would take customer orders and configure specific VAX computers for those orders including

    • completing the order if the order was incomplete

    • how the various components (drive and tape units, mother board(s), etc) would be placed inside the mainframe cabinet)

    • how the wiring would take place among the various components

  • R1 would perform forward chaining over about 10,000 rules

    • over a 6 year period, it configured some 80,000 orders with a 95-98% accuracy rating

    • ironically, whereas planning/design is viewed as a backward chaining task, R1 used forward chaining because, in this particular case, the problem is data driven, starting with user input of the computer system’s specifications

      • R1’s solutions were similar in quality to human solutions

R1 sample rules
R1 Sample Rules

  • Constraint rules

    • if device requires battery then select battery for device

    • if select battery for device then pick battery with voltage(battery) = voltage(device)

  • Configuration rules

    • if we are in the floor plan stage and there is space for a power supply and there is no power supply available then add a power supply to the order

    • if step is configuring, propose alternatives and there is an unconfigured device and no container was chosen and no other device that can hold it was chosen and selecting a container wasn’t proposed yet and no problems for selecting containers were identified then propose selecting a container

    • if the step is distributing a massbus device and there is a single port disk drive that has not been assigned to a massbus and there are no unassigned dual port disk drives and the number of devices that each massbus should support is known and there is a massbus that has been assigned at least one disk drive and that should support additional disk drives and the type of cable needed to connect the disk drive is known, then assign the disk drive to this massbus

Advantages of production systems
Advantages of Production Systems

  • Separation of knowledge and control

    • these systems contain two (or more) distinct forms of knowledge – the knowledge base (rules) and the inference engine

      • this makes it easy to update/change knowledge and debug the system

  • Easy to map knowledge into rule format

    • a lot of expert knowledge is already in this form, in fact, a production system is a plausible model for human problem solving

  • Rules can be grouped into logical sets

    • promotes modularity and allows meta-knowledge to select which set of rules to concentrate on

  • Easy to enhance a system to explain its behavior

    • just add code to output the selected rules to demonstrate the chain of logic that led to the conclusion(s)

  • Easy to construct shell languages

Disadvantages of production systems
Disadvantages of Production Systems

  • There is a lack of focus

    • that is, the system will just continue to fire rules

    • a human problem solver might discover a pattern early on so that the expert refocuses attention on some specific set of rules, this is not typically done in production systems

  • Computationally complex

    • as with nearly any AI system, search means inefficiency, a production system is just another means of searching through a space of knowledge

  • Difficult to debug

    • odd behavior begins to occur with thousands of rules and its hard to figure out why or just what rules should be changed

    • changing a rule may cause problems with other rules – for instance, am I altering a rule that will be needed by another rule? am I altering a rule so that it overlaps with another rule?

Blackboard architecture
Blackboard Architecture

  • Rules can be grouped in logical sections

    • a scheduler can be used to determine which group of rules should be examined at any given point in time

      • an agenda approach can be used whereby the focus is first on obtaining reasonable input

        • in a diagnostic situation, get the symptoms and make sure there are no contradictory data

        • in a planning situation, get the specifications and make sure there are no contradictory specs

      • next, generate partial conclusions

        • a general disease classification or a set of plan steps

      • now refine the solution

        • a specific disease or a coherent plan

  • Since the results of one group may need to be examined by another group, a distributed memory representation might be useful – a blackboard

    • the blackboard was first pioneered with the Hearsay speech recognition system


  • Knowledge was organized into knowledge groups – each group would solve a portion of the speech recognition task (e.g., group phonemes into syllables, group syllables into words)

Scheduler would evaluate the

Blackboard to determine what

part of the problem should be

solved next

Control would then go to that

knowledge group

Any rule would examine one

(or more) level for data and

either place new values or

modify values on the same or

the next level

E mycin

  • The control strategy of Mycin was mostly captured in the inference engine

    • a backward chaining process with working memory and conflict resolution strategies

  • By removing the KB (the domain specific medical rules), you are left with a shell, an empty knowledge base

    • you can use the shell and fill in your own KB to form a new rule based system

    • this shell was called E-Mycin (E for “empty” or “essential”)

  • Using E-Mycin, researchers constructed SACON

    • for structural analysis in engineering with sample rules like

      • if the material composing and the sub-structure is one of: the metals, and the analysis error (in percent) is between 5 and 30, and the non-dimensional stress of the sub-structure > .9 and the number of cycles the loading is to be applied is between 1000 and 10000 then the fatigue is one of the stress behavior phenomena in the sub-structure (1.0)

Beyond emycin
Beyond EMycin

  • EMYCIN (like MYCIN) performed backward chaining, other shells have been constructed:

    • the Official Production System language, OPS, was created for forward chaining

      • the OPS5 release would find wide-spread use in AI

    • Prolog – primarily a logic-based approach

      • can’t use certainty factors for instance, backward chaining, very limited in its capabilities

        • witch(X) <- burns(X), female(X). burns(X) <- wooden(X).

        • floats(X) <- sameweight(duck, X). wooden(X) <- floats(X).

        • female(girl). sameweight(duck,girl).

        • ? witch(girl). This question returns “yes” proving the girl is a witch

    • CLIPS – written in C++ but looks like Lisp, OOPL

      • forward and backward chaining, can use probabilities/certainty factors

      • built-in conflict resolution strategy is salience, but others can be implemented

    • Jess – Java Expert System Shell, like Clips but simplified