Planning & Search in Rust
Esc

Loading…

↑↓ move ↵ open Esc close
Colour theme
All algorithms

Constraint propagation to a fixpoint

Also known as Propagation engine, AC-3-style propagation

constraint constraint-search

The propagation engine removes the values that the constraints rule out, until no constraint can remove more: the fixpoint. Each constraint is a propagator that prunes the domains of its scope. At the root every propagator runs once; after that, a changed domain queues only the propagators that watch its variable, each at most once and first in, first out, and a propagator that changes its own scope runs again. A propagator that would empty a domain stops the run with a conflict, and a trail records every change so that search can undo it on backtrack. Use it under backtracking search, so that each choice prunes the other domains before the next one.

Pseudocode

algorithm Propagate(D, Q)input: domains D with a trail, queue Q of propagatorsoutput: the domains at the fixpoint, or failure▷ at the root Q holds every propagator; after a search choice, the watchers of the changed variableswhile Q ≠ ∅ dop ← pop-front(Q)if propagate(p, D) = failure then          ▷ p would empty a domainclear(Q)return failurefor each variable x that changed since the last wake dofor each propagator q in watchers(x) doif q ∉ Q thenpush-back(Q, q)                      ▷ p too, when it changed its own scopereturn Dprocedure remove(D, x, v)push(TRAIL, ⟨x, D(x)⟩)                       ▷ search pops the trail to undo a choiceD(x) ← D(x) ∖ {v}mark x as changed

In the crates

Lineage

Comes from

Nothing on this site.

Papers

  1. Consistency in networks of relations Alan K. Mackworth · 1977· Artificial Intelligence introduces doi 10.1016/0004-3702(77)90007-8