Planning & Search in Rust
Esc

Loading…

↑↓ move ↵ open Esc close
Colour theme
All algorithms

Table constraint

Also known as Extensional constraint, GAC on allowed tuples

constraint constraint-search

A table constraint lists the allowed tuples of values for its variables. Each run scans the whole table, keeps the tuples whose values are all still in their domains, and collects the values of those tuples per variable. Each variable then keeps only its collected values, and the constraint fails when no tuple is left. The result is complete: every value left belongs to an allowed tuple whose other values are all still possible. It keeps no reduced table between runs, so use it for small relations that are easier to list than to compute, such as KenKen cages or the allowed colour pairs of two regions.

Pseudocode

algorithm Table(x₁, …, x_k, T, D)input: variables x₁, …, x_k, allowed tuples T, domains Doutput: D with every value outside a possible tuple removed, or failureS_i ← ∅ for each i in 1, …, kfor each t in T do                           ▷ the full table on every runif t_i ∈ D(x_i) for every i thenfor i in 1, …, k doS_i ← S_i ∪ {t_i}for i in 1, …, k doD(x_i) ← D(x_i) ∩ S_iif D(x_i) = ∅ thenreturn failurereturn D

In the crates

  • constraint-search

    Complete propagation of a constraint given by its allowed tuples, in one scan of the tuples.

    Table

Lineage

Led to

Nothing on this site.