CS 8520: Artificial Intelligence

Similar documents
Solving problems by searching

CS 380: Artificial Intelligence Lecture #3

Chapter 2. Blind Search 8/19/2017

Outline. Solving problems by searching. Problem-solving agents. Example: Romania

Solving Problem by Searching. Chapter 3

EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS

Solving problems by searching

Solving problems by searching

Solving problems by searching

Artificial Intelligence Problem Solving and Uninformed Search

Multiagent Systems Problem Solving and Uninformed Search

Chapter 3 Solving problems by searching

ARTIFICIAL INTELLIGENCE (CSC9YE ) LECTURES 2 AND 3: PROBLEM SOLVING

Solving problems by searching. Chapter 3

Problem solving and search

KI-Programmierung. Basic Search Algorithms

Solving Problems: Blind Search

Problem solving and search

Uninformed Search. Problem-solving agents. Tree search algorithms. Single-State Problems

ITCS 6150 Intelligent Systems. Lecture 3 Uninformed Searches

AI: problem solving and search

Problem solving and search

Problem solving and search

CS 771 Artificial Intelligence. Problem Solving by Searching Uninformed search

Problem Solving and Search

Problem solving and search

Artificial Intelligence

4. Solving Problems by Searching

Problem solving and search: Chapter 3, Sections 1 5

Problem solving and search: Chapter 3, Sections 1 5

Week 3: Path Search. COMP9414/ 9814/ 3411: Artificial Intelligence. Motivation. Example: Romania. Romania Street Map. Russell & Norvig, Chapter 3.

Artificial Intelligence, CS, Nanjing University Spring, 2018, Yang Yu. Lecture 2: Search 1.

Search EECS 395/495 Intro to Artificial Intelligence

ARTIFICIAL INTELLIGENCE. Pathfinding and search

Search EECS 348 Intro to Artificial Intelligence

Artificial Intelligence: Search Part 1: Uninformed graph search

Search I. slides from: Padhraic Smyth, Bryan Low, S. Russell and P. Norvig

Set 2: State-spaces and Uninformed Search. ICS 271 Fall 2015 Kalev Kask

Solving Problems by Searching. AIMA Sections , 3.6

Solving Problems by Searching (Blindly)

Artificial Intelligence

Problem solving and search

Problem Solving by Searching

Goal-Based Agents Problem solving as search. Outline

Artificial Intelligence Uninformed search

Chapter3. Problem-Solving Agents. Problem Solving Agents (cont.) Well-defined Problems and Solutions. Example Problems.

Uninformed Search. Chapter 3. (Based on slides by Stuart Russell, Subbarao Kambhampati, Dan Weld, Oren Etzioni, Henry Kautz, and other UW-AI faculty)

Problem solving and search

Problem solving by search

CS 4700: Foundations of Artificial Intelligence. Bart Selman. Search Techniques R&N: Chapter 3

Planning and search. Lecture 1: Introduction and Revision of Search. Lecture 1: Introduction and Revision of Search 1

Problem Solving and Search. Chapter 3

S A E RC R H C I H NG N G IN N S T S A T T A E E G R G A R PH P S

Artificial Intelligence

Reminders. Problem solving and search. Problem-solving agents. Outline. Assignment 0 due 5pm today

Basic Search. Fall Xin Yao. Artificial Intelligence: Basic Search

Solving Problems by Searching

HW#1 due today. HW#2 due Monday, 9/09/13, in class Continue reading Chapter 3

Problem solving and search

ARTIFICIAL INTELLIGENCE SOLVING PROBLEMS BY SEARCHING. Chapter 3

Graph Search. Chris Amato Northeastern University. Some images and slides are used from: Rob Platt, CS188 UC Berkeley, AIMA

Solving Problems by Searching

Outline. Problem solving and search. Problem-solving agents. Example: Romania. Example: Romania. Problem types. Problem-solving agents.

Problem-solving agents. Problem solving and search. Example: Romania. Reminders. Example: Romania. Outline. Chapter 3

CS486/686 Lecture Slides (c) 2015 P.Poupart

CS486/686 Lecture Slides (c) 2014 P.Poupart

Pengju XJTU 2016

AGENTS AND ENVIRONMENTS. What is AI in reality?

Chapter 3. A problem-solving agent is a kind of goal-based agent. It decide what to do by finding sequences of actions that lead to desirable states.

Solving problems by searching

CS 151: Intelligent Agents, Problem Formulation and Search

A2 Uninformed Search

Example: The 8-puzzle. A2 Uninformed Search. It can be generalized to 15-puzzle, 24-puzzle, or. (n 2 1)-puzzle for n 6. Department of Computer Science

Uninformed Search. Chapter 3

