SlideShare a Scribd company logo
1
Spring
Informed/Heuristic search and
Exploration
Artificial Intelligence
Slides are mostly adapted from AIMA, MIT Open Courseware and
Svetlana Lazebnik (UIUC)
2
Review: Tree search
• Initialize the frontier using the starting state
• While the frontier is not empty
– Choose a frontier node to expand according to search strategy
and take it off the frontier
– If the node contains the goal state, return solution
– Else expand the node and add its children to the frontier
• To handle repeated states:
– Keep an explored set; add each node to the explored set every
time you expand it
– Every time you add a node to the frontier, check whether it
already exists in the frontier with a higher path cost, and if yes,
replace that node with the new one
3
General Search revisited
EXPAND: A function to generate the successors of a node
QUEUING-FN: A function to order nodes in the queue
4
General Search
5
Review: Uninformed search strategies
• A search strategy is defined by picking the order of
node expansion
• Uninformed search strategies use only the information
available in the problem definition
• only considers “already visited” path
• without edge cost, guided by
– path length as number of nodes
– successor relationships and structure (leftmost,…)
• with edge cost, guided by
– path length as cost of visited path
6
Uniform Cost Search
7
Informed search strategies
• Informed search strategies use problem specific
knowledge beyond the definition of the problem
itself
• Idea: give the algorithm “hints” about the
desirability of different states
– Use an evaluation function to rank nodes and select the
most promising one for expansion
• Greedy best-first search
• A* search
8
Spring
Best-first search
• 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
9
Spring
Best-first search
10
Informed – Estimate cost to the goal
11
Heuristic Function
Heuristic – several meanings
- To find, or discover (Heureka, Archimedes)
- Computers, Mathematics. pertaining to a trial-and-error
method of problem solving used when an algorithmic
approach is impractical.
h cannot be computed solely from the states and transitions
in the current problem -> If we could, we would already
know the optimal path!
h(.) is based on external knowledge about the problem ->
informed search
12
Spring
Greedy best-first search
• 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
13
Heuristic function
• Heuristic function h(n) estimates the cost of
reaching goal from node n
• Example:
Start state
Goal state
14
Spring
Romania with step costs in km
e.g. For Romania, cost of the cheapest path from Arad to
Bucharest can be estimated via the straight line distance
15
Greedy best-first search example
16
Greedy best-first search example
17
Greedy best-first search example
18
Greedy best-first search example
19
Spring
Greedy best-first search – Another example
20
Spring
Greedy best-first search – Another example
21
Spring
Greedy best-first search – Another example
22
Spring
Greedy best-first search – Another example
23
Spring
Greedy best-first search – Another example
24
Spring
Greedy best-first search – Another example
25
Spring
Greedy best-first search – Another example
26
Properties of greedy best-first search
• Complete?
No – can get stuck in loops
start
goal
Path through Faragas is not the optimal
In getting Iasi to Faragas, it will expand Neamt first but it is a dead end
27
Properties of greedy best-first search
• Complete?
No – can get stuck in loops
• Optimal?
No
28
Properties of greedy best-first search
• Complete?
No – can get stuck in loops
• Optimal?
No
• Time?
Worst case: O(bm)
Can be much better with a good heuristic
• Space?
Worst case: O(bm)
keeps all nodes in memory
29
How can we fix the greedy problem?
• How about keeping track of the distance already
traveled in addition to the distance remaining?
30
Fixing the problem
31
Spring
A* search
• Idea: avoid expanding paths that are already
expensive
• The evaluation function f(n) is the estimated total
cost of the path through node n to the goal:
f(n) = g(n) + h(n)
g(n) = cost so far to reach n
h(n) = estimated cost from n to goal
32
Can A* fix the problem?
33
A* search example
34
A* search example
35
A* search example
36
A* search example
37
A* search example
38
A* search example
39
When terminate?
40
Spring
A* search – Another example
41
Spring
A* search – Another example
42
Spring
A* search – Another example
43
Spring
A* search – Another example
44
Revisiting states (in queue)
45
Revisiting states (already expanded)
46
Uniform cost search vs. A* search
Source: Wikipedia
47
Spring
Uniform Cost (UC) versus A*
48
Spring
Why use estimate of goal distance
49
Spring
Why use estimate of goal distance
50
Spring
Classes of search
52
A* gone wrong?
Source: Berkeley CS188x
53
Admissible heuristics
• An admissible heuristic never overestimates the
cost to reach the goal, i.e., it is optimistic
• 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
• Consequence: f(n) never over estimates the true
cost of a solution through n since g(n) is the exact
cost to reach n
• Example: straight line distance never
overestimates the actual road distance
• Theorem: If h(n) is admissible, A* is optimal
54
Spring
Not all heuristics are addmissible
55
Consistency of heuristics
Source: Berkeley CS188x
h=4
56
Spring
Consistent heuristics
• A heuristic is consistent if for every node n, every successor n' of n
generated by any action a,
h(n) ≤ c(n,a,n') + h(n')
n' = successor of n generated by action a
• The estimated cost of reaching the goal from n is no greater than the step
cost of getting to n' plus the estimated cost of reaching the goal from 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)
• if h(n) is consistent then the values of f(n) along any path are non-
decreasing
• Theorem: If h(n) is consistent, A* using GRAPH-SEARCH is optimal
57
Optimality of A*
• Tree search (i.e., search without repeated state
detection):
– A* is optimal if heuristic is admissible (and non-
negative)
• Graph search (i.e., search with repeated state
detection)
– A* optimal if heuristic is consistent
• Consistency implies admissibility
– In general, most natural admissible heuristics tend to be
consistent, especially if they come from relaxed
problems
Source: Berkeley CS188x
58
Spring
Optimality of A*
• Monotonicity: 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
• A* expands all nodes with f(n) < C*
• A* might then expand some of the nodes right on the goal contour (where
f(n) = C*) before selecting a goal state
• A* expands no nodes with f(n) > C* (e.g. the subtree under Timisoara)
60
Spring
Optimality of A* (proof)
• 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) since h(G2) = 0
• g(G2) > C* since G2 is suboptimal
• f(G) = g(G) since h(G) = 0
• f(G2) > f(G) from above
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
61
Optimality of A*
• A* is optimally efficient – no other tree-based
algorithm that uses the same heuristic can expand
fewer nodes and still be guaranteed to find the
optimal solution
– A* expands all nodes for which f(n) ≤ C*. Any
algorithm that does not risks missing the optimal
solution
62
Spring
Properties of A*
• Complete? Yes (unless there are infinitely many
nodes with f ≤ f(G)
• Time? Exponential
• Space? Keeps all nodes in memory
• Optimal? Yes
• Alternative:
• Memory bounded heuristic search :
• IDA*: adapt the idea of iterative deepening search, use cut-off as f-
cost rather than the depth.
• Recursive best-first search
63
Spring
Admissible heuristics
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) = ?
64
Spring
Admissible heuristics
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
65
Spring
Quality of a heuristic
• Effective branching factor b*
• If N is the number of nodes generated by A*, and the solution depth is d, then
– N+1 = 1 + b* + (b*)^2 + … + (b*)^d
• E.g. If A* finds a solution at depth 5 using 52 nodes, then b* = 1.92
• The average solution cost for randomly generated 8-puzzle instance is about 22
steps. The branching factor is 3 (when the tile is in middle it is 4, when in the
corner it is 2, when it is along the edge it is 3)
• Typical search costs (average number of nodes expanded):
• d=12IDS = 3,644,035 nodes
A*(h1) = 227 nodes, b* =1,42
A*(h2) = 73 nodes, b* = 1.24
• d=24 IDS = too many nodes
A*(h1) = 39,135 nodes, b* = 1.48
A*(h2) = 1,641 nodes, b* = 1.26
66
Spring
Dominance
• 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
Why?
Every node with f(n) < C* will be expanded
i.e. every node with h(n) < C* - g(n) will be expanded
Since h2 is at least as big as h1 for all nodes, every node that is
expanded by h2, will be also expanded by h1, and h1 may also
cause other nodes to be expanded
67
Spring
Inventing admissible heuristic functions
• h1 and h2 estimates perfectly accurate path length for
simplified versions of 8-puzzle
• If a tile can move anywhere, then h1 would give the exact
number of steps in the shortest solution.
• If a tile can move to any adjacent square, even onto an
occupied square, then h2 would give the exact number of
steps in the shortest solution.
68
Spring
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
• 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
69
Spring
Inventing admissible heuristic functions
• 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
71
Combining heuristics
• Suppose we have a collection of admissible
heuristics h1(n), h2(n), …, hm(n), but none of them
dominates the others
• How can we combine them?
h(n) = max{h1(n), h2(n), …, hm(n)}
72
Weighted A* search
• Idea: speed up search at the expense of optimality
• Take an admissible heuristic, “inflate” it by a
multiple α > 1, and then perform A* search as
usual
• Fewer nodes tend to get expanded, but the
resulting solution may be suboptimal (its cost will
be at most α times the cost of the optimal solution)
73
Example of weighted A* search
Heuristic: 5 * Euclidean distance
from goal
Source: Wikipedia
Compare: Exact A*
74
All search strategies
Algorithm Complete? Optimal?
Time
complexity
Space
complexity
BFS
DFS
IDS
UCS
Greedy
A*
No No
Worst case: O(bm)
Yes
Yes
(if heuristic is
admissible)
Best case: O(bd)
Number of nodes with
g(n)+h(n) ≤ C*
Yes
Yes
No
Yes
If all step
costs are equal
If all step
costs are equal
Yes
No
O(bd)
O(bm)
O(bd)
O(bd)
O(bm)
O(bd)
Number of nodes with
g(n) ≤ C*

