Bounds propagation for linear constraints
Also known as Linear sum propagation
constraint constraint-search
Linear bounds propagation prunes a weighted sum a₁·x₁ + … + a_n·x_n compared with a constant b by ≤, = or ≥. Each run computes the smallest and largest contribution of every term over the current domains, and fails when their sums cannot meet b. A value of one term stays only if it fits the extreme contributions of the other terms: for ≤ its contribution plus their minimum may not exceed b, and for ≥ its contribution plus their maximum must reach b. This is sound but, for =, not complete: a value can stay although no completion of it hits b exactly. Use it for Kakuro and Killer-Sudoku cages, Minesweeper counts and cryptarithms.
Pseudocode
algorithm Linear(a, x, rel, b, D)input: terms a₁·x₁, …, a_n·x_n, relation rel ∈ {≤, =, ≥}, right-hand side b, domains Doutput: D with the values the bounds rule out removed, or failurecaps ← rel ∈ {≤, =}floors ← rel ∈ {≥, =}for i in 1, …, n dolo_i ← min of a_i · v over v ∈ D(x_i)hi_i ← max of a_i · v over v ∈ D(x_i)L ← ∑ lo_iH ← ∑ hi_iif (caps and L > b) or (floors and H < b) thenreturn failurefor i in 1, …, n do ▷ one pass; the engine runs it again on its own changesfor each v ∈ D(x_i) doc ← a_i · vif (caps and c + L − lo_i > b) or (floors and c + H − hi_i < b) thenD(x_i) ← D(x_i) ∖ {v}if D(x_i) = ∅ thenreturn failurereturn DIn the crates
constraint-searchWeighted sums compared with a constant (≤, = or ≥), pruned on the bounds the other terms can still reach.
Lineage
Comes from
builds on Constraint propagation to a fixpoint
Led to
Nothing on this site.