CS 188: Artificial Intelligence Fall 2008

Slides:



Advertisements
Similar presentations
Artificial Intelligent
Advertisements

Additional Topics ARTIFICIAL INTELLIGENCE
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.
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.
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.
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 Problem - solving agents Example : Romania  On holiday in Romania ; currently in Arad.  Flight leaves tomorrow from Bucharest.
Review: Search problem formulation
UnInformed Search What to do when you don’t know anything.
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.
Announcements Project 0: Python Tutorial
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.
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.
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.
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
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
Advanced Artificial Intelligence Lecture 2: Search.
Uninformed search strategies A search strategy is defined by picking the order of node expansion Uninformed search strategies use only the information.
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
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 Problem Solving through search Uninformed Search
Lecture 3: Uninformed Search
Review: Tree search Initialize the frontier using the starting state
Uniformed Search (cont.) Computer Science cpsc322, Lecture 6
Uninformed search Lirong Xia Spring, Uninformed search Lirong Xia Spring, 2017.
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.
Last time: Problem-Solving
Uninformed Search Chapter 3.4.
Uninformed Search Strategies
Artificial Intelligence (CS 370D)
Chap 4: Searching Techniques Artificial Intelligence Dr.Hassan Al-Tarawneh.
Uniformed Search (cont.) Computer Science cpsc322, Lecture 6
Artificial Intelligence
Solving problems by searching
CAP 5636 – Advanced Artificial Intelligence
CS 188: Artificial Intelligence Spring 2007
Lecture 1B: Search.
Problem Solving and Searching
What to do when you don’t know anything know nothing
EA C461 – Artificial Intelligence
Artificial Intelligence
Problem Solving and Searching
Principles of Computing – UFCFA3-30-1
CSE 473: Artificial Intelligence Spring 2012
Uninformed search Lirong Xia. Uninformed search Lirong Xia.
Uninformed search Lirong Xia. Uninformed search Lirong Xia.
CS 188: Artificial Intelligence Fall 2006
Chap 4: Searching Techniques
HW 1: Warmup Missionaries and Cannibals
CS 188: Artificial Intelligence Spring 2006
UNINFORMED SEARCH -BFS -DFS -DFIS - Bidirectional
HW 1: Warmup Missionaries and Cannibals
CMSC 471 Fall 2011 Class #4 Tue 9/13/11 Uninformed Search
CS440/ECE 448 Lecture 4: Search Intro
Presentation transcript:

CS 188: Artificial Intelligence Fall 2008 Lecture 2: Queue-Based Search 9/2/2008 Dan Klein – UC Berkeley Many slides from either Stuart Russell or Andrew Moore

Announcements Written assignments: One mini-homework each week (1-2 problems) We’ll drop your two lowest scores First one posted soon! Lab Wednesday 11am to 4pm in Soda 275 Learn Python Come whatever times you like Project 1.1 posted soon, too, due 9/12

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: Can a reflex agent be rational? 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 a reflex agent be rational? [demo: reflex optimal / loop ]

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 [demo: plan fast / slow ]

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 (a plan) which transforms the start state to a goal state “N”, 1.0 “E”, 1.0

Search Trees A search tree: “N”, 1.0 “E”, 1.0 A search tree: This is a “what if” tree of plans and outcomes Start state at the root node Children correspond to successors Nodes labeled with states, correspond to PLANS 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!

Laughably tiny search graph for a tiny search problem 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

Detailed pseudocode is in the book! 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 d b p q c e h a f r Each NODE in in the search tree is an entire PATH in the problem graph. S a b d p c e h f r q G We almost always construct both on demand – and we construct as little as possible.

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

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

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? O(BLMAX) Algorithm Complete Optimal Time Space DFS Depth First Search N O(BLMAX) O(LMAX) N N Infinite Infinite b START a GOAL Infinite paths make DFS incomplete… How can we fix this?

DFS With cycle checking, DFS is complete. When is DFS optimal? 1 node b … b nodes b2 nodes m tiers bm nodes Algorithm Complete Optimal Time Space DFS w/ Path Checking Y N O(bm+1) O(bm)

BFS Algorithm Complete Optimal Time Space DFS BFS When is BFS optimal? w/ Path Checking BFS When is BFS optimal? Y N O(bm+1) O(bm) Y N* O(bs+1) O(bs) 1 node b … b nodes s tiers b2 nodes bs nodes bm nodes

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

Iterative Deepening Algorithm Complete Optimal Time Space DFS BFS ID Y Iterative deepening uses DFS as a subroutine: Do a DFS which only searches for paths of length 1 or less. (DFS gives up on any path of length 2) If “1” failed, do a DFS which only searches paths of length 2 or less. If “2” failed, do a DFS which only searches paths of length 3 or less. ….and so on. b … Algorithm Complete Optimal Time Space DFS w/ Path Checking BFS ID Y N O(bm+1) O(bm) Y N* O(bs+1) O(bs) Y N* O(bs+1) O(bs)

Costs on Actions START GOAL d b p q c e h a f r 2 9 8 1 3 4 15 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.

Uniform Cost Search S G 2 Expand cheapest node first: b p q c e h a f r 2 Expand cheapest node first: Fringe is a priority queue 1 8 2 2 3 9 1 8 1 1 15 S a b d p c e h f r q G 9 1 3 4 5 17 11 16 11 Cost contours 6 13 7 8 11 10

Priority Queue Refresher 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. 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.

Uniform Cost Search Algorithm Complete Optimal Time Space DFS BFS UCS w/ Path Checking BFS UCS Y N O(bm+1) O(bm) Y N O(bs+1) O(bs) Y* Y O(C* bC*/) O(bC*/) C*/ tiers b … 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 … c  1 c  2 c  3 Start Goal [demo: ucs contours ]

Heuristics

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 2 9 8 1 3 5 4 15 h=0 h=8 h=5 h=4 h=11 h=8 h=4 h=6 h=12 h=11 h=6 h=9

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 …

Search Gone Wrong?

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 c e h f r q G

Graph Search Very simple fix: never expand a state type twice Can this wreck completeness? Why or why not? How about optimality? Why or why not?

Some Hints Graph search is almost always better than tree search (when not?) Fringes are sometimes called “closed lists” – but don’t implement them with lists (use sets)! Nodes are conceptually paths, but better to represent with a state, cost, and reference to parent node