Artificial Intelligence
Informed (Heuristic) search
• Heuristic search is an AI search technique that
employs heuristic for its moves.
• Heuristic is a rule of thumb that probably
leads to a solution.
• Heuristics play a major role in search
strategies because of exponential nature of
the most problems. Heuristics help to reduce
the number of alternatives from an
exponential number to a polynomial number.
Heuristic search
• In Artificial Intelligence, heuristic search has a
general meaning, and a more specialized
technical meaning.
• In a general sense, the term heuristic is used for
any advice that is often effective, but is not
guaranteed to work in every case.
• Within the heuristic search architecture,
however, the term heuristic usually refers to the
special case of a heuristic evaluation function.
Heuristic information
• In order to solve larger problems, domain-
specific knowledge must be added to improve
search efficiency.
• Information about the problem include the
nature of states, cost of transforming from one
state to another, and characteristics of the goals.
• This information can often be expressed in the
form of heuristic evaluation function, say f(n,g), a
function of the nodes n and/or the goals g.
Heuristic evaluation function
• Heuristic evaluation function estimates the
cost of an optimal path between a pair of
states in a single-agent path-finding problem, .
• For example, Euclidean or airline distance is an
estimate of the highway distance between a
pair of locations.
Manhattan Distance
• Manhattan distance is a common heuristic
function for the sliding-tile puzzles.
• Manhattan distance is computed by counting
the number of moves along the grid that each
tile is displaced from its goal position, and
summing these values over all faces.
Heuristic evaluation function
• For a fixed goal state, a heuristic evaluation is a
function of a node, say h(n), that estimates the
distance from node, say n to the given state.
• h(n) = estimated cost of the cheapest path from
node n to a goal node
• There is a whole family of Best-First Search
algorithms with different evaluation functions
– Each has a heuristic function h(n)
Following is a list of heuristic search
techniques…
• Greedy best-first search
• A* search
• Recursive best-first search
• Pure Heuristic Search
• Iterative-Deepening A*
• Depth-First Branch-And-Bound
• Heuristic Path Algorithm
Greedy Best-First Search
• Greedy Best-First search tries to expand the node that is
closest to the goal assuming it will lead to a solution quickly
– f(n) = h(n)
– “Greedy Search”
• to refer specifically to a search with a heuristic that attempts to predict
how close the end of a path is to a solution, so that paths which are
judged to be closer to a solution are extended first. This specific type
of search is called greedy best-first search.
• Implementation
– expand the “most desirable” node into the fringe queue
– sort the queue in decreasing order of desirability
• Example: consider the straight-line distance heuristic hSLD
– Expand the node that appears to be closest to the goal
Greedy Best-First Search
Greedy Best-First Search
• hSLD(In(Arid)) = 366
• Notice that the values of hSLD cannot be
computed from the problem itself
• It takes some experience to know that hSLD is
correlated with actual road distances
– Therefore a useful heuristic
Greedy Best-First Search
Greedy Best-First Search
Greedy Best-First Search
Greedy Best-First Search
• Complete
– No, GBFS can get stuck in loops (e.g. bouncing back and
forth between cities)
• Time
– O(bm) but a good heuristic can have dramatic improvement
• Space
– O(bm) – keeps all the nodes in memory
• Optimal
– No!
Robot Navigation
Robot Navigation
0 211
58 7
7
3
4
7
6
7
6 3 2
8
6
45
23 3
36 5 24 43 5
54 6
5
6
4
5
f(N) = h(N), with h(N) = Manhattan distance to the goal
Robot Navigation
0 211
58 7
7
3
4
7
6
7
6 3 2
8
6
45
23 3
36 5 24 43 5
54 6
5
6
4
5
f(N) = h(N), with h(N) = Manhattan distance to the goal
7
0
A* Search
• A* algorithm is a best-first search algorithm in which
the cost associated with a node is
f(n) = g(n) + h(n),
where g(n) is the cost of the path from the initial state
to node n and h(n) is the heuristic estimate or the cost
or a path from node n to a goal.
• Thus, f(n) estimates the lowest total cost of any
solution path going through node n. At each point a
node with lowest f value is chosen for expansion.
• Ties among nodes of equal f value should be broken in
favor of nodes with lower h values. The algorithm
terminates when a goal is chosen for expansion.
A* Search
• A* (A star) is the most widely known in AI
– It evaluates nodes by combining g(n) and h(n)
– f(n) = g(n) + h(n)
– Where
• g(n) = cost so far to reach n
• h(n) = estimated cost to goal from n
• f(n) = estimated total cost of path through n
A* Search
• When h(n) = actual cost to goal
– Only nodes in the correct path are expanded
– Optimal solution is found
• When h(n) < actual cost to goal
– Additional nodes are expanded
– Optimal solution is found
• When h(n) > actual cost to goal
– Optimal solution can be overlooked
Greedy Best-First Search
A* Search
A* Search
A* Search
A* Search
A* Search
A* Search
• A* expands nodes in increasing f value
– Gradually adds f-contours of nodes (like breadth-
first search adding layers)
– Contour i has all nodes f=fi where fi < fi+1
A* Search
• Complete
– Yes, unless there are infinitely many nodes with f <= f(G)
• Time
– Exponential in [relative error of h x length of soln]
– The better the heuristic, the better the time
• Best case h is perfect, O(d)
• Worst case h = 0, O(bd) same as BFS
• Space
– Keeps all nodes in memory and save in case of repetition
– This is O(bd) or worse
– A* usually runs out of space before it runs out of time
• Optimal
– Yes, cannot expand fi+1 unless fi is finished
Once more
• We kept looking at nodes closer and closer to the
goal, but were accumulating costs as we got further
from the initial state
• Our goal is not to minimize the distance from the
current head of our path to the goal, we want to
minimize the overall length of the path to the goal!
• Let g(N) be the cost of the best
path found so far between the initial
node and N
• f(N) = g(N) + h(N)
Robot Navigation
f(N) = g(N)+h(N), with h(N) = Manhattan distance to goal
0 211
58 7
7
3
4
7
6
7
6 3 2
8
6
45
23 3
36 5 24 43 5
54 6
5
6
4
57+0
6+1
6+1
8+1
7+0
7+2
6+1
7+2
6+1
8+1
7+2
8+3
7+2 6+36+3 5+45+4 4+54+5 3+63+6 2+7
8+3 7+47+4 6+5
5+6
6+3 5+6
2+7 3+8
4+7
5+6 4+7
3+8
4+7 3+83+8 2+92+9 3+10
2+9
3+8
2+9 1+101+10 0+11
Complexity Of Finding Optimal Solutions
• The time complexity of a heuristic search
algorithm depends on the accuracy of the
heuristic function.
• For example, if the heuristic evaluation function is
an exact estimator, then A* search algorithm runs
in linear time, expanding only those nodes on an
optimal solution path.
• Conversely, with a heuristic that returns zero
everywhere, A* algorithm becomes uniform-cost
search, which has exponential complexity.

