A.I.: Informed Search Algorithms
Chapter III: Part Deux
Outline
• Best-first search
• Greedy best-first search
• A* search
• Heuristics
Overview
• Informed Search: uses problem-specific knowledge.
• General approach: best-first search; an instance of TREE-
SEARCH (or GRAPH-SEARCH) – where a search strategy is
defined by picking the order of node expansion.
• With best-first, node is selected for expansion based on
evaluation function f(n).
• Evaluation function is a cost estimate; expand lowest cost node
first (same as uniform-cost search but we replace g with f).
Overview (cont’d)
• The choice of f determines the search strategy (one can show
that best-first tree search includes DFS as a special case).
• Often, for best-first algorithms, f is defined in terms of a
heuristic function, h(n).
h(n) = estimated cost of the cheapest path from the state at
node n to a goal state. (for goal state: h(n)=0)
• Heuristic functions are the most common form in which
additional knowledge of the problem is passed to the search
algorithm.
Overview (cont’d)
• Best-First Search algorithms constitute a large family of
algorithms, with different evaluation functions.
– Each has a heuristic function h(n)
• Example: in route planning the estimate of the cost of the
cheapest path might be the straight line distance between
two cities.
Recall:
• g(n) = cost from the initial state to the current state n.
• h(n) = estimated cost of the cheapest path from node n to
a goal node.
• f(n) = evaluation function to select a node for expansion
(usually the lowest cost node).
Best-First Search
• Idea: use an evaluation function f(n) for each node
– f(n) provides an estimate for the total cost.
Expand the node n with smallest f(n).
• Implementation:
Order the nodes in the frontier increasing order of cost.
• Special cases:
– Greedy best-first search
– A* search
Greedy best-first search
• Evaluation function f(n) = h(n) (heuristic), the estimate of cost
from n to goal.
• We use the straight-line distance heuristic: hSLD(n) = straight-
line distance from n to Bucharest.
• Note that the heuristic values cannot be computed from the
problem description itself!
• In addition, we require extrinsic knowledge to understand
that hSLD is correlated with the actual road distances, making
it a useful heuristic.
• Greedy best-first search expands the node that appears to be
closest to goal.
Romania with step costs in km
Greedy best-first search example
Greedy best-first search example
Greedy best-first search example
Greedy best-first search example
Greedy best-first search
• GBFS is incomplete!
• Why?
• Graph-Search version is, however, complete in finite spaces.
Properties of greedy best-first search
• Complete? No – can get stuck in loops, e.g., Iasi
 Neamt  Iasi  Neamt 
