SlideShare a Scribd company logo
By
Prof. Amira Yassien
1 2 3
4 6
7 8
5
goal
Best first search
lecture 6 AI - A star.pdf
lecture 6 AI - A star.pdf
lecture 6 AI - A star.pdf
Combining cost-so-far and heuristic function
• Since what we're really looking for is the optimal path
between the initial state, and some goal state, a better
measure of how promising a state is, is the sum of the
cost-so-far, and our best estimate of the cost from there to
the nearest goal state.
• For a state n, with a cost-so-far g(n), and a heuristic
estimate of the cost to goal of h(n), what we want is:
• f(n) = g(n) + h(n)
6
Algorithm A*
•Idea: avoid expanding paths that are already expensive.
•
•Evaluation function f(n) = g(n) + h(n)
•
• g(n) = cost so far to reach n
• h(n) = estimated cost from n to goal
• f(n) = estimated total cost of path through n to goal
•
•This proves to be a very effective strategy for controlling
state-space search. When used with best-first search, as a way
of sorting the agenda where the agenda is sorted so that the
states with the lowest values of f(n) come first, and are
therefore expanded first-> this is known as Algorithm A*.
A* Algorithm
 H.C. and B.F. (given heuristics) can find solutions faster
than exhaustive searches.
 However, it can’t tell whether the found solution is the
best one.
 Problem:
 The heuristic guides us to the good nodes but doesn’t give
enough information to guarantee we’ve found the optimum.
 Solution: Branch and bound method
 The cost of the path to a node serves as a lower bound on the
cost of the nodes below it.
 We need a heuristic function ev(n,p) with this property to
guarantee optimum solution.
lecture 6 AI - A star.pdf
+
178
lecture 6 AI - A star.pdf
lecture 6 AI - A star.pdf
lecture 6 AI - A star.pdf
lecture 6 AI - A star.pdf
A* search and admissibility
• The choice of an appropriate heuristic evaluation
function, h(n), is still crucial to the behaviour of the
search algorithm.
• In general, we want to choose a heuristic evaluation
function h(n) which is as close as possible to the
actual cost of getting to a goal state.
• A heuristic is admissible if it never overestimates the
cost to the goal.
• The A* algorithm always finds the optimal solution
path whenever a path from the start to a goal state
exists.
• When the agenda is sorted according to the function
f(n) = g(n) + h(n) and where the function h(n) is
admissible, can be proven to always find an optimal
solution.
Dominance
• We say that a search strategy which searches less of the
state-space in order to find a goal state is more informed.
Ideally, we'd like a search strategy which is both admissible
(so it will find us an optimal path to the goal state), and
informed (so it will find the optimal path quickly.)
• Admissibility requires that the heuristic evaluation function,
h(n) doesn't overestimate, but we do want a function which
is as close as possible to the actual cost of getting to the
goal.
Admissible
Heuristics
• Finding heuristics:
• Relaxing the problem restrictions (simplifying the problem), e.g. the
rules for moving tiles.
• Learning heuristics from experience: learning a function as weighted
sum of features (quantitative properties of the states).
• e.g. 8’s puzzle
• Number of tiles out of place
• h1= the number of tiles that are in the wrong position. This is
admissible because any tile that is out of place must be moved
at least once.
2 8
1 6 4
7 5
1 2 3
8 4
7 6 5
(4)
3
Different
heuristic
s applied
to states
The heuristic f applied to states in the 8-
puzzle
lecture 6 AI - A star.pdf
lecture 6 AI - A star.pdf
lecture 6 AI - A star.pdf
lecture 6 AI - A star.pdf
lecture 6 AI - A star.pdf
lecture 6 AI - A star.pdf
Inexact Search
When all leaf nodes are feasible(even some are
better than others), H.C. needs no backtracking.
We then must use Forgetful H.C.
Forgetful H.C.: keeps track of current node
and forget where we’ve been [no open list].
Why Inexact Search
• As the search space become very large
(exhaustive) even when guided by
heuristics it’ll be impractical.
Blind Search VS Heuristic Search
• Blind Search:
Very basic. Follow an algorithm, taking no
account of how close we might be to a
solution.
• Informed (Heuristic) Search:
Uses guesses, rules to aid the search.
It involves making an estimate of how far we
are from a solution after each possible next
move & going to the move with the lowest
estimate.
Informed Search Summary
• Best-first search
Is general search where the minimum cost nodes (according to some measure)
are expanded first.
• Hill-climbing search
• When chose to follow a node, it continues to do so in depth first way.
• Even though the children of the node(say a) has heuristic information worst
than that for a node in the same level of node (say a).
• Forgetful Hill-climbing search
keep only a single state in memory, but can get stuck on local optima.
A* search
• A* algorithm is a modified form of best first algorithm.
• It is a branch and bound method with cost associated by path.
• It’s used in path problems where the cost of a path is the sum of the costs of the
moves.
• Guarantee to find best solution.
• f(n) = g(n) + h(n) and handles state repetitions and h(n) never overestimates.
• A* is complete, optimal and optimally efficient but its space complexity is still bad.

