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.

Slides:



Advertisements
Similar presentations
Artificial Intelligent
Advertisements

Review: Search problem formulation
Uninformed search strategies
Lirong Xia Basic search Friday, Jan 24, TA OH –Joe Johnson (mainly in charge of the project): Wed 12:30-1:30 pm, Amos Eaton 217 –Hongzhao Huang.
Problem Solving and Search Andrea Danyluk September 9, 2013.
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.
CS 480 Lec 3 Sept 11, 09 Goals: Chapter 3 (uninformed search) project # 1 and # 2 Chapter 4 (heuristic search)
CMSC 471 Spring 2014 Class #4 Thu 2/6/14 Uninformed Search Professor Marie desJardins,
Blind Search1 Solving problems by searching Chapter 3.
Search Strategies Reading: Russell’s Chapter 3 1.
May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.
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.
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.
Artificial Intelligence (CS 461D)
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.
UNINFORMED SEARCH Problem - solving agents Example : Romania  On holiday in Romania ; currently in Arad.  Flight leaves tomorrow from Bucharest.
Tamara Berg CS Artificial Intelligence
14 Jan 2004CS Blind Search1 Solving problems by searching Chapter 3.
CS 380: Artificial Intelligence Lecture #3 William Regli.
Review: Search problem formulation
UnInformed Search What to do when you don’t know anything.
CS 188: Artificial Intelligence Fall 2009 Lecture 3: A* Search 9/3/2009 Dan Klein – UC Berkeley Multiple slides from Stuart Russell or Andrew Moore.
Artificial Intelligence Chapter 3: Solving Problems by Searching
1 Lecture 3 Uninformed Search. 2 Complexity Recap (app.A) We often want to characterize algorithms independent of their implementation. “This algorithm.
Announcements Project 0: Python Tutorial
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.
CSE 473: Artificial Intelligence Spring 2014 Hanna Hajishirzi Problem Spaces and Search slides from Dan Klein, Stuart Russell, Andrew Moore, Dan Weld,
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.
Lab 3 How’d it go?.
CSE 511a: Artificial Intelligence Spring 2012
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.
Quiz 1 : Queue based search  q1a1: Any complete search algorithm must have exponential (or worse) time complexity.  q1a2: DFS requires more space than.
Search Tamara Berg CS 560 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore, Svetlana Lazebnik,
PEAS: Medical diagnosis system  Performance measure  Patient health, cost, reputation  Environment  Patients, medical staff, insurers, courts  Actuators.
Artificial Intelligence
CSE 573: Artificial Intelligence Autumn 2012 Heuristic Search With slides from Dan Klein, Stuart Russell, Andrew Moore, Luke Zettlemoyer Dan Weld.
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
yG7s#t=15 yG7s#t=15.
Advanced Artificial Intelligence Lecture 2: Search.
1 Solving problems by searching Chapter 3. Depth First Search Expand deepest unexpanded node The root is examined first; then the left child of the root;
Uninformed search strategies A search strategy is defined by picking the order of node expansion Uninformed search strategies use only the information.
 Graphs vs trees up front; use grid too; discuss for BFS, DFS, IDS, UCS  Cut back on A* optimality detail; a bit more on importance of heuristics, performance.
