Solving Problems by Searching chap3 1. Problem-Solving Agents

Similar documents
Uninformed Search Strategies

Search I. Tuomas Sandholm Carnegie Mellon University Computer Science Department. [Read Russell & Norvig Chapter 3]

Problem Solving as Search - I

Uninformed search strategies

Problem Solving Agents

Princess Nora University Faculty of Computer & Information Systems ARTIFICIAL INTELLIGENCE (CS 370D) Computer Science Department

Real World Search Problems. CS 331: Artificial Intelligence Uninformed Search. Simpler Search Problems. Example: Oregon. Search Problem Formulation

Uninformed search methods II.

Uninformed Search (Ch )

Uninformed search methods

Uninformed search methods

Uninformed Search (Ch )

Artificial Intelligence. Uninformed Search Strategies

CENG 466 Artificial Intelligence. Lecture 4 Solving Problems by Searching (II)

CSE 3401: Intro to AI & LP Uninformed Search II

COMP9414: Artificial Intelligence Uninformed Search

Uninformed search methods II.

Representation. Representation. Representation. Representation. 8 puzzle.

SEARCH TREE. Generating the children of a node

SEARCH SEARCH TREE. Node: State in state tree. Root node: Top of state tree

Better Search Improved Uninformed Search CIS 32

COMP219: Artificial Intelligence. Lecture 8: Combining Search Strategies and Speeding Up

CSE 3402: Intro to Artificial Intelligence Uninformed Search II

Introduction. AI and Searching. Simple Example. Simple Example. Now a Bit Harder. From Hammersmith to King s Cross

Overview. Depth Limited Search. Depth Limited Search. COMP219: Artificial Intelligence. Lecture 8: Combining Search Strategies and Speeding Up

CSC384: Introduction to Artificial Intelligence. Search

CS 4649/7649 Robot Intelligence: Planning

/435 Artificial Intelligence Fall 2015

CMPUT680 - Winter 2001

SIDDHARTH INSTITUTE OF ENGINEERING & TECHNOLOGY :: PUTTUR (AUTONOMOUS) Siddharth Nagar, Narayanavanam Road QUESTION BANK (DESCRIPTIVE)

Spider Search: An Efficient and Non-Frontier-Based Real-Time Search Algorithm

Depth-bounded Discrepancy Search

Planning and Acting in Partially Observable Stochastic Domains

G53CLP Constraint Logic Programming

Advanced Search Hill climbing

Transposition Table, History Heuristic, and other Search Enhancements

CS 4649/7649 Robot Intelligence: Planning

Pedestrian Dynamics: Models of Pedestrian Behaviour

Aryeh Rappaport Avinoam Meir. Schedule automation

Optimization and Search. Jim Tørresen Optimization and Search

CS 4649/7649 Robot Intelligence: Planning

A SEMI-PRESSURE-DRIVEN APPROACH TO RELIABILITY ASSESSMENT OF WATER DISTRIBUTION NETWORKS

COMP 406 Lecture 05. Artificial. Fiona Yan Liu Department of Computing The Hong Kong Polytechnic University

Robust Task Execution: Procedural and Model-based. Outline. Desiderata: Robust Task-level Execution

6.034 Artificial Intelligence

EE 364B: Wind Farm Layout Optimization via Sequential Convex Programming

Provably Secure Camouflaging Strategy for IC Protection

CT PET-2018 Part - B Phd COMPUTER APPLICATION Sample Question Paper

A new Decomposition Algorithm for Multistage Stochastic Programs with Endogenous Uncertainties

Problem-Solving: A* and Beyond. CSCI 3202, Fall 2010

1 Fluids and Pressure

VLSI Design 14. Memories

The system design must obey these constraints. The system is to have the minimum cost (capital plus operating) while meeting the constraints.

CS 4649/7649 Robot Intelligence: Planning

Dispatching Universität Karlsruhe, System Architecture Group

Decision Trees. Nicholas Ruozzi University of Texas at Dallas. Based on the slides of Vibhav Gogate and David Sontag

Running the Table: An AI for Computer Billiards

1 Chapter 6: Stability. Chapter 6. Stability. 2000, John Wiley & Sons, Inc. Nise/Control Systems Engineering, 3/e

