SlideShare a Scribd company logo
1 of 43
3
Best-first search
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• Idea: use an evaluation function f(n) to select the node for
expansion
– estimate of "desirability"
Expand most desirable unexpanded node
• Implementation:
Order the nodes in fringe in decreasing order of desirability
• A key component in best-first algorithms is a heuristic
function, h(n), which is the estimated cost of the cheapest path
from n to a goal node
5
Romania with step costs in km
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
e.g. For Romania, cost of the cheapest path from Arad to
Bucharest can be estimated via the straight line distance
6
Greedy best-first search
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• Greedy best-first search expands the node that
appears to be closest to goal
• Evaluation function f(n) = h(n) (heuristic)
• = estimate of cost from n to goal
• e.g., hSLD(n) = straight-line distance from n to
Bucharest
• Note that, hSLD cannot be computed from the problem
description itself. It takes a certain amount of
experience to know that it is correlated with actual
road distances, and therefore it is a useful heuristic
7
Greedy best-first search example
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
8
Greedy best-first search example
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
9
Greedy best-first search example
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
10
Greedy best-first search example
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
11
Greedy best-first search example
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
Problems:
Path through Faragas is not the optimal
In getting Iasi to Faragas, it will expand Neamt first but it is a dead end
19
Properties of greedy best-first
search
• Complete? No – can get stuck in loops,
– e.g., Iasi  Neamt  Iasi  Neamt 
• Time? O(bm), but a good heuristic can give dramatic
Improvement
• Space? O(bm) -- keeps all nodes in memory
• Optimal? No
20
A* search
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• 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
21
A* search example
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
22
A* search example
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
23
A* search example
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
24
A* search example
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
25
A* search example
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
26
A* search example
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
33
Straight line estimate
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
Uniform-cost orders by path cost, or backward
cost g(n)
Greedy orders by goal proximity, or forward
cost h(n)
A* Search orders by the sum: f(n) = g(n) + h(n)
Initialize : set open={s} , closed={ }
g(s)=0 , f(s)= h(s)
Fail: if open= { } , terminate and fail
Select: select minimum cost state n from open{ } .save in closed{ }
Terminate: if n belongs to G ,terminate with success , return f(n)
Expand: for each successor m of n
if m Є [open U Closed]
set g(m)=g(n)+c(n,m)
set f(m)=g(m)+h(m)
insert m in open { }
if m Є [open U Closed]
set g(m)=min { g(m), g(n)+c(n,m)}
set f(m)=g(m)+h(m)
If f(m) has decreased and m Є closed
Move m to open { }
A* Algorithm
37
Admissible heuristics
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
•
•
• 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 – thinks that the cost of solving the problem is less
than it actually is
Consequence: f(n) never over estimates the the true cost of a solution
through n since g(n) is the exact cost to reach n
• Example: hSLD(n) (never overestimates the actual road distance) since
the shortest path between any two points is a straight line
38
Optimality of A* (proof)
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• Theorem: If h(n) is admissible, A* using TREE-SEARCH is
optimal
•
• Suppose some suboptimal goal G2 has been generated and is in the fringe.
Let the cost of the optimal solution to goal G is C*
f = g + h
• f(G2) = g(G2)
• g(G2) > C*
• f(G) = g(G)
• f(G2) > f(G)
since h(G2) = 0
since G2 is suboptimal
since h(G) = 0
from above
39
Optimality of A* (proof)
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• Let n be an unexpanded node in the fringe such that n is on a shortest path
to an optimal goal G (e.g. Pitesti).
If h(n) does not overestimate the cost of completing the solution path, then
f(n) = g(n) + h(n) ≤ C*
f(n) ≤ f(G)
•
•
•
• f(G2) > f(G) from above
• Hence f(G2) > f(G) >= f(n) , and A* will never select G2 for expansion
41
Optimality of A*
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
•
•
•
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
42
Properties of A*
• nodes with f ≤ f(G) )
• Time? Exponential
• Space? Keeps all nodes in memory
• Optimal? Yes
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• Complete? Yes (unless there are infinitely many
S
c
D
E
F
B
G
5
4
10
3
7
2
5
16
12
S=14
S-B=4+12=16 **
S-C=3+11=14
S-C-D=3+7+6=16
S-C-E=3+10+4=17
S-B-E=4+12+4=20
S-B-F=4+5+11=20
S-C-D-E=3+7+2+4=16
S-C-D-E-G=3+7+2+5=17
Open list Closed list
S(14) S(14)
C(14) B(16) C(14)
B(16)E(17)D(16) D(16)
E(16) E(16)
G(17) G(17)
Open list Closed list
S(14) S(14)
C(14) B(16) C(14)
B(16)E(17)D(16) B(16)
E(17)D(16)F(20) D(16)
E(16) E(16)
G(17) G(17)
43
Admissible heuristics
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
E.g., for the 8-puzzle:
•
•
h1(n) = number of misplaced tiles
h2(n) = total Manhattan distance – the sum of the distances of the tiles from
their goal positions
• h1(S) = ?
• h2(S) = ?
44
Admissible heuristics
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
E.g., for the 8-puzzle:
• h1(n) = number of misplaced tiles
• h2(n) = total Manhattan distance
• h1(S) = ? 8
• h2(S) = ? 3+1+2+2+2+3+3+2 = 18
45
Dominance
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• If h2(n) ≥ h1(n) for all n (both admissible)
• then h2 dominates h1
• h2 is better for search
• It is always better to use a heuristic function with higher
values, provided it does not overestimate and that the
computation time for the heuristic is not too large
• 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
46
Relaxed problems
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• 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
• The heuristic is admissible because the optimal
solution in the original problem is also a solution in
the relaxed problem and therefore must be at least as
expensive as the optimal solution in the relaxed
problem
• 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
47
Inventing admissible heuristic functions
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• If a problem definition is written down in a formal language, it is
possible to construct relaxed problems automatically (ABSOLVER)
– If 8-puzzle is described as
• A tile can move from square A to square B if
• A is horizontally or vertically adjacent to B and B is blank
– A relaxed problem can be generated by removing one or both of
the conditions
• (a) A tile can move from square A to square B if A is adjacent to B
• (b) A tile can move from square A to square B if B is blank
• (c) A tile can move from square A to square B
– h2 can be derived from (a) – h2 is the proper score if we move
each tile into its destination
– h1 can be derived from (c) – it is the proper score if tiles could
move to their intended destination in one step
• Admissible heuristics can also be derived from the solution cost of a
subproblem of a given problem
48
Local search algorithms
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• In many optimization problems, the path to the goal is
irrelevant; the goal state itself is the solution
• State space = set of "complete" configurations
• Find configuration satisfying constraints, e.g., n-
queens
• In such cases, we can use local search algorithms
• keep a single "current" state, try to improve it
49
Example: n-queens
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• Put n queens on an n × n board with no two queens
on the same row, column, or diagonal
50
Hill-climbing search
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• "Like climbing Everest in thick fog with amnesia"
51
Hill-climbing search
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• Problem: depending on initial state, can get stuck in
local maxima
52
Hill-climbing search: 8-queens problem
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• h = number of pairs of queens that are attacking each other, either directly or
indirectly
h = 17 for the above state
•
53
Hill-climbing search: 8-queens problem
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• A local minimum with h = 1
54
Simulated annealing search
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• Idea: escape local maxima by allowing some "bad"
moves but gradually decrease their frequency
56
Local beam search
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• Keep track of k states rather than just one
• Start with k randomly generated states
• At each iteration, all the successors of all k states are
generated
• If any one is a goal state, stop; else select the k best
successors from the complete list and repeat.
57
Genetic algorithms
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• A successor state is generated by combining two parent states
• Start with k randomly generated states (population)
• A state is represented as a string over a finite alphabet (often a
string of 0s and 1s)
• Evaluation function (fitness function). Higher values for better
states.
• Produce the next generation of states by selection, crossover,
and mutation
58
Genetic algorithms
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
•
•
•
Fitness function: number of non-attacking pairs of queens (min
= 0, max = 8 × 7/2 = 28)
24/(24+23+20+11) = 31%
23/(24+23+20+11) = 29% etc
59
Genetic algorithms
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu

More Related Content

Similar to AI 22-23 Chpt3 informed.pptx

Unit II Problem Solving Methods in AI K.sundar,AP/CSE,VEC
Unit II Problem Solving Methods in AI K.sundar,AP/CSE,VECUnit II Problem Solving Methods in AI K.sundar,AP/CSE,VEC
Unit II Problem Solving Methods in AI K.sundar,AP/CSE,VECsundarKanagaraj1
 
Artificial intelligence(06)
Artificial intelligence(06)Artificial intelligence(06)
Artificial intelligence(06)Nazir Ahmed
 
Artificial intelligence(06)
Artificial intelligence(06)Artificial intelligence(06)
Artificial intelligence(06)Nazir Ahmed
 
Jarrar: Informed Search
Jarrar: Informed Search  Jarrar: Informed Search
Jarrar: Informed Search Mustafa Jarrar
 
Presentacion nro 1 redes y comunicaciones de datos
Presentacion nro 1 redes y comunicaciones de datosPresentacion nro 1 redes y comunicaciones de datos
Presentacion nro 1 redes y comunicaciones de datosLuisGabrielVasquez
 
Searching Informed Search.pdf
Searching Informed Search.pdfSearching Informed Search.pdf
Searching Informed Search.pdfDrBashirMSaad
 
Informed-search TECHNIQUES IN ai ml data science
Informed-search TECHNIQUES IN ai ml data scienceInformed-search TECHNIQUES IN ai ml data science
Informed-search TECHNIQUES IN ai ml data sciencedevvpillpersonal
 
2-Heuristic Search.ppt
2-Heuristic Search.ppt2-Heuristic Search.ppt
2-Heuristic Search.pptMIT,Imphal
 
SCALABLE PATTERN MATCHING OVER COMPRESSED GRAPHS VIA DE-DENSIFICATION
SCALABLE PATTERN MATCHING OVER COMPRESSED GRAPHS VIA DE-DENSIFICATIONSCALABLE PATTERN MATCHING OVER COMPRESSED GRAPHS VIA DE-DENSIFICATION
SCALABLE PATTERN MATCHING OVER COMPRESSED GRAPHS VIA DE-DENSIFICATIONaftab alam
 
Heuristic Searching Algorithms Artificial Intelligence.pptx
Heuristic Searching Algorithms Artificial Intelligence.pptxHeuristic Searching Algorithms Artificial Intelligence.pptx
Heuristic Searching Algorithms Artificial Intelligence.pptxSwagat Praharaj
 
unit-4-dynamic programming
unit-4-dynamic programmingunit-4-dynamic programming
unit-4-dynamic programminghodcsencet
 
Module_2_rks in Artificial intelligence in Expert System
Module_2_rks in Artificial intelligence in Expert SystemModule_2_rks in Artificial intelligence in Expert System
Module_2_rks in Artificial intelligence in Expert SystemNareshKireedula
 
Combinatorial optimization CO-1
Combinatorial optimization CO-1Combinatorial optimization CO-1
Combinatorial optimization CO-1man003
 

Similar to AI 22-23 Chpt3 informed.pptx (20)

Unit II Problem Solving Methods in AI K.sundar,AP/CSE,VEC
Unit II Problem Solving Methods in AI K.sundar,AP/CSE,VECUnit II Problem Solving Methods in AI K.sundar,AP/CSE,VEC
Unit II Problem Solving Methods in AI K.sundar,AP/CSE,VEC
 
Artificial intelligence(06)
Artificial intelligence(06)Artificial intelligence(06)
Artificial intelligence(06)
 
Artificial intelligence(06)
Artificial intelligence(06)Artificial intelligence(06)
Artificial intelligence(06)
 
Jarrar: Informed Search
Jarrar: Informed Search  Jarrar: Informed Search
Jarrar: Informed Search
 
Heuristic search
Heuristic searchHeuristic search
Heuristic search
 
m4-heuristics.ppt
m4-heuristics.pptm4-heuristics.ppt
m4-heuristics.ppt
 
Presentacion nro 1 redes y comunicaciones de datos
Presentacion nro 1 redes y comunicaciones de datosPresentacion nro 1 redes y comunicaciones de datos
Presentacion nro 1 redes y comunicaciones de datos
 
M4 Heuristics
M4 HeuristicsM4 Heuristics
M4 Heuristics
 
Searching Informed Search.pdf
Searching Informed Search.pdfSearching Informed Search.pdf
Searching Informed Search.pdf
 
Lecture24
Lecture24Lecture24
Lecture24
 
Informed-search TECHNIQUES IN ai ml data science
Informed-search TECHNIQUES IN ai ml data scienceInformed-search TECHNIQUES IN ai ml data science
Informed-search TECHNIQUES IN ai ml data science
 
2-Heuristic Search.ppt
2-Heuristic Search.ppt2-Heuristic Search.ppt
2-Heuristic Search.ppt
 
SCALABLE PATTERN MATCHING OVER COMPRESSED GRAPHS VIA DE-DENSIFICATION
SCALABLE PATTERN MATCHING OVER COMPRESSED GRAPHS VIA DE-DENSIFICATIONSCALABLE PATTERN MATCHING OVER COMPRESSED GRAPHS VIA DE-DENSIFICATION
SCALABLE PATTERN MATCHING OVER COMPRESSED GRAPHS VIA DE-DENSIFICATION
 
Heuristic Searching Algorithms Artificial Intelligence.pptx
Heuristic Searching Algorithms Artificial Intelligence.pptxHeuristic Searching Algorithms Artificial Intelligence.pptx
Heuristic Searching Algorithms Artificial Intelligence.pptx
 
Aaex3 group2
Aaex3 group2Aaex3 group2
Aaex3 group2
 
unit-4-dynamic programming
unit-4-dynamic programmingunit-4-dynamic programming
unit-4-dynamic programming
 
3.informed search
3.informed search3.informed search
3.informed search
 
Module_2_rks in Artificial intelligence in Expert System
Module_2_rks in Artificial intelligence in Expert SystemModule_2_rks in Artificial intelligence in Expert System
Module_2_rks in Artificial intelligence in Expert System
 
Combinatorial optimization CO-1
Combinatorial optimization CO-1Combinatorial optimization CO-1
Combinatorial optimization CO-1
 
Searching
SearchingSearching
Searching
 

Recently uploaded

Artificial Intelligence in due diligence
Artificial Intelligence in due diligenceArtificial Intelligence in due diligence
Artificial Intelligence in due diligencemahaffeycheryld
 
Circuit Breakers for Engineering Students
Circuit Breakers for Engineering StudentsCircuit Breakers for Engineering Students
Circuit Breakers for Engineering Studentskannan348865
 
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas SachpazisSeismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas SachpazisDr.Costas Sachpazis
 
☎️Looking for Abortion Pills? Contact +27791653574.. 💊💊Available in Gaborone ...
☎️Looking for Abortion Pills? Contact +27791653574.. 💊💊Available in Gaborone ...☎️Looking for Abortion Pills? Contact +27791653574.. 💊💊Available in Gaborone ...
☎️Looking for Abortion Pills? Contact +27791653574.. 💊💊Available in Gaborone ...mikehavy0
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Ramkumar k
 
Maximizing Incident Investigation Efficacy in Oil & Gas: Techniques and Tools
Maximizing Incident Investigation Efficacy in Oil & Gas: Techniques and ToolsMaximizing Incident Investigation Efficacy in Oil & Gas: Techniques and Tools
Maximizing Incident Investigation Efficacy in Oil & Gas: Techniques and Toolssoginsider
 
analog-vs-digital-communication (concept of analog and digital).pptx
analog-vs-digital-communication (concept of analog and digital).pptxanalog-vs-digital-communication (concept of analog and digital).pptx
analog-vs-digital-communication (concept of analog and digital).pptxKarpagam Institute of Teechnology
 
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdf
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdfInstruct Nirmaana 24-Smart and Lean Construction Through Technology.pdf
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdfEr.Sonali Nasikkar
 
Databricks Generative AI FoundationCertified.pdf
Databricks Generative AI FoundationCertified.pdfDatabricks Generative AI FoundationCertified.pdf
Databricks Generative AI FoundationCertified.pdfVinayVadlagattu
 
Introduction-to- Metrology and Quality.pptx
Introduction-to- Metrology and Quality.pptxIntroduction-to- Metrology and Quality.pptx
Introduction-to- Metrology and Quality.pptxProfASKolap
 
Geometric constructions Engineering Drawing.pdf
Geometric constructions Engineering Drawing.pdfGeometric constructions Engineering Drawing.pdf
Geometric constructions Engineering Drawing.pdfJNTUA
 
Diploma Engineering Drawing Qp-2024 Ece .pdf
Diploma Engineering Drawing Qp-2024 Ece .pdfDiploma Engineering Drawing Qp-2024 Ece .pdf
Diploma Engineering Drawing Qp-2024 Ece .pdfJNTUA
 
History of Indian Railways - the story of Growth & Modernization
History of Indian Railways - the story of Growth & ModernizationHistory of Indian Railways - the story of Growth & Modernization
History of Indian Railways - the story of Growth & ModernizationEmaan Sharma
 
21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docx21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docxrahulmanepalli02
 
Artificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdfArtificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdfKira Dess
 
Presentation on Slab, Beam, Column, and Foundation/Footing
Presentation on Slab,  Beam, Column, and Foundation/FootingPresentation on Slab,  Beam, Column, and Foundation/Footing
Presentation on Slab, Beam, Column, and Foundation/FootingEr. Suman Jyoti
 
Fuzzy logic method-based stress detector with blood pressure and body tempera...
Fuzzy logic method-based stress detector with blood pressure and body tempera...Fuzzy logic method-based stress detector with blood pressure and body tempera...
Fuzzy logic method-based stress detector with blood pressure and body tempera...IJECEIAES
 
Filters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility ApplicationsFilters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility ApplicationsMathias Magdowski
 
Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...
Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...
Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...Christo Ananth
 

Recently uploaded (20)

Artificial Intelligence in due diligence
Artificial Intelligence in due diligenceArtificial Intelligence in due diligence
Artificial Intelligence in due diligence
 
Circuit Breakers for Engineering Students
Circuit Breakers for Engineering StudentsCircuit Breakers for Engineering Students
Circuit Breakers for Engineering Students
 
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas SachpazisSeismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
 
☎️Looking for Abortion Pills? Contact +27791653574.. 💊💊Available in Gaborone ...
☎️Looking for Abortion Pills? Contact +27791653574.. 💊💊Available in Gaborone ...☎️Looking for Abortion Pills? Contact +27791653574.. 💊💊Available in Gaborone ...
☎️Looking for Abortion Pills? Contact +27791653574.. 💊💊Available in Gaborone ...
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)
 
