SlideShare a Scribd company logo
Informed search
algorithms
Chapter Sections 1-5
Informed= use problem-specific
knowledge
Which search strategies?
—Best-first search and its variants
Heuristic functions?
—How to invent them
Local search and optimization
—Hill climbing, local beam search, genetic
algorithms,...
Local search in continuous
spaces Online search agents
function TREE-SEARCH(problem,fringe) return a solution or
failure fringe INSERT(MAKE-NODE(INITIAL-STATE problem]),
fringe) loop do
if EMPTY?(Fringe) then return failure
node +- REMOVE-FIRST(fringe)
if GOAL-TEST[pool/em] applied to STATE[node]
succeeds
then return SOLUTION(node)
fringe INSERT-ALL(EXPAND(node, problem), fringe)
A strategy is defined by picking the
order of node expansion
General approach of informed search:
- Best-first search • node is selected for expansion based
on an evaluation function f(n)
Idea: evaluation function measures
distance to the goal.
— Choose node which appears best
Implementation:
fringe is queue sorted in decreasing order of desirability.
- Special cases: greedy search, A” search
—l›‹iil estimated cost of the
cheapest path from
node n to goal node.
—If n is goal then li(i››=J
— More information
later
”,
••=
.g
ili
’é!
* **** *"
•°
hS
L
D
——straight-
line
distance
heuristic.
hS‹D can NOT be
computed from
the problem
description itself
In this example
f(n) —
—h(n)
§;;g
“
”-“
,°
’
•
- Expand node that
is closest to goal
= Greedy best-first search
Arad
(366)
Assume that we want to use greedy
search to solve the problem of travelling
from Arad to Bucharest.
The initial state=Arad
Sibiu(253)
Arad
Timisoara
(329)
The first expansion step
produces:
- Sibiu, Timisoara and Zerind
Greedy best-first will select
Sibiu.
Zerind(374)
Arad
(366)
Sibiu
(380) (193)
Fagaras
(176)
Arad
Ora ea l i e u Vilcea
If Sibiu is expanded we get:
— Arad, Fagaras, Oradea and Rimnicu Vilcea
Greedy best-firstsearch will select:
Fagaras
Sibiu
(253)
Sibiu
Fagaras
ucharest
(0)
Arad
If Fagaras is expanded we get:
Sibiu and Bucharest
Goal reached ! !
Yet not optimal (see Arad, Sibiu, Rim nicu Vil cea,
Pitesti
Completeness: NO (e.g. DF-search)
- Check on repeated states
- Minimizing h(n) can result in false starts, e.g.
lasi to Fagaras.
Completeness: NO (e.g. DF-search)
Time complexity?
- Worst-case DF-search @b
fH)
(with m is maximum depth of search space)
—Good heuristic can give dramatic
improvement.
Completeness: NO (e.g. DF-
search)
Time complexity:
O(b”)
Space complexity:
o(bM
—Keeps all nodes in memory
Time complexity:
Completeness: NO (e.g. DF-search)
O(b‘}
Optimality?
NO
— Same as DF-
search
W)
Space complexity: ( b
Best-known form of best-first search.
Idea: avoid expanding paths
that are already expensive.
Evaluation function f(n) —
—g(n) -i- h(n)
—g(n) the cost (so far) to reach the node.
—h(n) estimated cost to get from the node to the
goal.
—f(n) estimated total cost of path through n to
goal.
A* search uses an admissible
heuristic
— A heuristic is admissible if it never
overestimates the cost to reach the
goal
—Are optimistic
Formally:
t. h(n} < = h”(n) where is the true cost from n
2. h(n) > — 0 so h(G) —
—0 for any goal G.
e.g. hgtofn) never overestimates the actual road distance
U0
Tim I90e
æ
î0 J
360=0-›366
Find Buchareststarting at Arad
I(Arad) - c(??,Arad) + h(Arad) -0+366=
366
4+z-
11s-›oze
440=75+27
4
Expand Arrad and determine f(n) for each node
— f(5ibiu)=c(Arad,5ibiu)+h(5ibiu)=140+253=393
—f(Timisoara)=c(Arad,Timisoara)+h(Timisoara)=118+329=447
—f(Zerind)=c(Arad,Zerind)+h(Zerind)=75+374=449
Best choice is Sibiu
e46 @+300 415 3B+17B B71=æ1+2a0 413 1+1e3
Expand Sibiu and determine /¢nÿ for each
node
— f(Arad)=c(Sibiu,Arad)+h(Arad)=280+366=646
— f(Fagaras)-c(Sibiu,Fagaras)+h(Fagaras)=239+179—415
— f(Oradea) —c(Sibiu,Oradea)+h(Oradea) —291+380—671
— f(Rimnicu Vilcea)=c(Sibiu,Rimnicu Vìlcea)+
h(Rimnicu ViIcea)—220+ 192—
413
Best choice is Rimnicu Vilcea
+No 418 1?6 a71=&1+9W
Expand Rimnicu Vilcea and determine
f(n) for each node
— f(Craiova)=c(Rimnicu Vilcea, Craiova)+h(Craiova)=360+
160=526
- I(Pitesti)=c(Rimnicu Vilcea, Pitesti)-i-
h(Pitesti)=317+100=417
- I(Sibiu)=c(Rimnicu Vilcea,Sibiu)+h(Sibiu)=300+253=553
Best choice is Fagaras
52'6W0+160 417-G17+10€i 553=3 €I+253
Expand Fagaras and determine f(n) for each
node
—f(Sibiu)=c(Fagaras, Sibiu)+h(Sibiu)—338+253= 591
—f(Bucharest) -—c(Fagaras, Bucharest) +h(Bucharest) -—450+0-—
450
Best choice is Pitesti !!!
Expand Pitesti and determine f(n) for each
node
f(Bucharest) ——c(Pitesti,Bucharest)+h(Bucharest) —
—41
8+ 0 —
—4
1
8
Best choice is Bucharest ! !!
- Optimal solution (onIy if h(n) is admissable}
Note values along optimal path !!
Suppose suboptimalgoal G2 in the queue.
Let n be an unexpanded node on a shortest to
optimal goal G.
I(Gy) since h¿G
—
—0
—
—
g(Gy)
> g(G)
>= f(n)
since Cl is
suboptimal
since h is admissible
Since f(G,) > f(n), A* will never select G for
expansion
A heuristic is consistent
if (^
If h is consistent, we have
——g(n)+ c{n,a,n') + h{n')
?: g(n) + h(n)
i.e. f(n) is nondecreasing along any
path.
A” expands nodes in order of increasing I
value Contours can be drawn in state space
— Uniform -cost sea rch adds circ les.
F-contours are g radually
Aadea :
1) n Od es with I(n) < C
2) Some nodes on the goal
¿
Contour (I{n} —
—C”’ ).
Contour I nas a
l
l
Nodes with f=f,
vvnere
Completeness:YES
—Since bands of increasing 7 are added
—Unless there are infinitly many nodes
with
Completeness:
YESTime
complexity:
Number of nodes expanded is still exponential
in the length of the solution.
Completeness: YES
Time complexity: (exponential with
path
length)
Space complexity:
—It keeps all generated nodes in memory
—Hence space is the major problem not time
Completeness: YES
Time complexity: (exponential with
path length)
Space complexity:(all nodes are
stored) Optimality: YES
— Cannot expand f,+t until I, is finished.
- A* expands all nodes with /°{n/ < C*
— A
” expands some nodes with f(n) —
—C
”
- A* expands no nodes with f{n/ >C*
Also optimally efficient (not including
ties)
Some solutions to A” space
problems (maintain completeness and
optimality)
—Iterative-deepening A* (IDA*)
—Here cutoff information is the I-cost (g+h) instead of depth
—Recursive best-first search(RBFS)
—Recursive algorithm that attempts to mimic standard
best-first search with linear space.
— (simple)Memory-bounded A* ((S)MA*)
— Drop the worst-leaf node when memory is full
8
function RECURSIVE-BEST-FIRST-SEARCH problem) return a solution or failure
return RFBS(problem,MAKE-NODE(INITIAL-STATE problem]), )
function RFBS( prOblem, mode, /° /irnit) return a solution or failure and a
new f- cost limit
if GOAL-TEST(problem)(STATE[node]) then return
node successors +
— EXPAND(node, problem)
if successors is empty then return failure,
for each s in successors dn
max(g(s) + h(s), f (node) j
f (s)
repeat
best the lowest /-value node in
successors
if I [best) > I limit then return failure, I
[test]
alternative the second lowest I-value among successors
RBFS¿prob/em, best, min(£ limit, alternative))
result, I best)
if result failure then return
result
Recursive best-first
search
Keeps track of the f-value of the
best-alternative path available.
— If current f-values exceeds this
alternative
f-
value than backtrack to alternative path.
- Upon backtracking change f-value to best
f-
value of its children.
— Re-expansion of this result is thus
Path until Rumnicu Vilcea is already expanded
Above node; /°-limit for every recursive call is shown on
top. Below node: I(n)
The path is followed until Pitesti which has a /°-value worse
than the f-limit.
Ib
)
un•*edmg toSJü° .
’
1
41s 417
Unwind recursion and store best /-value for
current best leaf Pitesti
result, f (best) +- RBF5¿prOö/em, best, min(/°_//mit,
alternative))
liest •is nowFagaras. Call RBFS for new best
— best value is now 450
Unwind recursion and store best /°-value for current
best leaf
Fagaras
result, I (best] +- RBFS¿prod/em, best, min(ñ_/imit, alternative))
best is now Rimnicu Viclea (again). Call RBFS for new best
— Subtree is again expanded.
Best alternative subtree is now through Timisoara.
Solution is found since because 447 > 417.
RBFS is a bit more efficientthan
IDA”
—Still excessive node generation (mind changes)
Like A”, optimal if h(n) is
admissible Space complexity is
0(bd).
—IDA” retains onIy one single number (the
current f-cost limit)
Time complexity difficultto
characterize
—Depends on accuracy if h(n) and how often
best path changes.
IDA” en RBFS suffer from too
little memory.
E.g for the 8-puzzle knows two commonly used
heuristics
h —
— the number of misplaced tiles
— hp(s)=8
h —
— the sum of the distances of the tiles from
their goal positions (manhattan distance).
— h2(*)= 3 -i-1--2 -i-2 -i-2 --3 -i-3 -i-2= 18
E.g for the 8-puzzle
Avg. solution cost is about 22 steps (branching factor +/-
3) Exhaustive search to depth 22: 3.1 x 10‘0 states.
A good heuristic function can reduce the search process.
Effective branching factor
b*
—Is the branching factor that a uniform tree
of depth 4 would have in order to
contain //+ 4 nodes.
N + 1 = l + b * +(b*)2
+ ...+ {b*)d
—Measure is fairly constant for sufficiently
hard
problems.
—Can thus provide a good guide to the heuristic's
overall
useful ness.
—A good value of b” is 1
4 1
İ2
IO
47I27
I2
364d035
I4 -
16.
93'
539
J301
113
2IT
‹67f
1219
2.87
279
?:J8
I.38
I:42
1,45
1.46
1:47
I.28
If hymn) >= h1(n) for all n (both admissible)
then h2 dominates h1 and is better for
search
Admissible heuristics can be derived from the
exact solution cost of a relaxed version of the
problem: a
— Relaxed 8-puzzle for h1 tile can move
anywhere
As a result, h (n) gives the shortest solution
— Relaxed B-puzzle for h a tile can move to any adjacent squa
re.
As a result, h (n) gives the shortest solution.
The optimal solution cost of a relaxed problem
is no greater than the optimal solution cost of
the real problem.
ABSo1veZ fOUnd a usefull heuristicfor the rubic
cube.
Admissible heuristics can also be derived from the solution
cost
of a subproblemof a given problem.
This cost is a lower bound on the cost of the real problem.
Pattern databases store the exact solution to for every
possible subproblem instance.
— The complete heuristic is constructed using the patterns in the DB
Another way to find an
admissible heuristic is through
learning from experience:
—Experience solving lots of 8-puzzles
— An inductive learning algorithm can be used
to predict costs for other states that arise during
search.

