Chapter 3 Problem Solving Agents
Chapter 3 Problem Solving Agents
• The agent carries out its plans with its eyes closed
– Certain of what’s going on
– Open loop system
• Goal state:
– One of the buckets has two gallons of water in it
– Represented by either ( x 2 ) or ( 2 x )
• Path cost:
– 1 per unit step
(4,0) (0,3)
(1,0) (0,1)
(3,3) (4,2)
(4,1)
(2,3)
(2,0) (0,2)
• Breadth-first search
• Uniform-cost search
• Depth-first search
• Depth-limited search
• Iterative deepening search
1
S5 6
5 6 D6
9 2
3 C4 2
A7 1
B3
9 2 E5
5 2
7
G10 7
G30
G20
F6
8
A* Search: example cont’d
• Solution
• Visited : S(5) ,A(12), B(11),D(12),C(12),E(13)
6
S5
5 D6 12
5
9 2
C4 2
A7 12
12 B3 E5
9 3 5
12 7 7 13
G10 B3
14 11 G30
1 G20 15
F6
C4 13
21
13 GOAL!
A* Search cont’d
• The choice of an appropriate heuristic evaluation function, h(n), is still crucial to the
behavior of this algorithm.
• In general, we want to choose a heuristic evaluation function h(n) which is as close as
possible to the actual cost of getting to a goal state.
• If we can choose a function h(n) which never overestimates the actual cost of getting to
the goal state, then we have a very useful property. Such a h(n) is said to be admissible.
A* Search cont’d
•Perhaps surprisingly, breadth-first search (where each step has the same cost) is an example of
Algorithm A*, since the function it uses to sort the agenda is simply:
• f(n) = g(n) + 0
•Breadth-first search takes no account of the distance to the goal, and because a zero estimate cannot
possibly be an overestimate of that distance it has to be admissible. This means that BFS can be seen
as a basic example of Algorithm A*.
•However, despite being admissible breadth-first search isn't a very intelligent search strategy as it
doesn't direct the search towards the goal state. The search is still blind
•Informedness :
• We say that a search strategy which searches less of the state space in order to find a goal state is
more informed. Ideally, we'd like a search strategy which is both admissible (so it will find us an
optimal path to the goal state), and informed (so it will find the optimal path quickly.)
Hill Climbing (Greedy Search)
• Alternatively, we might sort the agenda by the cost of getting to the goal from that state. This
is known as greedy search.
• An obvious problem with greedy search is that it doesn't take account of the cost so far, so it
isn't optimal, and can wander into dead-ends, like depth-first search.
• QueueingFn is sort-by-h
• Features
• Much faster
• Less memory
• Dependent upon h(n)
• If bad h(n), may prune away all goals
• Not complete
Hill Climbing issues
states
Recap of search strategies
Avoiding Repeated States
• Complication of wasting time by expanding states
that have already been encountered and expanded
before
– Failure to detect repeated states can turn a linear problem
into an exponential one