More Related Content

PPT
Searchadditional2
PPT
M4 heuristics
PPTX
Jarrar: Informed Search
PPT
Informed search (heuristics)
PPT
Solving problems by searching Informed (heuristics) Search
PDF
Heuristic search
PPT
Lecture 11 Informed Search
PDF
Pathfinding - Part 1: Α* heuristic search
Searchadditional2
M4 heuristics
Jarrar: Informed Search
Informed search (heuristics)
Solving problems by searching Informed (heuristics) Search
Heuristic search
Lecture 11 Informed Search
Pathfinding - Part 1: Α* heuristic search

What's hot (18)

PPTX
Final slide (bsc csit) chapter 5
PPT
Ch2 3-informed (heuristic) search
PDF
16890 unit 2 heuristic search techniques
PPTX
A Star Search
PPTX
3.informed search
PPTX
2.uninformed search
PPT
Jarrar.lecture notes.aai.2011s.ch4.informedsearch
PDF
Pathfinding - Part 3: Beyond the basics
PPTX
Control Strategies in AI
PPTX
A star algorithms
PPTX
AI Greedy and A-STAR Search
PDF
09 heuristic search
PPT
Uniformed tree searching
PPT
04 search heuristic
PDF
2 lectures 16 17-informed search algorithms ch 4.3
PDF
Lec 2 1 informed search
PPTX
Heuristic or informed search
Final slide (bsc csit) chapter 5
Ch2 3-informed (heuristic) search
16890 unit 2 heuristic search techniques
A Star Search
3.informed search
2.uninformed search
Jarrar.lecture notes.aai.2011s.ch4.informedsearch
Pathfinding - Part 3: Beyond the basics
Control Strategies in AI
A star algorithms
AI Greedy and A-STAR Search
09 heuristic search
Uniformed tree searching
04 search heuristic
2 lectures 16 17-informed search algorithms ch 4.3
Lec 2 1 informed search
Heuristic or informed search
Ad

