Planning & Search in Rust
Esc

Loading…

↑↓ move ↵ open Esc close
Colour theme
All algorithms

IDDFS

Also known as Iterative deepening DFS, Iterative deepening depth-first search

search heuristic-search

IDDFS (iterative deepening depth-first search) finds a path with the fewest edges, in memory linear in that path's length. It ignores edge costs, so the path is not always the cheapest one. It runs a depth-limited depth-first search with the limits 0, 1, 2, and so on, until a search finds a goal; if a limit cuts off nothing, no goal is reachable and IDDFS reports failure. It keeps only the current path, so it skips cycles on that path but can visit a state many times along different paths and in every iteration. Use it when breadth-first search would need too much memory and the solution is shallow.

Pseudocode

algorithm IDDFS(s₀, goal)input: start state s₀, goal test goaloutput: a path to a goal with the fewest edges, or failurefor ℓ in 0, 1, 2, … dor ← depth-limited-dfs(⟨s₀⟩, ℓ, goal)if r is a path thenreturn rif r = exhausted then                      ▷ the limit cut nothing offreturn failurefunction depth-limited-dfs(P, ℓ, goal)s ← last(P)if goal(s) thenreturn Pcut ← falsefor each s′ in successors(s) doif s′ ∉ P then                             ▷ skip cycles on the pathif |P| − 1 = ℓ thencut ← true                             ▷ s′ lies beyond the limitcontinueappend(P, s′)r ← depth-limited-dfs(P, ℓ, goal)if r is a path thenreturn rif r = cutoff thencut ← trueremove-last(P)if cut thenreturn cutoffreturn exhausted

In the crates

Lineage

Comes from

builds on Depth-limited DFS

Led to

IDA* builds on it

Papers

  1. Depth-first iterative-deepening: An optimal admissible tree search Richard E. Korf · 1985· Artificial Intelligence analyses doi 10.1016/0004-3702(85)90084-0