Solving problems by searching A I C h a p t e r 3.

Slides:



Advertisements
Similar presentations
Artificial Intelligent
Advertisements

Solving problems by searching Chapter 3. Outline Problem-solving agents Problem types Problem formulation Example problems Basic search algorithms.
Additional Topics ARTIFICIAL INTELLIGENCE
Review: Search problem formulation
Uninformed search strategies
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
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.
Uninformed (also called blind) search algorithms) This Lecture Chapter Next Lecture Chapter (Please read lecture topic material before.
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.
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.
Search Strategies Reading: Russell’s Chapter 3 1.
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.
Search Search plays a key role in many parts of AI. These algorithms provide the conceptual backbone of almost every approach to the systematic exploration.
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 Chapter 3. Outline Problem-solving agents Problem types Problem formulation Example problems Basic search 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 for Games Uninformed search Patrick Olivier
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.
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.
An Introduction to Artificial Intelligence Lecture 3: Solving Problems by Sorting Ramin Halavati In which we look at how an agent.
CS 380: Artificial Intelligence Lecture #3 William Regli.
Review: Search problem formulation
Problem Solving by Searching Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 3 Spring 2004.
Artificial Intelligence Chapter 3: Solving Problems by Searching
1 Lecture 3 Uninformed Search. 2 Complexity Recap (app.A) We often want to characterize algorithms independent of their implementation. “This algorithm.
Solving problems by searching
1 Lecture 3 Uninformed Search
Lecture 3 Uninformed Search.
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.
Artificial Intelligence
AI in game (II) 권태경 Fall, outline Problem-solving agent Search.
Carla P. Gomes CS4700 CS 4700: Foundations of Artificial Intelligence Prof. Carla P. Gomes Module: Search I (Reading R&N: Chapter.
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.
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;
Uninformed Search ECE457 Applied Artificial Intelligence Spring 2007 Lecture #2.
Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable state (goal state).
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.
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.
Pengantar Kecerdasan Buatan
Uninformed search strategies A search strategy is defined by picking the order of node expansion Uninformed search strategies use only the information.
Problem Solving as Search. Problem Types Deterministic, fully observable  single-state problem Non-observable  conformant problem Nondeterministic and/or.
Problem Solving by Searching
Implementation: General Tree Search
Search Part I Introduction Solutions and Performance Uninformed Search Strategies Avoiding Repeated States Partial Information Summary.
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 Solving problems by searching.
Lecture 3: Uninformed Search
EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS
Uninformed Search Strategies
Artificial Intelligence
Solving problems by searching
Artificial Intelligence
Principles of Computing – UFCFA3-30-1
Solving Problems by Searching
Presentation transcript:

Solving problems by searching A I C h a p t e r 3

Outline Problem-solving agents Problem types Problem formulation Example problems Basic search algorithms

Problem-solving agents Fundamentals of classical symbolic AI can be divided into knowledge representation and search. Search deals with finding nodes having certain properties in a graph. Representing a problem in a way that is accessible to this sort of search is called knowledge representation.

Example: Romania On holiday in Romania; currently in Arad. Flight leaves tomorrow from Bucharest Formulate goal: – be in Bucharest Formulate problem: – states: various cities – actions: drive between cities Find solution: – sequence of cities, e.g., Arad, Sibiu, Fagaras, Bucharest

Example: Romania The path depends on the search algorithm

Problem types Deterministic, fully observable  single-state problem – Agent knows exactly which state it will be in; solution is a sequence Non-observable  sensorless problem (conformant problem) – Agents may have no idea where it is; solution is a sequence Nondeterministic and/or partially observable  contingency problem – percepts provide new information about current state – often interleave search, execution Unknown state space  exploration problem

Well-defined problems and solutions A problem can be defined formally by four components: 1.The initial state that the agent starts in. For example, the initial state for our agent in Romania might be described as In(Arad). 2.A description of the possible actions available to the agent. The most common formulation uses a successor function. Given a particular state x, SUCCESSOR-FN(x) returns a set of (action, successor) ordered pairs, where each action is one of the legal actions in state x and each successor is a state that can be reached from x by applying the action. For example, from the state In(Arad), the successor function for the Romania problem would return: { }

Example: The 8-puzzle 1.States: locations of tiles 2.Initial state: any initial state 3.Actions: move blank left, right, up, down 4.Goal test: check if whether the state matches goal 5.Path cost: 1 per move

Example: The 8-puzzle

The output of a problem-solving algorithm is either failure or a solution. (Some algorithms might get stuck in an infinite loop and never return an output.) We will evaluate an algorithm's performance in four ways:  Completeness: Is the algorithm guaranteed to find a solution when there is one?  Optimality: Does the strategy find the optimal solution  Time complexity : How long does it take to find a solution?  Space complexity: How much memory is needed to perform the search? Measuring problem-solving performance

Tree search algorithms Having formulated some problems, we now need to solve them. This is done by a search through the state space. Using an explicit search tree that is generated by the initial state and the successor function that together define the state space The root of the search tree is a search node corresponding to the initial State  In(Arad) By expanding the current state; that is, applying the successor function to the current state, thereby generating a new set of states. In this case, we get three new states  In(Sibiu), In(Timisoara), and In(Zerind). We also need to represent the collection of nodes that have been generated but not yet expanded-this collection is called the fringe. Each element of the fringe is a leaf node.

Tree search algorithms: graph into tree

Tree search example

Uninformed search strategies ( also called blind search) Uninformed search strategies use only the information available in the problem definition. Breadth-first search Uniform-cost search Depth-first search Depth-limited search Iterative deepening search

Breadth-first search is a simple strategy in which the root node is expanded first, then all the successors of the root node are expanded next, then their successors, and so on. In general, all the nodes are expanded at a given depth in the search tree before any nodes at the next level are expanded.

Breadth-first search is a simple strategy in which the root node is expanded first, then all the successors of the root node are expanded next, then their successors, and so on. In general, all the nodes are expanded at a given depth in the search tree before any nodes at the next level are expanded.

Breadth-first search is a simple strategy in which the root node is expanded first, then all the successors of the root node are expanded next, then their successors, and so on. In general, all the nodes are expanded at a given depth in the search tree before any nodes at the next level are expanded.

Breadth-first search is a simple strategy in which the root node is expanded first, then all the successors of the root node are expanded next, then their successors, and so on. In general, all the nodes are expanded at a given depth in the search tree before any nodes at the next level are expanded.

Order in which the nodes are expanded in Breadth-first search

Order in which the nodes are expanded in Breadth-first search

Order in which the nodes are expanded in Breadth-first search

Order in which the nodes are expanded in Breadth-first search

Order in which the nodes are expanded in Breadth-first search

Order in which the nodes are expanded in Breadth-first search

Order in which the nodes are expanded in Breadth-first search

Order in which the nodes are expanded in Breadth-first search

Order in which the nodes are expanded in Breadth-first search

Order in which the nodes are expanded in Breadth-first search

Order in which the nodes are expanded in Breadth-first search

Order in which the nodes are expanded in Breadth-first search

Order in which the nodes are expanded in Breadth-first search

Order in which the nodes are expanded in Breadth-first search

Order in which the nodes are expanded in Breadth-first search

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 ) Space? O(b d+1 ) (keeps every node in memory) Optimal? Yes (if cost = 1 per step) Space is the bigger problem (more than time) d is the depth of the solution b is the branching factor at each non-leaf node

Uniform Cost Search(UCS) uniform-cost search (UCS) is a tree search algorithm used for traversing or searching a tree or graph. The search begins at the root node. The search continues by visiting the next node which has the least total cost from the root. Nodes are visited in this manner until a goal state is reached. Uniform Cost Search is the best algorithm for a search problem, which does not involve the use of heuristics. It can solve any general graph for optimal cost. Uniform Cost Search as it sounds searches in branches which are more or less the same in cost. Uniform Cost Search again demands the use of a priority queue.

S A B C D G Initialization: { [ S, 0 ] } Iteration1: { [ S->A, 1 ], [ S->G, 12 ] } Iteration2: { [ S->A->C, 2 ], [ S->A->B, 4 ], [ S->G, 12] } Iteration3: { [ S->A->C->D, 3 ], [ S->A->B, 4 ], [ S->A->C->G, 4 ], [ S->G, 12 ] } Iteration4: { [ S->A->B, 4 ], [ S->A->C->G, 4 ], [ S->A->C->D->G, 6 ], [ S->G, 12 ] } Iteration5: { [ S->A->C->G, 4 ], [ S->A->C->D->G, 6 ], [ S->A->B->D, 7 ], [ S->G, 12 ] } Iteration6 gives the final output as S->A->C->G. Example: Uniform Cost Search(UCS)

Completeness: Yes Time complexity: : O(b d ) exponential Space complexity: O(b d ) exponential Optimality: Yes Properties Uniform Cost Search(UCS) d is the depth of the solution b is the branching factor at each non-leaf node

Depth-first search always expands the deepest node in the current fringe of the search tree. The search proceeds immediately to the deepest level of the search tree, where the nodes have no successors. As those nodes are expanded, they are dropped from the fringe, so then the search "backs up" to the next shallowest node that still has unexplored successors.

Depth-first search Find M

Depth-first search

M found

Order in which the nodes are expanded in Depth-first search

Order in which the nodes are expanded in Depth-first search

Order in which the nodes are expanded in Depth-first search

Order in which the nodes are expanded in Depth-first search

Order in which the nodes are expanded in Depth-first search

Order in which the nodes are expanded in Depth-first search

Order in which the nodes are expanded in Depth-first search

4 Order in which the nodes are expanded in Depth-first search

4 Order in which the nodes are expanded in Depth-first search

45 Order in which the nodes are expanded in Depth-first search

45 3 Order in which the nodes are expanded in Depth-first search

45 3 Order in which the nodes are expanded in Depth-first search

Order in which the nodes are expanded in Depth-first search

Order in which the nodes are expanded in Depth-first search

Order in which the nodes are expanded in Depth-first search

Order in which the nodes are expanded in Depth-first search

Order in which the nodes are expanded in Depth-first search

Order in which the nodes are expanded in Depth-first search

Order in which the nodes are expanded in Depth-first search

Order in which the nodes are expanded in Depth-first search

Order in which the nodes are expanded in Depth-first search

Order in which the nodes are expanded in Depth-first search

Order in which the nodes are expanded in Depth-first search

Order in which the nodes are expanded in Depth-first search

Order in which the nodes are expanded in Depth-first search

Order in which the nodes are expanded in Depth-first search

Order in which the nodes are expanded in Depth-first search

Properties of depth-first search Complete? No: fails in infinite-depth spaces, spaces with loops – Modify to avoid repeated states along path  complete in finite spaces Time? O(b m ): terrible if m is much larger than d – but if solutions are dense, may be much faster than breadth- first Space? O(bm), i.e., linear space! Optimal? No (because; it first explores one path to its end, thereby possibly finding a solution that is more expensive than some solution in another path.) b = branching factor m = max depth of search tree

Comparison between the two types The red node needs 3 actions The green node needs 10 actions The red node needs 7 actions The green node needs 5 actions depth-first search Breadth-first search

The problem of unbounded trees can be alleviated by supplying depth-first search with a predetermined depth limit L. That is, nodes at depth L are treated as if they have no successors to solve the infinite-path problem Depth-limited search

 It works exactly like depth-first search, but avoids its drawbacks regarding completeness by imposing a maximum limit on the depth of the search.  Even if the search could still expand a vertex beyond that depth, it will not do so and thereby it will not follow infinitely deep paths or get stuck in cycles.  Therefore depth-limited search will find a solution if it is within the depth limit, which guarantees at least completeness on all graphs.

Order in which the nodes are expanded in Depth-limited search Set level = 2Level = 0 Level = 1 Level = 2

1 2 Set level = 2Level = 0 Level = 1 Level = 2 Order in which the nodes are expanded in Depth-limited search

1 2 3 Set level = 2Level = 0 Level = 1 Level = 2 Order in which the nodes are expanded in Depth-limited search

Set level = 2Level = 0 Level = 1 Level = 2 Order in which the nodes are expanded in Depth-limited search

Set level = 2Level = 0 Level = 1 Level = 2 Order in which the nodes are expanded in Depth-limited search

Set level = 2Level = 0 Level = 1 Level = 2 Order in which the nodes are expanded in Depth-limited search

Set level = 2Level = 0 Level = 1 Level = 2 Order in which the nodes are expanded in Depth-limited search

Set level = 2Level = 0 Level = 1 Level = 2 Order in which the nodes are expanded in Depth-limited search

Set level = 2Level = 0 Level = 1 Level = 2 Order in which the nodes are expanded in Depth-limited search

Set level = 2Level = 0 Level = 1 Level = 2 Order in which the nodes are expanded in Depth-limited search

Set level = 2Level = 0 Level = 1 Level = 2 Order in which the nodes are expanded in Depth-limited search

Set level = 2Level = 0 Level = 1 Level = 2 Order in which the nodes are expanded in Depth-limited search

Properties of Depth-limited search Complete? No (because; it does not find any solution that lies beyond the given search depth. But if the maximum search depth is chosen to be greater than the depth of a solution the algorithm becomes complete). Time? O(b m ) : terrible if m is much larger than d – but if solutions are dense, may be much faster than breadth-first Space? O(bm), i.e., linear space! Optimal? No (because; it first explores one path to its end, thereby possibly finding a solution that is more expensive than some solution in another path.) b = branching factor m = max depth of search tree

 Iterative deepening depth-first search is a state space search strategy in which a depth-limited search is run repeatedly, increasing the depth limit with each iteration until it reaches, the depth of the shallowest goal state.  It is equivalent to breadth-first search  it visits the nodes in the search tree in the same order as depth-first search,  but the cumulative order in which nodes are first visited is effectively breadth-first. Iterative deepening depth-first search

Iterative deepening search L =0 Iterative deepening search L =1 Iterative deepening depth-first search

Iterative deepening search L =2 Iterative deepening depth-first search

Iterative deepening search L =3

Properties of iterative deepening search Complete? Yes Time? (d+1)b 0 + d b 1 + (d-1)b 2 + … + b d = O(b d ) Space? O(bd) Optimal? Yes, if step cost = 1 d is the depth of the solution b is the branching factor at each non-leaf node

Summary of algorithms

END