Uninformed Search Strategies AIMA

Ar#ficial)Intelligence!!

Solving problems by searching

Uninformed search strategies (Section 3.4) Source: Fotolia

Lecture 3. Uninformed Search

Robot Programming with Lisp

Problem solving Basic search. Example: Romania. Example: Romania. Problem types. Intelligent Systems and HCI D7023E. Single-state problem formulation

AGENTS AND ENVIRONMENTS. What is AI in reality?

Outline. Solving problems by searching. Prologue. Example: Romania. Uninformed search

Solving problems by searching

Pengju

Why Search. Things to consider. Example, a holiday in Jamaica. CSE 3401: Intro to Artificial Intelligence Uninformed Search

Search Algorithms. Uninformed Blind search. Informed Heuristic search. Important concepts:

CS:4420 Artificial Intelligence

Chapter 3: Solving Problems by Searching

CAP 4630 Artificial Intelligence

DFS. Depth-limited Search

Lecture 4: Search 3. Victor R. Lesser. CMPSCI 683 Fall 2010

Problem Solving as Search. CMPSCI 383 September 15, 2011

521495A: Artificial Intelligence

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

Uninformed Search. Reading: Chapter 4 (Tuesday, 2/5) HW#1 due next Tuesday

Uninformed Search Methods

Solving Problems by Searching

Solving Problems by Searching

Uninformed Search strategies. AIMA sections 3.4,3.5

Transcription:

CS 8520: Artificial Intelligence Solving Problems by Searching Paula Matuszek Spring, 2013 Slides based on Hwee Tou Ng, aima.eecs.berkeley.edu/slides-ppt, which are in turn based on Russell, aima.eecs.berkeley.edu/slides-pdf. Diagrams are based on AIMA.

Problem-Solving Agents A goal-based agent is essentially solving a problem Given some state and some goal, Figure out how to get from the current state to the goal By taking some sequence of actions. The problem is defined as a state space and a goal. Solving the problem consists of searching the state space for the sequence of actions that leads to the goal. 2

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 3

Example: Romania 4

Single-state problem formulation A problem is defined by five items: initial state e.g., "at Arad" actions or successor function S(x) = set of action state pairs e.g., S(Arad) = {<Arad to Zerind, Zerind>, } transition model: new state resulting from action goal test, can be explicit, e.g., x = "at Bucharest" implicit, e.g., Checkmate(x) path cost (additive) e.g., sum of distances, number of actions executed, etc. c(x,a,y) is the step cost, assumed to be 0 A solution is a sequence of actions leading from the initial state to a goal state 5

Selecting a state space Real world is absurdly complex therefore state space must be abstracted for problem solving (Abstract) state = set of real states (Abstract) action = complex combination of real actions e.g., "Arad to Zerind" represents a complex set of possible routes, detours, rest stops, etc. For guaranteed realizability, any real state "in Arad must get to some real state "in Zerind" (Abstract) solution = set of real paths that are solutions in the real world Each abstract action should be "easier" than the original problem 6

Vacuum world state space graph States? Actions? Transition Models? Goal Test? Path Cost? 7

Vacuum world state space graph states? integer dirt and robot location actions? Left, Right, Suck transition models? In A, in B, clean goal test? no dirt at all locations path cost? 1 per action 8

Example: The 8-puzzle states? actions? transition model? goal test? path cost? 9

Example: The 8-puzzle states? locations of tiles actions? move blank left, right, up, down transition model? square with tile moved. goal test? = goal state (given) path cost? 1 per move [Note: optimal solution of n-puzzle family is NP-hard] 10

Search The basic concept of search views the state space as a search tree Initial state is the root node Each possible action leads to a new node defined by the transition model Some nodes are identified as goals Search is the process of expanding some portion of the tree in some order until we get to a goal node The strategy we use to choose the order to expand nodes defines the type of search 11

Tree search algorithms Basic idea: offline, simulated exploration of state space by generating successors of already-explored states (a.k.a.~expanding states) 12

Tree search example 13

Tree search example 14

Tree search example 15

Implementation: general tree search 16

Implementation: states vs. nodes A state is a (representation of) a physical configuration A node is a data structure constituting part of a search tree includes state, parent node, action, path cost g(x), depth The Expand function creates new nodes, filling in the various fields and using the SuccessorFn of the problem to create the corresponding states. 17

Search strategies A search strategy is defined by picking the order of node expansion. (e.g., breadth-first, depth-first) Strategies are evaluated along the following dimensions: completeness: does it always find a solution if one exists? time complexity: number of nodes generated space complexity: maximum number of nodes in memory optimality: does it always find a least-cost solution? 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 infinite) 18

