Advanced Artificial Intelligence Lecture 2: Search.

Slides:



Advertisements
Similar presentations
Solving problems by searching Chapter 3. Outline Problem-solving agents Problem types Problem formulation Example problems Basic search algorithms.
Advertisements

Additional Topics ARTIFICIAL INTELLIGENCE
Review: Search problem formulation
May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.
1 Chapter 3 Solving Problems by Searching. 2 Outline Problem-solving agentsProblem-solving agents Problem typesProblem types Problem formulationProblem.
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.
14 Jan 2004CS Blind Search1 Solving problems by searching Chapter 3.
EIE426-AICV 1 Blind and Informed Search Methods Filename: eie426-search-methods-0809.ppt.
Artificial Intelligence (CS 461D)
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.
14 Jan 2004CS Blind Search1 Solving problems by searching Chapter 3.
CHAPTER 3 CMPT Blind Search 1 Search and Sequential Action.
CS 380: Artificial Intelligence Lecture #3 William Regli.
Announcements Homework 1: Search Project 1: Search Sections
CS 343H: Artificial Intelligence
Review: Search problem formulation
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
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?
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
Solving problems by searching
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.
Quiz 1 : Queue based search  q1a1: Any complete search algorithm must have exponential (or worse) time complexity.  q1a2: DFS requires more space than.
PEAS: Medical diagnosis system  Performance measure  Patient health, cost, reputation  Environment  Patients, medical staff, insurers, courts  Actuators.
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.
An Introduction to Artificial Intelligence Lecture 3: Solving Problems by Sorting Ramin Halavati In which we look at how an agent.
SOLVING PROBLEMS BY SEARCHING Chapter 3 August 2008 Blind Search 1.
A General Introduction to Artificial Intelligence.
CSC3203: AI for Games Informed search (1) Patrick Olivier
Solving problems by searching 1. Outline Problem formulation Example problems Basic search algorithms 2.
CPSC 420 – Artificial Intelligence Texas A & M University Lecture 3 Lecturer: Laurie webster II, M.S.S.E., M.S.E.e., M.S.BME, Ph.D., P.E.
 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.
Informed Search CSE 473 University of Washington.
Warm-up: Tree Search Solution
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
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.
WEEK 5 LECTURE -A- 23/02/2012 lec 5a CSC 102 by Asma Tabouk Introduction 1 CSC AI Basic Search Strategies.
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.
Chapter 3.5 Heuristic Search. Learning Objectives Heuristic search strategies –Best-first search –A* algorithm Heuristic functions.
Announcements Homework 1 Questions 1-3 posted. Will post remainder of assignment over the weekend; will announce on Slack. No AI Seminar today.
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
Problem Solving as Search
Solving problems by searching
CAP 5636 – Advanced Artificial Intelligence
CS 188: Artificial Intelligence Spring 2007
CS 188: Artificial Intelligence Fall 2008
Lecture 1B: Search.
CS 4100 Artificial Intelligence
EA C461 – Artificial Intelligence
Artificial Intelligence
CS 188: Artificial Intelligence Fall 2006
Announcements This Friday Project 1 due Talk by Jeniya Tabassum
Artificial Intelligence
Solving Problems by Searching
Artificial Intelligence: Theory and Practice Ch. 3. Search
Presentation transcript:

Advanced Artificial Intelligence Lecture 2: Search

2 Outline  Problem-solving agents (Book: 3.1)  Problem types and problem formulation  Search trees and state space graphs (3.3)  Uninformed search (3.4)  Depth-first, Breadth-first, Uniform cost  Search graphs  Informed search (3.5)  Greedy search, A* search  Heuristics, admissibility

Agents act = AgentFn(percept) sensors agent fn actuators 3

4 Problem types  Fully observable, deterministic  single-belief-state problem  Non-observable  sensorless (conformant) problem  Partially observable/non-deterministic  contingency problem  interleave search and execution  Unknown state space  exploration problem  execution first

Search Problems  A search problem consists of:  A state space  A transition model  A start state, goal test, and path cost function  A solution is a sequence of actions (a plan) which transforms the start state to a goal state N, 1 E, 1

