Search in Artificial Intelligence zFind the next move in chess, checkers. zScheduling: finding a good class schedule. zTheorem proving: given a set of axioms and inference rules, find a proof of a theorem. zPlanning: find a sequence of actions to achieve a goal for a robot. zNatural language understanding: find the best parse of a sentence.
Dimensions of Search Problems zIn its general form: find a desired object among a set of objects. zSometimes, you don’t even know if the object exists or not. zIn other cases, the goal is to find the best object. zBlind vs. informed search.
3 Specifying a search problem? zWhat are states (nodes in graph)? zWhat are the operators (arcs between nodes)? zInitial state? zGoal test zMetric (e.g., distance to goal) E.g., Eight Puzzle
Search zTypes of Search yBlind yHeuristic & optimization yAdversary Search zAnalysis yCompleteness yTime complexity ySpace Complexity yGuaranteed to find best solution? yGuaranteed to find the closest solution?
5 Search Strategies zBlind Search yGenerate & test yDepth first search yBreadth first search yIterative deepening search yIterative broadening search zHeuristic search zOptimizing search
O(b^d) O(d) Not for infinite spaces Depth First Search a b cd e f gh zMaintain stack of nodes to visit zEvaluation yComplete? yTime Complexity? ySpace Complexity?
Yes O(b^d) Breadth First Search a b c def gh zMaintain queue of nodes to visit zEvaluation yComplete? yTime Complexity? ySpace Complexity?
Yes O(b^d) O(d) Iterative Deepening Search a b c d e f gh zDFS with limit; incrementally grow limit zEvaluation yComplete? yTime Complexity? ySpace Complexity? j i k L
9 Search Strategies zBlind Search zHeuristic Search yBest-first yBeam yHill climbing ySimulated annealing zOptimizing Search
Heuristic Search zA heuristic (metric) is: yFunction from a state to a real number xLow number means state is close to goal xHigh number means state is far from the goal Designing a good heuristic is very important! (And hard) More on this in a bit...
No O(b^d) zIdea yBreadth first but use priority queue instead of a queue zEvaluation yComplete? yTime Complexity? ySpace Complexity? Best First Search a b c d e f ghj i k L
No O(b^d) O(b + N) Beam Search zIdea yBest first but only keep N best items on priority queue zEvaluation yComplete? yTime Complexity? ySpace Complexity? a b c d e f ghj i k L
No - suffers from plateau, local maxima, ridges O(b^d) but only in pathological cases O(b) Hill Climbing zIdea yAlways choose best child; no backtracking zEvaluation yComplete? yTime Complexity? ySpace Complexity? a b c d e f ghj i k L
Simulated Annealing zObjective: avoid local minima zTechnique: yFor the most part use hill climbing yOccasionally take non-optimal step yReduce probability(non-optimal) over time zComparison to Hill Climbing yCompleteness? ySpeed? ySpace Complexity? temp
15 Search Strategies zBlind Search zHeuristic Search zOptimizing Search yA* yIDA* ySMA* Objective is to find the very best solution.
A* Search zIdea yBest first search with admissible heuristic yPlus keep checking until all possibilities look worse zEvaluation yFinds optimal solution? yTime Complexity? ySpace Complexity? Yes O(b^d) Underestimates cost of any solution which can reached from node {
Admissible Heuristics zf(x) = g(x) + h(x) zg: cost so far zh: underestimate of remaining costs a b c d e f For eight puzzle?
Importance of Heuristics D IDS A*(h1)A*(h2) zh1 = number of tiles in wrong place zh2 = sum of distances of tiles from correct loc
Iterative Deepening A* zLike iterative deepening depth first, but... zDepth bound modified to be an f-cost limit zContour lines bounding search a b c d e f F=15 F=21
SMA* zProblem is f-cost bound increases slowly zMust do iterative search again and again zStoring little state between each iteration yJust one number: next highest contour level zSMA* yUses all available memory to store state yDuplicates minimal work yOptimal in a number of nice ways
Adversary Search zGame playing: want to make the move for which the opponent cannot respond well. a b c d e f ghj i k L c f gh c f h c f g c f gh max min
Alpha-beta Pruning z a b c d e f ghj i k L c f c f c f c f max min max