Artificial Intelligence

Slides:



Advertisements
Similar presentations
Artificial Intelligent
Advertisements

Review: Search problem formulation
Uninformed search strategies
Artificial Intelligence Problem Solving Eriq Muhammad Adams
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)
Search Strategies Reading: Russell’s Chapter 3 1.
1 Blind (Uninformed) Search (Where we systematically explore alternatives) R&N: Chap. 3, Sect. 3.3–5.
Lets remember about Goal formulation, Problem formulation and Types of Problem. OBJECTIVE OF TODAY’S LECTURE Today we will discus how to find a solution.
Implementation and Evaluation of Search Methods. Use a stack data structure. 1. Push root node of tree on the stack. 2. Pop the top node off the stack.
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 Problem - solving agents Example : Romania  On holiday in Romania ; currently in Arad.  Flight leaves tomorrow from Bucharest.
Searching the search space graph
1 Solving Problems by Searching. 2 Terminology State State Space Initial State Goal Test Action Step Cost Path Cost State Change Function State-Space.
1 Lecture 3 Uninformed Search. 2 Complexity Recap (app.A) We often want to characterize algorithms independent of their implementation. “This algorithm.
1 Lecture 3 Uninformed Search
Lecture 3 Uninformed Search.
1 Artificial Intelligence CS 165A Tuesday, October 9, 2007  Blind search (Ch. 3) 1.
For Friday Finish reading chapter 4 Homework: –Lisp handout 4.
For Monday Read chapter 4, section 1 No homework..
Lecture 3: Uninformed Search
Blind Search Russell and Norvig: Chapter 3, Sections 3.4 – 3.6 CS121 – Winter 2003.
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.
Artificial Intelligence Solving problems by searching.
Lecture 3 Problem Solving through search Uninformed Search
Lecture 3: Uninformed Search
Last time: Summary Definition of AI? Turing Test? Intelligent Agents:
Uniformed Search (cont.) Computer Science cpsc322, Lecture 6
Problem Solving Agents
EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS
Last time: Problem-Solving
For Monday Chapter 6 Homework: Chapter 3, exercise 7.
Uninformed Search Chapter 3.4.
Problem Solving by Searching
Problem solving and search
Artificial Intelligence (CS 370D)
Artificial Intelligence Problem solving by searching CSC 361
Search Tuomas Sandholm Read Russell & Norvig Sections
Uniformed Search (cont.) Computer Science cpsc322, Lecture 6
Uninformed Search Introduction to Artificial Intelligence
Russell and Norvig: Chapter 3, Sections 3.4 – 3.6
Solving problems by searching
CS 188: Artificial Intelligence Spring 2007
CS 188: Artificial Intelligence Fall 2008
Search Tuomas Sandholm Read Russell & Norvig Sections
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
G5BAIM Artificial Intelligence Methods
Informed Search Idea: be smart about what paths to try.
Supplemental slides for CSE 327 Prof. Jeff Heflin
UNINFORMED SEARCH -BFS -DFS -DFIS - Bidirectional
State-Space Searches.
State-Space Searches.
CS 416 Artificial Intelligence
CMSC 471 Fall 2011 Class #4 Tue 9/13/11 Uninformed Search
State-Space Searches.
Informed Search Idea: be smart about what paths to try.
Search Strategies CMPT 420 / CMPG 720.
Supplemental slides for CSE 327 Prof. Jeff Heflin
Basic Search Methods How to solve the control problem in production-rule systems? Basic techniques to find paths through state- nets. For the moment: -
Presentation transcript:

Artificial Intelligence CS 165A Thursday, October 11, 2007 Blind search (Ch. 3) Informed (heuristic) search methods (Ch 4) Today 1

Notes 8-puzzle problem Homework assignment #1 posted There are two disjoint sets of states! Homework assignment #1 posted Due Tuesday October 23rd May work in groups of two Get going on it right away! Midterm schedule scheduled: November 13th “Mid-to-late-term exam”

