Top Banner
May 12, 2013 Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM
42

May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Dec 16, 2015

Download

Documents

Mitchell Hodges
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

May 12, 2013 Problem Solving - Search

Symbolic AI: Problem Solving

E. Trentin, DIISM

Page 2: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

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

Page 3: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Example: Romania

Page 4: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Single-state problem formulation

A problem is defined by five items:

1. A set of discrete states (representing the “world”)2. initial state e.g., "at Arad"3. actions or successor function S(x) = set of action–state pairs

e.g., S(Arad) = {<Arad Zerind, Zerind>, … }4. goal test, can be

explicit, e.g., x = "at Bucharest" implicit, e.g., Checkmate(x)

5. path cost g(x) (additive) from the root to node x e.g., sum of distances, number of actions executed, etc. c(x,a,y) is the step cost (assumed to be ≥ 0) for expanding node y

from node x via action a

A solution is a sequence of actions leading from the initial state to a goal state

Page 5: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Example: The 8-puzzle

states? actions? goal test? path cost?

Page 6: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Example: The 8-puzzle

states? locations of tiles actions? move blank left, right, up, down goal test? = goal state (given) path cost? 1 per move

[Note: optimal solution of n-Puzzle family is NP-hard]

Page 7: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Example: robotic assembly

states?: coordinates of parts of the object to be assembled

actions?: motions of robot joints goal test?: complete assembly path cost?: time to execute

Page 8: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Tree search algorithms

Basic idea: offline, simulated exploration of state space by

generating successors of already-explored states (a.k.a.~expanding states)

Page 9: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Tree search example

Page 10: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Tree search example

Page 11: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Tree search example

Page 12: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Implementation: states vs. nodes

A state is a (representation of) a physical configuration

A node is a data structure (part of a search tree) that 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.

Page 13: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Search strategies

A search strategy is defined by picking the order of node expansion

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 ∞)

Page 14: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

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

Page 15: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Breadth-first search

Expand shallowest unexpanded node Implementation:

fringe is a FIFO queue, i.e., new successors go at end

Page 16: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Breadth-first search

Expand shallowest unexpanded node Implementation:

fringe is a FIFO queue, i.e., new successors go at end

Page 17: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Breadth-first search

Expand shallowest unexpanded node Implementation:

fringe is a FIFO queue, i.e., new successors go at end

Page 18: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Breadth-first search

Expand shallowest unexpanded node Implementation:

fringe is a FIFO queue, i.e., new successors go at end

Page 19: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Properties of breadth-first search

Complete? Yes (if b is finite) Time? 1+b+b2+b3+… +bd = O(bd) Space? O(bd) (keeps every node in memory) Optimal? Yes (if cost = 1 per step)

Space may be the bigger problem (even bigger than time)

Page 20: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

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 ≥ ε Time? # of nodes with g ≤ cost of optimal solution,

O(bceiling(C*/ ε)) where C* is the cost of the optimal solution

Space? # of nodes with g ≤ cost of optimal solution, O(bceiling(C*/ ε))

Optimal? Yes – nodes expanded in increasing order of g(n)

Page 21: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Depth-first search

Expand deepest unexpanded node Implementation:

fringe = LIFO queue, i.e., put successors at front

Page 22: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Depth-first search

Expand deepest unexpanded node Implementation:

fringe = LIFO queue, i.e., put successors at front

Page 23: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Depth-first search

Expand deepest unexpanded node Implementation:

fringe = LIFO queue, i.e., put successors at front

Page 24: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Depth-first search

Expand deepest unexpanded node Implementation:

fringe = LIFO queue, i.e., put successors at front

Page 25: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Depth-first search

Expand deepest unexpanded node Implementation:

fringe = LIFO queue, i.e., put successors at front

Page 26: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Depth-first search

Expand deepest unexpanded node Implementation:

fringe = LIFO queue, i.e., put successors at front

Page 27: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Depth-first search

Expand deepest unexpanded node Implementation:

fringe = LIFO queue, i.e., put successors at front

Page 28: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Depth-first search

Expand deepest unexpanded node Implementation:

fringe = LIFO queue, i.e., put successors at front

Page 29: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Depth-first search

Expand deepest unexpanded node Implementation:

fringe = LIFO queue, i.e., put successors at front

Page 30: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Depth-first search

Expand deepest unexpanded node Implementation:

fringe = LIFO queue, i.e., put successors at front

Page 31: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Depth-first search

Expand deepest unexpanded node Implementation:

fringe = LIFO queue, i.e., put successors at front

Page 32: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Depth-first search

Expand deepest unexpanded node Implementation:

fringe = LIFO queue, i.e., put successors at front

Page 33: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

(kind of wobbling) 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(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

Page 34: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Depth-limited search (DLS)

DLS = depth-first search with depth limit l,i.e., nodes at depth l are not expanded any further

Recursive implementation:

Page 35: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Iterative deepening search

Page 36: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Iterative deepening search l =0

Page 37: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Iterative deepening search l =1

Page 38: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Iterative deepening search l =2

Page 39: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Iterative deepening search l =3

Page 40: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Properties of iterative deepening search

Complete? Yes Time? O(bd) Space? O(bd) Optimal? Yes (if step cost = 1)

Page 41: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Repeated states

Failure to detect repeated states can turn a linear problem into an exponential one!

Page 42: May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.

Graph search