Maximizing Incident Investigation Efficacy in Oil & Gas: Techniques and Tools
Maximizing Incident Investigation Efficacy in Oil & Gas: Techniques and ToolsMaximizing Incident Investigation Efficacy in Oil & Gas: Techniques and Tools
Maximizing Incident Investigation Efficacy in Oil & Gas: Techniques and Tools
 
analog-vs-digital-communication (concept of analog and digital).pptx
analog-vs-digital-communication (concept of analog and digital).pptxanalog-vs-digital-communication (concept of analog and digital).pptx
analog-vs-digital-communication (concept of analog and digital).pptx
 
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdf
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdfInstruct Nirmaana 24-Smart and Lean Construction Through Technology.pdf
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdf
 
Databricks Generative AI FoundationCertified.pdf
Databricks Generative AI FoundationCertified.pdfDatabricks Generative AI FoundationCertified.pdf
Databricks Generative AI FoundationCertified.pdf
 
Introduction-to- Metrology and Quality.pptx
Introduction-to- Metrology and Quality.pptxIntroduction-to- Metrology and Quality.pptx
Introduction-to- Metrology and Quality.pptx
 
Geometric constructions Engineering Drawing.pdf
Geometric constructions Engineering Drawing.pdfGeometric constructions Engineering Drawing.pdf
Geometric constructions Engineering Drawing.pdf
 