Similar to Artificial intelligence(06) (20)

PPTX
Heuristic Search, Best First Search.pptx
PDF
shamwari dzerwendo.mmmmmmfmmfmfkksrkrttkt
PDF
What is A * Search? What is Heuristic Search? What is Tree search Algorithm?
PPTX
Introduction to artificial intelligence
PPT
2-Heuristic Search.ppt
PDF
BCS515B Module3 vtu notes : Artificial Intelligence Module 3.pdf
PDF
Informed-search TECHNIQUES IN ai ml data science
PPT
Ch4: Searching Techniques 6_2018_12_25!05_35_25_PM.ppt
PPTX
484507360-Lecture-4-Heuristic-Search-Strategies.pptx
PPT
Different Search Techniques used in AI.ppt
PPTX
AI_Lecture2.pptx
PPTX
AI UNIT-1-BREADTH and BEST FIRST SEARCH.pptx
PPTX
22 sch Artificial intelligence Module-3 1st part.pptx
PPTX
An Introduction to Artificial Intelligence
PPTX
Informed Search.pptx
PPTX
PowerPoint - K-State Laboratory for Knowledge Discovery in ...
PPT
ai and search algorithms general on a* and searching
PPTX
AI PPT Unit 2 Artificial Intelligence 24sd45
PPT
Unit II Problem Solving Methods in AI K.sundar,AP/CSE,VEC
Heuristic Search, Best First Search.pptx
shamwari dzerwendo.mmmmmmfmmfmfkksrkrttkt
What is A * Search? What is Heuristic Search? What is Tree search Algorithm?
Introduction to artificial intelligence
2-Heuristic Search.ppt
BCS515B Module3 vtu notes : Artificial Intelligence Module 3.pdf
Informed-search TECHNIQUES IN ai ml data science
Ch4: Searching Techniques 6_2018_12_25!05_35_25_PM.ppt
484507360-Lecture-4-Heuristic-Search-Strategies.pptx
Different Search Techniques used in AI.ppt
AI_Lecture2.pptx
AI UNIT-1-BREADTH and BEST FIRST SEARCH.pptx
22 sch Artificial intelligence Module-3 1st part.pptx
An Introduction to Artificial Intelligence
Informed Search.pptx
PowerPoint - K-State Laboratory for Knowledge Discovery in ...
ai and search algorithms general on a* and searching
AI PPT Unit 2 Artificial Intelligence 24sd45
Unit II Problem Solving Methods in AI K.sundar,AP/CSE,VEC
Ad

More from Nazir Ahmed (20)

PPT
Data structures final lecture 1
PPT
Data structures lecture 04
PPTX
Data structure
PPT
Cover letter
PPTX
Control unit design(1)
DOCX
Computer architecture mcq (2)
PPT
Complete binary tree and heap
PPTX
Clamper clipper(10)
PPTX
Cisc mc68000
PPTX
Chapter 08
PPT
Chapter 07 ddl_sql
PPTX
Chapter 4
PPT
Chapter 03
PPTX
Chapter # 12 er modeling
PPT
Chapeter 2
PPT
Ch7 1 v1
PPT
Ch07 deadlocks
PPT
Ch05 cpu-scheduling
PPT
Ch04 threads
PPT
Ch03 processes
Data structures final lecture 1
Data structures lecture 04
Data structure
Cover letter
Control unit design(1)
Computer architecture mcq (2)
Complete binary tree and heap
Clamper clipper(10)
Cisc mc68000
Chapter 08
Chapter 07 ddl_sql
Chapter 4
Chapter 03
Chapter # 12 er modeling
Chapeter 2
Ch7 1 v1
Ch07 deadlocks
Ch05 cpu-scheduling
Ch04 threads
Ch03 processes

Recently uploaded (20)

