Search CPSC 386 Artificial Intelligence Ellen Walker Hiram College.

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
Problem Solving by Searching Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 3 Spring 2007.
January 26, 2003AI: Chapter 3: Solving Problems by Searching 1 Artificial Intelligence Chapter 3: Solving Problems by Searching Michael Scherger Department.
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)
Blind Search1 Solving problems by searching Chapter 3.
CPSC 322, Lecture 5Slide 1 Uninformed Search Computer Science cpsc322, Lecture 5 (Textbook Chpt 3.4) January, 14, 2009.
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.
14 Jan 2004CS Blind Search1 Solving problems by searching Chapter 3.
Artificial Intelligence (CS 461D)
UNINFORMED SEARCH Problem - solving agents Example : Romania  On holiday in Romania ; currently in Arad.  Flight leaves tomorrow from Bucharest.
Artificial Intelligence for Games Depth limited search Patrick Olivier
14 Jan 2004CS Blind Search1 Solving problems by searching Chapter 3.
CS 380: Artificial Intelligence Lecture #3 William Regli.
SE Last time: Problem-Solving Problem solving: Goal formulation Problem formulation (states, operators) Search for solution Problem formulation:
Review: Search problem formulation
Problem Solving by Searching Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 3 Spring 2004.
UnInformed Search What to do when you don’t know anything.
Search I Tuomas Sandholm Carnegie Mellon University Computer Science Department [Read Russell & Norvig Chapter 3]
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?
Blind Search-Part 2 Ref: Chapter 2. Search Trees The search for a solution can be described by a tree - each node represents one state. The path from.
Solving problems by searching
CS 561, Session 6 1 Last time: Problem-Solving Problem solving: Goal formulation Problem formulation (states, operators) Search for solution Problem formulation:
Solving Problems by Searching
Artificial Intelligence Course outline Introduction Problem solving Generic algorithms Knowledge Representation and Reasoning Expert Systems Uncertainty.
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.
Solving Problems by Searching CPS Outline Problem-solving agents Example problems Basic search algorithms.
CS 440 / ECE 448 Introduction to Artificial Intelligence Spring 2010 Lecture #3 Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam.
Introduction to search Chapter 3. Why study search? §Search is a basis for all AI l search proposed as the basis of intelligence l inference l all learning.
CS.462 Artificial Intelligence SOMCHAI THANGSATHITYANGKUL Lecture 02 : Search.
Artificial Intelligence
AI in game (II) 권태경 Fall, outline Problem-solving agent Search.
Vilalta&Eick:Uninformed Search Problem Solving By Searching Introduction Solutions and Performance Uninformed Search Strategies Avoiding Repeated States/Looping.
For Friday Finish reading chapter 4 Homework: –Lisp handout 4.
For Monday Read chapter 4, section 1 No homework..
Lecture 3: Uninformed Search
1 Solving problems by searching 171, Class 2 Chapter 3.
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.
Basic Problem Solving Search strategy  Problem can be solved by searching for a solution. An attempt is to transform initial state of a problem into some.
Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable state (goal state).
Search (continued) CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
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.
Problem Solving as Search. Problem Types Deterministic, fully observable  single-state problem Non-observable  conformant problem Nondeterministic and/or.
Introduction to Artificial Intelligence (G51IAI) Dr Rong Qu Blind Searches - Introduction.
Problem Solving by Searching
Implementation: General Tree Search
Graph Search II GAM 376 Robin Burke. Outline Homework #3 Graph search review DFS, BFS A* search Iterative beam search IA* search Search in turn-based.
Solving problems by searching A I C h a p t e r 3.
Search Part I Introduction Solutions and Performance Uninformed Search Strategies Avoiding Repeated States Partial Information Summary.
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: Uninformed Search
Problem Solving by Searching
Problem Solving as Search
Problem Solving and Searching
Problem Solving and Searching
Principles of Computing – UFCFA3-30-1
Presentation transcript:

Search CPSC 386 Artificial Intelligence Ellen Walker Hiram College

Problem Solving Agent Goal-based agent (next slide) Must find sequence of actions that will satisfy goal No knowledge of the problem other than definition –No rules –No prior experience

Model-based, Goal Based

Defining the Problem World state –All relevant information about the world (even if it cannot be perceived) –E.g. “vacuum at left, left is dirty, right is clean” Initial state –World state in which the agent starts Goal state –World state in which the problem is solved (can be multiple) Actions –What the agent can do –Table: (current state, action) -> new state Solution –A recommended action sequence that will lead from the current state to a goal state