Diploma Engineering Drawing Qp-2024 Ece .pdf
Diploma Engineering Drawing Qp-2024 Ece .pdfDiploma Engineering Drawing Qp-2024 Ece .pdf
Diploma Engineering Drawing Qp-2024 Ece .pdf
 
History of Indian Railways - the story of Growth & Modernization
History of Indian Railways - the story of Growth & ModernizationHistory of Indian Railways - the story of Growth & Modernization
History of Indian Railways - the story of Growth & Modernization
 
21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docx21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docx
 
Artificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdfArtificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdf
 
Presentation on Slab, Beam, Column, and Foundation/Footing
Presentation on Slab,  Beam, Column, and Foundation/FootingPresentation on Slab,  Beam, Column, and Foundation/Footing
Presentation on Slab, Beam, Column, and Foundation/Footing
 
Signal Processing and Linear System Analysis
Signal Processing and Linear System AnalysisSignal Processing and Linear System Analysis
Signal Processing and Linear System Analysis
 
Fuzzy logic method-based stress detector with blood pressure and body tempera...
Fuzzy logic method-based stress detector with blood pressure and body tempera...Fuzzy logic method-based stress detector with blood pressure and body tempera...
Fuzzy logic method-based stress detector with blood pressure and body tempera...
 
Filters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility ApplicationsFilters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility Applications
 
Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...
Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...
Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...
 

