Professional Documents
Culture Documents
Search Strategies
Uninformed search (= blind search)
have no information about the number of steps or the path cost from
the current state to the goal
Informed search (= heuristic search)
have some domain-specific information
we can use this information to speed-up search
e.g. Bucharest is southeast of Arad.
e.g. the number of tiles that are out of place in an 8-puzzle position
e.g. for missionaries and cannibals problem, select moves that move
people across the river quickly
Search Strategies: Blind Search
Breadth-first search
Expand all the nodes of
one level first.
Depth-first search
Expand one of the nodes at
the deepest level.
Search Strategies: Heuristic
Search
Heuristic is for combinatorial explosion.
Optimal solutions are rarely needed.
Search Strategies: Heuristic
Search
The Travelling Salesman Problem
“A salesman has a list of cities, each of which he
must visit exactly once. There are direct roads
between each pair of cities on the list. Find the
route the salesman should follow for the
shortest possible round trip that both starts and
finishes at any one of the cities.”1 A 10
B
D E
5 5
15 5
C
Search Strategies: Heuristic
Search
Nearest neighbour heuristic:
1. Select a starting city.
2. Select the one closest to the current city .
3. Repeat step 2 until all cities have been
visited.
A heuristic function
[dictionary]“A rule of thumb, simplification,
or educated guess that reduces or limits the
search for solutions in domains that are
difficult and poorly understood.”
h(n) = estimated cost of the cheapest path from
node n to goal node.
If n is goal then h(n)=0
Heuristic Search
Let us suppose that we have one piece of information: a
heuristic function
h(n) = 0, n a goal node
h(n) > 0, n not a goal node
we can think of h(n) as a “guess” as to how far n is from the goal
Goal state
1 2 3
1 2 3 h(n) = 3
8 4
8 6
7 5 4 7 6 5
Example - cont
1 2 3 h(n) = 3
8 6
7 5 4
h(n) = 2 h(n) = 4
h(n) = 3
1 2 3 1 2
1 2 3
8 6 4 8 6 3
8 6
7 5 7 5 4
7 5 4
1 2 3 h(n) = 3
8 6
7 5 4
h(n) = 2 h(n) = 4
h(n) = 3
1 2 3 1 2
1 2 3
8 6 4 8 6 3
8 6
7 5 7 5 4
7 5 4
h(n) = 3 h(n) = 1
1 2 3 1 2 3
8 6 8 6 4
7 5 4 7 5
1 2 3 h(n) = 3
8 6
7 5 4
h(n) = 2 h(n) = 4
h(n) = 3
1 2 3 1 2
1 2 3
8 6 4 8 6 3
8 6
7 5 7 5 4
7 5 4
h(n) = 3 h(n) = 1
1 2 3 1 2 3
8 6 8 6 4
7 5 4 7 5
h(n) = 0 h(n) = 2
1 2 3 1 2 3 1 2 3
h(n) = 2
8 6 4 8 4 8 6 4
7 5 7 6 5 7 5
Heuristic Search
Heuristic: involving or serving as an aid to
learning, discovery, or problem-solving by
experimental and especially trial-and-error
methods.
Heuristic technique improves the efficiency of
a search process, possibly by sacrificing
claims of completeness or optimality.
Heuristic Search
A framework for describing search methods is
provided and several general purpose search
techniques are discussed.
All are varieties of Heuristic Search:
Generate and test
Hill Climbing
Best First Search
Problem Reduction
Constraint Satisfaction
Means-ends analysis
Generate-and-Test
Algorithm:
1. Generate a possible solution. For some problems,
this means generating a particular point in the
problem space. For others it means generating a
path from a start state
2. Test to see if this is actually a solution by
comparing the chosen point or the endpoint of the
chosen path to the set of acceptable goal states.
3. If a solution has been found, quit, Otherwise
return to step 1.
Generate-and-Test
It is a depth first search procedure since complete solutions
must be generated before they can be tested.
In its most systematic form, it is simply an exhaustive search
of the problem space.
Operate by generating solutions randomly.
Also called as British Museum algorithm
If a sufficient number of monkeys were placed in front of a
set of typewriters, and left alone long enough, then they would
eventually produce all the works of shakespeare.
Dendral: which infers the struture of organic compounds using
NMR spectrogram. It uses plan-generate-test.
Hill Climbing
Is a variant of generate-and test in which feedback
from the test procedure is used to help the generator
decide which direction to move in search space.
The test function is augmented with a heuristic
function that provides an estimate of how close a
given state is to the goal state.
Computation of heuristic function can be done with
negligible amount of computation.
Hill climbing is often used when a good heuristic
function is available for evaluating states but when no
other useful knowledge is available.
Simple Hill Climbing
Algorithm:
1. Evaluate the initial state. If it is also goal state, then return it
and quit. Otherwise continue with the initial state as the
current state.
2. Loop until a solution is found or until there are no new
operators left to be applied in the current state:
a. Select an operator that has not yet been applied to the current state
and apply it to produce a new state
b. Evaluate the new state
i. If it is the goal state, then return it and quit.
ii. If it is not a goal state but it is better than the current state, then make it
the current state.
iii. If it is not better than the current state, then continue in the loop.
Simple Hill Climbing
The key difference between Simple Hill
climbing and Generate-and-test is the use of
evaluation function as a way to inject task
specific knowledge into the control process.
Is one state better than another ? For this
algorithm to work, precise definition of better
must be provided.
: Hill-climbing
This simple policy has three well-
known drawbacks:
(a)
B C 5 D 1
B C 5 D 1 3
3
Step 4 Step 5
E 4 F
A A 6
B C D B C 5 D 1
3 5 1 3
E F G H E 4 F
G 6 H 5 4 6 5 6
6
A 2 A 1
AND-OR graphs
AND-OR graph (or tree) is useful for representing the solution
of problems that can be solved by decomposing them into a set
of smaller problems, all of which must then be solved.
One AND arc may point to any number of successor nodes, all
of which must be solved in order for the arc to point to a
solution.
Goal: Steal a TV Set Goal: Earn some money Goal: Buy TV Set
AND-OR graph examples
A A
9 38
B C 3 D B C D
5 4
17 9 27
E F G H I J
5 10 3 4 15 10
Summary
Four steps to design AI Problem solving:
1. Define the problem precisely. Specify the problem
space, the operators for moving within the space,
and the starting and goal state.
2. Analyze the problem to determine where it falls
with respect to seven important issues.
3. Isolate and represent the task knowledge required
4. Choose problem solving technique and apply them
to problem.
Summary
What the states in search spaces represent. Sometimes the states represent
complete potential solutions. Sometimes they represent solutions that are
partially specified.
How, at each stage of the search process, a state is selected for expansion.
How operators to be applied to that node are selected.
Whether an optimal solution can be guaranteed.
Whether a given state may end up being considered more than once.
How many state descriptions must be maintained throughout the search
process.
Under what circumstances should a particular search path be abandoned.