State space representations and search strategies Spring 2007, Juris Vīksna.
-
Upload
lucas-daniel -
Category
Documents
-
view
214 -
download
0
Transcript of State space representations and search strategies Spring 2007, Juris Vīksna.
![Page 1: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/1.jpg)
State space representations and search strategies
Spring 2007, Juris Vīksna
![Page 2: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/2.jpg)
Sample problems - 8-puzzle
[Adapted from C.Arany, R.Barak, M.Dang]
![Page 3: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/3.jpg)
Sample problems - 8-puzzle
[Adapted from C.Arany, R.Barak, M.Dang]
![Page 4: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/4.jpg)
Sample problems - 8 queens
[Adapted from C.Arany, R.Barak, M.Dang]
![Page 5: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/5.jpg)
Sample problems - 8 queens
[Adapted from C.Arany, R.Barak, M.Dang]
![Page 6: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/6.jpg)
Sample problems - 8 queens
[Adapted from C.Arany, R.Barak, M.Dang]
![Page 7: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/7.jpg)
Sample problems - Cryptarithmetic
[Adapted from C.Arany, R.Barak, M.Dang]
![Page 8: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/8.jpg)
Sample problems - Cryptarithmetic
[Adapted from C.Arany, R.Barak, M.Dang]
![Page 9: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/9.jpg)
Sample problems - River crossing puzzles
[Adapted from C.Arany, R.Barak, M.Dang]
![Page 10: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/10.jpg)
Sample problems - River crossing puzzles
[Adapted from C.Arany, R.Barak, M.Dang]
![Page 11: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/11.jpg)
Real world problems
[Adapted from C.Arany, R.Barak, M.Dang]
![Page 12: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/12.jpg)
Real world problems - Route finding
[Adapted from C.Arany, R.Barak, M.Dang]
![Page 13: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/13.jpg)
Real world problems - Travelling salesman
[Adapted from C.Arany, R.Barak, M.Dang]
![Page 14: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/14.jpg)
Real world problems - VLSI layout
[Adapted from C.Arany, R.Barak, M.Dang]
![Page 15: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/15.jpg)
State spaces
<S,P,I,G,W> - state space
S - set of statesP= {(x,y)|x,yS} - set of production rulesIS - initial stateGS - set of goal states W: PR+ - weight function
![Page 16: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/16.jpg)
State spaces
<S,P,I,G,W> - state space
The problem
• find a goal state• find a path from the initial state to a goal state• find a shortest path from the initial state to a goal state• find a path with minimal weight from the initial state to a goal state
![Page 17: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/17.jpg)
River crossing puzzle
[Adapted from R.Shinghal]
![Page 18: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/18.jpg)
River crossing puzzle[Adapted from R.Shinghal]
![Page 19: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/19.jpg)
River crossing puzzle
[Adapted from R.Shinghal]
![Page 20: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/20.jpg)
River crossing puzzle
[Adapted from R.Shinghal]
![Page 21: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/21.jpg)
River crossing puzzle
[Adapted from R.Shinghal]
![Page 22: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/22.jpg)
8-puzzle
[Adapted from R.Shinghal]
![Page 23: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/23.jpg)
8-puzzle
[Adapted from G.Luger, W.Stubblefield]
![Page 24: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/24.jpg)
Search strategies - Data Driven
[Adapted from G.Luger, W.Stubblefield]
![Page 25: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/25.jpg)
Search strategies - Goal Driven
[Adapted from G.Luger, W.Stubblefield]
![Page 26: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/26.jpg)
Search strategies - Bi-directional
[Adapted from G.Luger, W.Stubblefield]
![Page 27: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/27.jpg)
Search strategies - Bi-directional
[Adapted from G.Luger, W.Stubblefield]
![Page 28: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/28.jpg)
Search strategies -
BFS
[Adapted from G.Luger, W.Stubblefield]
![Page 29: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/29.jpg)
Search strategies - BFS
[Adapted from G.Luger, W.Stubblefield]
![Page 30: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/30.jpg)
Search strategies - BFS
BreadthFirstSearch(state space =<S,P,I,G,W>)Open {I}Closed while Open do
x DeQueue(Open)if Goal(x, ) then return xInsert(x,Closed)for y Child(x ,) do
if yClosed and yOpen thenEnQueue(y,Open)
return fail
Open is implemented as queue (FIFO); Closed can be an arbitrary data structure for sets
![Page 31: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/31.jpg)
Search strategies - Uniform Cost Search
UniformCostSearch(state space =<S,P,I,G,W>)Open {<0,I>}Closed while Open do
<wx,x> ExtractMin(Open)if Goal(x, ) then return xInsert(x,Closed)for y Child(x ,) do
if yClosed thenwy wx + W((x,y))Insert(<wy,y>,Open)
return fail
Open is implemented as a priority queue
![Page 32: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/32.jpg)
Search strategies - DFS
[Adapted from G.Luger, W.Stubblefield]
![Page 33: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/33.jpg)
Search strategies -
DFS
[Adapted from G.Luger, W.Stubblefield]
![Page 34: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/34.jpg)
Search strategies - DFS
[Adapted from J.Pearl]
![Page 35: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/35.jpg)
Search strategies - DFS
DepthFirstSearch(state space =<S,P,I,G,W>)Open {I}Closed while Open do
x Pop(Open)if Goal(x, ) then return xInsert(x,Closed)for y Child(x ,) do
if yClosed and yOpen thenPush(y,Open)
return fail
Open is implemented as stack (LIFO); Closed can be an arbitrary data structure for sets
![Page 36: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/36.jpg)
Search strategies - DFS
DepthFirstSearch(state space =<S,P,I,G,W>)Closed return DFSVisit(I,Closed,)
DFSVisit(x,Closed,) if Goal(x, ) then return xInsert(x,Closed)
for y Child(x ,) doif y Closed then
value DFSVisit(y,Closed,) if value fail then return value
return fail
![Page 37: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/37.jpg)
Search strategies - Backtracking
[Adapted from J.Pearl]
![Page 38: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/38.jpg)
Search strategies - Backtracking
BacktrackingSearch(state space =<S,P,I,G,W>)Open {I}Closed while Open do
x Pop(Open)if Goal(x, ) then return xInsert(x,Closed)if there exists y Child(x ,) and yClosed
and yOpen then Push(y,Open)
return fail
Open is implemented as stack (LIFO); Closed can be an arbitrary data structure for sets
![Page 39: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/39.jpg)
Heuristic function
<S,P,I,G,W> - state space
S - set of statesP= {(x,y)|x,yS} - set of production rulesIS - initial stateGS - set of goal states W: PR+ - weight function
d: SR+
d(x) - a shortest distance fromx to the closest goal state
f: SR+ - heuristic estimate of d
(if xG we usually assume f(x)=0)
![Page 40: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/40.jpg)
Search strategies - Hill climbing
HCSearch(state space =<S,P,I,G,W>,f)HCVisit(I,,f)
HCVisit(x,,f) if Goal(x, ) then return xfind y Child(x ,) with the smallest f(y) valueHCVisit(y,,f)
![Page 41: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/41.jpg)
Search strategies - Best first
[Adapted from J.Pearl]
![Page 42: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/42.jpg)
Search strategies - Best first
BestFirstSearch(state space =<S,P,I,G,W>,f)Open {<f(I),I>}Closed while Open do
<wx,x> ExtractMin(Open)if Goal(x, ) then return xInsert(x,Closed)for y Child(x ,) do
if yClosed thenInsert(<f(y),y>,Open)
return fail
Open is implemented as a priority queue
![Page 43: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/43.jpg)
Search strategies
[Adapted from J.Pearl]
![Page 44: State space representations and search strategies Spring 2007, Juris Vīksna.](https://reader036.fdocuments.in/reader036/viewer/2022081603/56649f1d5503460f94c34391/html5/thumbnails/44.jpg)
Search strategies
[Adapted from R.Shinghal]