Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 416 Artificial Intelligence Lecture 4 Uninformed Searches (cont) Lecture 4 Uninformed Searches (cont)

Similar presentations


Presentation on theme: "CS 416 Artificial Intelligence Lecture 4 Uninformed Searches (cont) Lecture 4 Uninformed Searches (cont)"— Presentation transcript:

1 CS 416 Artificial Intelligence Lecture 4 Uninformed Searches (cont) Lecture 4 Uninformed Searches (cont)

2 Chess Kasparov won the first chess game

3 Cost of Breadth-first Search (BFS) b – max branching factor (infinite?)b – max branching factor (infinite?) d – depth to shallowest goal noded – depth to shallowest goal node m – max length of any path (infinite?)m – max length of any path (infinite?) Analysis of space and time performance…Analysis of space and time performance… –see example on blackboard –big Oh = O(f(n)) is the asymptotic upper bound –means that there are positive constants c and n 0 such that  0 = n 0  Read algorithms textbook if this is new to you b – max branching factor (infinite?)b – max branching factor (infinite?) d – depth to shallowest goal noded – depth to shallowest goal node m – max length of any path (infinite?)m – max length of any path (infinite?) Analysis of space and time performance…Analysis of space and time performance… –see example on blackboard –big Oh = O(f(n)) is the asymptotic upper bound –means that there are positive constants c and n 0 such that  0 = n 0  Read algorithms textbook if this is new to you

4 BFS Space Requirements What’s important is the path, not just the existence of the goal in the tree.What’s important is the path, not just the existence of the goal in the tree. We must be able to reconstruct the path to the goal.We must be able to reconstruct the path to the goal. We’ve got to store the tree for reconstruction.We’ve got to store the tree for reconstruction. What’s important is the path, not just the existence of the goal in the tree.What’s important is the path, not just the existence of the goal in the tree. We must be able to reconstruct the path to the goal.We must be able to reconstruct the path to the goal. We’ve got to store the tree for reconstruction.We’ve got to store the tree for reconstruction.

5 Cost of Uniform Search See example on blackboard

6 Cost of Depth-first Search time complexity = O (b m )time complexity = O (b m ) –length of longest path anchors upper bound space complexity = O (bm)space complexity = O (bm) What’s an example that highlights difference in performance between BFS and DFS?What’s an example that highlights difference in performance between BFS and DFS? time complexity = O (b m )time complexity = O (b m ) –length of longest path anchors upper bound space complexity = O (bm)space complexity = O (bm) What’s an example that highlights difference in performance between BFS and DFS?What’s an example that highlights difference in performance between BFS and DFS?

7 Iterative Deepening Essentially DFS with a depth limit Why? Remember the space complexity, O(bm) and time complexity, O(b m ) of DFS?Remember the space complexity, O(bm) and time complexity, O(b m ) of DFS? So... limit m to be smallSo... limit m to be small But what if m is smaller than d?But what if m is smaller than d? –we’ll never find solution So… increment depth limit starting from 0So… increment depth limit starting from 0 Essentially DFS with a depth limit Why? Remember the space complexity, O(bm) and time complexity, O(b m ) of DFS?Remember the space complexity, O(bm) and time complexity, O(b m ) of DFS? So... limit m to be smallSo... limit m to be small But what if m is smaller than d?But what if m is smaller than d? –we’ll never find solution So… increment depth limit starting from 0So… increment depth limit starting from 0

8 Cost of Iterative Deepening See example on blackboard Preferred uninformed search method when search space is large and depth of solution is not known See example on blackboard Preferred uninformed search method when search space is large and depth of solution is not known

9 Bidirectional Search Search from goal to start Search from start to goal See example on blackboard Search from goal to start Search from start to goal See example on blackboard

10 Bidirectional Search Do you always know the predecessors of a goal state?Do you always know the predecessors of a goal state? Do you always know the goal state?Do you always know the goal state? –8-puzzle –Path planning –Chess Do you always know the predecessors of a goal state?Do you always know the predecessors of a goal state? Do you always know the goal state?Do you always know the goal state? –8-puzzle –Path planning –Chess

11 Avoid Repeated States How might you create repeated states in 8-puzzle? How can you detect repeated states? What about preserving lowest cost path among repeated states? uniform-cost search and BFS w/ constant step costsuniform-cost search and BFS w/ constant step costs How might you create repeated states in 8-puzzle? How can you detect repeated states? What about preserving lowest cost path among repeated states? uniform-cost search and BFS w/ constant step costsuniform-cost search and BFS w/ constant step costs

12 Interesting problems Exercise 3.9: 3 cannibals and 3 missionaries and a boat that can hold one or two people are on one side of the river. Get everyone across the river.3 cannibals and 3 missionaries and a boat that can hold one or two people are on one side of the river. Get everyone across the river. 8-puzzle and 15-puzzle, invented by Sam Loyd in good ol’ USA in 1870s. Think about search space.8-puzzle and 15-puzzle, invented by Sam Loyd in good ol’ USA in 1870s. Think about search space. Rubik’s cubeRubik’s cube Traveling Salesman Problem (TSP)Traveling Salesman Problem (TSP) Exercise 3.9: 3 cannibals and 3 missionaries and a boat that can hold one or two people are on one side of the river. Get everyone across the river.3 cannibals and 3 missionaries and a boat that can hold one or two people are on one side of the river. Get everyone across the river. 8-puzzle and 15-puzzle, invented by Sam Loyd in good ol’ USA in 1870s. Think about search space.8-puzzle and 15-puzzle, invented by Sam Loyd in good ol’ USA in 1870s. Think about search space. Rubik’s cubeRubik’s cube Traveling Salesman Problem (TSP)Traveling Salesman Problem (TSP)

