Solving Problems by Searching
Solving Problems by Searching
Solving Problems by Searching
Outline
Introduction
Problem-solving agents
Problem types
Problem formulation
Example problems
Basic search algorithms
INTRODUCTION
Problem can described by
Initial state
State space
Path
Goal test
Problem definition
Problem analysis
Knowledge representation
Problem solving (selection of best techniques)
Problem-solving agents
Example: Shortest path between VIT
Vellore Campus To VIT Chennai Campus
Sensorless, start in
{1,2,3,4,5,6,7,8} e.g.,
Right goes to {2,4,6,8}
Solution?
Example: vacuum world
Sensorless, start in
{1,2,3,4,5,6,7,8} e.g.,
Right goes to {2,4,6,8}
Solution?
[Right,Suck,Left,Suck]
Contingency
Nondeterministic: Suck may
dirty a clean carpet [Murphy's law]
Partially observable: location, dirt at current location.
Solution?
Example: vacuum world
Sensorless, start in
{1,2,3,4,5,6,7,8} e.g.,
Right goes to {2,4,6,8}
Solution?
[Right,Suck,Left,Suck]
Contingency
Nondeterministic: Suck may
dirty a clean carpet [Murphy's law]
Partially observable: location, dirt at current location.
Percept: [L, Clean], i.e., start in #5 or #7
Solution? [Right, if dirt then Suck]
Single-state problem formulation
A problem is defined by four items:
A solution is a sequence of actions leading from the initial state to a goal state
Selecting a state space
Real world is absurdly complex
state space must be abstracted for problem solving
(Abstract) solution = set of real paths that are solutions in the real world
states?
actions?
goal test?
path cost?
Vacuum world state space graph
states?
actions?
goal test?
path cost?
Example: The 8-puzzle
Breadth-first search
Uniform-cost search
Depth-first search
Depth-limited search
Time? O(bd)
Implementation:
fringe = queue ordered by path cost
Optimal? No
Depth-limited search
= depth-first search with depth limit l,
i.e., nodes at depth l have no successors
Recursive implementation:
Iterative deepening search
Iterative deepening search l =0
Iterative deepening search l =1
Iterative deepening search l =2
Iterative deepening search l =3
Iterative deepening search
Number of nodes generated in a depth-limited search to depth d
with branching factor b:
NDLS = b0 + b1 + b2 + … + bd-2 + bd-1 + bd
For b = 10, d = 5,
NDLS = 1 + 10 + 100 + 1,000 + 10,000 + 100,000 = 111,111
Complete? Yes
Time? O(bd)
Space? O(bd)
Iterative deepening search uses only linear space and not much
more time than other uninformed algorithms