CPSC 322 Introduction to Artificial Intelligence October 27, 2004.

Slides:



Advertisements
Similar presentations
Artificial Intelligence Chapter 9 Heuristic Search Biointelligence Lab School of Computer Sci. & Eng. Seoul National University.
Advertisements

October 1, 2012Introduction to Artificial Intelligence Lecture 8: Search in State Spaces II 1 A General Backtracking Algorithm Let us say that we can formulate.
1 Heuristic Search Chapter 4. 2 Outline Heuristic function Greedy Best-first search Admissible heuristic and A* Properties of A* Algorithm IDA*
Informed (Heuristic) Search Algorithms. Homework #1 assigned due 10/4 before Exam 1 2.
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
Search Strategies CPS4801. Uninformed Search Strategies Uninformed search strategies use only the information available in the problem definition Breadth-first.
Search in AI.
Slide 1 Heuristic Search: BestFS and A * Jim Little UBC CS 322 – Search 5 September 19, 2014 Textbook § 3.6.
State Space Search Algorithms CSE 472 Introduction to Artificial Intelligence Autumn 2003.
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 25, 2004.
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.
Informed Search Methods How can we make use of other knowledge about the problem to improve searching strategy? Map example: Heuristic: Expand those nodes.
Problem Solving and Search in AI Heuristic Search
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.
Uninformed Search (cont.)
Class of 28 th August. Announcements Lisp assignment deadline extended (will take it until 6 th September (Thursday). In class. Rao away on 11 th and.
State-Space Searches. 2 State spaces A state space consists of –A (possibly infinite) set of states The start state represents the initial problem Each.
State-Space Searches.
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
Graphs II Robin Burke GAM 376. Admin Skip the Lua topic.
Vilalta&Eick: Informed Search Informed Search and Exploration Search Strategies Heuristic Functions Local Search Algorithms Vilalta&Eick: Informed Search.
CPSC 322 Introduction to Artificial Intelligence November 12, 2004.
Heuristic Search In addition to depth-first search, breadth-first search, bound depth-first search, and iterative deepening, we can also use informed or.
Computer Science CPSC 322 Lecture A* and Search Refinements (Ch 3.6.1, 3.7.1, 3.7.2) Slide 1.
Introduction to search Chapter 3. Why study search? §Search is a basis for all AI l search proposed as the basis of intelligence l inference l all learning.
Introduction to search Chapter 3. Why study search? §Search is a basis for all AI l search proposed as the basis of intelligence l all learning algorithms,
P ROBLEM Write an algorithm that calculates the most efficient route between two points as quickly as possible.
Computer Science CPSC 322 Lecture 9 (Ch , 3.7.6) Slide 1.
State-Space Searches. 2 State spaces A state space consists of A (possibly infinite) set of states The start state represents the initial problem Each.
Informed search strategies Idea: give the algorithm “hints” about the desirability of different states – Use an evaluation function to rank nodes and select.
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..
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.
Advanced Artificial Intelligence Lecture 2: Search.
CSC3203: AI for Games Informed search (1) Patrick Olivier
Computer Science CPSC 322 Lecture 6 Iterative Deepening and Search with Costs (Ch: 3.7.3, 3.5.3)
Search (continued) CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
A General Introduction to Artificial Intelligence.
Informed Search II CIS 391 Fall CIS Intro to AI 2 Outline PART I  Informed = use problem-specific knowledge  Best-first search and its variants.
CPSC 322, Lecture 6Slide 1 Uniformed Search (cont.) Computer Science cpsc322, Lecture 6 (Textbook finish 3.5) Sept, 17, 2012.
Today’s Topics Exam Thursday Oct 22. 5:30-7:3-pm, same room as lecture Makeup Thursday Oct 29? Or that Monday or Wednesday? Exam Covers Material through.
A* optimality proof, cycle checking CPSC 322 – Search 5 Textbook § 3.6 and January 21, 2011 Taught by Mike Chiang.
Ch. 3 – Search Supplemental slides for CSE 327 Prof. Jeff Heflin.
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.
Artificial Intelligence Lecture No. 8 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
CPSC 420 – Artificial Intelligence Texas A & M University Lecture 5 Lecturer: Laurie webster II, M.S.S.E., M.S.E.e., M.S.BME, Ph.D., P.E.
For Monday Read chapter 4 exercise 1 No homework.
Chapter 3 Solving problems by searching. Search We will consider the problem of designing goal-based agents in observable, deterministic, discrete, known.
Chapter 3.5 Heuristic Search. Learning Objectives Heuristic search strategies –Best-first search –A* algorithm Heuristic functions.
Review: Tree search Initialize the frontier using the starting state
Uniformed Search (cont.) Computer Science cpsc322, Lecture 6
Heuristic Search A heuristic is a rule for choosing a branch in a state space search that will most likely lead to a problem solution Heuristics are used.
Uniformed Search (cont.) Computer Science cpsc322, Lecture 6
CPSC 322 Introduction to Artificial Intelligence
CPSC 322 Introduction to Artificial Intelligence
State-Space Searches.
State-Space Searches.
State-Space Searches.
Supplemental slides for CSE 327 Prof. Jeff Heflin
Presentation transcript:

CPSC 322 Introduction to Artificial Intelligence October 27, 2004

Things... Assignment 3 is due Friday morning Send me pairings for term project no later than Sunday, Oct. 31 Midterm exam 2 is Monday Bring me your first midterms before the second midterm if you want to be retested on problem 3 Jessica Hodgins talk, Thursday, October 28, 1-2pm, MacLeod 214

Back to heuristic search techniques

Heuristic depth-first search algorithm Given a set of start nodes, a set of goal nodes, and a graph (i.e., the nodes and arcs): apply heuristic h(n) to start nodes make a “list” of the start nodes - let’s call it the “frontier” sort the frontier by h(n) values repeat if no nodes on the frontier then terminate with failure choose one node from the front of the frontier and remove it if the chosen node matches the goal node then terminate with success else get next nodes (neighbors) and h(n) values and sort those nodes by h(n) values and put those sorted nodes on the front of the frontier end repeat

Heuristic depth-first search - tiles out of place _ 4 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ 4 7 _ _ _ _ _ _ _ _ _

Heuristic depth-first search - tiles out of place _ 4 3 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ 4 7 _ _ _ _ _ _ _ _ _

Heuristic depth-first search - tiles out of place _ 4 3 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ 4 7 _ _ _ _ _ _ _ _ _

Heuristic depth-first search - tiles out of place _ 4 3 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ 4 7 _ _ _ _ _ _ _ _ _

Heuristic depth-first search - tiles out of place _ 4 3 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ 4 7 _ _ _ _ _ _ _ _ _

Heuristic depth-first search - tiles out of place _ 4 3 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Heuristic depth-first search - tiles out of place _ 4 3 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Heuristic depth-first search - tiles out of place _ 4 3 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Heuristic depth-first search - tiles out of place _ 4 3 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Heuristic depth-first search - tiles out of place _ 4 3 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Heuristic depth-first search - tiles out of place _ 4 3 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Heuristic depth-first search - tiles out of place _ 4 3 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Heuristic depth-first search - tiles out of place _ 4 3 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Heuristic depth-first search - tiles out of place _ 4 3 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Heuristic depth-first search - tiles out of place _ 4 3 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Heuristic depth-first search - tiles out of place _ 4 3 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Why heuristic depth-first search?

Comparing search strategies strategy selection halts? space optimal path depth-first last node added no linear no breadth-first first node added yes exponential yes 1 lowest-cost minimal g(n) yes exponential yes first best-first globally minimal no exponential no h(n) heuristic locally minimal no linear no depth-first h(n) 1. assuming all arcs have the same cost

What’s missing? A heuristic search strategy that is guaranteed to find the optimal (lowest-cost) path from start node to goal node What do the strategies that find optimal paths have in common?

Comparing search strategies strategy selection halts? space optimal path depth-first last node added no linear no breadth-first first node added yes exponential yes 1 lowest-cost minimal g(n) yes exponential yes first best-first globally minimal no exponential no h(n) heuristic locally minimal no linear no depth-first h(n) 1. assuming all arcs have the same cost

Would this work? The search strategies that find optimal paths all take g(n) -- the cost of the path from start node to frontier node -- into consideration......and best-first search seems like a reasonably sane heuristic search (although it’s exponential)......what would happen if we rewrite best-first search to include g(n) as well as h(n)? Oh, by the way, we give the name f(n) to the sum of g(n) and h(n), as in f(n) = g(n) + h(n)

Refresher: Heuristic best-first search algorithm Given a set of start nodes, a set of goal nodes, and a graph (i.e., the nodes and arcs): apply heuristic h(n) to start nodes make a “list” of the start nodes - let’s call it the “frontier” sort the frontier by h(n) values repeat if no nodes on the frontier then terminate with failure choose one node from the front of the frontier and remove it if the chosen node matches the goal node then terminate with success else put next nodes (neighbors) and h(n) values on frontier and sort frontier by h(n) values end repeat

Heuristic best-first search - tiles out of place _ 4 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ 4 7 _ _ _ _ _ _ _ _ _

Heuristic best-first search - tiles out of place _ 4 3 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ 4 7 _ _ _ _ _ _ _ _ _

Heuristic best-first search - tiles out of place _ 4 3 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ 4 7 _ _ _ _ _ _ _ _ _

Heuristic best-first search - tiles out of place _ 4 3 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ 4 7 _ _ _ _ _ _ _ _ _

Heuristic best-first search - tiles out of place _ 4 3 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ 4 7 _ _ _ _ _ _ _ _ _

Heuristic best-first search - tiles out of place _ 4 3 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Heuristic best-first search - tiles out of place _ 4 3 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Heuristic best-first search - tiles out of place _ 4 3 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Heuristic best-first search - tiles out of place _ 4 3 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Heuristic best-first search - tiles out of place _ 4 3 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Heuristic best-first search - tiles out of place _ 4 3 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Best-first with g(n) included Given a set of start nodes, a set of goal nodes, and a graph (i.e., the nodes and arcs): apply heuristic g(n)+h(n) to start nodes make a “list” of the start nodes - let’s call it the “frontier” sort the frontier by g(n)+h(n) values repeat if no nodes on the frontier then terminate with failure choose one node from the front of the frontier and remove it if the chosen node matches the goal node then terminate with success else put next nodes (neighbors) and g(n)+h(n) values on frontier and sort frontier by g(n)+h(n) values end repeat

Combining g(n) + h(n) _ 4 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ 4 7 _ _ _ _ _ _ _ _ _

g(n) is actual path length from start node h(n) is tiles out of place g(n) _ 4 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ 4 7 _ _ _ _ _ _ _ _ _

g(n) is actual path length from start node h(n) is tiles out of place g(n) _ 4 3 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ 4 7 _ _ _ _ _ _ _ _ _

g(n) is actual path length from start node h(n) is tiles out of place g(n) _ 4 3 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ 4 7 _ _ _ _ _ _ _ _ _

g(n) is actual path length from start node h(n) is tiles out of place g(n) _ 4 3 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ 4 7 _ _ _ _ _ _ _ _ _

g(n) is actual path length from start node h(n) is tiles out of place g(n) _ 4 3 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ 4 7 _ _ _ _ _ _ _ _ _

g(n) is actual path length from start node h(n) is tiles out of place g(n) _ 4 3 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ 4 7 _ _ _ _ _ _ _ _ _

g(n) is actual path length from start node h(n) is tiles out of place g(n) _ 4 3 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ 4 7 _ _ _ _ _ _ _ _ _

g(n) is actual path length from start node h(n) is tiles out of place g(n) _ 4 3 goal: 8 _ _ _ _ _ _ _ 2 8 _ _ _ 8 _ _ _ _ _ _ _ _ _ 4 7 _ _ _ _ _ _ _ _ _

Best-first with g(n) included is called... Given a set of start nodes, a set of goal nodes, and a graph (i.e., the nodes and arcs): apply heuristic g(n)+h(n) to start nodes make a “list” of the start nodes - let’s call it the “frontier” sort the frontier by g(n)+h(n) values repeat if no nodes on the frontier then terminate with failure choose one node from the front of the frontier and remove it if the chosen node matches the goal node then terminate with success else put next nodes (neighbors) and g(n)+h(n) values on frontier and sort frontier by g(n)+h(n) values end repeat

Search algorithm A Given a set of start nodes, a set of goal nodes, and a graph (i.e., the nodes and arcs): apply heuristic g(n)+h(n) to start nodes make a “list” of the start nodes - let’s call it the “frontier” sort the frontier by g(n)+h(n) values repeat if no nodes on the frontier then terminate with failure choose one node from the front of the frontier and remove it if the chosen node matches the goal node then terminate with success else put next nodes (neighbors) and g(n)+h(n) values on frontier and sort frontier by g(n)+h(n) values end repeat

Search algorithm A If the branching factor in the state space is finite and If the arc costs are bounded above 0 (i.e., there is some e > 0 such that all arc costs are greater than e) and h(n) is a lower bound on the actual minimum cost of the shortest path from node n to a goal node then we call this search algorithm...

Search algorithm A* If the branching factor in the state space is finite and If the arc costs are bounded above 0 (i.e., there is some e > 0 such that all arc costs are greater than e) and h(n) is a lower bound on the actual minimum cost of the shortest path from node n to a goal node then we call this search algorithm...

Search algorithm A* More important than the odd name is the fact that algorithm A* is admissible That’s AI shorthand for “the algorithm will find an optimal path, if one exists, from the start to the goal, and that the first path found from the start to the goal will be optimal, even if the search space is infinite” Admissibility does not, however, guarantee that an optimal path will be found quickly

Search algorithm A* Using the “tiles out of place” heuristic for h(n) in the 8-tile puzzle search is an example of an A* algorithm -- “tiles out of place” is an admissible heuristic The “Manhattan distance” heuristic is also admissible

Back to the question: Would this work? Yes! The search strategies that find optimal paths all take g(n) -- the cost of the path from start node to frontier node -- into consideration......and best-first search seems like a reasonably sane heuristic search (although it’s exponential)......what would happen if we rewrite best-first search to include g(n) as well as h(n)? We get a heuristic search strategy that’s guaranteed to find an optimal path to the goal if one exists!

Comparing search strategies strategy selection halts? space optimal path depth-first last node added no linear no breadth-first first node added yes exponential yes 1 lowest-cost minimal g(n) yes exponential yes first best-first globally minimal no exponential no h(n) heuristic locally minimal no linear no depth-first h(n) A* minimal g(n)+h(n) yes exponential yes 1. assuming all arcs have the same cost

Refinements to search strategies Cycle checking you don’t want your search algorithm looping through cycles in the graph if your search algorithm puts paths from start node to frontier on the frontier list, it can compare new neighbor nodes to the nodes on the path before adding them to eliminate the possibility of cycles A* doesn’t have to “worry” about cycles...why?

Refinements to search strategies Iterative deepening Breadth-first search is optimal but hogs space; depth-first search conserves space but may not halt Iterative deepening combines the best of both: employ depth-first search to some depth bound; if the goal is not found, discard what’s been done, increase the depth bound and do depth-first search again Computational overhead will be increased, but it may not be as bad as it might seem at first (read your book)

Refinements to search strategies Direction of search It’s not necessary to begin searching at the start node; search can begin with a goal node In general, if goal nodes are explicitly defined, and the branching factor (number of arcs) leading into nodes tends to be smaller than the branching factor leading away from nodes, the problem might be a good candidate for backward search (8-tile puzzle) However, if goal nodes are determined implicitly by a predicate (leading to many goal nodes), forward search is probably better (chess...where would you start?)

Refinements to search strategies There are other refinements in chapter 4.6 you should read them but you can skip chapter 4.7 for now...we may get back to it later in the term