4. Please Do Break the Crystal

Shot-by-shot directional source deghosting and directional designature using near-gun measurements

A fast and complete convection scheme for ocean models. Stefan Rahmstorf. Institut für Meereskunde Kiel Germany. published in. Ocean Modelling Nr.

Bulgarian Olympiad in Informatics: Excellence over a Long Period of Time

Biostatistics & SAS programming

Motion Control of a Bipedal Walking Robot

OIL & GAS. 20th APPLICATION REPORT. SOLUTIONS for FLUID MOVEMENT, MEASUREMENT & CONTAINMENT. Q&A: OPEC Responds to SHALE BOOM

Navy Guidance and Tips for Using DOEHRS-IH Ventilation NAVY & MARINE CORPS PUBLIC HEALTH CENTER

9.2 Waves at Media Boundaries

Computational Models: Class 6

Decision Trees. an Introduction

Re: ENSC 440 Functional Specification for the Wall Climbing Robot. Dear Mr. Leung,

Chs. 16 and 17 Mechanical Waves

CS472 Foundations of Artificial Intelligence. Final Exam December 19, :30pm

Two Special Right Triangles

Chapter 15 Fluids. Copyright 2010 Pearson Education, Inc.

Extensive Games with Perfect Information

Urban OR: Quiz 2 Solutions (2003) ( 1 ρ 1 )( 1 ρ 1 ρ 2 ) ( 1 12 )( ) σ S ] 24 [ 2 = 60, 2 2 ] ( 2 ) 3

Evacuation Time Minimization Model using Traffic Simulation and GIS Technology

Where are you right now? How fast are you moving? To answer these questions precisely, you

Traffic Safety. Norman W. Garrick. Wesley Marshall. University of Connecticut. University of Colorado Denver

Quadratic Probing. Hash Tables (continued) & Disjoint Sets. Quadratic Probing. Quadratic Probing Example insert(40) 40%7 = 5

Algebra Date Lesson Independent Work Computer Tuesday, Introduction (whole class) Problem with Dice

COMPRESSED AIR DISTRIBUTION SYSTEMS

1 PIPESYS Application

SIMULATION OF ENTRAPMENTS IN LCM PROCESSES

University of Cincinnati

GRAPH-BASED SPORTS RANKINGS

Iteration: while, for, do while, Reading Input with Sentinels and User-defined Functions

Introduction to Pneumatics

Automating Injection Molding Simulation using Autonomous Optimization

Designing a Model Rocket

ISyE 3103 Introduction to Supply Chain Modeling: Logistics Summer 2012 Homework 8 Issued: July 11, 2012 Due: July 18, 2012

Introduction to Algorithms

Incremental ARA*: An Anytime Incremental Search Algorithm For Moving Target Search. University of Southern California Singapore Management University

Design and Evaluation of Adaptive Traffic Control System for Heterogeneous flow conditions

#19 MONITORING AND PREDICTING PEDESTRIAN BEHAVIOR USING TRAFFIC CAMERAS

CHAPTER 11: THE GASEOUS STATE

Broken Calculators. Prepared by Daniel Finkel for the Julia Robinson Festival

ITF Coaches Education Programme Biomechanics of the forehand stroke

Fast Software-managed Code Decompression

Chapter 13. ANTY: the robotic ant

Transcription:

Chapter3 Solving Problems by Searching 20070315 chap3 1 Problem-Solving Agents Reflex agents cannot work well in those environments - state/action mapping too large - take too long to learn Problem-solving agent - is one kind of goal-based agent - decides what to do by finding sequences of actions that lead to desirable states 20070315 chap3 2 1

Problem Solving Agents (cont.) Formulation - Goal formulation (final state) - Problem formulation (decide what actions and states to consider) Search (look for solution i.e.action sequence) Execution (follow states in solution) Assume the environment is static, observable, discrete, deterministic 20070315 chap3 3 Well-defined Problems and Solutions A problem can be defined by -Initial state In(Arad) - Possible actions (or successor function) {<Go(Sibiu), In(Sibiu)>, <Go(Timi), In(Timi)>, <Go(Zerind), In(Zerind)>} - Goal test {In(Bucharest)} - Path cost function state space of a problem Step cost: c(x, a, y) taking action a to go from state x to state y Optimal solution the lowest path cost among all solutions 20070315 chap3 4 2

