Problems, Problem Spaces, and Search • Define the Problem

advertisement
Problems, Problem Spaces,
and Search
• Define the Problem
precisely
• Analyse the problem
• Isolate and represent the
task knowledge
• Choose the best problemsolving technique
Chapter 2
1
Defining the Problem as a
State Space Search
Example - Water Jug
Problem
You are given two jugs, a 4-gallon
one and a 3-gallon one. Neither has
any measring markers on it. There
is a pump that can be used to fill
the jugs with water. How can you
get exactly 2 gallons of water into
the 4-gallon jug?
initial state (0,0)
goal state (2,n)
Chapter 2
2
Operators
1 if x<4 ->
(4,y)
2 if y<3 ->
(x,3)
3 if x>0 ->
(x-d,y)
4 if y>0 ->
(x,y-d)
5 if x>0 ->
(0,y)
6 if y>0 ->
(x,0)
7 if x+y>=4 and y>0 ->
(4,y-(4-x))
8 if x+y>=3 and x>0 ->
(x-(3-y),3)
9 if x+y<=4 and y>0 ->
((x+y),0)
10 if x+y<=3 and x>0 ->
(0,x+y)
11 (0,2) ->
12 (2,y) ->
Chapter 2
(2,0)
(0,y)
3
Formal Description of a Problem
1- Define a state space
2- Specify initial states
3- Specify goal states
4- Specify set of rules that describe the
actions available
Chapter 2
4
Production System
•
A set of Rules
•
One or more databases
•
A control stsretegy
•
A Rule applier
Chapter 2
5
Control Strategies
The requirements of a good control
strategy are :
•
it causes motion
•
it is systematic
Chapter 2
6
Algorithm : Breadth-First Search
(0,0)
---------------------|
|
(4,0)
(0,3)
------------------------------|
|
|
|
|
|
(4,3)
(0,0) (1,3)
(4,3) (0,0)
(3,0)
Algorithm : Depth-First Search
(0,0)
------------------|
(4,0)
---------|
(4,3)
Chapter 2
7
Advantage of Depth-First Search
•
•
Less Memory
By chance, it may find a solution
without examining much of the
search space at all
Advantage of Breadth-First
Search
It will not get trapped exploring a blind
alley
If there is a solution then BFS is
guaranteed to find it
If there are multiple solution, a minimal
solution will be found
Chapter 2
8
Heurestic Search
Example
The traveling Salesman Problem
A Simple motion-causing and systemic
control structure can solve the problem
in time propootional to:
(N-1) !
Applying nearest neighbor heurestic
N2
A heurestic function is a function that
maps from problem state descriptions
to measures of desirability , usually
represented as numbers
Chapter 2
9
Problem Characteristics
Is the Problem Decomposable?
Integration, Blocks World
Can Solution Steps Be Ignored or Undone ?
Theorem Proving, 8-Puzzle, Chess
Is the Universe Predictable?
8-Puzzle, Bridge
Is a Good Solution Absolute or Relative ?
Answering question, Salesman Problem
Is the Solution a State or a Path?
NLUnderstanding, Water Jug
What is the Role of Knowledge?
Chess, newspaper story understanding
Does the Task Require Interaction witha
Person?
Theorem proofing, Medical Diagnosis
Chapter 2
10
Production System Characteristics
• A Monotonic Production System is a
production system in which the
application of a rule never prevents the
later application of another rule that
could also have been applied at the time
the first rule was selected
• A Nonmonotonic Production System
is one in which the above condition is
not true
• A Partially commutative Production
System is a production system with the
property that if the application of a
particular sequence of rules transforms
state x into state y , then any
permutation of those rules that is
allowable also transforms state x into
state y
• A commutative Production System is
a production system that is both
monotonic and partially commutative.
Chapter 2
11
Issues in the Design of
Search Programs
• Forward versus backward reasoning
• Matching rules against state
• Representing each node of the search
process
Additional Problems
The Missionaries and Cannibals Problem
The Tower of Hanoi
The Monkey and Banana Problem
Cryptarithmetic
Chapter 2
12
Download