Computer Science CPSC 322 Lecture 9 (Ch 3.7.1 - 3.7.4, 3.7.6) Slide 1.

Slides:



Advertisements
Similar presentations
BEST FIRST SEARCH - BeFS
Advertisements

Review: Search problem formulation
Uninformed search strategies
Informed search strategies
An Introduction to Artificial Intelligence
CPSC 322, Lecture 5Slide 1 Uninformed Search Computer Science cpsc322, Lecture 5 (Textbook Chpt 3.5) Sept, 14, 2012.
Traveling Salesperson Problem
Solving Problem by Searching
Artificial Intelligence Chapter 9 Heuristic Search Biointelligence Lab School of Computer Sci. & Eng. Seoul National University.
1 Lecture 3 Uninformed Search. 2 Uninformed search strategies Uninformed: While searching you have no clue whether one non-goal state is better than any.
CPSC 322, Lecture 5Slide 1 Uninformed Search Computer Science cpsc322, Lecture 5 (Textbook Chpt 3.4) January, 14, 2009.
Uninformed Search Jim Little UBC CS 322 – Search 2 September 12, 2014
CPSC 322, Lecture 10Slide 1 Finish Search Computer Science cpsc322, Lecture 10 (Textbook Chpt 3.6) January, 28, 2008.
Slide 1 Finish Search Jim Little UBC CS 322 – Search 7 September 24, 2014 Textbook §3.6.
Slide 1 Heuristic Search: BestFS and A * Jim Little UBC CS 322 – Search 5 September 19, 2014 Textbook § 3.6.
Slide 1 Search: Advanced Topics Jim Little UBC CS 322 – Search 5 September 22, 2014 Textbook § 3.6.
CPSC 322, Lecture 9Slide 1 Search: Advanced Topics Computer Science cpsc322, Lecture 9 (Textbook Chpt 3.6) January, 23, 2009.
CPSC 322 Introduction to Artificial Intelligence October 27, 2004.
CPSC 322, Lecture 10Slide 1 Finish Search Computer Science cpsc322, Lecture 10 (Textbook Chpt 3.6) January, 25, 2010.
CPSC 322, Lecture 9Slide 1 Search: Advanced Topics Computer Science cpsc322, Lecture 9 (Textbook Chpt 3.6) January, 22, 2010.
Review: Search problem formulation
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 580 Artificial Intelligence Ch.3 [P]: Searching Fall 2009 Marco Valtorta.
CPSC 322, Lecture 12Slide 1 CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12 (Textbook Chpt ) January, 29, 2010.
Blind Search-Part 2 Ref: Chapter 2. Search Trees The search for a solution can be described by a tree - each node represents one state. The path from.
CPSC 322, Lecture 8Slide 1 Heuristic Search: BestFS and A * Computer Science cpsc322, Lecture 8 (Textbook Chpt 3.5) January, 21, 2009.
CS 188: Artificial Intelligence Spring 2006 Lecture 2: Queue-Based Search 8/31/2006 Dan Klein – UC Berkeley Many slides over the course adapted from either.
Uninformed Search (cont.)
Multiple Path Pruning, Iterative Deepening CPSC 322 – Search 7 Textbook § January 26, 2011.
Review: Search problem formulation Initial state Actions Transition model Goal state (or goal test) Path cost What is the optimal solution? What is the.
Informed Search Strategies
Problem Solving and Search Andrea Danyluk September 11, 2013.
Computer Science CPSC 322 Lecture Heuristic Search (Ch: 3.6, 3.6.1) Slide 1.
Computer Science CPSC 322 Lecture A* and Search Refinements (Ch 3.6.1, 3.7.1, 3.7.2) Slide 1.
Lecture 2 Search (textbook Ch: 3)
Branch & Bound, CSP: Intro CPSC 322 – CSP 1 Textbook § & January 28, 2011.
P ROBLEM Write an algorithm that calculates the most efficient route between two points as quickly as possible.
Informed search strategies Idea: give the algorithm “hints” about the desirability of different states – Use an evaluation function to rank nodes and select.
For Monday Read chapter 4, section 1 No homework..
Search with Costs and Heuristic Search 1 CPSC 322 – Search 3 January 17, 2011 Textbook §3.5.3, Taught by: Mike Chiang.
Review: Tree search Initialize the frontier using the starting state While the frontier is not empty – Choose a frontier node to expand according to search.
Lecture 3: Uninformed Search
Heuristic Search: A* 1 CPSC 322 – Search 4 January 19, 2011 Textbook §3.6 Taught by: Vasanth.
1 Branch and Bound Searching Strategies Updated: 12/27/2010.
Computer Science CPSC 322 Lecture 6 Iterative Deepening and Search with Costs (Ch: 3.7.3, 3.5.3)
Informed Search and Heuristics Chapter 3.5~7. Outline Best-first search Greedy best-first search A * search Heuristics.
Uninformed search strategies A search strategy is defined by picking the order of node expansion Uninformed search strategies use only the information.
Slides by: Eric Ringger, adapted from slides by Stuart Russell of UC Berkeley. CS 312: Algorithm Design & Analysis Lecture #36: Best-first State- space.
CPSC 322, Lecture 8Slide 1 Heuristic Search: BestFS and A * Computer Science cpsc322, Lecture 8 (Textbook Chpt 3.6) Sept, 21, 2010.
Informed Search CSE 473 University of Washington.
CPSC 322, Lecture 6Slide 1 Uniformed Search (cont.) Computer Science cpsc322, Lecture 6 (Textbook finish 3.5) Sept, 17, 2012.
A* optimality proof, cycle checking CPSC 322 – Search 5 Textbook § 3.6 and January 21, 2011 Taught by Mike Chiang.
1 CSC 384 Lecture Slides (c) , C. Boutilier and P. Poupart CSC384: Lecture 10  Last time A*  Today complete A*, iterative deepening  Announcements:
Chapter 3.5 and 3.6 Heuristic Search Continued. Review:Learning Objectives Heuristic search strategies –Best-first search –A* algorithm Heuristic functions.
CPSC 322, Lecture 5Slide 1 Uninformed Search Computer Science cpsc322, Lecture 5 (Textbook Chpt 3.5) Sept, 13, 2013.
Solving problems by searching Uninformed search algorithms Discussion Class CS 171 Friday, October, 2nd (Please read lecture topic material before and.
CPSC 322, Lecture 10Slide 1 Finish Search Computer Science cpsc322, Lecture 10 (Textbook Chpt 3.6) Sep, 26, 2010.
CPSC 322, Lecture 7Slide 1 Heuristic Search Computer Science cpsc322, Lecture 7 (Textbook Chpt 3.6) Sept, 20, 2013.
Computer Science CPSC 322 Lecture 6 Analysis of A*, Search Refinements (Ch ) Slide 1.
Chapter 3.5 Heuristic Search. Learning Objectives Heuristic search strategies –Best-first search –A* algorithm Heuristic functions.
Computer Science CPSC 322 Lecture 5 Heuristic Search and A* (Ch: 3.6, 3.6.1) Slide 1.
Review: Tree search Initialize the frontier using the starting state
Uniformed Search (cont.) Computer Science cpsc322, Lecture 6
Search: Advanced Topics Computer Science cpsc322, Lecture 9
Branch & Bound, Summary of Advanced Topics
Search: Advanced Topics Computer Science cpsc322, Lecture 9
Uniformed Search (cont.) Computer Science cpsc322, Lecture 6
Informed search algorithms
Search: Advanced Topics Computer Science cpsc322, Lecture 9
Iterative Deepening CPSC 322 – Search 6 Textbook § 3.7.3
Iterative Deepening and Branch & Bound
Presentation transcript:

Computer Science CPSC 322 Lecture 9 (Ch , 3.7.6) Slide 1

Announcements Midterm: Friday Feb See update schedule on website Slide 2

Slide 3 Lecture Overview Recap of Lecture 8 Cycle checking, multiple path pruning Branch-and-Bound Other A* refinements

Apply basic properties of search algorithms: - completeness, optimality, time and space complexity CompleteOptimalTimeSpace DFSN (Y if no cycles) NO(b m )O(mb) BFSYYO(b m ) IDSYYO(b m )O(mb) LCFS (when arc costs available) Y Costs > 0 Y Costs >=0 O(b m ) Best First (when h available) NNO(b m ) A* (when arc costs > 0 and h admissible) YYO(b m ) Recap 4

Proved A* optimality under admissibility conditions Discussed A* as optimally efficient No other optimal algorithm is guaranteed to expand fewer nodes than A* Slide 5

Slide 6 Lecture Overview Recap of Lecture 8 Cycle checking, multiple path pruning Branch-and-Bound Other A* refinements

Clarification: state space graph vs search tree kc b z h a d f State space graph represents the states in a search problem, and how they are connected by the available operators Search Tree: Shows how the search space is traversed by a given search algorithm: explicitly “unfolds” the paths that are expanded. k c b z h a d f If there are no cycles or multiple paths, the two look the same 7

Clarification: state space graph vs search tree kc b z h a d f State space graph k cb z k ad c If there are cycles or multiple paths, the two look very different Search Tree: (first three levels) h b k cbf 8

Size of state space vs. search tree If there are cycles or multiple paths, the two look very different A B C D A B C B CCC DD E.g. state space with d states and 2 actions from each state to next With d + 1 states, search tree has depth d 2 d possible paths through the search space => exponentially larger search tree! With cycles or multiple parents, the search tree can be exponential in the state space 9

Cycle Checking and Multiple Path Pruning Cycle checking: good when we want to avoid infinite loops, but also want to find more than one solution, if they exist Multiple path pruning: good when we only care about finding one solution Subsumes cycle checking 10

What is the computational cost of cycle checking? Cycle Checking You can prune a path that ends in a node already on the path. This pruning cannot remove an optimal solution => cycle check Good when we want to avoid infinite loops, but also want to find more than one solution, if they exist 11

Cycle Checking See how DFS and BFS behave on Cyclic Graph Example in Aispace, when Search Options-> Pruning -> Loop detection is selected Set N1 to be a normal node so that there is only one start node. Check, for each algorithm, what happens during the first expansion from node 3 to node 2 12

Depth First Search Since DFS looks at one path at a time, when a node is encountered for the second time (e.g. Node 2 while expanding N0, N2, N5, N3) it is guaranteed to be part of a cycle. 13

Breadth First Search Since BFS keeps multiple subpaths going, when a node is encountered for the second time, it could be as part of expanding a different path (e.g. Node 2 while expanding N0-.N3). Not necessarily a cycle. 14

Breadth First Search The cycle for BFS happens when N2 is encountered for the second time while expanding the path N0-.N2- N5-N3. 15

Computational Cost of Cycle Checking? D. None of the above B. Linear time in the path length: before adding a new node to the currently selected path, check that the node is not already part of the path A. As low as Constant time: (e.g., set a bit to 1 when a node is selected for expansion, and never expand a node with a bit set to 1) C. It depends on the algorithm 16

Computational Cost of Cycle Checking? D. None of the above B. Linear time in the path length: before adding a new node to the currently selected path, check that the node is not already part of the path A. As low as constant time: (e.g., set a bit to 1 when a node is selected for expansion, and never expand a node with a bit set to 1) C. It depends on the algorithm 17

What is the computational cost of cycle checking? Cycle Checking You can prune a path that ends in a node already on the path. This pruning cannot remove an optimal solution => cycle check Using depth-first methods, with the graph explicitly stored, this can be done in constant time -Only one path being explored at a time Other methods: cost is linear in path length -check each node in the path 18

If we only want one path to the solution Can prune path to a node n that has already been reached via a previous path -Subsumes cycle check Multiple Path Pruning n 19

Can see how it works by –Running BFS on the Cyclic Graph Example in CISPACE –See how it handles the multiple paths from N0 to N2 –You can erase start node N1 to simplify things Multiple Path Pruning n 20

Multiple-Path Pruning & Optimal Solutions Problem: what if a subsequent path p 2 to n is better (shorter or less costly) than the first path p 1 to n, and we want an optimal solution ? Can remove all paths from the frontier that use the longer path: these can’t be optimal. Can change the initial segment of the paths on the frontier to use the shorter or Can prove that this can’t happen for an algorithm? p1 p2 21

“ Whenever search algorithm X expands the first path p ending in node n, this is the lowest-cost path from the start node to n (if all costs ≥ 0)” This is true for D. None of the above A. Lowest Cost Search First C. Both of the above B. A* Can prove that search algorithm X always find the optimal path to any node n in the search space first? 22

“ Whenever search algorithm X expands the first path p ending in node n, this is the lowest-cost path from the start node to n (if all costs ≥ 0)” This is true for D. None of the above A. Lowest Cost Search First C. Both of the above B. A* Can prove that search algorithm X always find the optimal path to any node n in the search space first? 23

Which of the following algorithms always find the shortest path to nodes on the frontier first? Only Least Cost First Search Counter-example for A*: it expands the upper path first Special conditions on the heuristic can recover the guarantee of LCFS for A*: the monotone restriction (See P&M text, Section 3.7.2) Start10 0 1Goal 24

25

Slide 26 Lecture Overview Recap of Lecture 8 Cycle checking, multiple path pruning Branch-and-Bound Other A* refinements

Branch-and-Bound Search What does allow A* to do better than the other search algorithms we have seen? Arc cost and h(h) combined in f(n) What is the biggest problem with A*? space Possible Solution: Combine DFS with f 27

Branch-and-Bound Search One way to combine DFS with heuristic guidance Follows exactly the same search path as depth-first search But to ensure optimality, it does not stop at the first solution found It continues, after recording upper bound on solution cost upper bound: UB = cost of the best solution found so far Initialized to  or any overestimate of optimal solution cost When a path p is selected for expansion: Compute lower bound LB(p) = f(p) = cost(p) + h(p) - If LB(p)  UB, remove p from frontier without expanding it (pruning) - Else expand p, adding all of its neighbors to the frontier 28

Example Arc cost = 1 h(n) = 0 for every n UB = ∞ Solution! UB = 5 Before expanding a path p, check its f value f(p): Expand only if f(p) < UB 29 Simplifications for clarity

Example Arc cost = 1 h(n) = 0 for every n UB = 5 Cost = 5 Prune! 30

Example Arc cost = 1 h(n) = 0 for every n UB = 5 Cost = 5 Prune! Cost = 5 Prune! Solution! UB =? 31

Example Arc cost = 1 h(n) = 0 for every n UB = 3 Cost = 3 Prune! Cost = 3 Prune! Cost = 3 Prune! 32

Branch-and-Bound Analysis Complete ? Optimal: Space complexity: Time complexity: ……. 33

Is Branch-and-Bound optimal? D. Only if there are no cycles A. YES, with no further conditions C. Only if h(n) is admissible B. NO Branch-and-Bound Analysis 34

Is Branch-and-Bound optimal? D. Only if there are no cycles A. YES, with no further conditions C. Only if h(n) is admissible. Otherwise, when checking LB(p)  UB, if the answer is yes but h(p) is an overestimate of the actual cost of p, we remove a possibly optomal solution B. NO Branch-and-Bound Analysis 35

Branch-and-Bound Analysis Complete ? (..even when there are cycles) B. NO A. YES C. It depends 36

Branch-and-Bound Analysis Complete ? (..even when there are cycles) IT DEPENDS on whether we can initialize UB to a finite value, i.e. we have a reliable overestimate of the solution cost. If we don`t, we need to use ∞, and BBA can be caught in a cycle 37

Branch-and-Bound Analysis Complete ? Same as DFS: can’t handle cycles/infinite graphs. But complete if initialized with some finite U Optimal: YES, if h(n) is admissible Space complexity: Branch & Bound has the same space complexity as DFS this is a big improvement over A*! Time complexity O(b m ) 38

Learning Goals for today’s class Pruning cycles and multiple paths Define/read/write/trace/debug different search algorithms - In more detail today: Branch-and-Bound Slide 39

CompleteOptimalTimeSpace DFSNNO(b m )O(mb) BFSYYO(b m ) IDSYYO(b m )O(mb) LCFS (when arc costs available) Y Costs > 0 Y Costs >=0 O(b m ) Best First (when h available) NNO(b m ) A* (when arc costs > 0 and h admissible ) YY O(b m ) Optimally Efficient O(b m ) Branch-and-BoundN (Y with finite initial bound) Y If h admissible O(b m ) Search Methods so Far Slide 40

Next class: Fri Read 3.6 (Dynamic programming) 4.1 and 4.2 (Intro to CSP) Keep working on assignment-1 ! Do Practice Exercise 3D Slide 41