Example: Romania 20070315 chap3 5 Example Problems Toy problems Vacuum World, 8-Puzzle, 8-Queens Problem, Cryptarithmetic, Missionaries and Cannibals Real-world problems Route finding, Touring problems Traveling salesman problem, VLSI layout, Robot navigation, Assembly sequencing, Protein Design, Internet Searching 20070315 chap3 6 3

Vacuum World 20070315 chap3 7 Vacuum World (cont.) States: agent location, each location might or might not contain dirt # of possible states = 2* 2 2 = 8 Initial state: any possible state Successor function: possible actions (left, Right, Suck) Goal test: check whether all the squares are clean Path cost: the number of steps, each step cost 1 20070315 chap3 8 4

The 8-Puzzle States: location of each of the eight tiles and the blank tile # of possible states = 9!/2 = 181,440 --- 9!/4??? Initial state: any state Successor function: blank moves(left, Right, Up, Down) Goal test: check whether the state match as the goal configuration Path cost: the number of steps, each step cost 1 20070315 chap3 9 The 8-Queens Incremental formulation vs. complete-state formulation States-I-1: 0-8 queens on board Successor function-i-1: add a queen to any square 14 # of possible states = (64*63* *57= 3*10 ) States-I-2: 0-8 non-attacking queens on board Successor function-i-2: add a queen to a non-attacking square in the left-most empty column # of possible states = 2057 ---??? Goal test: 8 queens on board, none attacked Path cost: of no interest (since only the final state count) 20070315 chap3 10 5

Robotic Assembly States: real-valued coordinates of robot joint angles parts of the object to be assembled Successor function: continuous motions of robot joints Goal test : complete assembly Path cost : time to execute 20070315 chap3 11 Basic Search Algorithms How do we find the solutions of previous problems? - Search the state space (remember complexity of space depends on state representation) - Here: search through explicit tree generation ROOT= initial state. Nodes and leafs generated through successor function. - In general search generates a graph (same state through multiple paths) 20070315 chap3 12 6

Tree Search Algorithms 20070315 chap3 13 Simple Tree Search Example function TREE-SEARCH(problem, strategy) return a solution or failure Initialize search tree to the initial state of the problem loop do if no candidates for expansion then return failure choose leaf node for expansion according to strategy if node contains goal state then return solution else expand the node and add resulting nodes to the search tree end 20070315 chap3 14 7

Simple tree search example function TREE-SEARCH(problem, strategy) return a solution or failure Initialize search tree to the initial state of the problem loop do if no candidates for expansion then return failure choose leaf node for expansion according to strategy if node contains goal state then return solution else expand the node and add resulting nodes to the search tree end 20070315 chap3 15 Simple tree search example function TREE-SEARCH(problem, strategy) return a solution or failure Initialize search tree to the initial state of the problem loop do if no candidates for expansion then return failure choose leaf node for expansion according to strategy Determines search process!! if node contains goal state then return solution else expand the node and add resulting nodes to the search tree end 20070315 chap3 16 8

State Space vs. Search Tree State: a (representation of) a physical configuration Node: a data structure belong to a search tree < State, Parent-Node, Action, Path-Cost, Depth> Fringe: contains generated nodes which are not yet expanded. 20070315 chap3 17 General Tree-Search Algorithm 20070315 chap3 18 9

Search Strategies A strategy is defined by picking the order of node expansion Strategies are evaluated along - Completeness --- Is it guaranteed that a solution will be found (if one exists)? - Time complexity --- How long does it take to find a solution? - Space complexity--- How much memory is needed to perform a search? - Optimality --- Is the best solution found when several solutions exist? Time and space complexity are measured in terms of b --- maximum branching factor of the search tree d --- depth of the least-cost solution m --- maximum depth of the state space (may be ) 20070315 chap3 19 Uninformed Search Strategies use only the information available in the problem definition do not use state information to decide the order on which nodes are expanded Breadth-first search -Tree-Search( problem, FIFO-Queue() ) - Expand the shallowest node in the fringe. - It is both optimal and complete. Uniform-cost search Depth-first search - Expand the deepest node in the fringe. - It is neither complete nor optimal. Why? Depth-limited search Iterative deepening search - Try all possible depth limits in depth limited search. - It is both optimal and complete. 20070315 chap3 20 10

