我正在查看Depth-Limited Search的僞代碼實現,但我無法理解它。深度受限搜索遞歸僞代碼
僞代碼:
Function Recursive-DLS(node, problem, limit)
cutoff-occurred? = false
if Goal-Test(problem, State[node]) then return node
else if Depth[node] = limit then return cutoff
else for each successor in Expand(node, problem) do
result = Recursive-DLS(successor, problem, limit-1)
if result = cutoff then cutoff-occurred? = true
else if result != failure then return result
if cutoff-occurred? then return cutoff else return failure
林主要有無法理解與限制-1的重複的算法中每一個繼任者的原因。有人能和我一起跑過這個嗎?一些圖形解釋將是很好的哈哈。
我打算在此期間查看其他來源。謝謝閱讀!
看起來像僞代碼可能有錯誤。我認爲測試(否則,如果深度[節點] =限制,然後返回截止)應該是(否則如果0 ==限制,然後返回截止) –