More Related Content

PPT
ARTIFICIAL INTELLIGENCE- informed search strategies
PPT
09_Informed_Search.ppt
PPTX
484507360-Lecture-4-Heuristic-Search-Strategies.pptx
PPTX
Heuristic or informed search
PPTX
Artificial intelligence(06)
PPTX
Artificial intelligence(06)
PPTX
Heuristic Searching Algorithms Artificial Intelligence.pptx
PPTX
Problem Solving through Search - Informed Search
ARTIFICIAL INTELLIGENCE- informed search strategies
09_Informed_Search.ppt
484507360-Lecture-4-Heuristic-Search-Strategies.pptx
Heuristic or informed search
Artificial intelligence(06)
Artificial intelligence(06)
Heuristic Searching Algorithms Artificial Intelligence.pptx
Problem Solving through Search - Informed Search

Similar to lecture 6 AI - A star.pdf (20)

PPTX
Heuristic search
PPTX
Mod3_AI_UPDATED 4th sem engineering.pptx
PPT
Heuristic search problem-solving str.ppt
PPTX
AI UNIT-1-BREADTH and BEST FIRST SEARCH.pptx
PPTX
Unit1_AI&ML_leftover (2).pptx
PPTX
Informed Search Techniques new kirti L 8.pptx
PDF
AI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdf
PDF
What is A * Search? What is Heuristic Search? What is Tree search Algorithm?
DOCX
Heuristis search
PPTX
Introduction to artificial intelligence
PPTX
Heuristic search
PPTX
A Star Search
PDF
Search problems in Artificial Intelligence
PPT
2-Heuristic Search.ppt
PPTX
Informed Search in Artifical Intelligence
PPTX
abhishek ppt.pptx
PPTX
Adhit_presentation_Searching_Algorithm(BFS,DFS).pptx
PPTX
AI_Lecture2.pptx
PPTX
Informed search algorithm.pptx power poi
Heuristic search
Mod3_AI_UPDATED 4th sem engineering.pptx
Heuristic search problem-solving str.ppt
AI UNIT-1-BREADTH and BEST FIRST SEARCH.pptx
Unit1_AI&ML_leftover (2).pptx
Informed Search Techniques new kirti L 8.pptx
AI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdf
What is A * Search? What is Heuristic Search? What is Tree search Algorithm?
Heuristis search
Introduction to artificial intelligence
Heuristic search
A Star Search
Search problems in Artificial Intelligence
2-Heuristic Search.ppt
Informed Search in Artifical Intelligence
abhishek ppt.pptx
Adhit_presentation_Searching_Algorithm(BFS,DFS).pptx
AI_Lecture2.pptx
Informed search algorithm.pptx power poi
Ad

Recently uploaded (20)

PPTX
Major-Components-ofNKJNNKNKNKNKronment.pptx
PDF
Launch Your Data Science Career in Kochi – 2025
PPTX
ALIMENTARY AND BILIARY CONDITIONS 3-1.pptx
PPTX
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
PPTX
Business Ppt On Nestle.pptx huunnnhhgfvu
PDF
BF and FI - Blockchain, fintech and Financial Innovation Lesson 2.pdf
PDF
Lecture1 pattern recognition............
PPTX
Global journeys: estimating international migration
PPTX
Database Infoormation System (DBIS).pptx
PPTX
iec ppt-1 pptx icmr ppt on rehabilitation.pptx
PPTX
oil_refinery_comprehensive_20250804084928 (1).pptx
PPTX
STUDY DESIGN details- Lt Col Maksud (21).pptx
PDF
“Getting Started with Data Analytics Using R – Concepts, Tools & Case Studies”
PDF
Introduction to Business Data Analytics.
PPTX
IB Computer Science - Internal Assessment.pptx
PPTX
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
PPTX
Introduction to Knowledge Engineering Part 1
PPTX
Acceptance and paychological effects of mandatory extra coach I classes.pptx
PPTX
Introduction-to-Cloud-ComputingFinal.pptx
PPT
Miokarditis (Inflamasi pada Otot Jantung)
Major-Components-ofNKJNNKNKNKNKronment.pptx
Launch Your Data Science Career in Kochi – 2025
ALIMENTARY AND BILIARY CONDITIONS 3-1.pptx
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
Business Ppt On Nestle.pptx huunnnhhgfvu
BF and FI - Blockchain, fintech and Financial Innovation Lesson 2.pdf
Lecture1 pattern recognition............
Global journeys: estimating international migration
Database Infoormation System (DBIS).pptx
iec ppt-1 pptx icmr ppt on rehabilitation.pptx
oil_refinery_comprehensive_20250804084928 (1).pptx
STUDY DESIGN details- Lt Col Maksud (21).pptx
“Getting Started with Data Analytics Using R – Concepts, Tools & Case Studies”
Introduction to Business Data Analytics.
IB Computer Science - Internal Assessment.pptx
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
Introduction to Knowledge Engineering Part 1
Acceptance and paychological effects of mandatory extra coach I classes.pptx
Introduction-to-Cloud-ComputingFinal.pptx
Miokarditis (Inflamasi pada Otot Jantung)
Ad