Breadth-First Search Tree-Search(problem, FIFO-Queue()) Fringe is a FIFO queue, i.e., new successors go at end Expand the shallowest unexpanded node 20070315 chap3 21 Analysis of Breadth-First Search Complete?? Yes (if b is finite) 1+ b + b + L+ b + ( b Time?? expand all but the last node at level d Space?? d +1 O( b ) keep every node in memory b) = O( b 2 d d + 1 d + 1 i.e. exp. in d Optimal?? Yes (if cost = 1 per step); not optimal in general (unless actions have different cost) ) 20070315 chap3 22 11

Analysis of Breadth-First Search (cont.) Space is the bigger problem (more than time) If d = 8, it will take 31 hours with 1 terabytes. Exponential complexity search problems cannot be solved by uninformed search methods for any but the smallest instances. DEPTH NODES TIME MEMORY 2 1100 0.11 seconds 1 megabyte 4 111100 11 seconds 106 megabytes 6 10 7 19 minutes 10 gigabytes 8 10 9 31 hours 1 terabyte 10 10 11 129 days 101 terabytes 12 10 13 35 years 10 petabytes 14 10 15 3523 years 1 exabyte 20070315 chap3 23 Uniform Cost Search Each node n has a path cost g(n). Expand lowest path cost unexpanded node. Fringe is queue ordered by path cost. It will find the cheapest solution provided that n. g( Successor( n)) g( n) i.e. Every operator has a nonnegative cost. Equivalent to breadth-first search if step costs all equal. 20070315 chap3 24 12

Uniform Cost Search (cont.) 20070315 chap3 25 Analysis of Uniform Cost Search Complete?? Yes (if step cost >= ε) Time?? ( C * / ε O b ) Where C * is the cost of the optimal solution Space?? ( C * / ε O b ) Optimal?? Nodes expanded in increasing order of g(n) Yes, if complete 20070315 chap3 26 13

Depth-First Search Tree-Search(problem, LIFO-Queue()) Fringe is a LIFO queue, i.e., stack, put successors at front. Expand the deepest unexpanded node 20070315 chap3 27 Depth-First Search (cont.-1) Tree-Search(problem, LIFO-Queue()) Fringe is a LIFO queue, i.e., stack, put successors at front. Expand the deepest unexpanded node 20070315 chap3 28 14

Depth-First Search (cont.-2) Tree-Search(problem, LIFO-Queue()) Fringe is a LIFO queue, i.e., stack, put successors at front. Expand the deepest unexpanded node 20070315 chap3 29 Depth-First Search (cont.-3) Tree-Search(problem, LIFO-Queue()) Fringe is a LIFO queue, i.e., stack, put successors at front. Expand the deepest unexpanded node 20070315 chap3 30 15

Depth-First Search (cont.-4) Tree-Search(problem, LIFO-Queue()) Fringe is a LIFO queue, i.e., stack, put successors at front. Expand the deepest unexpanded node 20070315 chap3 31 Depth-First Search (cont.-5) Tree-Search(problem, LIFO-Queue()) Fringe is a LIFO queue, i.e., stack, put successors at front. Expand the deepest unexpanded node 20070315 chap3 32 16

Depth-First Search (cont.-6) Tree-Search(problem, LIFO-Queue()) Fringe is a LIFO queue, i.e., stack, put successors at front. Expand the deepest unexpanded node 20070315 chap3 33 Depth-First Search (cont.-7) Tree-Search(problem, LIFO-Queue()) Fringe is a LIFO queue, i.e., stack, put successors at front. Expand the deepest unexpanded node 20070315 chap3 34 17

Depth-First Search (cont.-8) Tree-Search(problem, LIFO-Queue()) Fringe is a LIFO queue, i.e., stack, put successors at front. Expand the deepest unexpanded node 20070315 chap3 35 Depth-First Search (cont.-9) Tree-Search(problem, LIFO-Queue()) Fringe is a LIFO queue, i.e., stack, put successors at front. Expand the deepest unexpanded node 20070315 chap3 36 18

