Chapter - 3 Searching and Planning
Chapter - 3 Searching and Planning
Chapter 3
Solving Problems by Searching and Constraint
Satisfaction Problem
Topics we will cover
2
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
Problem Formulation
11
A solution is a sequence of actions leading from the initial state to a goal state.
Cont….
14
Example: Vacuum world state space graph
15
Aim: Understanding the state space for
vacuum cleaner world.
Note: R - Right
L - Left
S - Suck
Start node
Goal
Tree search example (1)
21
JiT
(c) After expanding Mercato Mercato Gabriel
campus
Sidist Kilo
(b) After expanding Sidist Kilo generating a new state
MeskelSquare
Piassa Megenagna
(Stadium)
Searching strategies
26
• Search strategy gives the order in which the search space is
examined.
1. Uninformed (= blind) search
o They do not need domain knowledge that guide them towards the
goal.
o Have no information about the number of steps or the path cost
from the current state to the goal.
o It is important for problems for which there is no additional
information to consider.
2. Informed (= heuristic) search
o Have problem-specific knowledge (knowledge that is true from
experience).
o Have knowledge about how far are the various state from the goal.
o Can find solutions more efficiently than uninformed search.
Search methods types:
27
Uninformed search
o Breadth first search
o Depth first search
o Uniform cost search,
o Depth limited search
o Iterative deepening search
o etc.
Informed search
o Greedy search
o A*-search
o Iterative improvement,
o Constraint satisfaction
o etc.
Uninformed search strategies
28
Properties:
Equivalent to breadth-first if step costs all equal.
This strategy finds the cheapest solution.
It does not care about the number of steps involved in searching and only concerned
about path cost. Due to which this algorithm may be stuck in an infinite loop.
Uniform cost Search
49
Look at the following example(2) on how UCS works.
• From A we look at its children nodes B and C. So since C has the lowest step
cost it traverses through node C and then we look at successors of C i.e. D and
G since the cost to D is low we expand along with the node D.
Uniform cost Search
50
Properties
o Incomplete if solution is below cut-off depth l
o Not optimal if solution is above cut-off depth l
Iterative deepening search
53
1'st Iteration-----> A
Iterative deepening search l =1
55
2'nd Iteration----> A, B, C
Iterative deepening search l =2
56
At L=2, the start node and its children are expanded. Its
grand-children are goal-tested, but not expanded.
3'rd Iteration------>A, B, D, E, C, F, G
Iterative deepening search l =3
57
At L=3, the start node, its children, and its grand-children are
expanded. Its great-grandchildren are goal-tested, but not expanded.
4'rth Iteration------>A, B, D, H, l, E, J, K, C, F, L, M, G
Bidirectional search
58
A B C
3 9
7 4 5
D E G
BFS: S-A-B-C-D-E-G DFS: S-A-D-E-G
UCS: S-B-G DLS: S-A-D-E-G(L=2) same with
DFS due to L=2 equivalent to max depth of tree.
Informed search strategies(Heuristic)
62
Step 2:
Fringe=[Sibiu,Timisoara,Zerind]
Lowest value of heuristic function hSLD(Sibiu)=253
Action: expand Sibiu
Greedy Search...
68
Step 3:
Fringe=[Timisoara,Zerind,Arad,Fagaras,Oradea,Rimnicu
Vilcea]
Lowest value of heuristic function hSLD(Fagaras)=176
Action: expand Fagaras
Greedy Search... ...
69
Step 4:
Fringe=[Timisoara,Zerind,Arad,Oradea,Rimnicu
Vilcea,Sibiu,Bucharest]
Lowest value of heuristic function hSLD(Bucharest)=0
Action: find goal at Bucharest!
Greedy Search... ...
70
Step 2:
Fringe=[Sibiu,Timisoara,Zerind]
Lowest value of evaluation function f(Sibiu)=140+253=393
Action: expand Sibiu
A* Search...
73
Step 3:
Fringe=[Timisoara,Zerind,Arad,Fagaras,Oradea,Rimnicu Vilcea]
Lowest value of evaluation function f(Rimnicu Vilcea)=220+193=413
Action: expand Rimnicu Vilcea
A* Search...
74
Step 4:
Fringe=[Timisoara,Zerind,Arad,Fagaras,Oradea,Craiova,Pitesti,Sibiu]
Lowest value of evaluation function f( Fagaras)=239+176=415
Action: expand Fagaras
A* Search...
75
Step 5:
Fringe=[Timisoara,Zerind,Arad,Oradea,Craiova,Pitesti,Sibiu,Sibiu,
Bucharest]
Lowest value of evaluation function f(Pitesti)=317+100=417
Action: expand Pitesti
A* Search...
76
Step 6:
Fringe=[Timisoara,Zerind,Arad,Oradea,Craiova,Sibiu,Bucharest,C
raiova,Rimnicu Vilcea]
Lowest value of evaluation function f(Bucharest)=418+0=418
Action: find goal at Bucharest
Constraint Satisfaction Problems (CSPs)
77
?
D
Constraints: “no
neighboring regions
?
F
E have the same color”
?
?
Exercise: Coloring Problem
81
The End!