More Related Content

Similar to informed_search.pdf

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
LuisGabrielVasquez
 
Search 2
Search 2Search 2
AI 22-23 Chpt3 informed.pptx
AI 22-23 Chpt3 informed.pptxAI 22-23 Chpt3 informed.pptx
AI 22-23 Chpt3 informed.pptx
DrChhayaPawar1
 
Searching
SearchingSearching
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
devvpillpersonal
 
Searchadditional2
Searchadditional2Searchadditional2
Searchadditional2chandsek666
 
Heuristic search
Heuristic searchHeuristic search
Heuristic search
Soheil Khodayari
 
Searching Informed Search.pdf
Searching Informed Search.pdfSearching Informed Search.pdf
Searching Informed Search.pdf
DrBashirMSaad
 
Informed Search.pptx
Informed Search.pptxInformed Search.pptx
Informed Search.pptx
MohanKumarP34
 
Astar.ppt hjguyjgukyjgoyjgugukgulgoyulgyilglyi
Astar.ppt hjguyjgukyjgoyjgugukgulgoyulgyilglyiAstar.ppt hjguyjgukyjgoyjgugukgulgoyulgyilglyi
Astar.ppt hjguyjgukyjgoyjgugukgulgoyulgyilglyi
kamaleshs183
 
3.informed search
3.informed search3.informed search
3.informed search
KONGU ENGINEERING COLLEGE
 