• Time? O(bm), (in worst case) but a good heuristic
can give dramatic improvement (m is max depth
of search space).
• Space? O(bm) -- keeps all nodes in memory.
• Optimal? No (not guaranteed to render lowest
cost solution).
A* Search
• Most widely-known form of best-first search.
• It evaluates nodes by combining g(n), the cost to reach the
node, and h(n), the cost to get from the node to the goal:
f(n) = g(n) + h(n) (estimated cost of cheapest
solution through n).
• A reasonable strategy: try node with the lowest g(n) + h(n)
value!
• Provided heuristic meets some basic conditions, A* is both
complete and optimal.
A* search example
f(n)=g(n)+h(n)
A* search example
A* search example
A* search example
A* search example
A* search example
Admissible heuristics
• A heuristic h(n) is admissible if for every node n,
h(n) ≤ h*(n), where h*(n) is the true cost to reach the goal
state from n.
• An admissible heuristic never overestimates the cost to
reach the goal, i.e., it is optimistic.
• Example: hSLD(n) (never overestimates the actual road
distance)
• Theorem: If h(n) is admissible, A* using TREE-
SEARCH is optimal.
Optimality of A* (proof)
• Suppose some suboptimal goal G2 has been generated and is in
the frontier. Let n be an unexpanded node in the frontier such that
n is on a shortest path to an optimal goal G.
• f(G2) = g(G2) since h(G2) = 0
• g(G2) > g(G) since G2 is suboptimal
• f(G) = g(G) since h(G) = 0
• f(G2) > f(G) from above
Optimality of A* (proof)
• Suppose some suboptimal goal G2 has been generated and is in
the fringe. Let n be an unexpanded node in the fringe such that n
is on a shortest path to an optimal goal G.
• f(G2) > f(G) (from above)
• h(n) ≤ h*(n) (since h is admissible)
-> g(n) + h(n) ≤ g(n) + h*(n)
• f(n) ≤ g(n) + h*(n) < f(G) < f(G2)
Hence f(G2) > f(n), and A* will never select G2 for expansion.
Consistent Heuristics
• A heuristic is consistent (or monotonic) if for every node n,
every successor n' of n generated by any action a:
h(n) ≤ c(n,a,n') + h(n')
• If h is consistent, we have:
f(n') = g(n') + h(n')
= g(n) + c(n,a,n') + h(n')
≥ g(n) + h(n)
= f(n)
i.e., f(n) is non-decreasing along any path.
Theorem: If h(n) is consistent, A* using GRAPH-SEARCH is
optimal.
Optimality of A*
• A* expands nodes in order of increasing f value.
• Gradually adds "f-contours" of nodes.
• Contour i has all nodes with f=fi, where fi < fi+1.
• That is to say, nodes inside a given contour have f-costs less
than or equal to contour value.
Properties of A*
• Complete: Yes (unless there are infinitely many nodes with
f ≤ f(G) ).
• Time: Exponential.
• Space: Keeps all nodes in memory, so also exponential.
• Optimal: Yes (provided h admissible or consistent).
• Optimally Efficient: Yes (no algorithm with the
same heuristic is guaranteed to expand fewer nodes).
• NB: Every consistent heuristic is also admissible (Pearl).
Q: What about the converse?
Admissible Heuristics
E.g., for the 8-puzzle:
• h1(n) = number of misplaced tiles
• h2(n) = total Manhattan distance (i.e. 1-norm)
(i.e., no. of squares from desired location of each tile)
Q: Why are these admissible heuristics?
• h1(S) = ?
• h2(S) = ?
Admissible Heuristics
E.g., for the 8-puzzle:
• h1(n) = number of misplaced tiles
• h2(n) = total Manhattan distance
(i.e., no. of squares from desired location of each tile)
• h1(S) = ? 8
• h2(S) = ? 3+1+2+2+2+3+3+2 = 18
Dominance
• If h2(n) ≥ h1(n) for all n (both admissible), then h2 dominates
h1 .
• Essentially, domination translates directly into efficiency: “h2 is
better for search.
• A* using h2 will never expand more nodes than A* using h1.
• Typical search costs (average number of nodes expanded):
d=12 IDS = 3,644,035 nodes
A*(h1) = 227 nodes
A*(h2) = 73 nodes
d=24 IDS = too many nodes
A*(h1) = 39,135 nodes
A*(h2) = 1,641 nodes
(IDS=iterative deepening search)
Memory Bounded Heuristic Search:
Recursive BFS (best-first)
• How can we solve the memory problem for A* search?
• Idea: Try something like depth-first search, but let’s not forget
everything about the branches we have partially explored.
• We remember the best f-value we have found so far in the branch we are
deleting.
Memory Bounded Heuristic Search:
Recursive BFS
• RBFS changes its mind very
often in practice. This is because
f=g+h become more accurate
(less optimistic) as we approach
the goal. Hence, higher level nodes
have smaller f-values and
will be explored first.
• Problem: We should keep
• in memory whatever we can.
Best alternative
over frontier nodes,
which are not children:
i.e. do I want to back up?
Simple Memory-Bounded A*
• This is like A*, but when memory is full we delete the worst
node (largest f-value).
• Like RBFS, we remember the best descendent in the branch
we delete.
• If there is a tie (equal f-values) we delete the oldest nodes first.
• Simple-MBA* finds the optimal reachable solution given the
memory constraint (reachable means path from root to goal
fits in memory).
• Can also use iterative deepening with A* (IDA*).
• Time can still be exponential.
Relaxed Problems
• A problem with fewer restrictions on the actions is called
a relaxed problem.
• The cost of an optimal solution to a relaxed problem is
an admissible heuristic for the original problem. (why?)
• If the rules of the 8-puzzle are relaxed so that a tile can
move anywhere, then h1(n) gives the shortest solution.
• If the rules are relaxed so that a tile can move to any
adjacent square, then h2(n) gives the shortest solution.
Summary
• Informed search methods may have access to a heuristic
function h(n) that estimates the cost of a solution from n.
• The generic best-first search algorithm selects a node for
expansion according to an evaluation function.
• Greedy best-first search expands nodes with minimal h(n).
It is not optimal, but is often efficient.
• A* search expands nodes with minimal f(n)=g(n)+h(n).
• A* s complete and optimal, provided that h(n) is admissible
(for TREE-SEARCH) or consistent (for GRAPH-SEARCH).
• The space complexity of A* is still prohibitive.
• The performance of heuristic search algorithms depends on
the quality of the h(n) function.
• One can sometimes construct good heuristics by relaxing the
problem definition.

More Related Content

PDF
Informed-search TECHNIQUES IN ai ml data science
PDF
BCS515B Module3 vtu notes : Artificial Intelligence Module 3.pdf
PPT
m4-heuristics.ppt
PPT
Presentacion nro 1 redes y comunicaciones de datos
PPT
M4 heuristics
PPTX
Heuristic Search, Best First Search.pptx
PPT
Jarrar.lecture notes.aai.2011s.ch4.informedsearch
PPT
M4 Heuristics
Informed-search TECHNIQUES IN ai ml data science
BCS515B Module3 vtu notes : Artificial Intelligence Module 3.pdf
m4-heuristics.ppt
Presentacion nro 1 redes y comunicaciones de datos
M4 heuristics
Heuristic Search, Best First Search.pptx
Jarrar.lecture notes.aai.2011s.ch4.informedsearch
M4 Heuristics

Similar to shamwari dzerwendo.mmmmmmfmmfmfkksrkrttkt (20)

PPT
Searchadditional2
PPTX
22 sch Artificial intelligence Module-3 1st part.pptx
PDF
Artificial intelligence and machine learning
PPTX
3.informed search
PPTX
Informed Search in Artifical Intelligence
PDF
informed_search.pdf
PPT
Different Search Techniques used in AI.ppt
PPTX
Artificial intelligence(06)
PPTX
Artificial intelligence(06)
PDF
AI 4 | Informed Search
PPTX
AI UNIT-1-BREADTH and BEST FIRST SEARCH.pptx
PPTX
Artificial Intelligence - Informed search algorithms
PPT
ai and search algorithms general on a* and searching
PPTX
Module 3.pptx...........................
PPT
2-Heuristic Search.ppt
PPT
cps170_search.ppt. This ppt talk about search algorithm
PPT
cps170_search CPS 170: Artificial Intelligence http://www.cs.duke.edu/courses...
PDF
Searching Informed Search.pdf
PPTX
BFS,DFS, BEST FIRST,A-STAR,AO-STAR SEARCH.pptx
PPT
ARTIFICIAL INTELLIGENCE- informed search strategies
Searchadditional2
22 sch Artificial intelligence Module-3 1st part.pptx
Artificial intelligence and machine learning
3.informed search
Informed Search in Artifical Intelligence
informed_search.pdf
Different Search Techniques used in AI.ppt
Artificial intelligence(06)
Artificial intelligence(06)
AI 4 | Informed Search
AI UNIT-1-BREADTH and BEST FIRST SEARCH.pptx
Artificial Intelligence - Informed search algorithms
ai and search algorithms general on a* and searching
Module 3.pptx...........................
2-Heuristic Search.ppt
cps170_search.ppt. This ppt talk about search algorithm
cps170_search CPS 170: Artificial Intelligence http://www.cs.duke.edu/courses...
Searching Informed Search.pdf
BFS,DFS, BEST FIRST,A-STAR,AO-STAR SEARCH.pptx
ARTIFICIAL INTELLIGENCE- informed search strategies
Ad

Recently uploaded (20)

PPTX
PPT for Diseases.pptx, there are 3 types of diseases
PPTX
lung disease detection using transfer learning approach.pptx
PPTX
AI AND ML PROPOSAL PRESENTATION MUST.pptx
PPTX
C programming msc chemistry pankaj pandey
PPTX
865628565-Pertemuan-2-chapter-03-NUMERICAL-MEASURES.pptx
PDF
General category merit rank list for neet pg
PPTX
Chapter security of computer_8_v8.1.pptx
PPTX
Sheep Seg. Marketing Plan_C2 2025 (1).pptx
PDF
REPORT CARD OF GRADE 2 2025-2026 MATATAG
PPTX
Stats annual compiled ipd opd ot br 2024
PPTX
indiraparyavaranbhavan-240418134200-31d840b3.pptx
PDF
Grey Minimalist Professional Project Presentation (1).pdf
PPTX
ch20 Database System Architecture by Rizvee
PPT
Technicalities in writing workshops indigenous language
PPTX
DIGITAL DESIGN AND.pptx hhhhhhhhhhhhhhhhh
PPT
What is life? We never know the answer exactly
PDF
9 FinOps Tools That Simplify Cloud Cost Reporting.pdf
PDF
Mcdonald's : a half century growth . pdf
PPTX
Introduction to Fundamentals of Data Security
PPTX
GPS sensor used agriculture land for automation
PPT for Diseases.pptx, there are 3 types of diseases
lung disease detection using transfer learning approach.pptx
AI AND ML PROPOSAL PRESENTATION MUST.pptx
C programming msc chemistry pankaj pandey
865628565-Pertemuan-2-chapter-03-NUMERICAL-MEASURES.pptx
General category merit rank list for neet pg
Chapter security of computer_8_v8.1.pptx
Sheep Seg. Marketing Plan_C2 2025 (1).pptx
REPORT CARD OF GRADE 2 2025-2026 MATATAG
Stats annual compiled ipd opd ot br 2024
indiraparyavaranbhavan-240418134200-31d840b3.pptx
Grey Minimalist Professional Project Presentation (1).pdf
ch20 Database System Architecture by Rizvee
Technicalities in writing workshops indigenous language
DIGITAL DESIGN AND.pptx hhhhhhhhhhhhhhhhh
What is life? We never know the answer exactly
9 FinOps Tools That Simplify Cloud Cost Reporting.pdf
Mcdonald's : a half century growth . pdf
Introduction to Fundamentals of Data Security
GPS sensor used agriculture land for automation
Ad

shamwari dzerwendo.mmmmmmfmmfmfkksrkrttkt

  • 1. A.I.: Informed Search Algorithms Chapter III: Part Deux
  • 2. Outline • Best-first search • Greedy best-first search • A* search • Heuristics
  • 3. Overview • Informed Search: uses problem-specific knowledge. • General approach: best-first search; an instance of TREE- SEARCH (or GRAPH-SEARCH) – where a search strategy is defined by picking the order of node expansion. • With best-first, node is selected for expansion based on evaluation function f(n). • Evaluation function is a cost estimate; expand lowest cost node first (same as uniform-cost search but we replace g with f).
  • 4. Overview (cont’d) • The choice of f determines the search strategy (one can show that best-first tree search includes DFS as a special case). • Often, for best-first algorithms, f is defined in terms of a heuristic function, h(n). h(n) = estimated cost of the cheapest path from the state at node n to a goal state. (for goal state: h(n)=0) • Heuristic functions are the most common form in which additional knowledge of the problem is passed to the search algorithm.
  • 5. Overview (cont’d) • Best-First Search algorithms constitute a large family of algorithms, with different evaluation functions. – Each has a heuristic function h(n) • Example: in route planning the estimate of the cost of the cheapest path might be the straight line distance between two cities. Recall: • g(n) = cost from the initial state to the current state n. • h(n) = estimated cost of the cheapest path from node n to a goal node. • f(n) = evaluation function to select a node for expansion (usually the lowest cost node).
  • 6. Best-First Search • Idea: use an evaluation function f(n) for each node – f(n) provides an estimate for the total cost. Expand the node n with smallest f(n). • Implementation: Order the nodes in the frontier increasing order of cost. • Special cases: – Greedy best-first search – A* search
  • 7. Greedy best-first search • Evaluation function f(n) = h(n) (heuristic), the estimate of cost from n to goal. • We use the straight-line distance heuristic: hSLD(n) = straight- line distance from n to Bucharest. • Note that the heuristic values cannot be computed from the problem description itself! • In addition, we require extrinsic knowledge to understand that hSLD is correlated with the actual road distances, making it a useful heuristic. • Greedy best-first search expands the node that appears to be closest to goal.
  • 8. Romania with step costs in km
  • 13. Greedy best-first search • GBFS is incomplete! • Why? • Graph-Search version is, however, complete in finite spaces.
  • 14. Properties of greedy best-first search • Complete? No – can get stuck in loops, e.g., Iasi  Neamt  Iasi  Neamt  • Time? O(bm), (in worst case) but a good heuristic can give dramatic improvement (m is max depth of search space). • Space? O(bm) -- keeps all nodes in memory. • Optimal? No (not guaranteed to render lowest cost solution).
  • 15. A* Search • Most widely-known form of best-first search. • It evaluates nodes by combining g(n), the cost to reach the node, and h(n), the cost to get from the node to the goal: f(n) = g(n) + h(n) (estimated cost of cheapest solution through n). • A reasonable strategy: try node with the lowest g(n) + h(n) value! • Provided heuristic meets some basic conditions, A* is both complete and optimal.
  • 22. Admissible heuristics • A heuristic h(n) is admissible if for every node n, h(n) ≤ h*(n), where h*(n) is the true cost to reach the goal state from n. • An admissible heuristic never overestimates the cost to reach the goal, i.e., it is optimistic. • Example: hSLD(n) (never overestimates the actual road distance) • Theorem: If h(n) is admissible, A* using TREE- SEARCH is optimal.
  • 23. Optimality of A* (proof) • Suppose some suboptimal goal G2 has been generated and is in the frontier. Let n be an unexpanded node in the frontier such that n is on a shortest path to an optimal goal G. • f(G2) = g(G2) since h(G2) = 0 • g(G2) > g(G) since G2 is suboptimal • f(G) = g(G) since h(G) = 0 • f(G2) > f(G) from above
  • 24. Optimality of A* (proof) • Suppose some suboptimal goal G2 has been generated and is in the fringe. Let n be an unexpanded node in the fringe such that n is on a shortest path to an optimal goal G. • f(G2) > f(G) (from above) • h(n) ≤ h*(n) (since h is admissible) -> g(n) + h(n) ≤ g(n) + h*(n) • f(n) ≤ g(n) + h*(n) < f(G) < f(G2) Hence f(G2) > f(n), and A* will never select G2 for expansion.
  • 25. Consistent Heuristics • A heuristic is consistent (or monotonic) if for every node n, every successor n' of n generated by any action a: h(n) ≤ c(n,a,n') + h(n') • If h is consistent, we have: f(n') = g(n') + h(n') = g(n) + c(n,a,n') + h(n') ≥ g(n) + h(n) = f(n) i.e., f(n) is non-decreasing along any path. Theorem: If h(n) is consistent, A* using GRAPH-SEARCH is optimal.
  • 26. Optimality of A* • A* expands nodes in order of increasing f value. • Gradually adds "f-contours" of nodes. • Contour i has all nodes with f=fi, where fi < fi+1. • That is to say, nodes inside a given contour have f-costs less than or equal to contour value.
  • 27. Properties of A* • Complete: Yes (unless there are infinitely many nodes with f ≤ f(G) ). • Time: Exponential. • Space: Keeps all nodes in memory, so also exponential. • Optimal: Yes (provided h admissible or consistent). • Optimally Efficient: Yes (no algorithm with the same heuristic is guaranteed to expand fewer nodes). • NB: Every consistent heuristic is also admissible (Pearl). Q: What about the converse?
  • 28. Admissible Heuristics E.g., for the 8-puzzle: • h1(n) = number of misplaced tiles • h2(n) = total Manhattan distance (i.e. 1-norm) (i.e., no. of squares from desired location of each tile) Q: Why are these admissible heuristics? • h1(S) = ? • h2(S) = ?
  • 29. Admissible Heuristics E.g., for the 8-puzzle: • h1(n) = number of misplaced tiles • h2(n) = total Manhattan distance (i.e., no. of squares from desired location of each tile) • h1(S) = ? 8 • h2(S) = ? 3+1+2+2+2+3+3+2 = 18
  • 30. Dominance • If h2(n) ≥ h1(n) for all n (both admissible), then h2 dominates h1 . • Essentially, domination translates directly into efficiency: “h2 is better for search. • A* using h2 will never expand more nodes than A* using h1. • Typical search costs (average number of nodes expanded): d=12 IDS = 3,644,035 nodes A*(h1) = 227 nodes A*(h2) = 73 nodes d=24 IDS = too many nodes A*(h1) = 39,135 nodes A*(h2) = 1,641 nodes (IDS=iterative deepening search)
  • 31. Memory Bounded Heuristic Search: Recursive BFS (best-first) • How can we solve the memory problem for A* search? • Idea: Try something like depth-first search, but let’s not forget everything about the branches we have partially explored. • We remember the best f-value we have found so far in the branch we are deleting.
  • 32. Memory Bounded Heuristic Search: Recursive BFS • RBFS changes its mind very often in practice. This is because f=g+h become more accurate (less optimistic) as we approach the goal. Hence, higher level nodes have smaller f-values and will be explored first. • Problem: We should keep • in memory whatever we can. Best alternative over frontier nodes, which are not children: i.e. do I want to back up?
  • 33. Simple Memory-Bounded A* • This is like A*, but when memory is full we delete the worst node (largest f-value). • Like RBFS, we remember the best descendent in the branch we delete. • If there is a tie (equal f-values) we delete the oldest nodes first. • Simple-MBA* finds the optimal reachable solution given the memory constraint (reachable means path from root to goal fits in memory). • Can also use iterative deepening with A* (IDA*). • Time can still be exponential.
  • 34. Relaxed Problems • A problem with fewer restrictions on the actions is called a relaxed problem. • The cost of an optimal solution to a relaxed problem is an admissible heuristic for the original problem. (why?) • If the rules of the 8-puzzle are relaxed so that a tile can move anywhere, then h1(n) gives the shortest solution. • If the rules are relaxed so that a tile can move to any adjacent square, then h2(n) gives the shortest solution.
  • 35. Summary • Informed search methods may have access to a heuristic function h(n) that estimates the cost of a solution from n. • The generic best-first search algorithm selects a node for expansion according to an evaluation function. • Greedy best-first search expands nodes with minimal h(n). It is not optimal, but is often efficient. • A* search expands nodes with minimal f(n)=g(n)+h(n). • A* s complete and optimal, provided that h(n) is admissible (for TREE-SEARCH) or consistent (for GRAPH-SEARCH). • The space complexity of A* is still prohibitive. • The performance of heuristic search algorithms depends on the quality of the h(n) function. • One can sometimes construct good heuristics by relaxing the problem definition.