Planning & Search in Rust
Esc

Loading…

↑↓ move ↵ open Esc close
Colour theme
All algorithms

Incremental STN consistency

validation temporal-control

Incremental STN consistency keeps the all-pairs distance matrix of a simple temporal network (STN) up to date while constraints arrive one by one. A new edge u → v of weight w closes a negative cycle exactly when D[v][u] + w < 0. The check rejects such a constraint, leaves the network unchanged and explains the conflict. Otherwise each entry becomes min(D[a][b], D[a][u] + w + D[v][b]), which costs O(n²) per constraint instead of O(n³) for a new Floyd-Warshall run. The matrix is always the minimal network (the tightest interval of every pair), so a planner that adds constraints one at a time gets each answer at once.

Pseudocode

algorithm Add-Constraint(D, u, v, lo, hi)input: closed distance matrix D of a consistent STN, a new constraint lo ≤ t_v − t_u ≤ hioutput: accepted with D updated, or rejected with a negative cycleif D[v][u] + hi < 0 or D[u][v] − lo < 0 or hi − lo < 0 thenreturn rejected(negative-cycle(STN plus the constraint))   ▷ D stays unchangedD′ ← copy(D)add-edge(D′, u, v, hi)                   ▷ a missing bound adds no edgeadd-edge(D′, v, u, −lo)D ← D′                                   ▷ replace D only on successreturn acceptedprocedure add-edge(D, u, v, w)if w < D[u][v] thenfor each a in V dofor each b in V doD[a][b] ← min(D[a][b], D[a][u] + w + D[v][b])   ▷ row u and column v stay fixed

In the crates

  • temporal-control feature alloc

    Keeps the closed all-pairs distance matrix of an STN up to date as constraints arrive, at O(n^2) per constraint, rejecting constraints that would make it inconsistent.

    IncrementalStn

Lineage

Comes from

builds on Bellman-Ford

Led to

Nothing on this site.