lecture 6 AI - A star.pdf

  • 2. 1 2 3 4 6 7 8 5 goal Best first search
  • 6. Combining cost-so-far and heuristic function • Since what we're really looking for is the optimal path between the initial state, and some goal state, a better measure of how promising a state is, is the sum of the cost-so-far, and our best estimate of the cost from there to the nearest goal state. • For a state n, with a cost-so-far g(n), and a heuristic estimate of the cost to goal of h(n), what we want is: • f(n) = g(n) + h(n) 6
  • 7. Algorithm A* •Idea: avoid expanding paths that are already expensive. • •Evaluation function f(n) = g(n) + h(n) • • g(n) = cost so far to reach n • h(n) = estimated cost from n to goal • f(n) = estimated total cost of path through n to goal • •This proves to be a very effective strategy for controlling state-space search. When used with best-first search, as a way of sorting the agenda where the agenda is sorted so that the states with the lowest values of f(n) come first, and are therefore expanded first-> this is known as Algorithm A*.
  • 8. A* Algorithm  H.C. and B.F. (given heuristics) can find solutions faster than exhaustive searches.  However, it can’t tell whether the found solution is the best one.  Problem:  The heuristic guides us to the good nodes but doesn’t give enough information to guarantee we’ve found the optimum.  Solution: Branch and bound method  The cost of the path to a node serves as a lower bound on the cost of the nodes below it.  We need a heuristic function ev(n,p) with this property to guarantee optimum solution.
  • 10. + 178
  • 15. A* search and admissibility • The choice of an appropriate heuristic evaluation function, h(n), is still crucial to the behaviour of the search algorithm. • In general, we want to choose a heuristic evaluation function h(n) which is as close as possible to the actual cost of getting to a goal state. • A heuristic is admissible if it never overestimates the cost to the goal.
  • 16. • The A* algorithm always finds the optimal solution path whenever a path from the start to a goal state exists. • When the agenda is sorted according to the function f(n) = g(n) + h(n) and where the function h(n) is admissible, can be proven to always find an optimal solution.
  • 17. Dominance • We say that a search strategy which searches less of the state-space in order to find a goal state is more informed. Ideally, we'd like a search strategy which is both admissible (so it will find us an optimal path to the goal state), and informed (so it will find the optimal path quickly.) • Admissibility requires that the heuristic evaluation function, h(n) doesn't overestimate, but we do want a function which is as close as possible to the actual cost of getting to the goal.
  • 18. Admissible Heuristics • Finding heuristics: • Relaxing the problem restrictions (simplifying the problem), e.g. the rules for moving tiles. • Learning heuristics from experience: learning a function as weighted sum of features (quantitative properties of the states). • e.g. 8’s puzzle • Number of tiles out of place • h1= the number of tiles that are in the wrong position. This is admissible because any tile that is out of place must be moved at least once. 2 8 1 6 4 7 5 1 2 3 8 4 7 6 5 (4) 3
  • 20. The heuristic f applied to states in the 8- puzzle
  • 27. Inexact Search When all leaf nodes are feasible(even some are better than others), H.C. needs no backtracking. We then must use Forgetful H.C. Forgetful H.C.: keeps track of current node and forget where we’ve been [no open list].
  • 28. Why Inexact Search • As the search space become very large (exhaustive) even when guided by heuristics it’ll be impractical.
  • 29. Blind Search VS Heuristic Search • Blind Search: Very basic. Follow an algorithm, taking no account of how close we might be to a solution. • Informed (Heuristic) Search: Uses guesses, rules to aid the search. It involves making an estimate of how far we are from a solution after each possible next move & going to the move with the lowest estimate.
  • 30. Informed Search Summary • Best-first search Is general search where the minimum cost nodes (according to some measure) are expanded first. • Hill-climbing search • When chose to follow a node, it continues to do so in depth first way. • Even though the children of the node(say a) has heuristic information worst than that for a node in the same level of node (say a). • Forgetful Hill-climbing search keep only a single state in memory, but can get stuck on local optima.
  • 31. A* search • A* algorithm is a modified form of best first algorithm. • It is a branch and bound method with cost associated by path. • It’s used in path problems where the cost of a path is the sum of the costs of the moves. • Guarantee to find best solution. • f(n) = g(n) + h(n) and handles state repetitions and h(n) never overestimates. • A* is complete, optimal and optimally efficient but its space complexity is still bad.