AI 22-23 Chpt3 informed.pptx

  • 1. 3 Best-first search Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • Idea: use an evaluation function f(n) to select the node for expansion – estimate of "desirability" Expand most desirable unexpanded node • Implementation: Order the nodes in fringe in decreasing order of desirability • A key component in best-first algorithms is a heuristic function, h(n), which is the estimated cost of the cheapest path from n to a goal node
  • 2. 5 Romania with step costs in km Spring2008 CS461 Artificial Intelligence © Pinar Duygulu e.g. For Romania, cost of the cheapest path from Arad to Bucharest can be estimated via the straight line distance
  • 3. 6 Greedy best-first search Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • Greedy best-first search expands the node that appears to be closest to goal • Evaluation function f(n) = h(n) (heuristic) • = estimate of cost from n to goal • e.g., hSLD(n) = straight-line distance from n to Bucharest • Note that, hSLD cannot be computed from the problem description itself. It takes a certain amount of experience to know that it is correlated with actual road distances, and therefore it is a useful heuristic
  • 4. 7 Greedy best-first search example Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
  • 5. 8 Greedy best-first search example Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
  • 6. 9 Greedy best-first search example Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
  • 7. 10 Greedy best-first search example Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
  • 8. 11 Greedy best-first search example Spring2008 CS461 Artificial Intelligence © Pinar Duygulu Problems: Path through Faragas is not the optimal In getting Iasi to Faragas, it will expand Neamt first but it is a dead end
  • 9. 19 Properties of greedy best-first search • Complete? No – can get stuck in loops, – e.g., Iasi  Neamt  Iasi  Neamt  • Time? O(bm), but a good heuristic can give dramatic Improvement • Space? O(bm) -- keeps all nodes in memory • Optimal? No
  • 10. 20 A* search Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • 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
  • 11. 21 A* search example Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
  • 12. 22 A* search example Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
  • 13. 23 A* search example Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
  • 14. 24 A* search example Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
  • 15. 25 A* search example Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
  • 16. 26 A* search example Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
  • 17. 33 Straight line estimate Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
  • 18. Uniform-cost orders by path cost, or backward cost g(n) Greedy orders by goal proximity, or forward cost h(n) A* Search orders by the sum: f(n) = g(n) + h(n)
  • 19. Initialize : set open={s} , closed={ } g(s)=0 , f(s)= h(s) Fail: if open= { } , terminate and fail Select: select minimum cost state n from open{ } .save in closed{ } Terminate: if n belongs to G ,terminate with success , return f(n) Expand: for each successor m of n if m Є [open U Closed] set g(m)=g(n)+c(n,m) set f(m)=g(m)+h(m) insert m in open { } if m Є [open U Closed] set g(m)=min { g(m), g(n)+c(n,m)} set f(m)=g(m)+h(m) If f(m) has decreased and m Є closed Move m to open { } A* Algorithm
  • 20.
  • 21. 37 Admissible heuristics Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • • • 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 – thinks that the cost of solving the problem is less than it actually is Consequence: f(n) never over estimates the the true cost of a solution through n since g(n) is the exact cost to reach n • Example: hSLD(n) (never overestimates the actual road distance) since the shortest path between any two points is a straight line
  • 22. 38 Optimality of A* (proof) Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • Theorem: If h(n) is admissible, A* using TREE-SEARCH is optimal • • Suppose some suboptimal goal G2 has been generated and is in the fringe. Let the cost of the optimal solution to goal G is C* f = g + h • f(G2) = g(G2) • g(G2) > C* • f(G) = g(G) • f(G2) > f(G) since h(G2) = 0 since G2 is suboptimal since h(G) = 0 from above
  • 23. 39 Optimality of A* (proof) Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • Let n be an unexpanded node in the fringe such that n is on a shortest path to an optimal goal G (e.g. Pitesti). If h(n) does not overestimate the cost of completing the solution path, then f(n) = g(n) + h(n) ≤ C* f(n) ≤ f(G) • • • • f(G2) > f(G) from above • Hence f(G2) > f(G) >= f(n) , and A* will never select G2 for expansion
  • 24. 41 Optimality of A* Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • • • 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
  • 25. 42 Properties of A* • nodes with f ≤ f(G) ) • Time? Exponential • Space? Keeps all nodes in memory • Optimal? Yes Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • Complete? Yes (unless there are infinitely many
  • 26. S c D E F B G 5 4 10 3 7 2 5 16 12 S=14 S-B=4+12=16 ** S-C=3+11=14 S-C-D=3+7+6=16 S-C-E=3+10+4=17 S-B-E=4+12+4=20 S-B-F=4+5+11=20 S-C-D-E=3+7+2+4=16 S-C-D-E-G=3+7+2+5=17 Open list Closed list S(14) S(14) C(14) B(16) C(14) B(16)E(17)D(16) D(16) E(16) E(16) G(17) G(17) Open list Closed list S(14) S(14) C(14) B(16) C(14) B(16)E(17)D(16) B(16) E(17)D(16)F(20) D(16) E(16) E(16) G(17) G(17)
  • 27.
  • 28. 43 Admissible heuristics Spring2008 CS461 Artificial Intelligence © Pinar Duygulu E.g., for the 8-puzzle: • • h1(n) = number of misplaced tiles h2(n) = total Manhattan distance – the sum of the distances of the tiles from their goal positions • h1(S) = ? • h2(S) = ?
  • 29. 44 Admissible heuristics Spring2008 CS461 Artificial Intelligence © Pinar Duygulu E.g., for the 8-puzzle: • h1(n) = number of misplaced tiles • h2(n) = total Manhattan distance • h1(S) = ? 8 • h2(S) = ? 3+1+2+2+2+3+3+2 = 18
  • 30. 45 Dominance Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • If h2(n) ≥ h1(n) for all n (both admissible) • then h2 dominates h1 • h2 is better for search • It is always better to use a heuristic function with higher values, provided it does not overestimate and that the computation time for the heuristic is not too large • 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
  • 31. 46 Relaxed problems Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • 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 • The heuristic is admissible because the optimal solution in the original problem is also a solution in the relaxed problem and therefore must be at least as expensive as the optimal solution in the relaxed problem • 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
  • 32. 47 Inventing admissible heuristic functions Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • If a problem definition is written down in a formal language, it is possible to construct relaxed problems automatically (ABSOLVER) – If 8-puzzle is described as • A tile can move from square A to square B if • A is horizontally or vertically adjacent to B and B is blank – A relaxed problem can be generated by removing one or both of the conditions • (a) A tile can move from square A to square B if A is adjacent to B • (b) A tile can move from square A to square B if B is blank • (c) A tile can move from square A to square B – h2 can be derived from (a) – h2 is the proper score if we move each tile into its destination – h1 can be derived from (c) – it is the proper score if tiles could move to their intended destination in one step • Admissible heuristics can also be derived from the solution cost of a subproblem of a given problem
  • 33. 48 Local search algorithms Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • In many optimization problems, the path to the goal is irrelevant; the goal state itself is the solution • State space = set of "complete" configurations • Find configuration satisfying constraints, e.g., n- queens • In such cases, we can use local search algorithms • keep a single "current" state, try to improve it
  • 34. 49 Example: n-queens Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • Put n queens on an n × n board with no two queens on the same row, column, or diagonal
  • 35. 50 Hill-climbing search Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • "Like climbing Everest in thick fog with amnesia"
  • 36. 51 Hill-climbing search Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • Problem: depending on initial state, can get stuck in local maxima
  • 37. 52 Hill-climbing search: 8-queens problem Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • h = number of pairs of queens that are attacking each other, either directly or indirectly h = 17 for the above state •
  • 38. 53 Hill-climbing search: 8-queens problem Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • A local minimum with h = 1
  • 39. 54 Simulated annealing search Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • Idea: escape local maxima by allowing some "bad" moves but gradually decrease their frequency
  • 40. 56 Local beam search Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • Keep track of k states rather than just one • Start with k randomly generated states • At each iteration, all the successors of all k states are generated • If any one is a goal state, stop; else select the k best successors from the complete list and repeat.
  • 41. 57 Genetic algorithms Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • A successor state is generated by combining two parent states • Start with k randomly generated states (population) • A state is represented as a string over a finite alphabet (often a string of 0s and 1s) • Evaluation function (fitness function). Higher values for better states. • Produce the next generation of states by selection, crossover, and mutation
  • 42. 58 Genetic algorithms Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • • • Fitness function: number of non-attacking pairs of queens (min = 0, max = 8 × 7/2 = 28) 24/(24+23+20+11) = 31% 23/(24+23+20+11) = 29% etc
  • 43. 59 Genetic algorithms Spring2008 CS461 Artificial Intelligence © Pinar Duygulu