A* Algorithm
A* AlgorithmA* Algorithm
A* Algorithm
maharajdey
 
Chapter 3.pptx
Chapter 3.pptxChapter 3.pptx
Chapter 3.pptx
ashetuterefa
 
AI Greedy and A-STAR Search
AI Greedy and A-STAR SearchAI Greedy and A-STAR Search
AI Greedy and A-STAR Search
Andrew Ferlitsch
 
Jarrar: Informed Search
Jarrar: Informed Search  Jarrar: Informed Search
Jarrar: Informed Search
Mustafa Jarrar
 
Heuristic Searching Algorithms Artificial Intelligence.pptx
Heuristic Searching Algorithms Artificial Intelligence.pptxHeuristic Searching Algorithms Artificial Intelligence.pptx
Heuristic Searching Algorithms Artificial Intelligence.pptx
Swagat Praharaj
 
Jarrar.lecture notes.aai.2011s.ch4.informedsearch
Jarrar.lecture notes.aai.2011s.ch4.informedsearchJarrar.lecture notes.aai.2011s.ch4.informedsearch
Jarrar.lecture notes.aai.2011s.ch4.informedsearchPalGov
 
2-Heuristic Search.ppt
2-Heuristic Search.ppt2-Heuristic Search.ppt
2-Heuristic Search.ppt
MIT,Imphal
 
Combinatorial optimization CO-1
Combinatorial optimization CO-1Combinatorial optimization CO-1
Combinatorial optimization CO-1
man003
 