Search Criteria Primary criteria to evaluate search strategies Review Search Criteria Primary criteria to evaluate search strategies Completeness Is it guaranteed to find a solution (if one exists)? Optimality Does it find the “best” solution (if there are more than one)? Time complexity Number of nodes generated/expanded (How long does it take to find a solution?) Space complexity How much memory does it require? Some performance measures Best case Worst case Average case Real-world case

General Search Algorithm (Version 2) Review General Search Algorithm (Version 2) Uses a queue (a list) and a queuing function to implement a search strategy Queuing-Fn(queue, elements) inserts a set of elements into the queue and determines the order of node expansion function GENERAL-SEARCH(problem, QUEUING-FN) returns a solution or failure nodes  MAKE-QUEUE(MAKE-NODE(INITIAL-STATE[problem])) loop do if nodes is empty then return failure node  REMOVE-FRONT(nodes) if GOAL-TEST[problem] applied to STATE(node) succeeds then return node nodes  QUEUING-FN(nodes, EXPAND(node, OPERATORS[problem])) end

Depth-First Search Always expands one of the nodes at the deepest level of the tree Low memory requirements Problem: depth could be infinite Uses LIFO queue function DEPTH-FIRST-SEARCH(problem) returns a solution or failure return GENERAL-SEARCH(problem, ENQUEUE-AT-FRONT)

Thursday Quiz Given the initial node s, a goal node g, and the current node n .... What is a heuristic function h (n) of the current node? What does it mean for a search routine to be complete? Is breadth-first search complete?

Example State space graph Search tree Queue (A) (B C) (D C) (C) (B D E) (D D E) (D E) (E) (F) B A C D E F A B C D D E B D F

Example: MU-Puzzle State space description Search tree Queue Start state: MI Goal state: MU Operators: x I  x IU M x  M x x I I I  U U U  (null) Search tree Queue (MI) (MIU MII) (MIUIU MII) (MIUIUIUIU MII) (MIUIUIUIUIUIUIUIU MII) … MI MIU 1 MII 2 MIUIU 2 MIUIUIUIU 2 MIUIUIUIUIUIUIUIU 2

Note on depth-first search Is depth-first this? Or this? That is, when a node is expanded, is it expanded fully? For our purposes, YES Open all children of each node

Depth-First Search Complete? Optimal? Time complexity? Space complexity? No Exponential: O( bm ) Polynomial: O( bm ) b = Maximum branching factor of the search tree d = Depth of an optimal solution (may be more than one) m = maximum depth of the search tree (may be infinite)

bm Why is the space complexity (memory usage) of depth-first search O( bm )? Remove expanded node when all descendents evaluated At each of the m levels, you have to keep b nodes in memory Example: b = 3 m = 6 Nodes in memory: bm+1 = 19 Actually, (b-1)m + 1 = 13 nodes, the way we have been keeping our node list

Uniform Cost Search Similar to breadth-first search, but always expands the lowest-cost node, as measured by the path cost function, g(n) g(n) is (actual) cost of getting to node n Breadth-first search is actually a special case of uniform cost search, where g(n) = DEPTH(n) If the path cost is monotonically increasing, uniform cost search will find the optimal solution function UNIFORM-COST-SEARCH(problem) returns a solution or failure return GENERAL-SEARCH(problem, ENQUEUE-IN-COST-ORDER)

Try breadth-first and uniform cost Example A 2 6 8 B C E 2 12 8 4 D 1 F Try breadth-first and uniform cost

Uniform-Cost Search Complete? Optimal? Time complexity? Space complexity? Yes Exponential: O( bd ) Same as breadth-first

Must explicitly represent node depth Depth-Limited Search Like depth-first search, but uses a depth cutoff to avoid long (possibly infinite), unfruitful paths Do depth-first search up to depth limit l Depth-first is special case with l=inf Problem: How to choose the depth limit l ? Some problem statements make it obvious (e.g., TSP), but others don’t (e.g., MU-puzzle) function DEPTH-LIMITED-SEARCH(problem, depth-limit) returns a solution or failure return GENERAL-SEARCH(problem, ENQUEUE-AT-FRONT-IF-UNDER-DEPTH-LIMIT) Must explicitly represent node depth