Searching for a Solution If the initial state is a goal state, return an empty sequence of actions Repeat (until a sequence is found) [SEARCH] –Choose an action sequence –If the sequence leads to a goal, save it. Repeat (until the sequence is empty) [EXECUTE] –Remove the first step from the sequence and execute it.

Environmental requirements Static –so the plan will still work later Fully Observable –so agent knows the initial state Discrete –so agent can enumerate choices Deterministic –so agent can plan a sequence of actions, believing each will lead to a specific intermediate state

State Space Formulation State space –Graph of states connected by actions –Usually too big to be explicitly represented, we create a Successor Function instead Successor (state) -> ((action state) (action state)…) Goal test –Is this state a goal state? Path cost –(we assume) sum of costs of actions in a path Solution –Path from initial state to a goal state –Optimal: least-cost path from initial state to a goal state

Example: Water Pouring Problem –We have two buckets; one holds 4 gallons, and one holds 3 gallons. There are no markings on the buckets. –How can we get exactly 2 gallons into one bucket?

Problem Formulation Initial state –Two empty buckets (0 0) –Goal state (x 2) or (2 x) Actions & successor function –Fill a bucket (x y) -> (3 y) or (x y) -> (x 4) –Empty a bucket (x y) -> (0 y) or (x y) -> (y 0) –Pour from one bucket to another (stop when full) (x y) -> (0 x+y) or (x+y-4, 4) (x y) -> (x+y 0) or (3, x+y-3) Path cost: 1 unit per step

Partial State Space for Water Pouring

Graph Node Formulation State (world state at this node) Parent-node (previous node on path) Action (action taken to generate this node) Path cost, g(n) (from initial state to this node) Depth (number of steps taken so far)

Generic Searching Create a node for the initial state, and put it into the set of unexpanded nodes While the problem is not solved… –Pick an unexpanded node [according to strategy] –Stop (and report the path) if it is a goal state –Expand it (create nodes for every possible action that can be applied to that state)

Terminology Expanded nodes (visited) –Nodes that we have already created child nodes for Save these to avoid repetition Fringe nodes (generated but unvisited) –Nodes that exist but we have not yet created child nodes for them.

Uninformed Search Strategies Random (if you let it run long enough) Depth-first –Choose the most recently generated fringe node –Save fringe nodes on a stack Breadth-first –Choose the least recently generated fringe node –Save fringe nodes on a queue Uniform cost –Choose the least cost fringe node –Save fringe nodes on a priority queue, based on path cost

Maze Example Startabcd efgh ijkl mnoGoal

Paths with Costs A D H B C J G E I F

Variations on DFS Backtracking search –Instead of generating all children at once and putting them on the stack, generate them one at a time –Obvious recursive implementation –Minimal space requirements, since only the current path is stored Depth-limited search –Recursive implementation with a depth limit –If limit has been reached, return immediately –Distinguish between “cutoff” and “failure”

Issues with DFS and BFS DFS can waste a very long time on the wrong path! BFS requires much more space to hold the fringe. –DFS stores approximately 1 path –BFS stores all “current” nodes on all paths simultaneously BFS can expand nodes beyond the solution

Iterative Deepening Search Do a depth-limited search at 1, then at 2, etc. Properties –Finds shortest path (like BFS) –Cost of additional searches isn’t much, in the big-O sense. (Because the number of nodes expanded at a level is comparable to all nodes expanded at earlier levels) –Doesn’t expand nodes beyond solution (which BFS does) –Cost is O(b d ) while BFS is O(b d+1 ) IDS is the preferred uninformed search method when there is a large search space and the depth of the solution is not known.

Bidirectional Search Two searches at once –Initial state toward goal state –Goal state toward initial state Before expanding a node, see if it’s at the fringe of the other tree. –If so, you have found a complete path 2 trees of depth d/2 have much fewer nodes than 1 tree of depth d Space cost is high, though - one tree must be kept in memory for testing against.

Evaluating Search Strategies Completeness –Will a solution always be found if one exists? Optimality –Will the optimal (least cost) solution be found? Time Complexity –How long does it take to find the solution? –Often represented by # nodes expanded Space Complexity –How much memory is needed to perform the search? –Represented by max # nodes stored at once