State Space Search. Backtracking Suppose  We are searching depth-first  No further progress is possible (i.e., we can only generate nodes we’ve already.

Slides:



Advertisements
Similar presentations
Review: Search problem formulation
Advertisements

State Space Heuristic Search. Three Algorithms  Backtrack  Depth First  Breadth First All work if we have well-defined:  Goal state  Start state.
Greedy best-first search Use the heuristic function to rank the nodes Search strategy –Expand node with lowest h-value Greedily trying to find the least-cost.
State Space 3 Chapter 4 Heuristic Search. Three Algorithms Backtrack Depth First Breadth First All work if we have well-defined: Goal state Start state.
Comp 307 Problem Solving and Search Formalize a problem as State Space Search Blind search strategies Heuristic search.
Part2 AI as Representation and Search
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.
Solving Problems by Searching Currently at Chapter 3 in the book Will finish today/Monday, Chapter 4 next.
CMSC 471 Spring 2014 Class #4 Thu 2/6/14 Uninformed Search Professor Marie desJardins,
CS 484 – Artificial Intelligence1 Announcements Department Picnic: today, after class Lab 0 due today Homework 2 due Tuesday, 9/18 Lab 1 due Thursday,
Biointelligence Lab School of Computer Sci. & Eng. Seoul National University Artificial Intelligence Chapter 8 Uninformed Search.
Artificial Intelligence (CS 461D)
Depth-First and Breadth-First Search In addition to specifying a search direction (data-driven or goal-driven), a search algorithm must determine the order.
Artificial Intelligence Lecture No. 7 Dr. Asad Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
State Space Search 2 Chapter 3 Three Algorithms. Backtracking Suppose We are searching depth-first No further progress is possible (i.e., we can only.
Search in AI.
Search Strategies.  Tries – for word searchers, spell checking, spelling corrections  Digital Search Trees – for searching for frequent keys (in text,
B ACKTRACK SEARCH ALGORITHM. B ACKTRACKING Suppose you have to make a series of decisions, among various choices, where You don’t have enough information.
Review: Search problem formulation
MAE 552 – Heuristic Optimization Lecture 27 April 3, 2002
Using Search in Problem Solving
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.
Using Search in Problem Solving
1 Structures and Strategies for State Space Search 3 3.0Introduction 3.1Graph Theory 3.2Strategies for State Space Search 3.3Using the State Space to Represent.
On Search Search is one of the most common CS problems. There are lots of different algorithms for searching through a set of alternatives. They can be.
1 Control and Implementation of State Space Search 5 5.0Introduction 5.1Recursion-Based Search 5.2Pattern-directed Search 5.3Production Systems 5.4The.
Informed Search Idea: be smart about what paths to try.
Review: Search problem formulation Initial state Actions Transition model Goal state (or goal test) Path cost What is the optimal solution? What is the.
Search.
Recursion Bryce Boe 2013/11/18 CS24, Fall Outline Wednesday Recap Lab 7 Iterative Solution Recursion Binary Tree Traversals Lab 7 Recursive Solution.
1 Trees Tree nomenclature Implementation strategies Traversals –Depth-first –Breadth-first Implementing binary search trees.
Heuristic Search In addition to depth-first search, breadth-first search, bound depth-first search, and iterative deepening, we can also use informed or.
KU NLP Structures and Strategies for State Space Search Depth-First and Breadth-First Search q A search algorithm must determine the order in which.
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.
Introduction to search Chapter 3. Why study search? §Search is a basis for all AI l search proposed as the basis of intelligence l all learning algorithms,
CS 415 – A.I. Slide Set 5. Chapter 3 Structures and Strategies for State Space Search – Predicate Calculus: provides a means of describing objects and.
A RTIFICIAL I NTELLIGENCE UNIT : 2 Search Techniques.
“Planning is bringing the future into the present so that you can do something about it now.” – Alan Lakein Thought for the Day.
For Monday Read chapter 4, section 1 No homework..
Lecture 3: Uninformed Search
Search CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Basic Search Procedure 1. Start with the start node (root of the search tree) and place in on the queue 2. Remove the front node in the queue and If the.
1 Solving problems by searching Chapter 3. Depth First Search Expand deepest unexpanded node The root is examined first; then the left child of the root;
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.
Uninformed search strategies A search strategy is defined by picking the order of node expansion Uninformed search strategies use only the information.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Ver Chapter 13: Graphs Data Abstraction & Problem Solving with C++
Search Techniques CS480/580 Fall Introduction Trees: – Root, parent, child, sibling, leaf node, node, edge – Single path from root to any node Graphs:
Kruse/Ryba ch051 Object Oriented Data Structures Recursion Introduction to Recursion Principles of Recursion Backtracking: Postponing the Work Tree-Structured.
CMSC 202, Version 5/02 1 Trees. CMSC 202, Version 5/02 2 Tree Basics 1.A tree is a set of nodes. 2.A tree may be empty (i.e., contain no nodes). 3.If.
Graphs - II CS 2110, Spring Where did David leave that book? 2.
Artificial Intelligence Solving problems by searching.
Uniformed Search (cont.) Computer Science cpsc322, Lecture 6
Breadth First and Depth First
Backtracking And Branch And Bound
Csc 2720 Instructor: Zhuojun Duan
Data Structures and Database Applications Binary Trees in C#
Artificial Intelligence (CS 370D)
Backtracking And Branch And Bound
Uniformed Search (cont.) Computer Science cpsc322, Lecture 6
SOLVING PROBLEMS BY SEARCHING
Search Related Algorithms
Depth-First Searches Introduction to AI.
Artificial Intelligence
Informed Search Idea: be smart about what paths to try.
Backtracking And Branch And Bound
Chapter 14 Graphs © 2011 Pearson Addison-Wesley. All rights reserved.
CMSC 471 Fall 2011 Class #4 Tue 9/13/11 Uninformed Search
Informed Search Idea: be smart about what paths to try.
Lecture 4: Tree Search Strategies
Depth-First Searches.
Presentation transcript:

State Space Search

Backtracking Suppose  We are searching depth-first  No further progress is possible (i.e., we can only generate nodes we’ve already generated), then backtrack.

The algorithm: First Pass 1. Pursue path until goal is reached or dead end 2. If goal, quit and return the path 3. If dead end, backtrack until you reach the most recent node whose children have not been fully examined

BT maintains Three Lists and A State  SL –List of nodes in current path being tried. If goal is found, SL contains the path  NSL –List of nodes whose descendents have not been generated and searched  DE –List of dead end nodes  All lists are treated as stacks  CS –Current state of the search

The Algorithm

State Space a b F g c a d h i j A as a child of C is intentional

Trace Goal: J, Start: A NSLSLCSDE AAA BCDABAB FBCDAFBAF GFBCDAGFBAG FBCDAFBAFFG BCDABABBFG CDAAC CAC DADAD JDAJDAJ(GOAL)

Depth-First: A Simplification of BT  Eliminate saved path  Results in Depth-First search –Goes as deeply as possible –Is not guaranteed to find a shortest path –Maintains two lists  Open List –Contains states generated –Children have not been examined (like NSL) –Open is implemented as a stack  Closed List –Contains states already examined –Union of SL and DE

bool Depth-First(Start) { open = [Start]; closed = []; while (!isEmpty.open()) { CS = open.pop(); if (CS == goal) return true; return true; else else { generate children of CS; generate children of CS; closed.push(CS); closed.push(CS); eliminate children from CS that are on open or closed; eliminate children from CS that are on open or closed; while (CS has more children) open.push(child of CS); open.push(child of CS); } } return false; return false;}

State Space a b E g c a d h i j A as a child of C is intentional

Goal: J Start: A OpenCSClosed A[] []A A BCD CDB BAECD CDEBA EBAGCD CDG GEBA DC []D DJH HJ(return true)

Breadth-First Search: DF but with a Queue bool Breadth-First(Start) { open = [Start]; closed = []; while (!isEmpty.open()) { CS = open.dequeue(); if (CS == goal) return true; return true; else else { generate children of CS; generate children of CS; closed.enqueue(CS); closed.enqueue(CS); eliminate children from CS that are on open or closed; eliminate children from CS that are on open or closed; while (CS has more children) open.enqueue(child of CS); open.enqueue(child of CS); } } return false; return false;}

Trace If you trace this, you’ll notice that the algorithm examines each node at each level before descending to another level You will also notice that open contains: 1. Unopened children of current state 2. Unopened states at current level

Both Algorithms 1. Open forms frontier of search 2. Path can be easily reconstructed  Each node is an ordered pair (x,y)  X is the node name  Y is the parent  When goal is found, search closed for parent, the parent of the parent, etc., until start is reached.

Breadth-First  Finds shortest solution  If branching factor is high, could require a lot of storage Depth-First  If it is known that the solution path is long, DF will not waste time searching shallow states  DF can get lost going too deep and miss a shallow solution  DF and BF follow for the 8-puzzle

8 Puzzle—DF (p. 105) Depth First Search of 8-Puzzle (p. 105) Depth Bound = 5 Search Protocol: L, U, R, D If each state has B children on average, requires that we store B * N states to go N levels deep

8 Puzzle-BF (p. 103) Depth Bound = 5 Search Protocol: L,U,R,D If each state has on average B children, requires that we store B * the number of states on the previous level for a total of B N states at level N.

Problem with Depth Bounds  What happens if we don’t reach the goal at a given depth bound?  Fail

Solution