Depth-First Search (cont.-10) Tree-Search(problem, LIFO-Queue()) Fringe is a LIFO queue, i.e., stack, put successors at front. Expand the deepest unexpanded node 20070315 chap3 37 Depth-First Search (cont.-11) Tree-Search(problem, LIFO-Queue()) Fringe is a LIFO queue, i.e., stack, put successors at front. Expand the deepest unexpanded node 20070315 chap3 38 19

Analysis of Depth-First Search Complete?? No: fails in indefinite-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 (m: the maximum depth of any node, d: depth of the shallowest solution) But if solutions are dense, may be much faster than breadth-first Space?? O(bm), i.e., linear space Optimal?? No If d = 12, b= 10, Space: 10 petabytes for BFS; 118 KB for DFS 20070315 chap3 39 Analysis of Depth-First Search (cont.) Time requirement: - Goal at the far left: d+1 + 1 - Goal at the far right: b d 1 b 1 - Average: (How is the average derived?) + 1 b d + bd + b d 2 2( b 1) 20070315 chap3 40 20

Depth-limited Search The unbounded trees can be alleviated by supplying depth-first search with a predetermined depth limit l. Failure (no solution) / Cutoff (no solution within the depth limit) 20070315 chap3 41 Analysis of Depth-Limit Search Complete?? Yes, if l >= d if l <=d, the shallowest goal is beyond the depth limit. Time?? Space?? O(bl) Optimal?? No 0 1 2 l l b + b + b +... + b = O( b ) DFS can be viewed as a special case of depth-limit search with l = Diameter of state space is a better depth limit, which leads to a more efficient depth-limit search e.g. diameter = 9, for the map of Romania of 20 cities 20070315 chap3 42 21

Iterative Deepening Search 20070315 chap3 43 Iterative Deepening Search (cont.-1) 20070315 chap3 44 22

Iterative Deepening Search (cont.-2) 20070315 chap3 45 Iterative Deepening Search (cont.-3) 20070315 chap3 46 23

Iterative Deepening Search (cont.-4) 20070315 chap3 47 Analysis of Iterative Deepening Search Complete?? Yes. 0 1 2 d d Time?? ( d + 1) b + db + ( d 1) b +... + b = O( b ) Space?? O(bd) Optimal?? Yes, if step cost = 1 Can be modified to explore uniform-cost tree. If b = 10, d = 5, N BFS = 1 + 10 + 100 + 1,000 + 10,000 + 999,990 = 1,111,101 N DLS = 1 + 10 + 100 +1,000 + 10,000 + 100,000 = 111,111 N IDS = 6 + 50 + 400 + 3,000 + 20,000 + 100,000 = 123,456 Iterative deepening is faster than breadth-first search, despite the repeated generation of states. Overhead = (123,456-111,111)/111,111 = 11% Iterative deepening is the preferred uninformed search when there is a large search space and the depth of the solution is not known. 20070315 chap3 48 24

Bidirectional Search Search forward from the initial state. Generate successors to the current node. Search backward from the goal. Generate predecessors to the current node. Stop when two searches meet in the middle. 20070315 chap3 49 Bidirectional Search (cont.-1) Two simultaneous searches from start an goal. - Motivation: b d /2 + b d /2 b d Check whether the node belongs to the other fringe before expansion. Space complexity is the most significant weakness. Complete and optimal if both searches are BF. 20070315 chap3 50 25

Bidirectional Search (cont.-2) Issues: If all operators are reversible, predecessor(n) = successor(n) Multiple goal states Cost of checking if a node exists Search strategy for each half? 20070315 chap3 51 Comparing Uninformed Search Strategies b: the branching factor d: the depth of the shallowest solution m: the maximum depth of the search tree l: the depth limit 20070315 chap3 52 26

Comparing Uninformed Search Strategies (cont.) Issues considered in selecting search strategies: size of the search space depth of the solution solution density finite vs. infinite depth any vs. all solutions optimality? predecessors? 20070315 chap3 53 Avoid Repeated States Do not return to the previous state. Do not create paths with cycles. Do not generate the same state twice. - Store states in a hash table. - Check for repeated states. 20070315 chap3 54 27

Graph Search To modify Tree Search Algorithm by adding closed list --- to store every expanded node 20070315 chap3 55 28