Title: Chapter 6: Building Control Algorithms for State Space Search
1Chapter 6 Building Control Algorithms for State
Space Search
- Because we skipped ahead to Prolog, you should
find everything in the first two sections of this
chapter to be quite familiar - Please review these sections on your own
- In essence, Prolog uses recursion and
backtracking to control and implement a state
space search through a space of logical
inferences - The other control and implementation approaches
discussed in Chapter 6 are the production system
and the blackboard architecture
2Production Systems
- The production system is a computational model
that has been used both to model human problem
solving and to implement search algorithms - Many expert systems are implemented as production
systems - Language translation, for both human and computer
languages, can also be implemented using this
approach - A production system has three main components
- a set of production rules, each of which is a
condition-action pair - the condition tells when the rule is applicable
- the action tells what to do when the rule applies
- each production rule defines one problem solving
step - working memory
- this is a description of the state of the world
(or at least, the current state of the problem
being solved)
3Parts of a Production System, continued
- The production rules interact with the working
memory as follows - When a condition of a rule matches the state of
the world, then that rule can fire (ie., its
action may be performed) - When a rule fires, it can change the state of the
world - The third component of a production system is the
recognize-act cycle - Working memory, or the state of the world, is
initialized to whatever is given by the problem
description - the state of the world is represented by a set of
patterns - All rules with conditions matching the patterns
in working memory become a conflict set - one rule is selected from the set, using some
selection strategy, called conflict resolution - the selected rule is fired
- The cycle repeats until nothing in working memory
matches any rule conditions
4Overview of a Production System
5A Production System for Sorting abc Strings
6Background of Production Systems
- Newell and Simon gave people problems to solve
and then monitored the people as they solved the
problems - They recorded what the people said they were
doing while they were solving problems, and also
what they could see the people doing, such as
moving their eyes from place to place - These recordings were represented as a problem
behavior graph - A production system was then used to search this
graph - Production rules represented human problem
solving skills (long term memory) - The working memory was whatever the subject was
paying attention to at a particular point in the
problem solving process (short term memory) - When this focus of attention matched the
condition of a production rule, the persons
focus of attention would change to the next thing - Production systems, in general, may or may not
embody such human problem solving strategies
7The 8-Puzzle as a Production System
8Search Space for 8-Puzzle with Depth Bound of 5
9The Knights Tour Revisited
10The Knights Tour as a Production System
- When we looked at the Knights Tour in Prolog, we
wrote rules for each of the possible moves on the
3 x 3 chessboard - Ex move(1,8).
- This could be expressed as a production rule,
- condition the knight is on square 1
- action move the knight to square 8,
- or, using the ? notation for productions,
- knight on square 1 ? knight on square
8 - To extend the approach to an 8 x 8 chessboard,
you would not want to enumerate every possible
move - Rather, there are eight types of moves possible,
leading to just eight production rules - Ex condition current row lt 6 and current
column lt 7 - action new row current row 2 and
- new
column current column 1
11Controlling Search in Production Systems
- To control search in production systems, you can
choose data-driven or goal-driven search
strategies, choose the structure of the rules,
and choose the strategies for resolving conflicts
(picking the rule to apply when more than one
rules condition is satisfied) - In the data-driven (forward chaining) approach
- Known facts are placed in working memory
- The recognize-act cycle finds the conditions of
rules that match the fact patterns in working
memory - A rule with a matching condition is fired
- This creates new facts to add to working memory
- When a goal is added to working memory,
computation stops - When the rules are formulated as logical
assertions, firing a rule corresponds to applying
modus ponens to infer new facts
12Example of Data-Driven Search
- In this example, the conflict resolution strategy
is to choose the rule that has fired least
recently
13Goal-Driven Search
- To use a production system for goal-driven search
(backward chaining) - Start out with the goal you want to satisfy in
working memory - Instead of matching conditions and then firing
actions, you match actions (which are
conclusions) and choose a rule with a matching
action from the conflict resolution set - When you fire the selected rule, its conditions
are added to working memory as new subgoals - The cycle ends when you come to facts (which may
be viewed as rules having actions but no
conditions) justifying all of the subgoals in
working memory - These facts may be built into the program or may
be asked of the user
14Example of Goal-Driven Search (page 182)
- In this example, the start state is considered
to be a known fact
15Other Methods of Controlling Search in Production
Systems
- In predicate calculus, there is no implied order
to truth - In a production system, even though the
conditions of several rules may all be true, the
rules are fired in a particular order - Ordering the rules affects the way in which
search will proceed - Ex In Prolog, the order in which rules is
written is important - Conflict resolution is a related issue
- You dont have to always fire the first true
rule. Other strategies are - Refraction This discourages cycles by preventing
a rule from firing a second time unless the
patterns in working memory that matched its
conditions have changed - Recency This keeps the search moving in one
direction by choosing rules whose conditions are
matched by the facts most recently added to
working memory - Specificity This prefers rules which match more
specific conditions to those which match more
generally
16Advantages of Production Systems
- Production systems are used widely in AI
applications because - Knowledge and control are separated
- Problem solving knowledge is in production rules
- Control is in the recognize-act cycle
- They make it easy to implement state space search
- The state of working memory is a node in the
graph - The rules tell the allowable transitions between
nodes - Conflict resolution selects the branch of the
graph to follow - Production rules are modular (ie., very small
independent modules) - They can be added, deleted and modified
independently of other rules (to some extent) - Control is pattern directed
- What happens next is controlled by the state of
the world
17More Advantages
- The order in which rules fire may provide a
solution path through a graph, and/or a trace of
the way a person would solve a problem - You can build a production system in almost any
programming language, as long as you can match
patterns - Production systems may be used to model human
cognition as well as to build practical systems - Modeling human problem solving was Newell and
Simons original intent for production systems
18The Blackboard Architecture
- The blackboard architecture may be considered as
an extension of the production system, although
its possible to use this architecture with other
reasoning mechanisms, as well - The blackboard architecture is another approach
to control in AI systems - In this architecture, there are multiple problem
solving modules, each of which is capable of
solving some part of the problem - The modules communicate with each other through a
globally accessible structure called the
blackboard - The blackboard is (in a loose sense) a database
- Independent problem solving modules, called
knowledge sources, regularly check the blackboard
to see if there is data they can use - If there is, they process the data, and post the
results to the blackboard, providing additional
data for any knowledge source to use
19The HEARSAY Project
- The blackboard architecture was introduced by the
HEARSAY project, a speech understanding program
that interpreted and answered spoken questions
about a library database of computer science
articles - Understanding speech is complex, and many factors
enter into it - Asynchronous, data-driven knowledge sources were
built to analyze - the waveform of the acoustic signal
- the phonemes of the acoustic signal
- the syllables these phonemes could produce
- the possible words these syllables could comprise
- the possible sequences these words could comprise
- the possible phrases these sequences could
comprise - Knowledge sources work on different parts of a
problem and/or provide different possible
interpretations for the same part of a problem - This project led to the use of blackboards in
many expert systems