informed search include specific knowledge to efficiently conduct the search and find the solution
TRANSCRIPT
![Page 1: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/1.jpg)
Informed SearchInclude specific knowledge to efficiently conduct the search and find the solution.
![Page 2: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/2.jpg)
Informed Search Methodsfunction BEST-FIRST-SEARCH (problem, EVAL-FN) returns a solution sequence
Queuing-Fn a function that orders nodes by EVAL-FN
return GENERAL-SEARCH(problem,Queuing-Fn)
end
Strategy: function of the order of node expansion
What evaluation functions can we choose?
Not really Best-first, can be close with proper EVAL-FN.
EVAL-FN can be incorrect, search goes off in wrong direction.
![Page 3: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/3.jpg)
Informed Search Methods
Different evaluation functions lead to different Best-First-Search algorithms
• Uniform Cost Search: EVAL-FN = g(n) = cost from start
node to current node
Function BEST-FIRST-SEARCH (problem, EVAL-FN) returns a solution sequence
Queuing-Fn a function that orders nodes by EVAL-FN
return GENERAL-SEARCH(problem,Queuing-Fn)
end
• Greedy Search: EVAL-FN = h(n) = estimated cost from current node to
goal node• A* Search: EVAL-FN = g(n) + h(n)
![Page 4: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/4.jpg)
Best First Search
70
![Page 5: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/5.jpg)
Informed Search MethodsGreedy Search Expand the node closest to goal. Must be estimated, cannot be exactly
determined. if we could calculate then we could directly find
shortest path to the goal.
Heuristic Functions Estimate the cost to the goal from current node.h(n) = estimated cost of cheapest path from current state (node n) to goal node.
The EVAL-FN = h(n)
![Page 6: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/6.jpg)
Greedy SearchHeuristic: Straight-Line Distance (HSLD)
![Page 7: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/7.jpg)
Fararas
Sibiu
Greedy SearchApply the Straight Line Distance Heuristic to go from Oradea to Bucharest
Fararas
380
253374
Oradea
Zerind Sibiu
Bucharest
151
99
211
176
0
The actual path cost based upon distance is: 151+99+211 = 461
Is this the shortest distance?
![Page 8: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/8.jpg)
Greedy Search
![Page 9: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/9.jpg)
RimnicuVilcea Fararas
Sibiu
Greedy SearchIs this the shortest path between Oradea to Bucharest?
Pitesti
Fararas
380
253374
Oradea
Zerind Sibiu
193
Bucharest
151
80 99
97211
101
176
0
100No, Rimnicu Vilcea will lead to the shortest distance: 151+80+97+101 = 429
![Page 10: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/10.jpg)
Greedy SearchSimilarities to Depth-First Search Both tend to follow a single path to the
goal. If Greedy Search encounters a dead end, it will
back-up. Is the expansion of dead end nodes a problem?
Both are susceptible to false starts, and can get caught in infinite loops.
Depending on the heuristic, a large number of extra nodes may be generated.
![Page 11: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/11.jpg)
Properties of Greedy search
Is Greedy search Complete?
How long does this method take to find a solution?
How much memory does this method require?
Is this method optimal?
![Page 12: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/12.jpg)
Heuristic FunctionsWhat are Heuristic functions?
Heuristic: to find or to discover. Cost estimate to the goal from current
node. Not an exact method.
Generally only improves average case performance. Does not improve worst case performance.
![Page 13: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/13.jpg)
A* SearchAn improved Best-First Search is A* Search.Expanding nodes that have low cost. g(n): cost so far to reach n from start
node. Chose nodes for expansion based on proximity to goal. h(n): estimated cost to goal from n.The Evaluation function
f(n) = g(n) + h(n) Estimated total cost of path from start to goal going through node n.
![Page 14: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/14.jpg)
A* Searchfunction A*-SEARCH (problem) returns a solution or failure
return BEST-FIRST-SEARCH(problem, g+h)
end
![Page 15: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/15.jpg)
RimnicuVilcea
Oradea
Bucharest
A* Search - Oradea to Bucharest
A* search generates an optimal solution if the heuristic satisfies certain conditions.
nnn – g(n)nnn – h(n)nnn – f(n)
Fararas
Sibiu
Pitesti
RimnicuVilcea
380
253374
Oradea
Sibiu
193
Bucharest
151
151+80=231151+99=250
231+80=311 231+97=328
328+101=429
176
0
100
Zerind
Arad Oradea
71
151+151=302151+140=291
SibiuCraiova 160
231+146=377
Pitesti
Craiova
328+138=466
366 380
253
160
71+374=445
151+253=404
291+366=657 302+380=682 231+193=424 250+176=426
311+253=564 328+100=428 377+160=537
466+160=626 429+0=429
0+380=380
445
657 682
380
404
424 426
564 428 537Sibiu
250+99=349
250+211=461
Bucharest 0253
461+0=461 349+253=602
Fararas
602461
![Page 16: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/16.jpg)
A* SearchUses an admissibleadmissible heuristic i.e., h(n) h*(n), for all nodes n in state space h*(n)
then h(n) is the true cost of going from n to goal state. Admissible heuristics never overestimate the distance
to the goal. Examples
Path finding: straight line distance: hSLD
Eight Tiles: # of misplaced tiles A better heuristic: (Manhattan distance for each tile from its
true location) -- this is also an underestimate
Can proveCan prove A* algorithm is optimalA* algorithm is optimal It always finds an optimal solution, if a solution exists.
![Page 17: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/17.jpg)
A* SearchDesirable properties of the evaluation function. Along any path from start node (root) the path
cost f(n) does not decrease. If this property is satisfied, the heuristic function
satisfies the monotonicitymonotonicity property. Monotonicity is linked to the consistency property.
Consistency: A heuristic h(n) is consistent if, for every node n and every successor n’ of n generated by any 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 monotonicity is satisfied, then it is an easy intuitive proof to demonstrate the optimality of A*.
)'()',,()( nhnancnh
![Page 18: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/18.jpg)
Some conceptual questions?
Is uniform cost search a form of A* search?
Given two heuristics, h1(n) < h2(n) h*(n)
what can we say about the performance of A1* versus A2*?
![Page 19: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/19.jpg)
A* SearchTheorem: If h is admissible, and there is a path of finite cost from the start node, n0 to the goal node, A* is guaranteed to terminate with a minimal-cost path to the goal.
![Page 20: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/20.jpg)
A* SearchLemma: At every step before A* terminates, there is always a node, say n*, yet to be expanded with the following properties:
1)n* is an optimal path to goal2)f(n*) f(n0)Proof of lemma can be developed by
mathematical induction.
![Page 21: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/21.jpg)
A* SearchPart of the proof. Suppose some suboptimal goal G2 has
been generated, and is in the queue. Let n be an unexpanded node from shortest path to optimal goal G1
Start
G2
n
GnsionexpaforGselectneverwillAnfGfSince
dmissibleais hsincenf
suboptimalisGsince)g(G
)h(G sinceGgGf
22
21
222
*),()(
:)(
:
0 :)()(
![Page 22: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/22.jpg)
Optimality of A*• A* expands nodes in order of increasing f value (f(n) < C*)• This gradually adds f-contours of nodes (like BFS adds layers)• Contour i has all nodes with f = fi, where fi < fi+1
If B is the goalthen when the contouris the goal contour,f(n) = C*.
A more accurate heuristic will createbands that stretch towards the goal state and become more narrowly focused around the optimal path.
![Page 23: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/23.jpg)
Properties of A*Is A* an optimal search?
What is the time complexity?
What are the space requirements?
Does A* find the best (highest quality) solution when there is more than one solution?
What is the “informed” aspect of A* search?
![Page 24: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/24.jpg)
Memory Bounded SearchIterative deepening A* (IDA*) search Depth first search with an f-cost limit
rather than a depth limit. Each iteration expands all nodes inside the
contour of the current f-cost (f-cost(g + h)) If solution found, stop. Else, look over current contour to determine
where the next contour lies.
![Page 25: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/25.jpg)
IDA* vs. A*IDA* generates roughly the same number of nodes as A*. For example, the 8 puzzle problem.but not always! For example, the traveling salesperson
problem. It is a memory bounded search.
![Page 26: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/26.jpg)
![Page 27: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/27.jpg)
IDA*
Performs well when the heuristic has only a few possible values.
![Page 28: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/28.jpg)
IDA*Is IDA* complete?
What is the time complexity of IDA*?
What is the space complexity of IDA*?
Does the method find the best (highest quality) solution when there is more than one solution?
![Page 29: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/29.jpg)
More on Informed Heuristics
Some facts about the 8-puzzle Total # arrangements = 9! = 362,880 Typical solution may take 22 steps Exhaustive search to depth 22 would look at 322 nodes 3.1 * 1010 states.
![Page 30: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/30.jpg)
8-Puzzle HeuristicsTwo heuristics: h1(n) = # of misplaced tiles = 7
h2(n) = (Manhattan distance for each tile from
its true location)
= 2+3+3+2+4+2+0+2 = 18
![Page 31: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/31.jpg)
Heuristic QualityEffective Branching Factor: b* The branching factor that a uniform tree of depth d
would have to have to contain N + 1 nodes. An A* search of depth 5 using 52 nodes requires a b*
of 1.92. 52 + 1 = 1 + b* + (b*)2 + (b*)3 + (b*)4 + (b*)5
53 = 1 + 1.92 + 3.68 + 7.07 + 13.58 + 26.09 Useful for determining the overall usefulness of a
heuristic by applying b* to a small set of problems.
Well-designed heuristics will have a b* value close to 1.
![Page 32: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/32.jpg)
8-Puzzle HeuristicsReturning to the two heuristics: h1(n) = # of misplaced tiles = 7
h2(n) = (Manhattan distance for each tile from its true location)
= 2+3+3+2+4+2+0+2 = 18
Typical Search Costs: d = 14: IDS = more than 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
![Page 33: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/33.jpg)
HeuristicsGiven h1(n) < h2(n) h*(n), h2(n) always expands fewer nodes than h1(n) because it dominates h1(n). h2(n) h1(n)
Recall that an admissible heuristic never overestimates the value to the goal.Therefore, it is always better to use a heuristic [h2(n)] that dominates another heuristic [h1(n)]if: h2(n) does not overestimate. The computation time for h2(n) is not too long.
![Page 34: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/34.jpg)
HeuristicsDefining a heuristic depends upon the particular problem domain. If the problem is a game, then the rules.
Multiple heuristics can be combined into one heuristic:h(n) = max{h1(n) … hx(n)}
Inductive learning can also be employed to develop a heuristic.
![Page 35: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/35.jpg)
Sudoku Heuristics
Define at least one heuristic to incorporate into an A* search solution for Sudoku.
![Page 36: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/36.jpg)
Local SearchLocal search is applicable to problems in which the final solution is all that matters, rather than the entire path. For example the Eight-queens problem.
Only care about the final configuration, not how it came about.
Search only looks at the local state and only moves to neighbors of that state. Paths to the current state are not maintained. Not a systematic search method, the others we have
discussed are systematic.
![Page 37: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/37.jpg)
Local SearchAdvantages Minimal memory usage
Typically a constant amount. Can typically find reasonable solutions for
problems with large or continuous state spaces. Systematic algorithms are not suited to these
problems. Very good for optimization problems
where want to find the best possible state given the objective function.
![Page 38: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/38.jpg)
State Space LandscapeHave a state and an elevation
Current State
Elevation = heuristic cost, then global minimumElevation = objective function, then global maximum
![Page 39: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/39.jpg)
Local Search
Complete local searches always find a goal if one exists.
Optimal algorithms always find a global minimum or maximum.
![Page 40: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/40.jpg)
Hill Climbing SearchHill Climbing Search requires the local search to choose the direction of the increasing value. The search terminates when there is no
neighbor with a higher value. Remember, no look ahead. Only know
about the immediate neighbors. If there is a set of multiple successors,
algorithm randomly chooses from the set.
Also called a Greedy Local Search.
![Page 41: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/41.jpg)
Hill Climbing SearchAdvantage: often can rapidly find a solution.
Disadvantages: Easily becomes stuck Local Maxima: A peak that is higher than all it’s
neighbors but is lower than the Global Maxima. Ridges: A series of local maxima. Plateaus: An area where the elevation function
is flat. Can resolve by always moving in one particular
sideways direction but usually limit the number of consecutive sideways movements.
Algorithm success is very dependent upon the shape of the state-space landscape.
![Page 42: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/42.jpg)
Hill Climbing Searchfunction HILL-CLIMBING (problem) returns a state that is a local maximum
local variables: current, a node
neighbor, a node
current MAKE-NODE(INITIAL-STATE[problem])
loop do
neighbor A highest-valued successor of current
if VALUE[neighbor] VALUE[current]
then return STATE[current]
current neighbor
end
![Page 43: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/43.jpg)
VariationsStochastic hill climbing (SHC) Randomly chooses from the uphill
moves. Probability of selection can vary with
steepness of move.
First-Choice hill climbing Like SHC but randomly generates
successors until one is generated that is better than the current state.
![Page 44: Informed Search Include specific knowledge to efficiently conduct the search and find the solution](https://reader036.vdocument.in/reader036/viewer/2022062408/56649f145503460f94c287f4/html5/thumbnails/44.jpg)
Variations
Hill climbing algorithms discussed thus far are incomplete.
Random-restart hill climbing Multiple hill climbing searches from randomly
generated initial states. Will eventually randomly generate the goal.
Additional local search algorithms exist Simulated annealing Local beam search