CS 188: Artificial Intelligence Spring 2007

Slides:



Advertisements
Similar presentations
Artificial Intelligent
Advertisements

Solving problems by searching Chapter 3. Outline Problem-solving agents Problem types Problem formulation Example problems Basic search algorithms.
Additional Topics ARTIFICIAL INTELLIGENCE
Review: Search problem formulation
Uninformed search strategies
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.
May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.
Solving Problem by Searching Chapter 3. Outline Problem-solving agents Problem formulation Example problems Basic search algorithms – blind search Heuristic.
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.
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 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.
Review: Search problem formulation Initial state Actions Transition model Goal state (or goal test) Path cost What is the optimal solution? What is the.
1 Problem Solving and Searching CS 171/271 (Chapter 3) Some text and images in these slides were drawn from Russel & Norvig’s published material.
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,
Artificial Intelligence
An Introduction to Artificial Intelligence Lecture 3: Solving Problems by Sorting Ramin Halavati In which we look at how an agent.
Advanced Artificial Intelligence Lecture 2: Search.
SOLVING PROBLEMS BY SEARCHING Chapter 3 August 2008 Blind Search 1.
A General Introduction to Artificial Intelligence.
Uninformed search strategies A search strategy is defined by picking the order of node expansion Uninformed search strategies use only the information.
CS 343H: Artificial Intelligence
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.
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
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.
EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS
Uninformed Search Chapter 3.4.
Uninformed Search Strategies
Problem Solving as Search
Artificial Intelligence (CS 370D)
Russell and Norvig: Chapter 3, Sections 3.4 – 3.6
Solving problems by searching
CS 188: Artificial Intelligence Fall 2008
Lecture 1B: Search.
Problem Solving and Searching
What to do when you don’t know anything know nothing
EA C461 – Artificial Intelligence
Artificial Intelligence
Searching for Solutions
Problem Solving and Searching
Principles of Computing – UFCFA3-30-1
Problem Spaces & Search
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
Problem Spaces & Search
UNINFORMED SEARCH -BFS -DFS -DFIS - Bidirectional
ECE457 Applied Artificial Intelligence Fall 2007 Lecture #2
CMSC 471 Fall 2011 Class #4 Tue 9/13/11 Uninformed Search
Presentation transcript:

CS 188: Artificial Intelligence Spring 2007 Lecture 3: Queue-Based Search 1/23/2007 Srini Narayanan – UC Berkeley Many slides over the course adapted from Dan Klein, Stuart Russell or Andrew Moore

Announcements Assignment 1 due 1/30 11:59 PM Sections start this week You can do most of it after today Sections start this week Stay tuned for Python Lab

Summary Agents interact with environments through actuators and sensors The agent function describes what the agent does in all circumstances The agent program calculates the agent function The performance measure evaluates the environment sequence A perfectly rational agent maximizes expected performance PEAS descriptions define task environments Environments are categorized along several dimensions: Observable? Deterministic? Episodic? Static? Discrete? Single-agent? Problem-solving agents make a plan, then execute it State space encodings of problems

Problem-Solving Agents This offline problem solving! Solution is executed “eyes closed. This is the hard part!

Tree Search Basic solution method for graph problems Offline simulated exploration of state space Searching a model of the space, not the real world

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

Tree Search

General Tree Search Important ideas: Fringe Expansion Exploration strategy Main question: which fringe nodes to explore?

Search Nodes vs. States 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 3 5 6 8 4 7 2

when the state space is finite Search Nodes vs. States 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 3 5 6 8 4 7 2 If states are allowed to be revisited, the search tree may be infinite even when the state space is finite

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

Uninformed search strategies (a.k.a. blind search) = use only information available in problem definition. When strategies can determine whether one non-goal state is better than another  informed search. Categories defined by expansion algorithm: Breadth-first search Depth-first search (Depth-limited search) Iterative deepening search Uniform-cost search Bidirectional search

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 8-puzzle? S G d b p q c e h a f r Laughably tiny search graph for a tiny search problem

Example: Romania

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) 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) O(bm) Y N* O(bs+1) O(bs+1) 1 node b … b nodes s tiers b2 nodes bs nodes bm nodes

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

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. Binary heap, subtree root has highest key.

Uniform Cost Search Algorithm Complete Optimal Time Space DFS BFS UCS w/ Path Checking BFS UCS Y N O(bm) O(bm) Y N O(bs+1) O(bs+1) Y* Y O(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

Depth-limited search depth-first search with depth limit l, i.e., nodes at depth l have no successors Recursive implementation:

Iterative deepening search

Iterative deepening search l =0

Iterative deepening search l =1

Iterative deepening search l =2

Iterative deepening search l =3

Iterative deepening search Number of nodes generated in a depth-limited search to depth d with branching factor b: NDLS = b0 + b1 + b2 + … + bd-2 + bd-1 + bd Number of nodes generated in an iterative deepening search to depth d with branching factor b: NIDS = (d+1)b0 + d b^1 + (d-1)b^2 + … + 3bd-2 +2bd-1 + 1bd For b = 10, d = 5, NDLS = 1 + 10 + 100 + 1,000 + 10,000 + 100,000 = 111,111 NIDS = 6 + 50 + 400 + 3,000 + 20,000 + 100,000 = 123,456 Overhead = (123,456 - 111,111)/111,111 = 11%

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) O(bm) Y N* O(bs+1) O(bs+1) Y N* O(bd) O(bd)

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 node twice Can this wreck correctness? Why or why not?

Search Gone Wrong?