cs 430 lecture 9 - uenics.evansville.eduuenics.evansville.edu/~hwang/s17-courses/cs430/... ·...
TRANSCRIPT
Monday, January 30 CS 430 Artificial Intelligence - Lecture 9 1
Lecture 9
Questions?
Monday, January 30 CS 430 Artificial Intelligence - Lecture 9 2
Outline
Chapter 3 - Solving Problems by Searching Uninformed Search Strategies
Depth-limited Search Iterative-deepening Search
Informed (Heuristic) Search Strategies Greedy Best-First Search A* Search
Monday, January 30 CS 430 Artificial Intelligence - Lecture 9 3
Recall: Depth-First Search (DFS)
Depth-first search expands the deepest node in the frontier. It searches down a path to the leaf nodes, then "backs up" to the next deepest unexplored node.
Frontier is implemented using a stack. Tree-Search is not complete, but Graph-Search
is complete. Time complexity is O(bm), but space complexity is O(bm). (Note: m the maximum depth, rather than d, depth of shallowest node.)
Monday, January 30 CS 430 Artificial Intelligence - Lecture 9 4
Depth-Limited Search (DLS)
Depth-limited search (DLS) alleviates the problem of infinite paths in DFS tree search by limiting the depth of the search.
All nodes at the depth limit l are treated as if they have no successors. When this happens a cutoff failure occurs for that branch.
Time complexity becomes O(bl) and space complexity becomes O(bl). Still not complete or optimal.
Monday, January 30 CS 430 Artificial Intelligence - Lecture 9 5
Iterative-DeepeningDepth-First Search (IDS)
Iterative-deepening search combines the characteristics of DFS and BFS. Call DLS with depths from 0 to .
Explores frontier like BFS, but with time and space complexity like DFS.
Monday, January 30 CS 430 Artificial Intelligence - Lecture 9 6
Iterative-DeepeningDepth-First Search (IDS)
Monday, January 30 CS 430 Artificial Intelligence - Lecture 9 7
Comparison of UninformedSearch Strategies
Criterion BFS UCS DFS DLS IDS
Complete? Yes Yes No No YesOptimal? Sometimes Yes No No SometimesTime O(bd) O(b1+C*/ε) O(bm) O(bl) O(bd)
Space O(bd) O(b1+C*/ε) O(bm) (O(bl) O(bd)
When using Tree-Search. Graph-Search makes DFS complete for finite
spaces and space and time complexity bounded by size of state space.
Monday, January 30 CS 430 Artificial Intelligence - Lecture 9 8
Informed Search Strategies
Previous search algorithms generated new states from problem definition data only.
If search uses problem-specific data beyond the problem definition can do an informed search much more efficiently.
General approach is a best-first strategy that bases selection on an evaluation function, traditionally called f(n), that is construed as a cost estimate.
Monday, January 30 CS 430 Artificial Intelligence - Lecture 9 9
Informed Search Strategies
Choice of f(n) determines the search strategy, and most best-first algorithms include a heuristic function, denoted h(n), where
h(n) = estimated cost of cheapest path from the state at node n to the goal state
For now, h(n) is an arbitrary, non-negative, problem specific function with constraint that h(n) = 0 when n is a goal node.
Monday, January 30 CS 430 Artificial Intelligence - Lecture 9 10
Greedy Best-First Search
Greedy best-first search expands the node that is believed to be the closest to the goal node by using f(n) = h(n).
E.g., for the Romanian map problem, can use the straight-line distance heuristic, denoted h
SLD.
Straight-line distanceto Bucharest
Monday, January 30 CS 430 Artificial Intelligence - Lecture 9 11
Example: Romanian Map
Choose Sibiu (253), then Faragas (176), then Bucharest (0), a goal node.
Start with Arad and expand to Sibiu (253), Timisoara (329), and Zerind (374).
Monday, January 30 CS 430 Artificial Intelligence - Lecture 9 12
Greedy Best-First Search
Note that the value of hSLD
cannot be computed
from the problem description.
Also, it takes experience to know that hSLD
is
correlated to actual road distances, and therefore a useful heuristic function.
Evaluation: Complete? Optimal? Time? Space?
Monday, January 30 CS 430 Artificial Intelligence - Lecture 9 13
Map of Romania
Monday, January 30 CS 430 Artificial Intelligence - Lecture 9 14
A* Search
Mostly widely known form of best-first search is called A* (pronounced "A-star") search. It uses
f(n) = g(n) + h(n)
where g(n) is the (actual) path cost to reach node n and h(n) is the estimated cost from node n to the goal, making f(n) the estimated cost of the cheapest solution through n.
Expand the node with the lowest f(n). Note if h(n) = 0 for all nodes, this is the same as uniform-cost search.
Monday, January 30 CS 430 Artificial Intelligence - Lecture 9 15
Example: Romanian Map
Choose Sibiu, then Rimnicu Vilcea (413=220+ 193), then Faragas (415 =239+176).
Start with Arad and expand to Sibiu (393=140+253), Timisoara (447=118+329), and Zerind (449=75+374).
Monday, January 30 CS 430 Artificial Intelligence - Lecture 9 16
Example: Romanian Map
Choose Pitesti, then Bucharest (418=418+0), a goal node.
Faragas expands to Sibiu and Bucharest, but next lowest node is Pitesti (417=317+100).
Monday, January 30 CS 430 Artificial Intelligence - Lecture 9 17
A* Search
Time? Space? Complete? Optimal?
Monday, January 30 CS 430 Artificial Intelligence - Lecture 9 18
Optimality of A* Search
For certain heuristic functions, A* search is both complete and optimal using Graph-Search.
First, h(n) must be an admissible heuristic, meaning that it never overestimates the cost to reach the goal.
E.g., hSLD
is admissible, since the straight-line
distance is the minimum distance between two points, it can never be shorter than the actual road distance between two cities.
Monday, January 30 CS 430 Artificial Intelligence - Lecture 9 19
Optimality of A* Search
Second, h(n) must be consistent, meaning that for every node n and every successor n' of n generated by any action a, the estimated cost of reaching the goal from n is no greater than the step cost of getting to n' plus the estimated cost of reaching the goal from n'. I.e.,
h(n) <= c(n, a, n') + h(n')
This a form of the triangle inequality: a side of a triangle cannot be longer than the sum of the other two sides.
Monday, January 30 CS 430 Artificial Intelligence - Lecture 9 20
Optimality of A* Search
Proof of A* optimality with consistent h(n): If h(n) is consistent, then the values of f(n)
along any path are non-decreasing. This follows directly from the definition of
consistency. Suppose n' is a successor to n, then g(n') = g(n) + c(n, a, n') for some action a, giving
f(n') = g(n') + h(n') = g(n) + c(n, a, n') + h(n') >= g(n) + h(n) = f(n)
Monday, January 30 CS 430 Artificial Intelligence - Lecture 9 21
Optimality of A* Search
Whenever A* selects a node n for expansion, the optimal path to that node has been found.
Prove this by contradiction: If this was not the case, there would have to be another frontier node n' on the optimal path from the start node to n by the graph separation property of Graph-Search. Because f is non-decreasing along any path, n' would have a lower f-cost than n and would have been selected first.
Monday, January 30 CS 430 Artificial Intelligence - Lecture 9 22
Optimality of A* Search
Thus the sequence of nodes expanded by A* is in non-decreasing order of f(n).
Hence the first goal node selected for expansion must be an optimal solution, because f(n) is the true cost (h(n) = 0) and all later nodes will be at least as expensive.
Monday, January 30 CS 430 Artificial Intelligence - Lecture 9 23
Optimality of A* Search
Then A* expands some nodes on the goal contour (f(n) = C*) before selecting a goal node.
Can draw this as contours in the search space. For example, in the Romanian map, the contour labeled 400 encloses all nodes that have f(n) <= 400.
A* expands all nodes with f(n) < C*
Monday, January 30 CS 430 Artificial Intelligence - Lecture 9 24
Optimality of A* Search
Note: A* expands no nodes with f(n) > C*, effectively pruning away parts of the search space without having to examine them.
Among algorithms that extend search paths from the root and use the same heuristic function, A* is optimally efficient, meaning that no other optimal algorithm is guaranteed to expand fewer nodes than A*.