Depth-Limited Search Complete? Optimal? Time complexity? Space complexity? No, unless d  l No Exponential: O( bl ) b = Maximum branching factor of the search tree d = Depth of an optimal solution (may be more than one) m = maximum depth of the search tree (may be infinite) l = depth limit

Iterative-Deepening Search Since the depth limit is difficult to choose in depth-limited search, use depth limits of l = 0, 1, 2, 3, … Do depth-limited search at each level function ITERATIVE-DEEPENING-SEARCH(problem) returns a solution or failure for depth  0 to  do if DEPTH-LIMITED-SEARCH(problem, depth) succeeds then return result end return failure

Iterative-Deepening Search IDS has advantages of Breadth-first search – Optimal and complete Depth-first search – Modest memory requirements This is the preferred blind search method when the search space is large and the solution depth is unknown Many states are expanded multiple times Is this terribly inefficient? No… and it’s great for memory (compared with breadth-first) Why is it not particularly inefficient?

IDS efficiency When d = 2, the penalty for IDS is almost 100% When d = 3, the penalty for IDS is about 50% When d = 10, the penalty for IDS is about 11% When d = 35, the penalty for IDS is about 3% This assumes the solution is in the “right bottom corner”

Iterative-Deepening Search Complete? Optimal? Time complexity? Space complexity? Yes Exponential: O( bd ) Polynomial: O( bd ) b = Maximum branching factor of the search tree d = Depth of an optimal solution (may be more than one) m = maximum depth of the search tree (may be infinite)

bd Why is the space complexity (memory usage) of iterative-deepening search O( bd )? At each of the d levels, you have to keep b nodes in memory Example: b = 3 d = 6 Nodes in memory: bd+1 = 19 Actually, (b-1)d + 1 = 13 nodes, the way we have been keeping our node list

Bidirectional Search Forward search only: …

Bidirectional Search Simultaneously search forward from the initial state and backward from the goal state Much more efficient!

Bidirectional Search Example: 410 ≈ 1,000,000 2*45 ≈ 2,000 O(bd/2) rather than O(bd) – hopefully Both actions and predecessors (inverse actions) must be defined Must test for intersection between the two searches Constant time for test? Really a search strategy, not a specific search method Often not practical….

Bidirectional Search Complete? Optimal? Time complexity? Space complexity? Yes Exponential: O( bd/2 ) * Assuming breadth-first search used, and no misses!

Summary of Search Criteria b – max branching factor of the search tree d – depth of the least-cost solution m – max depth of the state-space (may be infinity) l – depth cutoff (Slightly different from the textbook)

When to Use Which Method? What kinds of problems are most appropriate (or inappropriate) for each type of search method? Hmm, that would be a good test question….

Practical note about search algorithms The computer can’t “see” the search graph like we can No “bird’s eye view” – make relevant information explicit! What information should you keep for a node in the search tree? State (1 2 0) Parent node (or perhaps complete ancestry) Node #3 (or, nodes 0, 2, 5, 11, 14) Depth of the node d = 4 Path cost up to (and including) the node g(node) = 12 Operator that produced this node Operator #1 Why might you want to know this?

Avoiding repeated states It may be beneficial to explicitly avoid repeated states, especially where there are loops in the state graph and/or reversible operators Search space can be very significantly pruned How to deal with repeated states: Do not return to state we just came from (parent node) Do not create paths with cycles (ancestor nodes) Do not generate any state that was ever generated before (complete tree) But there is a cost Have to keep track (in memory) of every state generated

Avoiding repeated states: Example For my M&C implementation in Lisp : With no checking 11,851 nodes expanded, 760 MB Checking parent 55 nodes expanded, 17 kB Checking ancestors 26 nodes expanded, 7 kB Checking all expanded nodes 14 nodes, 4 kB memory

Search as problem-solving We have defined the problem Data States, initial state(s), goal test/state(s), path cost function Operations State transitions Control – Search to find paths from initial states to goal states Build up a search tree whose nodes and arcs correspond to nodes and arcs in the state space graph Solution: “Best” path through the state space

Next: Informed (heuristic) search methods (Ch 4)