PDF
advance database management system book.pdf
PDF
Journal of Dental Science - UDMY (2021).pdf
PDF
Paper A Mock Exam 9_ Attempt review.pdf.
PDF
LIFE & LIVING TRILOGY- PART (1) WHO ARE WE.pdf
PPTX
Share_Module_2_Power_conflict_and_negotiation.pptx
PPTX
Introduction to pro and eukaryotes and differences.pptx
PDF
Uderstanding digital marketing and marketing stratergie for engaging the digi...
PDF
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 2).pdf
PDF
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
PDF
Complications of Minimal Access-Surgery.pdf
PDF
LIFE & LIVING TRILOGY - PART - (2) THE PURPOSE OF LIFE.pdf
PDF
Skin Care and Cosmetic Ingredients Dictionary ( PDFDrive ).pdf
DOCX
Cambridge-Practice-Tests-for-IELTS-12.docx
PDF
HVAC Specification 2024 according to central public works department
PDF
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
PDF
Environmental Education MCQ BD2EE - Share Source.pdf
PDF
FORM 1 BIOLOGY MIND MAPS and their schemes
PDF
CISA (Certified Information Systems Auditor) Domain-Wise Summary.pdf
PDF
LIFE & LIVING TRILOGY - PART (3) REALITY & MYSTERY.pdf
PDF
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
advance database management system book.pdf
Journal of Dental Science - UDMY (2021).pdf
Paper A Mock Exam 9_ Attempt review.pdf.
LIFE & LIVING TRILOGY- PART (1) WHO ARE WE.pdf
Share_Module_2_Power_conflict_and_negotiation.pptx
Introduction to pro and eukaryotes and differences.pptx
Uderstanding digital marketing and marketing stratergie for engaging the digi...
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 2).pdf
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
Complications of Minimal Access-Surgery.pdf
LIFE & LIVING TRILOGY - PART - (2) THE PURPOSE OF LIFE.pdf
Skin Care and Cosmetic Ingredients Dictionary ( PDFDrive ).pdf
Cambridge-Practice-Tests-for-IELTS-12.docx
HVAC Specification 2024 according to central public works department
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
Environmental Education MCQ BD2EE - Share Source.pdf
FORM 1 BIOLOGY MIND MAPS and their schemes
CISA (Certified Information Systems Auditor) Domain-Wise Summary.pdf
LIFE & LIVING TRILOGY - PART (3) REALITY & MYSTERY.pdf
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf

Artificial intelligence(06)

  • 2. Informed (Heuristic) search • Heuristic search is an AI search technique that employs heuristic for its moves. • Heuristic is a rule of thumb that probably leads to a solution. • Heuristics play a major role in search strategies because of exponential nature of the most problems. Heuristics help to reduce the number of alternatives from an exponential number to a polynomial number.
  • 3. Heuristic search • In Artificial Intelligence, heuristic search has a general meaning, and a more specialized technical meaning. • In a general sense, the term heuristic is used for any advice that is often effective, but is not guaranteed to work in every case. • Within the heuristic search architecture, however, the term heuristic usually refers to the special case of a heuristic evaluation function.
  • 4. Heuristic information • In order to solve larger problems, domain- specific knowledge must be added to improve search efficiency. • Information about the problem include the nature of states, cost of transforming from one state to another, and characteristics of the goals. • This information can often be expressed in the form of heuristic evaluation function, say f(n,g), a function of the nodes n and/or the goals g.
  • 5. Heuristic evaluation function • Heuristic evaluation function estimates the cost of an optimal path between a pair of states in a single-agent path-finding problem, . • For example, Euclidean or airline distance is an estimate of the highway distance between a pair of locations.
  • 6. Manhattan Distance • Manhattan distance is a common heuristic function for the sliding-tile puzzles. • Manhattan distance is computed by counting the number of moves along the grid that each tile is displaced from its goal position, and summing these values over all faces.
  • 7. Heuristic evaluation function • For a fixed goal state, a heuristic evaluation is a function of a node, say h(n), that estimates the distance from node, say n to the given state. • h(n) = estimated cost of the cheapest path from node n to a goal node • There is a whole family of Best-First Search algorithms with different evaluation functions – Each has a heuristic function h(n)
  • 8. Following is a list of heuristic search techniques… • Greedy best-first search • A* search • Recursive best-first search • Pure Heuristic Search • Iterative-Deepening A* • Depth-First Branch-And-Bound • Heuristic Path Algorithm
  • 9. Greedy Best-First Search • Greedy Best-First search tries to expand the node that is closest to the goal assuming it will lead to a solution quickly – f(n) = h(n) – “Greedy Search” • to refer specifically to a search with a heuristic that attempts to predict how close the end of a path is to a solution, so that paths which are judged to be closer to a solution are extended first. This specific type of search is called greedy best-first search. • Implementation – expand the “most desirable” node into the fringe queue – sort the queue in decreasing order of desirability • Example: consider the straight-line distance heuristic hSLD – Expand the node that appears to be closest to the goal
  • 11. Greedy Best-First Search • hSLD(In(Arid)) = 366 • Notice that the values of hSLD cannot be computed from the problem itself • It takes some experience to know that hSLD is correlated with actual road distances – Therefore a useful heuristic
  • 15. Greedy Best-First Search • Complete – No, GBFS can get stuck in loops (e.g. bouncing back and forth between cities) • Time – O(bm) but a good heuristic can have dramatic improvement • Space – O(bm) – keeps all the nodes in memory • Optimal – No!
  • 17. Robot Navigation 0 211 58 7 7 3 4 7 6 7 6 3 2 8 6 45 23 3 36 5 24 43 5 54 6 5 6 4 5 f(N) = h(N), with h(N) = Manhattan distance to the goal
  • 18. Robot Navigation 0 211 58 7 7 3 4 7 6 7 6 3 2 8 6 45 23 3 36 5 24 43 5 54 6 5 6 4 5 f(N) = h(N), with h(N) = Manhattan distance to the goal 7 0
  • 19. A* Search • A* algorithm is a best-first search algorithm in which the cost associated with a node is f(n) = g(n) + h(n), where g(n) is the cost of the path from the initial state to node n and h(n) is the heuristic estimate or the cost or a path from node n to a goal. • Thus, f(n) estimates the lowest total cost of any solution path going through node n. At each point a node with lowest f value is chosen for expansion. • Ties among nodes of equal f value should be broken in favor of nodes with lower h values. The algorithm terminates when a goal is chosen for expansion.
  • 20. A* Search • A* (A star) is the most widely known in AI – It evaluates nodes by combining g(n) and h(n) – f(n) = g(n) + h(n) – Where • g(n) = cost so far to reach n • h(n) = estimated cost to goal from n • f(n) = estimated total cost of path through n
  • 21. A* Search • When h(n) = actual cost to goal – Only nodes in the correct path are expanded – Optimal solution is found • When h(n) < actual cost to goal – Additional nodes are expanded – Optimal solution is found • When h(n) > actual cost to goal – Optimal solution can be overlooked
  • 28. A* Search • A* expands nodes in increasing f value – Gradually adds f-contours of nodes (like breadth- first search adding layers) – Contour i has all nodes f=fi where fi < fi+1
  • 29. A* Search • Complete – Yes, unless there are infinitely many nodes with f <= f(G) • Time – Exponential in [relative error of h x length of soln] – The better the heuristic, the better the time • Best case h is perfect, O(d) • Worst case h = 0, O(bd) same as BFS • Space – Keeps all nodes in memory and save in case of repetition – This is O(bd) or worse – A* usually runs out of space before it runs out of time • Optimal – Yes, cannot expand fi+1 unless fi is finished
  • 30. Once more • We kept looking at nodes closer and closer to the goal, but were accumulating costs as we got further from the initial state • Our goal is not to minimize the distance from the current head of our path to the goal, we want to minimize the overall length of the path to the goal! • Let g(N) be the cost of the best path found so far between the initial node and N • f(N) = g(N) + h(N)
  • 31. Robot Navigation f(N) = g(N)+h(N), with h(N) = Manhattan distance to goal 0 211 58 7 7 3 4 7 6 7 6 3 2 8 6 45 23 3 36 5 24 43 5 54 6 5 6 4 57+0 6+1 6+1 8+1 7+0 7+2 6+1 7+2 6+1 8+1 7+2 8+3 7+2 6+36+3 5+45+4 4+54+5 3+63+6 2+7 8+3 7+47+4 6+5 5+6 6+3 5+6 2+7 3+8 4+7 5+6 4+7 3+8 4+7 3+83+8 2+92+9 3+10 2+9 3+8 2+9 1+101+10 0+11
  • 32. Complexity Of Finding Optimal Solutions • The time complexity of a heuristic search algorithm depends on the accuracy of the heuristic function. • For example, if the heuristic evaluation function is an exact estimator, then A* search algorithm runs in linear time, expanding only those nodes on an optimal solution path. • Conversely, with a heuristic that returns zero everywhere, A* algorithm becomes uniform-cost search, which has exponential complexity.