Similar to informed_search.pdf (20)

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
 
Search 2
Search 2Search 2
Search 2
 
AI 22-23 Chpt3 informed.pptx
AI 22-23 Chpt3 informed.pptxAI 22-23 Chpt3 informed.pptx
AI 22-23 Chpt3 informed.pptx
 
Searching
SearchingSearching
Searching
 
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
 
Searchadditional2
Searchadditional2Searchadditional2
Searchadditional2
 
Heuristic search
Heuristic searchHeuristic search
Heuristic search
 
Searching Informed Search.pdf
Searching Informed Search.pdfSearching Informed Search.pdf
Searching Informed Search.pdf
 
Informed Search.pptx
Informed Search.pptxInformed Search.pptx
Informed Search.pptx
 
Astar.ppt hjguyjgukyjgoyjgugukgulgoyulgyilglyi
Astar.ppt hjguyjgukyjgoyjgugukgulgoyulgyilglyiAstar.ppt hjguyjgukyjgoyjgugukgulgoyulgyilglyi
Astar.ppt hjguyjgukyjgoyjgugukgulgoyulgyilglyi
 
3.informed search
3.informed search3.informed search
3.informed search
 
A* Algorithm
A* AlgorithmA* Algorithm
A* Algorithm
 
Chapter 3.pptx
Chapter 3.pptxChapter 3.pptx
Chapter 3.pptx
 
AI Greedy and A-STAR Search
AI Greedy and A-STAR SearchAI Greedy and A-STAR Search
AI Greedy and A-STAR Search
 
M4 Heuristics
M4 HeuristicsM4 Heuristics
M4 Heuristics
 
Jarrar: Informed Search
Jarrar: Informed Search  Jarrar: Informed Search
Jarrar: Informed Search
 
Heuristic Searching Algorithms Artificial Intelligence.pptx
Heuristic Searching Algorithms Artificial Intelligence.pptxHeuristic Searching Algorithms Artificial Intelligence.pptx
Heuristic Searching Algorithms Artificial Intelligence.pptx
 
Jarrar.lecture notes.aai.2011s.ch4.informedsearch
Jarrar.lecture notes.aai.2011s.ch4.informedsearchJarrar.lecture notes.aai.2011s.ch4.informedsearch
Jarrar.lecture notes.aai.2011s.ch4.informedsearch
 
2-Heuristic Search.ppt
2-Heuristic Search.ppt2-Heuristic Search.ppt
2-Heuristic Search.ppt
 
Combinatorial optimization CO-1
Combinatorial optimization CO-1Combinatorial optimization CO-1
Combinatorial optimization CO-1
 

Recently uploaded

Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
ClaraZara1
 
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERSCW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
veerababupersonal22
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
SyedAbiiAzazi1
 
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTSHeap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Soumen Santra
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
Building Electrical System Design & Installation
Building Electrical System Design & InstallationBuilding Electrical System Design & Installation
Building Electrical System Design & Installation
symbo111
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
Intella Parts
 
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdfTutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
aqil azizi
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 

Recently uploaded (20)

Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
 
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERSCW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
 
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTSHeap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
Building Electrical System Design & Installation
Building Electrical System Design & InstallationBuilding Electrical System Design & Installation
Building Electrical System Design & Installation
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
 
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdfTutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 