More Related Content

PPTX
3.informed search
PDF
Informed-search TECHNIQUES IN ai ml data science
PDF
Artificial intelligence and machine learning
PDF
BCS515B Module3 vtu notes : Artificial Intelligence Module 3.pdf
PPT
4 informed-search
PPTX
22 sch Artificial intelligence Module-3 1st part.pptx
PDF
shamwari dzerwendo.mmmmmmfmmfmfkksrkrttkt
PPT
Jarrar.lecture notes.aai.2011s.ch4.informedsearch
3.informed search
Informed-search TECHNIQUES IN ai ml data science
Artificial intelligence and machine learning
BCS515B Module3 vtu notes : Artificial Intelligence Module 3.pdf
4 informed-search
22 sch Artificial intelligence Module-3 1st part.pptx
shamwari dzerwendo.mmmmmmfmmfmfkksrkrttkt
Jarrar.lecture notes.aai.2011s.ch4.informedsearch

Similar to Artificial Intelligence - Informed search algorithms (20)

PPT
Searchadditional2
PPT
Artificial intelligence: informed search
PPT
M4 Heuristics
PPT
ai and search algorithms general on a* and searching
PPT
Different Search Techniques used in AI.ppt
PPTX
Informed Search.pptx
PPT
Heuristic Search Algorithm in AI and its Techniques
PPTX
AI444444444444444444444444444444444.pptx
PPT
cps170_search.ppt. This ppt talk about search algorithm
PPT
cps170_search CPS 170: Artificial Intelligence http://www.cs.duke.edu/courses...
PPTX
Introduction to artificial intelligence
PPTX
AI BEST FIRST,A-STAR,AO-STAR SEARCH.pptx
PPTX
Module 3.pptx...........................
PPTX
Chapter 3.pptx
PDF
informed_search.pdf
PDF
UNIT 2 - Artificial intelligence merged.pdf
PPTX
Artificial Intelligence Problem Slaving PPT
PPTX
AI UNIT-1-BREADTH and BEST FIRST SEARCH.pptx
PPTX
BFS,DFS, BEST FIRST,A-STAR,AO-STAR SEARCH.pptx
PPTX
Heuristic Search, Best First Search.pptx
Searchadditional2
Artificial intelligence: informed search
M4 Heuristics
ai and search algorithms general on a* and searching
Different Search Techniques used in AI.ppt
Informed Search.pptx
Heuristic Search Algorithm in AI and its Techniques
AI444444444444444444444444444444444.pptx
cps170_search.ppt. This ppt talk about search algorithm
cps170_search CPS 170: Artificial Intelligence http://www.cs.duke.edu/courses...
Introduction to artificial intelligence
AI BEST FIRST,A-STAR,AO-STAR SEARCH.pptx
Module 3.pptx...........................
Chapter 3.pptx
informed_search.pdf
UNIT 2 - Artificial intelligence merged.pdf
Artificial Intelligence Problem Slaving PPT
AI UNIT-1-BREADTH and BEST FIRST SEARCH.pptx
BFS,DFS, BEST FIRST,A-STAR,AO-STAR SEARCH.pptx
Heuristic Search, Best First Search.pptx
Ad