Summary Problem-solving agents search through a problem or state space for an acceptable solution. A state space can be specified by An initial state Actions A transition model or successor function S(x) describing the results of actions A goal test or goal state A path cost A solution is a sequence of actions leading from the initial state to a goal state The formalization of a good state space is hard, and critical to success. It must abstract the essence of the problem so that It is easier than the real-world problem. A solution can be found. The solution maps back to the real-world problem and solves it. 19

Uninformed search strategies 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 20

Implementation: general tree search 21

Breadth-first search Expand shallowest unexpanded node Implementation: fringe is a FIFO queue, i.e., new successors go at end 22

Breadth-first search Expand shallowest unexpanded node Implementation: fringe is a FIFO queue, i.e., new successors go at end 23

Breadth-first search Expand shallowest unexpanded node Implementation: fringe is a FIFO queue, i.e., new successors go at end 24

Breadth-first search Expand shallowest unexpanded node Implementation: fringe is a FIFO queue, i.e., new successors go at end 25

Properties of breadth-first search Complete? Yes (if b is finite) Time? 1+b+b2+b3+ +bd + b(bd-1) = O(bd+1) Space? O(bd+1) (keeps every node in memory) Optimal? Yes (if cost = 1 per step) Space is the bigger problem (more than time) 26

Uniform-cost search Expand least-cost unexpanded node Implementation: fringe = queue ordered by path cost Equivalent to breadth-first if step costs all equal Complete? Yes, if step cost >= epsilon (otherwise can loop) Time and space? O(bceiling(C*/ epsilon)) where C* is the cost of the optimal solution and epsilon is the smallest step cost. Can be much worse than breadth-first if many small steps not on optimal path Optimal? Yes nodes expanded in increasing order of g(n) 27

Uniform Cost Search 28

Uniform Cost Search 28

Uniform Cost Search 28

Uniform Cost Search 28

Uniform Cost Search 28

Uniform Cost Search 28

Uniform Cost Search 28

Depth-first search Expand deepest unexpanded node Implementation: fringe = LIFO queue, i.e., put successors at front 29

Depth-first search Expand deepest unexpanded node Implementation: fringe = LIFO queue, i.e., put successors at front 30

Depth-first search Expand deepest unexpanded node Implementation: fringe = LIFO queue, i.e., put successors at front 31

Depth-first search Expand deepest unexpanded node Implementation: fringe = LIFO queue, i.e., put successors at front 32

Depth-first search Expand deepest unexpanded node Implementation: fringe = LIFO queue, i.e., put successors at front 33

Depth-first search Expand deepest unexpanded node Implementation: fringe = LIFO queue, i.e., put successors at front 34

Properties of depth-first search Complete? No: fails in infinite-depth spaces, spaces with loops Modify to avoid repeated states along path then complete in finite spaces Time? O(bm): 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 35

Depth-limited search = depth-first search with depth limit l Nodes at depth l have no successors Solves problem of infinite depth Incomplete Recursive implementation: 36

Iterative deepening search Repeated Depth-Limited search, incrementing limit l until a solution is found or failure. Repeats earlier steps at each new level, so inefficient -- but never more than doubles cost No longer incomplete 37

Iterative deepening search l =0 38

Iterative deepening search l =1 39

Iterative deepening search l =2 40

Iterative deepening search l =3 41

Properties of iterative deepening Complete? Yes Time? (d+1)b0 + d b1 + (d-1)b2 + + bd = O(bd) Space? O(bd) Optimal? Yes, if step cost = 1 42

Summary of Algorithms for Uninformed Search Criterion Uniform Cost Depth First Breadthfirst Depth- Limited Iterative Deepening Complete? Yes Yes No No Yes Time? O(b d ) O(b (ceilingc*/ε) ) O(b m ) O(b l ) O(b d ) Space? O(b d ) O(b (ceilingc*/ε) ) O(bm) O(bl) O(bd) Optimal? Yes Yes No No Yes Where: b is branching factor d is depth of shallowest solution, m is max depth of search tree C* is cost of optimal solution ε is an arbitrarily small number 43

A Caution: Repeated States Failure to detect repeated states can turn a linear problem into an exponential one, or even an infinite one. For example: 8-puzzle Simple repeat -- empty square simply moves back and forth More complex repeats also possible. Save list of expanded states -- the closed list. Add new state to fringe only if it's not in closed list. 44

Summary: Uninformed Search Problem formulation usually requires abstracting away real-world details to define a state space that can feasibly be explored There exists a variety of uninformed search strategies Search strategies can be evaluated by whether they find a solution if one exists: completeness how long they take: time complexity how much memory they take: space complexity whether they find the best solution: optimality Iterative deepening search uses linear space and not much more time than other algorithms: usual choice 45