informed_search.pdf

  • 1. 1 Spring Informed/Heuristic search and Exploration Artificial Intelligence Slides are mostly adapted from AIMA, MIT Open Courseware and Svetlana Lazebnik (UIUC)
  • 2. 2 Review: Tree search • Initialize the frontier using the starting state • While the frontier is not empty – Choose a frontier node to expand according to search strategy and take it off the frontier – If the node contains the goal state, return solution – Else expand the node and add its children to the frontier • To handle repeated states: – Keep an explored set; add each node to the explored set every time you expand it – Every time you add a node to the frontier, check whether it already exists in the frontier with a higher path cost, and if yes, replace that node with the new one
  • 3. 3 General Search revisited EXPAND: A function to generate the successors of a node QUEUING-FN: A function to order nodes in the queue
  • 5. 5 Review: Uninformed search strategies • A search strategy is defined by picking the order of node expansion • Uninformed search strategies use only the information available in the problem definition • only considers “already visited” path • without edge cost, guided by – path length as number of nodes – successor relationships and structure (leftmost,…) • with edge cost, guided by – path length as cost of visited path
  • 7. 7 Informed search strategies • Informed search strategies use problem specific knowledge beyond the definition of the problem itself • Idea: give the algorithm “hints” about the desirability of different states – Use an evaluation function to rank nodes and select the most promising one for expansion • Greedy best-first search • A* search
  • 8. 8 Spring Best-first search • 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
  • 10. 10 Informed – Estimate cost to the goal
  • 11. 11 Heuristic Function Heuristic – several meanings - To find, or discover (Heureka, Archimedes) - Computers, Mathematics. pertaining to a trial-and-error method of problem solving used when an algorithmic approach is impractical. h cannot be computed solely from the states and transitions in the current problem -> If we could, we would already know the optimal path! h(.) is based on external knowledge about the problem -> informed search
  • 12. 12 Spring Greedy best-first search • 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
  • 13. 13 Heuristic function • Heuristic function h(n) estimates the cost of reaching goal from node n • Example: Start state Goal state
  • 14. 14 Spring Romania with step costs in km e.g. For Romania, cost of the cheapest path from Arad to Bucharest can be estimated via the straight line distance
  • 19. 19 Spring Greedy best-first search – Another example
  • 20. 20 Spring Greedy best-first search – Another example
  • 21. 21 Spring Greedy best-first search – Another example
  • 22. 22 Spring Greedy best-first search – Another example
  • 23. 23 Spring Greedy best-first search – Another example
  • 24. 24 Spring Greedy best-first search – Another example
  • 25. 25 Spring Greedy best-first search – Another example
  • 26. 26 Properties of greedy best-first search • Complete? No – can get stuck in loops start goal Path through Faragas is not the optimal In getting Iasi to Faragas, it will expand Neamt first but it is a dead end
  • 27. 27 Properties of greedy best-first search • Complete? No – can get stuck in loops • Optimal? No
  • 28. 28 Properties of greedy best-first search • Complete? No – can get stuck in loops • Optimal? No • Time? Worst case: O(bm) Can be much better with a good heuristic • Space? Worst case: O(bm) keeps all nodes in memory
  • 29. 29 How can we fix the greedy problem? • How about keeping track of the distance already traveled in addition to the distance remaining?
  • 31. 31 Spring A* search • Idea: avoid expanding paths that are already expensive • The evaluation function f(n) is the estimated total cost of the path through node n to the goal: f(n) = g(n) + h(n) g(n) = cost so far to reach n h(n) = estimated cost from n to goal
  • 32. 32 Can A* fix the problem?
  • 40. 40 Spring A* search – Another example
  • 41. 41 Spring A* search – Another example
  • 42. 42 Spring A* search – Another example
  • 43. 43 Spring A* search – Another example
  • 46. 46 Uniform cost search vs. A* search Source: Wikipedia
  • 48. 48 Spring Why use estimate of goal distance
  • 49. 49 Spring Why use estimate of goal distance
  • 51. 52 A* gone wrong? Source: Berkeley CS188x
  • 52. 53 Admissible heuristics • An admissible heuristic never overestimates the cost to reach the goal, i.e., it is optimistic • 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 • Consequence: f(n) never over estimates the true cost of a solution through n since g(n) is the exact cost to reach n • Example: straight line distance never overestimates the actual road distance • Theorem: If h(n) is admissible, A* is optimal
  • 53. 54 Spring Not all heuristics are addmissible
  • 55. 56 Spring Consistent heuristics • A heuristic is consistent if for every node n, every successor n' of n generated by any action a, h(n) ≤ c(n,a,n') + h(n') n' = successor of n generated by action a • The estimated cost of reaching the goal from n is no greater than the step cost of getting to n' plus the estimated cost of reaching the goal from 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) • if h(n) is consistent then the values of f(n) along any path are non- decreasing • Theorem: If h(n) is consistent, A* using GRAPH-SEARCH is optimal
  • 56. 57 Optimality of A* • Tree search (i.e., search without repeated state detection): – A* is optimal if heuristic is admissible (and non- negative) • Graph search (i.e., search with repeated state detection) – A* optimal if heuristic is consistent • Consistency implies admissibility – In general, most natural admissible heuristics tend to be consistent, especially if they come from relaxed problems Source: Berkeley CS188x
  • 57. 58 Spring Optimality of A* • Monotonicity: 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 • A* expands all nodes with f(n) < C* • A* might then expand some of the nodes right on the goal contour (where f(n) = C*) before selecting a goal state • A* expands no nodes with f(n) > C* (e.g. the subtree under Timisoara)
  • 58. 60 Spring Optimality of A* (proof) • 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) since h(G2) = 0 • g(G2) > C* since G2 is suboptimal • f(G) = g(G) since h(G) = 0 • f(G2) > f(G) from above 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
  • 59. 61 Optimality of A* • A* is optimally efficient – no other tree-based algorithm that uses the same heuristic can expand fewer nodes and still be guaranteed to find the optimal solution – A* expands all nodes for which f(n) ≤ C*. Any algorithm that does not risks missing the optimal solution
  • 60. 62 Spring Properties of A* • Complete? Yes (unless there are infinitely many nodes with f ≤ f(G) • Time? Exponential • Space? Keeps all nodes in memory • Optimal? Yes • Alternative: • Memory bounded heuristic search : • IDA*: adapt the idea of iterative deepening search, use cut-off as f- cost rather than the depth. • Recursive best-first search
  • 61. 63 Spring Admissible heuristics 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) = ?
  • 62. 64 Spring Admissible heuristics 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
  • 63. 65 Spring Quality of a heuristic • Effective branching factor b* • If N is the number of nodes generated by A*, and the solution depth is d, then – N+1 = 1 + b* + (b*)^2 + … + (b*)^d • E.g. If A* finds a solution at depth 5 using 52 nodes, then b* = 1.92 • The average solution cost for randomly generated 8-puzzle instance is about 22 steps. The branching factor is 3 (when the tile is in middle it is 4, when in the corner it is 2, when it is along the edge it is 3) • Typical search costs (average number of nodes expanded): • d=12IDS = 3,644,035 nodes A*(h1) = 227 nodes, b* =1,42 A*(h2) = 73 nodes, b* = 1.24 • d=24 IDS = too many nodes A*(h1) = 39,135 nodes, b* = 1.48 A*(h2) = 1,641 nodes, b* = 1.26
  • 64. 66 Spring Dominance • 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 Why? Every node with f(n) < C* will be expanded i.e. every node with h(n) < C* - g(n) will be expanded Since h2 is at least as big as h1 for all nodes, every node that is expanded by h2, will be also expanded by h1, and h1 may also cause other nodes to be expanded
  • 65. 67 Spring Inventing admissible heuristic functions • h1 and h2 estimates perfectly accurate path length for simplified versions of 8-puzzle • If a tile can move anywhere, then h1 would give the exact number of steps in the shortest solution. • If a tile can move to any adjacent square, even onto an occupied square, then h2 would give the exact number of steps in the shortest solution.
  • 66. 68 Spring 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 • 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
  • 67. 69 Spring Inventing admissible heuristic functions • 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
  • 68. 71 Combining heuristics • Suppose we have a collection of admissible heuristics h1(n), h2(n), …, hm(n), but none of them dominates the others • How can we combine them? h(n) = max{h1(n), h2(n), …, hm(n)}
  • 69. 72 Weighted A* search • Idea: speed up search at the expense of optimality • Take an admissible heuristic, “inflate” it by a multiple α > 1, and then perform A* search as usual • Fewer nodes tend to get expanded, but the resulting solution may be suboptimal (its cost will be at most α times the cost of the optimal solution)
  • 70. 73 Example of weighted A* search Heuristic: 5 * Euclidean distance from goal Source: Wikipedia Compare: Exact A*
  • 71. 74 All search strategies Algorithm Complete? Optimal? Time complexity Space complexity BFS DFS IDS UCS Greedy A* No No Worst case: O(bm) Yes Yes (if heuristic is admissible) Best case: O(bd) Number of nodes with g(n)+h(n) ≤ C* Yes Yes No Yes If all step costs are equal If all step costs are equal Yes No O(bd) O(bm) O(bd) O(bd) O(bm) O(bd) Number of nodes with g(n) ≤ C*