Recently uploaded (20)

PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
Web App vs Mobile App What Should You Build First.pdf
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
Encapsulation theory and applications.pdf
PPTX
OMC Textile Division Presentation 2021.pptx
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Zenith AI: Advanced Artificial Intelligence
PPTX
TLE Review Electricity (Electricity).pptx
PPTX
1. Introduction to Computer Programming.pptx
PPTX
A Presentation on Touch Screen Technology
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
August Patch Tuesday
PDF
project resource management chapter-09.pdf
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
Getting Started with Data Integration: FME Form 101
PDF
Assigned Numbers - 2025 - Bluetooth® Document
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
Web App vs Mobile App What Should You Build First.pdf
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
Encapsulation theory and applications.pdf
OMC Textile Division Presentation 2021.pptx
A comparative study of natural language inference in Swahili using monolingua...
Hindi spoken digit analysis for native and non-native speakers
Enhancing emotion recognition model for a student engagement use case through...
Unlocking AI with Model Context Protocol (MCP)
Programs and apps: productivity, graphics, security and other tools
Zenith AI: Advanced Artificial Intelligence
TLE Review Electricity (Electricity).pptx
1. Introduction to Computer Programming.pptx
A Presentation on Touch Screen Technology
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
August Patch Tuesday
project resource management chapter-09.pdf
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Getting Started with Data Integration: FME Form 101
Assigned Numbers - 2025 - Bluetooth® Document
Ad

