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.

Slides:



Advertisements
Similar presentations
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.
Advertisements

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.
Alyce Brady CS 470: Data Structures CS 510: Computer Algorithms Breadth-First Binary Tree Traversal Algorithm.
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.
Breadth-First Search Text Read Weiss, § 9.3 (pp ) Breadth-First Search Algorithms.
Solving Problems by Searching Currently at Chapter 3 in the book Will finish today/Monday, Chapter 4 next.
Properties of breadth-first search Complete? Yes (if b is finite) Time? 1+b+b 2 +b 3 +… +b d + b(b d -1) = O(b d+1 ) Space? O(b d+1 ) (keeps every node.
CMSC 471 Spring 2014 Class #4 Thu 2/6/14 Uninformed Search Professor Marie desJardins,
Branch & Bound Algorithms
Blind Search1 Solving problems by searching Chapter 3.
Chapter 8, Part I Graph Algorithms.
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)
Feng Zhiyong Tianjin University Fall  datatype PROBLEM ◦ components: INITIAL-STATE, OPERATORS, GOAL- TEST, PATH-COST-FUNCTION  Measuring problem-solving.
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.
Branch and bound Pasi Fränti Explore all alternatives Solution constructed by stepwise choices Decision tree Guarantees optimal solution Exponential.
Review: Search problem formulation
Problem Solving by Searching Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 3 Spring 2004.
1 Using Search in Problem Solving Part II. 2 Basic Concepts Basic concepts: Initial state Goal/Target state Intermediate states Path from the initial.
Toy Problem: Missionaries and Cannibals
Informed Search (no corresponding text chapter). Recall: Wanted " An algorithm and associated data structure(s) that can: 1) Solve an arbitrary 8-puzzle.
1 Chapter 4 Search Methodologies. 2 Chapter 4 Contents l Brute force search l Depth-first search l Breadth-first search l Properties of search methods.
Chapter 5 Trees PROPERTIES OF TREES 3 4.
Fall 2007CS 2251 Iterators and Tree Traversals. Fall 2007CS 2252 Binary Trees In a binary tree, each node has at most two subtrees A set of nodes T is.
Introduction to Artificial Intelligence Blind Search Ruth Bergman Fall 2004.
Alyce Brady CS 510: Computer Algorithms Breadth-First Graph Traversal Algorithm.
Using Search in Problem Solving
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved L12 (Chapter 20) Lists, Stacks,
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.
Alyce Brady CS 510: Computer Algorithms Depth-First Graph Traversal Algorithm.
Using Search in Problem Solving
Introduction to Artificial Intelligence Blind Search Ruth Bergman Fall 2002.
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.
Review: Search problem formulation Initial state Actions Transition model Goal state (or goal test) Path cost What is the optimal solution? What is the.
Busby, Dodge, Fleming, and Negrusa. Backtracking Algorithm Is used to solve problems for which a sequence of objects is to be selected from a set such.
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.
Problem Solving and Search Andrea Danyluk September 11, 2013.
October 3, 2012Introduction to Artificial Intelligence Lecture 9: Two-Player Games 1 Iterative Deepening A* Algorithm A* has memory demands that increase.
Heuristic Search In addition to depth-first search, breadth-first search, bound depth-first search, and iterative deepening, we can also use informed or.
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.
Trees – Part 2 CS 367 – Introduction to Data Structures.
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,
Problem-Solving by Searching Uninformed (Blind) Search Algorithms.
AI in game (II) 권태경 Fall, outline Problem-solving agent Search.
Search exploring the consequences of possible actions.
Lecture 3: Uninformed Search
Binary trees Binary search trees Expression trees Heaps Data Structures and Algorithms in Java, Third EditionCh06 – 1.
Search CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Advanced Artificial Intelligence Lecture 2: Search.
For Friday Read chapter 4, sections 1 and 2 Homework –Chapter 3, exercise 7 –May be done in groups.
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.
Search (continued) CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
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.
1 search CS 331/531 Dr M M Awais REPRESENTATION METHODS Represent the information: Animals are generally divided into birds and mammals. Birds are further.
Uninformed search strategies A search strategy is defined by picking the order of node expansion Uninformed search strategies use only the information.
Search Techniques CS480/580 Fall Introduction Trees: – Root, parent, child, sibling, leaf node, node, edge – Single path from root to any node Graphs:
Local Search. Systematic versus local search u Systematic search  Breadth-first, depth-first, IDDFS, A*, IDA*, etc  Keep one or more paths in memory.
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.
Breadth-first and depth-first traversal CS1114
Optimization Problems The previous examples simply find a single solution What if we have a cost associated with each solution and we want to find the.
Best-first search is a search algorithm which explores a graph by expanding the most promising node chosen according to a specified rule.
Brute Force and Exhaustive Search Brute Force and Exhaustive Search Traveling Salesman Problem Knapsack Problem Assignment Problem Selection Sort and Bubble.
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.
Alyce Brady CS 470: Data Structures CS 510: Computer Algorithms
Problem Solving and Searching
Problem Solving and Searching
Breadth First Search - A B C D E F G H I front FIFO Queue.
Presentation transcript:

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 compared in terms of –Time/number of steps needed to find a solution –Space needed by the algorithm –Optimality

Searching Large Structures For most interesting problems (game trees, Prolog rules, route finding, circuit layout, etc) you can’t keep the entire data structure in memory. Instead, we select a set of nodes to examine and keep in memory. For each node in memory, we check to see if there is other nodes (successors) that we can visit from this node. A node with no successors is called a goal node or a terminal node.

An Example father(Father,Son) :- parent(Father,Son),male(Father) parent(marge,bart). parent(homer,bart). male(homer). father(X,Y)

An Example father(Father,Son) :- parent(Father,Son),male(Father) parent(marge,bart). parent(homer,bart). male(homer). father(X,Y) parent(X,Y)

An Example father(Father,Son) :- parent(Father,Son),male(Father) parent(marge,bart). parent(homer,bart). male(homer). father(X,Y) parent(X,Y) parent(marge,bart) {X=marge Y=bart}

An Example father(Father,Son) :- parent(Father,Son),male(Father) parent(marge,bart). parent(homer,bart). male(homer). father(X,Y) parent(X,Y) parent(marge,bart) {X=marge Y=bart} male(marge) Fails!

An Example father(Father,Son) :- parent(Father,Son),male(Father) parent(marge,bart). parent(homer,bart). male(homer). father(X,Y) parent(X,Y) parent(X,bart) {Y=bart} male(marge) Fails! We need to backtrack And undo the binding Of X to marge.

An Example father(Father,Son) :- parent(Father,Son),male(Father) parent(marge,bart). parent(homer,bart). male(homer). father(X,Y) parent(X,Y) parent(homer,bart) {X=homer, Y=bart} male(homer) Success!

Depth-First Search Rule: –Expand a node. –Choose the “leftmost” child. –If it’s a solution, stop. –Else, expand it. If it has children, follow its leftmost child. –Else, back up to the parent and follow the next leftmost node. Pro: Uses a linear amount of memory. Con: Not guaranteed to find a solution.

Breadth-first Search Rule: –Expand a node –Check if any of the children are solutions. –If not, expand each of these nodes and visit those children in order. –Traverse each level of the structure in order. Pro: Will find a solution of one exists. Con: Requires exponential space.

Search and Priority Queues Any search strategy can be implemented with a priority queue. Algorithm: –Dequeue first node, check to see if it’s a solution. –Expand node. –Enqueue children. –If we use a normal queue, we get breadth-first search. –If we use a stack, we get depth-first search. –We can get a hybrid search by assigning priorities to nodes.