CE 473: Artificial Intelligence Autumn 2011 A* Search Luke Zettlemoyer Based on slides from Dan Klein Multiple slides from Stuart Russell or Andrew Moore.
CHAPTER 2 SEARCH HEURISTIC. QUESTION ???? What is Artificial Intelligence? The study of systems that act rationally What does rational mean? Given its.
CS 343H: Artificial Intelligence
CSE 473: Artificial Intelligence Spring 2012 Search: Cost & Heuristics Luke Zettlemoyer Lecture adapted from Dan Klein’s slides Multiple slides from Stuart.
Solving problems by searching A I C h a p t e r 3.
AI Adjacent Fields  Philosophy:  Logic, methods of reasoning  Mind as physical system  Foundations of learning, language, rationality  Mathematics.
Warm-up We’ll often have a warm-up exercise for the 10 minutes before class starts. Here’s the first one… Write the pseudo code for breadth first search.
Chapter 3 Solving problems by searching. Search We will consider the problem of designing goal-based agents in observable, deterministic, discrete, known.
Artificial Intelligence Search Instructors: David Suter and Qince Li Course Harbin Institute of Technology [Many slides adapted from those.
Artificial Intelligence Solving problems by searching.
Lecture 3: Uninformed Search
Announcements Homework 1 will be posted this afternoon. After today, you should be able to do Questions 1-3. Python 2.7 only for the homework; turns.
CS 188: Artificial Intelligence Spring 2007
CS 188: Artificial Intelligence Fall 2008
Lecture 1B: Search.
CSE 473: Artificial Intelligence Spring 2012
CS 188: Artificial Intelligence Fall 2006
Presentation transcript:

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 Stuart Russell or Andrew Moore

Announcements  Lab Friday 1-5pm in Soda 275  Learn Python  Start on Project 1.1: Mazeworld  Come for whatever times you like  No sections this Monday  Project 1.1 posted due 9/8  You can do most of it after today

Today  Agents that Plan Ahead  Search Problems  Uniformed Search Methods  Depth-First Search  Breadth-First Search  Uniform-Cost Search  Heuristic Search Methods  Greedy Search  A* Search

Reflex Agents  Reflex agents:  Choose action based on current percept and memory  May have memory or a model of the world’s current state  Do not consider the future consequences of their actions  Can an reflex agent be rational?

Goal-Based Agents  Goal-based agents:  Plan ahead  Decisions based on (hypothesized) consequences of actions  Must have a model of how the world evolves in response to actions

Search Problems  A search problem consists of:  A state space  A successor function  A start state and a goal test  A solution is a sequence of actions which transform the start state to a goal state “N”, 1.0 “E”, 1.0

Search Trees  A search tree:  This is a “what if” tree  Current state at the root node  Children correspond to successors  Nodes labeled with states, correspond to PATHS to those states  For most problems, can never actually build the whole tree  So, have to find ways of using only the important parts of the tree! “N”, 1.0“E”, 1.0

State Space Graphs  There’s some big graph in which  Each state is a node  Each successor is an outgoing arc  Important: For most problems we could never actually build this graph  How many states in Pacman? S G d b p q c e h a f r Laughably tiny search graph for a tiny search problem

Example: Romania

Another Search Tree  Search:  Expand out possible plans  Maintain a fringe of unexpanded plans  Try to expand as few tree nodes as possible

States vs. Nodes  Problem graphs have problem states  Have successors  Search trees have search nodes  Have parents, children, depth, path cost, etc.  Expand uses successor function to create new search tree nodes  The same problem state may be in multiple search tree nodes

General Tree Search  Important ideas:  Fringe  Expansion  Exploration strategy  Main question: which fringe nodes to explore? Detailed pseudocode is in the book!

Example: Tree Search S G d b p q c e h a f r

State Graphs vs Search Trees S a b d p a c e p h f r q qc G a q e p h f r q qc G a S G d b p q c e h a f r We almost always construct both on demand – and we construct as little as possible. Each NODE in in the search tree is an entire PATH in the problem graph.

Review: Depth First Search S a b d p a c e p h f r q qc G a q e p h f r q qc G a S G d b p q c e h a f r q p h f d b a c e r Strategy: expand deepest node first Implementation: Fringe is a LIFO stack

Review: Breadth First Search S a b d p a c e p h f r q qc G a q e p h f r q qc G a S G d b p q c e h a f r Search Tiers Strategy: expand shallowest node first Implementation: Fringe is a FIFO queue

Search Algorithm Properties  Complete? Guaranteed to find a solution if one exists?  Optimal? Guaranteed to find the least cost path?  Time complexity?  Space complexity? Variables: n Number of states in the problem b The average branching factor B (the average number of successors) C* Cost of least cost solution s Depth of the shallowest solution m Max depth of the search tree

DFS  Infinite paths make DFS incomplete…  How can we fix this? AlgorithmCompleteOptimalTimeSpace DFS Depth First Search NN O(B LMAX )O(LMAX) START GOAL a b NNInfinite

DFS  With cycle checking, DFS is complete.  When is DFS optimal? AlgorithmCompleteOptimalTimeSpace DFS w/ Path Checking YN O(b m+1 )O(bm) … b 1 node b nodes b 2 nodes b m nodes m tiers

BFS  When is BFS optimal? AlgorithmCompleteOptimalTimeSpace DFS w/ Path Checking BFS YN O(b m+1 )O(bm) … b 1 node b nodes b 2 nodes b m nodes s tiers YN* O(b s+1 )O(b s ) b s nodes

Comparisons  When will BFS outperform DFS?  When will DFS outperform BFS?

Costs on Actions Notice that BFS finds the shortest path in terms of number of transitions. It does not find the least-cost path. We will quickly cover an algorithm which does find the least-cost path. START GOAL d b p q c e h a f r

Uniform Cost Search S a b d p a c e p h f r q qc G a q e p h f r q qc G a Expand cheapest node first: Fringe is a priority queue S G d b p q c e h a f r Cost contours 2

Priority Queue Refresher pq.push(key, value) inserts (key, value) into the queue. pq.pop() returns the key with the lowest value, and removes it from the queue.  A priority queue is a data structure in which you can insert and retrieve (key, value) pairs with the following operations:  You can promote or demote keys by resetting their priorities  Unlike a regular queue, insertions into a priority queue are not constant time, usually O(log n)  We’ll need priority queues for most cost-sensitive search methods.

Uniform Cost Search  What will UCS do for this graph?  What does this mean for completeness? START GOAL a b

Uniform Cost Search AlgorithmCompleteOptimalTimeSpace DFS w/ Path Checking BFS UCS YN O(b m+1 )O(bm) … b C*/  tiers YN O(b s+1 )O(b s ) Y*Y O(C* b C*/  )O(b C*/  ) We’ll talk more about uniform cost search’s failure cases later…

Uniform Cost Problems  Remember: explores increasing cost contours  The good: UCS is complete and optimal!  The bad:  Explores options in every “direction”  No information about goal location Start Goal … c  3 c  2 c  1

Extra Work?  Failure to detect repeated states can cause exponentially more work. Why?

Graph Search  In BFS, for example, we shouldn’t bother expanding the circled nodes (why?) S a b d p a c e p h f r q qc G a q e p h f r q qc G a

Graph Search  Very simple fix: never expand a node twice  Can this wreck correctness? Why or why not?

Search Gone Wrong?

Best-First / Greedy Search

 Expand the node that seems closest…  What can go wrong?

Best-First / Greedy Search START GOAL d b p q c e h a f r h=12 h=11 h=8 h=5 h=4 h=6 h=9 h=0 h=4 h=6 h=11

Best-First / Greedy Search  A common case:  Best-first takes you straight to the (wrong) goal  Worst-case: like a badly- guided DFS in the worst case  Can explore everything  Can get stuck in loops if no cycle checking  Like DFS in completeness (finite states w/ cycle checking) … b … b

Best First Greedy Search AlgorithmCompleteOptimalTimeSpace Greedy Best-First Search  What do we need to do to make it complete?  Can we make it optimal? Next class! Y*N O(b m ) … b m

Iterative Deepening Iterative deepening uses DFS as a subroutine: 1.Do a DFS which only searches for paths of length 1 or less. (DFS gives up on any path of length 2) 2.If “1” failed, do a DFS which only searches paths of length 2 or less. 3.If “2” failed, do a DFS which only searches paths of length 3 or less. ….and so on. AlgorithmCompleteOptimalTimeSpace DFS w/ Path Checking BFS ID YN O(b m+1 )O(bm) YN* O(b s+1 )O(b s ) YN* O(b d+1 )O(bd) … b