Planning & Search in Rust
Esc

Loading…

↑↓ move ↵ open Esc close
Colour theme
All algorithms

Floyd-Warshall

Also known as Floyd-Warshall algorithm, STN minimal network

other temporal-control

Floyd-Warshall computes the shortest-path distance between every pair of vertices in O(n³) time. Round k lets every path pass through vertex k: D[i][j] ← min(D[i][j], D[i][k] + D[k][j]). For a consistent simple temporal network (STN), these distances give the minimal network: each pair of time points gets the tightest interval [−D[j][i], D[i][j]], and every value in that interval occurs in some valid schedule. A negative entry on the diagonal shows a negative cycle, so the network is inconsistent. temporal-control stops at the first negative diagonal entry, which keeps the distances exact.

Pseudocode

algorithm Floyd-Warshall(V, E)input: time points V = {0, …, n − 1}, distance-graph edges E, each (u, v, w)output: the all-pairs distance matrix D, or inconsistentfor each (i, j) in V × V doD[i][j] ← 0 if i = j, else ∞for each (u, v, w) in E doD[u][v] ← min(D[u][v], w)for k in 0, …, n − 1 doif D[k][k] < 0 thenreturn inconsistent                  ▷ stop before distances divergefor each (i, j) in V × V doD[i][j] ← min(D[i][j], D[i][k] + D[k][j])if D[i][i] < 0 for some i in V thenreturn inconsistentreturn D                                 ▷ pair (i, j) gets the interval [−D[j][i], D[i][j]]

In the crates

Lineage

Comes from

Nothing on this site.

Led to

Dominated-edge filtering builds on it

Labelled closure builds on it

Resource envelopes combines it

Papers

  1. Algorithm 97: Shortest path Robert W. Floyd · 1962· Communications of the ACM introduces doi 10.1145/367766.368168
  2. Temporal constraint networks Rina Dechter, Itay Meiri, Judea Pearl · 1991· Artificial Intelligence applies doi 10.1016/0004-3702(91)90006-6