Transition Models  Successor function  Successors( ) = {(N, 1, ), (E, 1, )}  Actions and Results  Actions( ) = {N, E}  Result(, N) = ; Result(, E) =  Cost(, N, ) = 1; Cost(, E, ) = 1

Example: Romania  State space:  Cities  Successor function:  Go to adj city with cost = dist  Start state:  Arad  Goal test:  Is state == Bucharest?  Solution?

State Space Graphs  State space graph: A mathematical representation of a search problem  For every search problem, there’s a corresponding state space graph  The successor function is represented by arcs  This can be large or infinite, so we won’t create it in memory S G d b p q c e h a f r Ridiculously tiny search graph for a tiny search problem

Search Trees  A search tree:  This is a “what if” tree of plans and outcomes  Start state at the root node  Children correspond to successors  Nodes contain states, correspond to paths to those states  For most problems, we can never actually build the whole tree E, 1N, 1

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

General Tree Search  Important ideas:  Frontier (aka fringe)  Expansion  Exploration strategy  Main question: which frontier nodes to explore?

State Space vs. Search Tree 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 construct both on demand – and we construct as little as possible. Each NODE in in the search tree is an entire PATH in the state space.

States vs. Nodes  Nodes in state space graphs are problem states  Represent an abstracted state of the world  Have successors, can be goal / non-goal, have multiple predecessors  Nodes in search trees are paths  Represent a path (sequence of actions) which results in the node’s state  Have a problem state and one parent, a path length, (a depth) & a cost  The same problem state may be achieved by multiple search tree nodes Depth 5 Depth 6 Parent Node Search TreeState Space Graph Action

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: Frontier is a LIFO stack

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 [demo: bfs]

Santayana’s Warning  “Those who cannot remember the past are condemned to repeat it.” – George Santayana  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 state twice  Can this wreck completeness? Lowest cost?

Graph Search Hints  Graph search is almost always better than tree search (when not?)  Implement explored as a dict or set  Implement frontier as priority Q and set

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: Frontier is a priority queue S G d b p q c e h a f r Cost contours 2

Uniform Cost Issues  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

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

AI Lesson To do more, Know more

Heuristics

Greedy Best First Search  Expand the node that seems closest to goal…  What can go wrong?

Greedy goes wrong S G

Best First / Greedy Search S G 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 e  Strategy: expand the closest node to the goal

Combining UCS and Greedy  Uniform-cost orders by path cost, or backward cost g(n)  Best-first orders by distance to goal, or forward cost h(n)  A* Search orders by the sum: f(n) = g(n) + h(n) Sad b G h=5 h=6 h= h=6 h=0 c h=7 3 e h=1 1

 Should we stop when we enqueue a goal?  No: only stop when we dequeue a goal When should A* terminate? S B A G h = 1 h = 2 h = 0 h = 3

Is A* Optimal? A G S 1 3 h = 6 h = 0 5 h = 7  What went wrong?  Actual bad path cost (5) < estimate good path cost (1+6)  We need estimates (h=6) to be less than actual (3) costs!

Admissible Heuristics  A heuristic h is admissible (optimistic) if: where is the true cost to a nearest goal Never overestimate!

Optimality of A*: Blocking … Notation:  g(n) = cost to node n  h(n) = estimated cost from n to the nearest goal (heuristic)  f(n) = g(n) + h(n) = estimated total cost via n  G*: a lowest cost goal node  G: another goal node

Optimality of A*: Blocking Proof:  What could go wrong?  We’d have to have to pop a suboptimal goal G off the frontier before G*  This can’t happen:  Imagine a suboptimal goal G is on the queue  Some node n which is a subpath of G* must also be on the frontier (why?)  n will be popped before G …

Other A* Applications  Path finding / routing problems  Resource planning problems  Robot motion planning  Language analysis  Machine translation  Speech recognition  …

Summary: A*  A* uses both backward costs, g(n), and (estimates of) forward costs, h(n)  A* is optimal with admissible heuristics  A* is not the final word in search algorithms (but it does get the final word for today)