Search with Costs and Heuristic Search 1 CPSC 322 – Search 3 January 17, 2011 Textbook §3.5.3, 3.6.1 Taught by: Mike Chiang.

Slides:



Advertisements
Similar presentations
Uninformed search strategies
Advertisements

CPSC 322, Lecture 5Slide 1 Uninformed Search Computer Science cpsc322, Lecture 5 (Textbook Chpt 3.5) Sept, 14, 2012.
1 Heuristic Search Chapter 4. 2 Outline Heuristic function Greedy Best-first search Admissible heuristic and A* Properties of A* Algorithm IDA*
ICS-171:Notes 4: 1 Notes 4: Optimal Search ICS 171 Summer 1999.
Problem Solving Agents A problem solving agent is one which decides what actions and states to consider in completing a goal Examples: Finding the shortest.
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.
Solving Problems by Searching Currently at Chapter 3 in the book Will finish today/Monday, Chapter 4 next.
Properties of breadth-first search Complete? Yes (if b is finite) Time? 1+b+b 2 +b 3 +… +b d + b(b d -1) = O(b d+1 ) Space? O(b d+1 ) (keeps every node.
CS 480 Lec 3 Sept 11, 09 Goals: Chapter 3 (uninformed search) project # 1 and # 2 Chapter 4 (heuristic search)
Blind Search1 Solving problems by searching Chapter 3.
CPSC 322, Lecture 5Slide 1 Uninformed Search Computer Science cpsc322, Lecture 5 (Textbook Chpt 3.4) January, 14, 2009.
Search Strategies Reading: Russell’s Chapter 3 1.
Touring problems Start from Arad, visit each city at least once. What is the state-space formulation? Start from Arad, visit each city exactly once. What.
Uninformed Search Jim Little UBC CS 322 – Search 2 September 12, 2014
Search Strategies CPS4801. Uninformed Search Strategies Uninformed search strategies use only the information available in the problem definition Breadth-first.
Artificial Intelligence Lecture No. 7 Dr. Asad Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
Slide 1 Heuristic Search: BestFS and A * Jim Little UBC CS 322 – Search 5 September 19, 2014 Textbook § 3.6.
CPSC 322, Lecture 9Slide 1 Search: Advanced Topics Computer Science cpsc322, Lecture 9 (Textbook Chpt 3.6) January, 23, 2009.
Review: Search problem formulation
1 Lecture 3 Uninformed Search. 2 Complexity Recap (app.A) We often want to characterize algorithms independent of their implementation. “This algorithm.
Uninformed Search Reading: Chapter 3 by today, Chapter by Wednesday, 9/12 Homework #2 will be given out on Wednesday DID YOU TURN IN YOUR SURVEY?
CPSC 322, Lecture 8Slide 1 Heuristic Search: BestFS and A * Computer Science cpsc322, Lecture 8 (Textbook Chpt 3.5) January, 21, 2009.
5-Nov-2003 Heuristic Search Techniques What do you do when the search space is very large or infinite? We’ll study three more AI search algorithms: Backtracking.
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.)
1 Lecture 3 Uninformed Search
CS 188: Artificial Intelligence Fall 2009 Lecture 2: Queue-Based Search 9/1/2009 Dan Klein – UC Berkeley Multiple slides from Stuart Russell, Andrew Moore.
Lecture 3 Uninformed Search.
Multiple Path Pruning, Iterative Deepening CPSC 322 – Search 7 Textbook § January 26, 2011.
CMU Snake Robot
Review: Search problem formulation Initial state Actions Transition model Goal state (or goal test) Path cost What is the optimal solution? What is the.
Problem Solving and Search Andrea Danyluk September 11, 2013.
CPSC 322, Lecture 8Slide 1 Heuristic Search: BestFS and A * Computer Science cpsc322, Lecture 8 (Textbook Chpt 3.6) Sept, 23, 2013.
Uninformed Search Strategies CPSC 322 – Search 2 January 14, 2011 Textbook §3.5 1.
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.
How are things going? Core AI Problem Mobile robot path planning: identifying a trajectory that, when executed, will enable the robot to reach the goal.
Computer Science CPSC 322 Lecture 9 (Ch , 3.7.6) Slide 1.
Informed search strategies Idea: give the algorithm “hints” about the desirability of different states – Use an evaluation function to rank nodes and select.
Informed searching. Informed search Blind search algorithms do not consider any information about the states and the goals Often there is extra knowledge.
Informed Search Methods. Informed Search  Uninformed searches  easy  but very inefficient in most cases of huge search tree  Informed searches  uses.
Informed Search Strategies Lecture # 8 & 9. Outline 2 Best-first search Greedy best-first search A * search Heuristics.
For Friday Finish reading chapter 4 Homework: –Lisp handout 4.
For Monday Read chapter 4, section 1 No homework..
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.
Advanced Artificial Intelligence Lecture 2: Search.
Computer Science CPSC 322 Lecture 6 Iterative Deepening and Search with Costs (Ch: 3.7.3, 3.5.3)
1 Kuliah 4 : Informed Search. 2 Outline Best-First Search Greedy Search A* Search.
Search (continued) CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Uninformed search strategies A search strategy is defined by picking the order of node expansion Uninformed search strategies use only the information.
CPSC 322, Lecture 8Slide 1 Heuristic Search: BestFS and A * Computer Science cpsc322, Lecture 8 (Textbook Chpt 3.6) Sept, 21, 2010.
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.
CPSC 322, Lecture 5Slide 1 Uninformed Search Computer Science cpsc322, Lecture 5 (Textbook Chpt 3.5) Sept, 13, 2013.
Artificial Intelligence Lecture No. 8 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
For Monday Read chapter 4 exercise 1 No homework.
CPSC 322, Lecture 7Slide 1 Heuristic Search Computer Science cpsc322, Lecture 7 (Textbook Chpt 3.6) Sept, 20, 2013.
Example Search Problem A genetics professor – Wants to name her new baby boy – Using only the letters D,N & A Search through possible strings (states)
Computer Science CPSC 322 Lecture 6 Analysis of A*, Search Refinements (Ch ) Slide 1.
Chapter 3 Solving problems by searching. Search We will consider the problem of designing goal-based agents in observable, deterministic, discrete, known.
Artificial Intelligence Solving problems by searching.
Computer Science CPSC 322 Lecture 5 Heuristic Search and A* (Ch: 3.6, 3.6.1) Slide 1.
Uniformed Search (cont.) Computer Science cpsc322, Lecture 6
Department of Computer Science
Uniformed Search (cont.) Computer Science cpsc322, Lecture 6
Artificial Intelligence
Iterative Deepening CPSC 322 – Search 6 Textbook § 3.7.3
Iterative Deepening and Branch & Bound
Presentation transcript:

Search with Costs and Heuristic Search 1 CPSC 322 – Search 3 January 17, 2011 Textbook §3.5.3, Taught by: Mike Chiang

Today’s Lecture Recap from last lecture, combined with AIspace demo Search with costs: Least Cost First Search Heuristic Search: Best First Search 2

Apply basic properties of search algorithms:  completeness  optimality  time and space complexity of search algorithms Select the most appropriate search algorithms for specific problems. –Depth-First Search vs. Breadth-First Search Learning Goals from last class 3

DFS and BFS 4 Depth-First Search, DFSBreadth-First Search, BFS Let’s look at these algorithms in action:

Comparing Searching Algorithms: Will it find a solution? The best one? Def. : A search algorithm is complete if whenever there is at least one solution, the algorithm is guaranteed to find it within a finite amount of time. Def.: A search algorithm is optimal if when it finds a solution, it is the best one 5 BFS is complete, DFS is not BFS is optimal, DFS is not

Comparing Searching Algorithms: Complexity Def.: The time complexity of a search algorithm is the worst-case amount of time it will take to run, expressed in terms of -maximum path length m -maximum forward branching factor b. Def.: The space complexity of a search algorithm is the worst-case amount of memory that the algorithm will use (i.e., the maxmial number of nodes on the frontier). 6 Both BFS and DFS take time O(b m ) in the worst case O(b+m) O(b m ) O(m b ) O(b+m) O(b m ) O(m b ) BFS: DFS:

Today’s Lecture Recap from last lecture, combined with AIspace demo Search with costs: Least Cost First Search Heuristic Search: Best First Search 7

Example: edge costs in the delivery robot domain 8

Search with Costs Sometimes there are costs associated with arcs. In this setting we often don't just want to find any solution – we usually want to find the solution that minimizes cost Def.: The cost of a path is the sum of the costs of its arcs Def.: A search algorithm is optimal if when it finds a solution, it is the best one 9

Search with Costs Sometimes there are costs associated with arcs. In this setting we often don't just want to find any solution – we usually want to find the solution that minimizes cost Def.: The cost of a path is the sum of the costs of its arcs Def.: A search algorithm is optimal if when it finds a solution, it is the best one: it has the lowest path cost 10

Lowest-cost-first search finds the path with the lowest cost to a goal node At each stage, it selects the path with the lowest cost on the frontier. The frontier is implemented as a priority queue ordered by path cost. Let’s look at this in action: Lowest-Cost-First Search (LCFS) 11

When arc costs are equal, LCFS is equivalent to… None of the above DFS IDS BFS 12

Analysis of Lowest-Cost First Search Is LCFS complete? - Not in general: a cycle with zero cost, or negative arc costs could be followed forever - Yes, as long as arc costs are strictly positive Is LCFS optimal? - Not in general: arc costs could be negative: a path that initially looks high-cost could end up getting a ``refund''. - Yes, as long as arc costs are guaranteed to be non-negative. YESNOIT DEPENDS 13

Analysis of Lowest-Cost First Search 14 What is the time complexity of LCFS if the maximum path length is m and the maximum branching factor is b? - Knowing costs doesn't help here; worst case: all nodes What is the space complexity? E.g. uniform cost: just like BFS, in worst case frontier has to store all nodes m-1 steps from the start node O(b+m) O(b m ) O(m b ) O(b+m) O(b m ) O(m b )

“Uninformed Search”: DFS, BFS, LCFS Why are all these strategies called uninformed? - Because they do not consider any information about the states and the goals to decide which path to expand first on the frontier - They are blind to the goal In other words, they are general and do not take into account the specific nature of the problem. 15

Today’s Lecture Recap from last lecture, combined with AIspace demo Search with costs: Least Cost First Search Heuristic Search: Best First Search 16

Blind search algorithms do not take into account the goal until they are at a goal node. Often there is extra knowledge that can be used to guide the search: - an estimate of the distance from node n to a goal node. This estimate is called search heuristic Heuristic Search 17

More formally Def.: A search heuristic h(n) is an estimate of the cost of the optimal (cheapest) path from node n to a goal node. Estimate: h(n1) 18 Estimate: h(n2) Estimate: h(n3) n3 n2 n1

Example: finding routes 19 What could we use as h(n)?

Example: finding routes 20 What could we use as h(n)? E.g., the straight-line (Euclidian) distance between source and goal node

Idea: always choose the path on the frontier with the smallest h value. BestFS treats the frontier as a priority queue ordered by h. Greedy approach: expand path whose last node seems closest to the goal Best First Search (BestFS) 21 Let’s look at this in action: Optimal? AISPACE example, load from URL

Best-first Search: Illustrative Graph B A A low heuristic value can mean that a cycle gets followed forever -> not complete 22

Complete? No, see the example last slide Optimal? No, see the AIspace example from above: Time Complexity - Worst case: has to explore all nodes Space Complexity - Heuristic could be such to emulate BFS: E.g. h(n) = (m – distance of n from start) Analysis of BestFS 23 O(b+m) O(b m ) O(m b ) O(b+m) O(b m ) O(m b )

Select the most appropriate algorithms for specific problems. – Depth-First Search vs. Breadth-First Search vs. Least-Cost-First Search vs. Best-First Search Define/read/write/trace/debug different search algorithms Construct heuristic functions for specific search problems (just started, more on this next time) 24 Learning Goals for today’s class