Problem Solving and Search Andrea Danyluk September 11, 2013.

download Problem Solving and Search Andrea Danyluk September 11, 2013.

If you can't read please download the document

Transcript of Problem Solving and Search Andrea Danyluk September 11, 2013.

  • Slide 1
  • Problem Solving and Search Andrea Danyluk September 11, 2013
  • Slide 2
  • Announcements Progamming Assignment 0: Python Tutorial Due now Thanks for your patience with account set-up, turnin, etc. Assignment 1: Search Now posted on web site Due Fri, Sep 20 Team project! (35 students) First few parts straightforward. Dont be fooled. It gets harder.
  • Slide 3
  • Todays Lecture More on Uninformed search Breadth-first Depth-first Uniform-cost search New Informed (Heuristic) search Greedy best-first
  • Slide 4
  • Formalizing State Space Search A node in a search tree typically contains: A state description A reference to the parent node The name of the operator that generated it from its parent The cost of the path from the initial state to itself Might also include its depth in the tree The node that is the root of the search tree typically represents the initial state
  • Slide 5
  • Formalizing State Space Search Child nodes are generated by applying legal operators to a node The process of expanding a node means to generate all of its successor nodes and to add them to the frontier. A goal test is a function applied to a state to determine whether its associated node is a goal node
  • Slide 6
  • Formalizing State Space Search A solution is either A sequence of operators that is associated with a path from start state to goal or A state that satisfies the goal test The cost of a solution is the sum of the arc costs on the solution path If all arcs have the same (unit) cost, then the solution cost is just the length of the solution (i.e., the length of the path)
  • Slide 7
  • Evaluating Search Strategies Completeness Is the strategy guaranteed to find a solution when there is one? Optimality Does the strategy find the highest-quality solution when there are several solutions? Time Complexity How long does it take (in the worst case) to find a solution? Space Complexity How much memory is required (in the worst case)?
  • Slide 8
  • Evaluating BFS Complete? Yes (if the number of possible actions is finite) Optimal? Not in general. When is it optimal? When costs of all actions are the same Time Complexity? How do we measure it? Space Complexity?
  • Slide 9
  • Time and Space Complexity Let b = branching factor (i.e., max number of successors) m = maximum depth of the search tree d = depth of shallowest solution For BFS Time: O(b d ) If we check for goal as we generate a node! Not if we check as we get ready to expand! Space: O(b d )
  • Slide 10
  • Evaluating DFS Complete? Not in general Yes if state space is finite and we modify tree search to account for loops Optimal? No Time Complexity? O(b m ) Space Complexity? O(mb)
  • Slide 11
  • Depth-Limited DFS? Let l be the depth limit Complete? No Optimal? No Time Complexity? O(b l ) Space Complexity? O(m l )
  • Slide 12
  • Iterative Deepening? Complete? Yes (if b is finite) Optimal? Yes (if costs of all actions are the same) Time Complexity? O(b d ) Space Complexity? O(bd)
  • Slide 13
  • Costs on Actions
  • Slide 14
  • Cost of moving a truck = 2x the cost of moving a car that isnt a sports car. Cost of moving a sports car is 4x the cost of moving any other vehicle.
  • Slide 15
  • Uniform Cost Search a a b b h h g g c c f f e e d d i i 2 3 1 1 1 1 2 3 3.5 4 5 3 3.75 3 Fringe is a Priority Queue Priority = cost so far Similar to another algorithm you know?
  • Slide 16
  • Evaluating Uniform Cost Search Complete? Yes (if b is finite and step cost for positive ) Optimal? Yes Time Complexity? O(b 1+C*/ ) Cant check for goal until coming out of PQ! Space Complexity? O(b 1+C*/ )
  • Slide 17
  • Generalized Search Function S EARCH (problem, frontier) returns a solution, or failure expanded an empty set frontier Insert(Make-Node(Initial-State[problem]), frontier) loop do if frontier is empty then return failure node Remove(frontier) if Goal-Test(problem, State[node]) then return node if State[node] is not in explored then add State[node] to explored frontier InsertAll(Expand(node, problem), frontier) end But be careful about slight (and yet significant) differences!
  • Slide 18
  • So were done, right? Our search spaces are big.
  • Slide 19
  • Informed (Heuristic) Search Strategies Use problem-specific knowledge to find solutions more efficiently
  • Slide 20
  • Best-first Search Choose a node from the frontier based on its desirability Frontier is a priority queue Requires a search heuristic Any estimate of how close a state is to a goal Examples: Euclidean distance Manhattan distance For the rush hour problem?
  • Slide 21
  • Greedy Best-first Search h(n) = estimate of cost from n to the closest goal Expand the node with lowest h value - i.e., the node that appears to be closest to the goal
  • Slide 22
  • Greedy Search with h SLD a a b b h h g g c c f f e e d d i i 2 3 1 1 1 1 2 3 3.5 4 5 3 3.75 3 a6 b2.5 c6 d3 e1.5 f3 g0 h3.5 i6.5 black4.5 red3.5 yellow2.5 This time g is the goal.
  • Slide 23
  • Problems with Greedy Search? Can be quite good with a high-quality heuristic, but Not optimal Time and space complexity: O(b m )