13 Chapter 4 – Informed Search INFORMED? Uses problem-specific knowledge beyond the definition of the problem itselfUses problem-specific knowledge beyond the definition of the problem itself –selecting best lane in traffic –playing a sport  what’s the heuristic (or evaluation function)? INFORMED? Uses problem-specific knowledge beyond the definition of the problem itselfUses problem-specific knowledge beyond the definition of the problem itself –selecting best lane in traffic –playing a sport  what’s the heuristic (or evaluation function)? www.curling.ca

14 Best-first Search Use an evaluation function to select node to expand f(n) = evaluation function = expected distance to goalf(n) = evaluation function = expected distance to goal select the node that minimizes f(n)select the node that minimizes f(n) but if we knew the ‘best’ node to explore it wouldn’t be search!!!but if we knew the ‘best’ node to explore it wouldn’t be search!!! Let’s use heuristics for our evaluation functionsLet’s use heuristics for our evaluation functions Use an evaluation function to select node to expand f(n) = evaluation function = expected distance to goalf(n) = evaluation function = expected distance to goal select the node that minimizes f(n)select the node that minimizes f(n) but if we knew the ‘best’ node to explore it wouldn’t be search!!!but if we knew the ‘best’ node to explore it wouldn’t be search!!! Let’s use heuristics for our evaluation functionsLet’s use heuristics for our evaluation functions

15 Heuristics A function, h(n), that estimates cost of cheapest path from node n to the goal h(n) = 0 if n == goal nodeh(n) = 0 if n == goal node A function, h(n), that estimates cost of cheapest path from node n to the goal h(n) = 0 if n == goal nodeh(n) = 0 if n == goal node

16 Greedy Best-first Search Trust your heuristic evaluate node that minimizes h(n)evaluate node that minimizes h(n) f(n) = h(n)f(n) = h(n) Example: getting from A to B Explore nodes with shortest straight distance to BExplore nodes with shortest straight distance to B Shortcomings of heuristic?Shortcomings of heuristic? –slow route (traffic), long route, dead end Trust your heuristic evaluate node that minimizes h(n)evaluate node that minimizes h(n) f(n) = h(n)f(n) = h(n) Example: getting from A to B Explore nodes with shortest straight distance to BExplore nodes with shortest straight distance to B Shortcomings of heuristic?Shortcomings of heuristic? –slow route (traffic), long route, dead end

17 A* (A-star) Search Combine two costs f(n) = g(n) + h(n)f(n) = g(n) + h(n) –g(n) = cost to get to n –h(n) = cost to get to goal from n Minimize f(n) Combine two costs f(n) = g(n) + h(n)f(n) = g(n) + h(n) –g(n) = cost to get to n –h(n) = cost to get to goal from n Minimize f(n)

18 A* is Optimal? A* can be optimal if h(n) satisfies conditions h(n) never overestimates cost to reach the goalh(n) never overestimates cost to reach the goal –admissible heurisitic –h(n) is optimistic –f(n) never overestimates cost of a solution through n Proof of optimality?Proof of optimality? A* can be optimal if h(n) satisfies conditions h(n) never overestimates cost to reach the goalh(n) never overestimates cost to reach the goal –admissible heurisitic –h(n) is optimistic –f(n) never overestimates cost of a solution through n Proof of optimality?Proof of optimality?

19 A* is Optimal We must prove that A* will not return a suboptimal goal or a suboptimal path to a goal Let G be a suboptimal goal nodeLet G be a suboptimal goal node –f(G) = g(G) + h(G) –h(G) = 0 because G is a goal node –f(G) = g(G) > C* (because G is suboptimal) We must prove that A* will not return a suboptimal goal or a suboptimal path to a goal Let G be a suboptimal goal nodeLet G be a suboptimal goal node –f(G) = g(G) + h(G) –h(G) = 0 because G is a goal node –f(G) = g(G) > C* (because G is suboptimal)

20 A* is Optimal We must prove that A* will not return a suboptimal goal or a suboptimal path to a goal Let G be a suboptimal goal nodeLet G be a suboptimal goal node –f(G) = g(G) + h(G) –h(G) = 0 because G is a goal node –f(G) = g(G) > C* (because G is suboptimal) We must prove that A* will not return a suboptimal goal or a suboptimal path to a goal Let G be a suboptimal goal nodeLet G be a suboptimal goal node –f(G) = g(G) + h(G) –h(G) = 0 because G is a goal node –f(G) = g(G) > C* (because G is suboptimal) Let n be a node on the optimal pathLet n be a node on the optimal path –because h(n) does not overestimate –f(n) = g(n) + h(n) <= C* Therefore f(n) <= C* < f(G)Therefore f(n) <= C* < f(G) –node n will be selected before node G Let n be a node on the optimal pathLet n be a node on the optimal path –because h(n) does not overestimate –f(n) = g(n) + h(n) <= C* Therefore f(n) <= C* < f(G)Therefore f(n) <= C* < f(G) –node n will be selected before node G


Download ppt "CS 416 Artificial Intelligence Lecture 4 Uninformed Searches (cont) Lecture 4 Uninformed Searches (cont)"

Similar presentations


Ads by Google