Artificial Intelligence - Informed search algorithms

  • 2. Informed= use problem-specific knowledge Which search strategies? —Best-first search and its variants Heuristic functions? —How to invent them Local search and optimization —Hill climbing, local beam search, genetic algorithms,... Local search in continuous spaces Online search agents
  • 3. function TREE-SEARCH(problem,fringe) return a solution or failure fringe INSERT(MAKE-NODE(INITIAL-STATE problem]), fringe) loop do if EMPTY?(Fringe) then return failure node +- REMOVE-FIRST(fringe) if GOAL-TEST[pool/em] applied to STATE[node] succeeds then return SOLUTION(node) fringe INSERT-ALL(EXPAND(node, problem), fringe) A strategy is defined by picking the order of node expansion
  • 4. General approach of informed search: - Best-first search • node is selected for expansion based on an evaluation function f(n) Idea: evaluation function measures distance to the goal. — Choose node which appears best Implementation: fringe is queue sorted in decreasing order of desirability. - Special cases: greedy search, A” search
  • 5. —l›‹iil estimated cost of the cheapest path from node n to goal node. —If n is goal then li(i››=J — More information later
  • 6. ”, ••= .g ili ’é! * **** *" •° hS L D ——straight- line distance heuristic. hS‹D can NOT be computed from the problem description itself In this example f(n) — —h(n) §;;g “ ”-“ ,° ’ • - Expand node that is closest to goal = Greedy best-first search
  • 7. Arad (366) Assume that we want to use greedy search to solve the problem of travelling from Arad to Bucharest. The initial state=Arad
  • 8. Sibiu(253) Arad Timisoara (329) The first expansion step produces: - Sibiu, Timisoara and Zerind Greedy best-first will select Sibiu. Zerind(374)
  • 9. Arad (366) Sibiu (380) (193) Fagaras (176) Arad Ora ea l i e u Vilcea If Sibiu is expanded we get: — Arad, Fagaras, Oradea and Rimnicu Vilcea Greedy best-firstsearch will select: Fagaras
  • 10. Sibiu (253) Sibiu Fagaras ucharest (0) Arad If Fagaras is expanded we get: Sibiu and Bucharest Goal reached ! ! Yet not optimal (see Arad, Sibiu, Rim nicu Vil cea, Pitesti
  • 11. Completeness: NO (e.g. DF-search) - Check on repeated states - Minimizing h(n) can result in false starts, e.g. lasi to Fagaras.
  • 12. Completeness: NO (e.g. DF-search) Time complexity? - Worst-case DF-search @b fH) (with m is maximum depth of search space) —Good heuristic can give dramatic improvement.
  • 13. Completeness: NO (e.g. DF- search) Time complexity: O(b”) Space complexity: o(bM —Keeps all nodes in memory
  • 14. Time complexity: Completeness: NO (e.g. DF-search) O(b‘} Optimality? NO — Same as DF- search W) Space complexity: ( b
  • 15. Best-known form of best-first search. Idea: avoid expanding paths that are already expensive. Evaluation function f(n) — —g(n) -i- h(n) —g(n) the cost (so far) to reach the node. —h(n) estimated cost to get from the node to the goal. —f(n) estimated total cost of path through n to goal.
  • 16. A* search uses an admissible heuristic — A heuristic is admissible if it never overestimates the cost to reach the goal —Are optimistic Formally: t. h(n} < = h”(n) where is the true cost from n 2. h(n) > — 0 so h(G) — —0 for any goal G. e.g. hgtofn) never overestimates the actual road distance
  • 18. 360=0-›366 Find Buchareststarting at Arad I(Arad) - c(??,Arad) + h(Arad) -0+366= 366
  • 19. 4+z- 11s-›oze 440=75+27 4 Expand Arrad and determine f(n) for each node — f(5ibiu)=c(Arad,5ibiu)+h(5ibiu)=140+253=393 —f(Timisoara)=c(Arad,Timisoara)+h(Timisoara)=118+329=447 —f(Zerind)=c(Arad,Zerind)+h(Zerind)=75+374=449 Best choice is Sibiu
  • 20. e46 @+300 415 3B+17B B71=æ1+2a0 413 1+1e3 Expand Sibiu and determine /¢nÿ for each node — f(Arad)=c(Sibiu,Arad)+h(Arad)=280+366=646 — f(Fagaras)-c(Sibiu,Fagaras)+h(Fagaras)=239+179—415 — f(Oradea) —c(Sibiu,Oradea)+h(Oradea) —291+380—671 — f(Rimnicu Vilcea)=c(Sibiu,Rimnicu Vìlcea)+ h(Rimnicu ViIcea)—220+ 192— 413 Best choice is Rimnicu Vilcea
  • 21. +No 418 1?6 a71=&1+9W Expand Rimnicu Vilcea and determine f(n) for each node — f(Craiova)=c(Rimnicu Vilcea, Craiova)+h(Craiova)=360+ 160=526 - I(Pitesti)=c(Rimnicu Vilcea, Pitesti)-i- h(Pitesti)=317+100=417 - I(Sibiu)=c(Rimnicu Vilcea,Sibiu)+h(Sibiu)=300+253=553 Best choice is Fagaras
  • 22. 52'6W0+160 417-G17+10€i 553=3 €I+253 Expand Fagaras and determine f(n) for each node —f(Sibiu)=c(Fagaras, Sibiu)+h(Sibiu)—338+253= 591 —f(Bucharest) -—c(Fagaras, Bucharest) +h(Bucharest) -—450+0-— 450 Best choice is Pitesti !!!
  • 23. Expand Pitesti and determine f(n) for each node f(Bucharest) ——c(Pitesti,Bucharest)+h(Bucharest) — —41 8+ 0 — —4 1 8 Best choice is Bucharest ! !! - Optimal solution (onIy if h(n) is admissable} Note values along optimal path !!
  • 24. Suppose suboptimalgoal G2 in the queue. Let n be an unexpanded node on a shortest to optimal goal G. I(Gy) since h¿G — —0 — — g(Gy) > g(G) >= f(n) since Cl is suboptimal since h is admissible Since f(G,) > f(n), A* will never select G for expansion
  • 25. A heuristic is consistent if (^ If h is consistent, we have ——g(n)+ c{n,a,n') + h{n') ?: g(n) + h(n) i.e. f(n) is nondecreasing along any path.
  • 26. A” expands nodes in order of increasing I value Contours can be drawn in state space — Uniform -cost sea rch adds circ les. F-contours are g radually Aadea : 1) n Od es with I(n) < C 2) Some nodes on the goal ¿ Contour (I{n} — —C”’ ). Contour I nas a l l Nodes with f=f, vvnere
  • 27. Completeness:YES —Since bands of increasing 7 are added —Unless there are infinitly many nodes with
  • 28. Completeness: YESTime complexity: Number of nodes expanded is still exponential in the length of the solution.
  • 29. Completeness: YES Time complexity: (exponential with path length) Space complexity: —It keeps all generated nodes in memory —Hence space is the major problem not time
  • 30. Completeness: YES Time complexity: (exponential with path length) Space complexity:(all nodes are stored) Optimality: YES — Cannot expand f,+t until I, is finished. - A* expands all nodes with /°{n/ < C* — A ” expands some nodes with f(n) — —C ” - A* expands no nodes with f{n/ >C* Also optimally efficient (not including ties)
  • 31. Some solutions to A” space problems (maintain completeness and optimality) —Iterative-deepening A* (IDA*) —Here cutoff information is the I-cost (g+h) instead of depth —Recursive best-first search(RBFS) —Recursive algorithm that attempts to mimic standard best-first search with linear space. — (simple)Memory-bounded A* ((S)MA*) — Drop the worst-leaf node when memory is full
  • 32. 8 function RECURSIVE-BEST-FIRST-SEARCH problem) return a solution or failure return RFBS(problem,MAKE-NODE(INITIAL-STATE problem]), ) function RFBS( prOblem, mode, /° /irnit) return a solution or failure and a new f- cost limit if GOAL-TEST(problem)(STATE[node]) then return node successors + — EXPAND(node, problem) if successors is empty then return failure, for each s in successors dn max(g(s) + h(s), f (node) j f (s) repeat best the lowest /-value node in successors if I [best) > I limit then return failure, I [test] alternative the second lowest I-value among successors RBFS¿prob/em, best, min(£ limit, alternative)) result, I best) if result failure then return result
  • 33. Recursive best-first search Keeps track of the f-value of the best-alternative path available. — If current f-values exceeds this alternative f- value than backtrack to alternative path. - Upon backtracking change f-value to best f- value of its children. — Re-expansion of this result is thus
  • 34. Path until Rumnicu Vilcea is already expanded Above node; /°-limit for every recursive call is shown on top. Below node: I(n) The path is followed until Pitesti which has a /°-value worse than the f-limit.
  • 35. Ib ) un•*edmg toSJü° . ’ 1 41s 417 Unwind recursion and store best /-value for current best leaf Pitesti result, f (best) +- RBF5¿prOö/em, best, min(/°_//mit, alternative)) liest •is nowFagaras. Call RBFS for new best — best value is now 450
  • 36. Unwind recursion and store best /°-value for current best leaf Fagaras result, I (best] +- RBFS¿prod/em, best, min(ñ_/imit, alternative)) best is now Rimnicu Viclea (again). Call RBFS for new best — Subtree is again expanded. Best alternative subtree is now through Timisoara. Solution is found since because 447 > 417.
  • 37. RBFS is a bit more efficientthan IDA” —Still excessive node generation (mind changes) Like A”, optimal if h(n) is admissible Space complexity is 0(bd). —IDA” retains onIy one single number (the current f-cost limit) Time complexity difficultto characterize —Depends on accuracy if h(n) and how often best path changes. IDA” en RBFS suffer from too little memory.
  • 38. E.g for the 8-puzzle knows two commonly used heuristics h — — the number of misplaced tiles — hp(s)=8 h — — the sum of the distances of the tiles from their goal positions (manhattan distance). — h2(*)= 3 -i-1--2 -i-2 -i-2 --3 -i-3 -i-2= 18
  • 39. E.g for the 8-puzzle Avg. solution cost is about 22 steps (branching factor +/- 3) Exhaustive search to depth 22: 3.1 x 10‘0 states. A good heuristic function can reduce the search process.
  • 40. Effective branching factor b* —Is the branching factor that a uniform tree of depth 4 would have in order to contain //+ 4 nodes. N + 1 = l + b * +(b*)2 + ...+ {b*)d —Measure is fairly constant for sufficiently hard problems. —Can thus provide a good guide to the heuristic's overall useful ness. —A good value of b” is 1
  • 41. 4 1 İ2 IO 47I27 I2 364d035 I4 - 16. 93' 539 J301 113 2IT ‹67f 1219 2.87 279 ?:J8 I.38 I:42 1,45 1.46 1:47 I.28 If hymn) >= h1(n) for all n (both admissible) then h2 dominates h1 and is better for search
  • 42. Admissible heuristics can be derived from the exact solution cost of a relaxed version of the problem: a — Relaxed 8-puzzle for h1 tile can move anywhere As a result, h (n) gives the shortest solution — Relaxed B-puzzle for h a tile can move to any adjacent squa re. As a result, h (n) gives the shortest solution. The optimal solution cost of a relaxed problem is no greater than the optimal solution cost of the real problem. ABSo1veZ fOUnd a usefull heuristicfor the rubic cube.
  • 43. Admissible heuristics can also be derived from the solution cost of a subproblemof a given problem. This cost is a lower bound on the cost of the real problem. Pattern databases store the exact solution to for every possible subproblem instance. — The complete heuristic is constructed using the patterns in the DB
  • 44. Another way to find an admissible heuristic is through learning from experience: —Experience solving lots of 8-puzzles — An inductive learning algorithm can be used to predict costs for other states that arise during search.