Informed search algorithms ( 接收資訊的搜尋演算法 )
description
Transcript of Informed search algorithms ( 接收資訊的搜尋演算法 )
Informed search algorithms
( 接收資訊的搜尋演算法 )
Outline
Best-first search ( 最佳優先搜尋法 ) Greedy best-first search ( 貪婪最佳優先搜尋 ) A* search
Review( 複習 ): Tree search
A search strategy is defined by picking the order of node expansion
( 搜尋策略為挑選節點展開的順序 )
Review: Uninformed search strategies( 無接收資訊的搜尋策略 ) Uninformed search strategies use only the information available in
the problem definition Breadth-first search Uniform-cost search Depth-first search Depth-limited search Iterative deepening search
(無接收資訊的的搜尋策略僅使用問題本身定義的可用資訊 )
Best-first search( 最佳優先搜尋 ) Idea: use an evaluation function f(n) for each node 想法:對每個節點使用一個評估函數
estimate of "desirability" 有利條件的評估 Expand most desirable unexpanded node
Implementation: 實作Order the nodes in fringe in decreasing order of desirability依據有利條件的評估值由大而小排列待展開的節點順序
Special cases (特別的例子) greedy best-first search A* search
展開最有利之未展開節點
增加各個城鎮到 Bucharest 的直線距離之資訊
Greedy best-first search 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(到 Bucharest 的直線距離 )
Greedy best-first search expands the node that appears to be closest to goal
(貪婪最佳優先搜尋法展開似乎最接近目標的節點 )
從 n狀態到目標狀態的花費
Greedy best-first search example
Greedy best-first search example
Greedy best-first search example
Greedy best-first search example
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, why? How to modify the greedy best-first search? (如何改進貪婪最佳優先搜尋法 )
(m is the maximum depth of the search space)但一個好的啟發式可以產生極大的改善
A* search Idea: avoid expanding paths that are already
expensive Evaluation function( 評估函數 ) f(n) = g(n) + h(n) g(n) = cost so far to reach n ( 到 n 點的已知花費 ) h(n) = estimated cost from n to goal( 評估從 n 點
到目標還需要的花費 , 啟發式 ) f(n) = estimated total cost of path through n to
goal (評估經由 n 到目標所需的總花費 )
(想法 :避免展開已知較大花費的路徑 )
A* search example
A* search example
A* search example
A* search example
A* search example
A* search example
Admissible heuristics ( 可採納的啟發式 )
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
Example: hSLD(n) (never overestimates the actual road distance)
直線距離不會超過實際的距離
(簡言之 :低估 )
Optimality of A*
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
Properties of A* Complete? Yes Time? Exponential Space? Keeps all nodes in memory Optimal? Yes
Optimally efficient No other optimal algorithm is guaranteed to expand fewer
nodes than A* ( 沒有其他的最佳解演算法能保證展開較 A* 少的節點數 )
(指數成長 )
Memory-bounded heuristic search
IDA* (Iterative-deepening A*) RBFS (Recursive best-first search) MA* (Memory-bounded A*) SMA* (Simplified MA*)
IDA*
The main difference ( 與 ID method比較主要差別 ) Cutoff using f-cost rather than the
depth使用花費取代深度來加深展開層數
RBFS (Recursive best-first search) Its structure is similar to that of a recursive
depth-first search, it keeps track of the f-value of the best alternative path available from any ancestor of the current node.( 其結構與 RDFS 相似 , 但他記錄其他路徑的最佳 f-value)
If the current node exceeds this limit, the recursion unwinds back to the alternative path. ( 如果目前的展開節點花費已超過紀錄的限制 , 則轉換到另一個路徑展開 )
用途 : 節省記憶體的使用
Example of RBFS
Arad
Sibiu Timisoara Zerind
Arad Fagaras Oradea Rimmicu
Craiova Pitesti Sibiu
∞
447
415
393 447
366
449
413526415
646
526 417 553
Example of RBFS (cont.)
Arad
Sibiu Timisoara Zerind
Arad Fagaras Oradea Rimmicu
BucharestSibiu
∞
447
393 447
366
449
417526415
646
450591
417
Example of RBFS (cont.)
Arad
Sibiu Timisoara Zerind
Arad Fagaras Oradea Rimmicu
Craiova Pitesti Sibiu
∞
447
447
393 447
366
449
417526450
646
526 417 553
Bucharest Craiova Rimmicu
447
607615418
SMA* Proceeds just like A* ( 處理過程像 A*) Expanding the best leaf until memory is
full ( 持續展開最佳的節點直到記憶體已經用完 )
Drops the worst leaf node (with highest f-value) 丟掉最糟的節點資料
Backs up the value of the forgotten node to its parent ( 將丟掉節點的花費值記在他們的父節點內 )
隨堂作業 在地圖的問題中 , 直線距離作為啟發函
數可以達到很好的效果 , 那在 8 puzzles 的問題中 , 你會如何定啟發函數 ( 沒有標準答案 , 盡量發揮… )