🧩 Constraint Solving POTD:Constraint Acquisition: Learning Constraint Models from Examples #26644
Closed
Replies: 1 comment
-
|
This discussion has been marked as outdated by Constraint Solving — Problem of the Day. A newer discussion is available at Discussion #26868. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Emerging Topics · 2026-04-16
What if you didn't know the constraints? What if you had to discover them? Constraint Acquisition tackles exactly this scenario — inferring a constraint model from examples of valid and invalid assignments.
Problem Statement
Given:
X = {x1, x2, ..., xn}each with a finite domainD(xi)Γ— a pool of candidate constraints (e.g.,allDifferent,x + y ≤ z,x ≠ y, ...)E+: complete assignments known to satisfy the unknown target networkE−: complete assignments known to violate at least one constraintFind: A subset of constraints
CN ⊆ Γsuch that:E+satisfies all constraints inCNE−violates at least one constraint inCNSmall Concrete Instance
Suppose a teacher designs a 4-variable scheduling puzzle with variables
{A, B, C, D}and domains{1, 2, 3, 4}, but doesn't tell you the rules. You observe:From e3 you deduce
A ≠ B; from e4 you deduceB ≠ C; from e5 you deduceC ≠ D. Eventually you might inferallDifferent(A, B, C, D).Why It Matters
Constraint modelling is the bottleneck. In practice, eliciting an accurate model from a domain expert is time-consuming and error-prone. Constraint acquisition automates this by letting users demonstrate acceptable and unacceptable configurations.
Human-computer interaction. Tools like interactive solvers and intelligent assistants can use acquisition algorithms to adapt to user preferences without requiring the user to articulate rules explicitly.
Reverse engineering & verification. Security researchers use constraint acquisition to infer protocol invariants or hardware safety properties from observed execution traces.
Modeling Approaches
Approach 1 — Version Space Learning (CONACQ)
The CONACQ algorithm (Bessiere et al., 2005) maintains a version space — the set of all constraint networks consistent with observed examples.
Key idea: The version space is represented implicitly as a collapse graph. Each node is a candidate constraint; each negative example collapses (eliminates) constraints that the example already violates. The learner queries the user about membership of new assignments.
Trade-off: Dramatically fewer queries than passive learning — QuAcq achieves polynomial query complexity (in the number of constraints) when constraints have bounded arity. More complex to implement but far more practical.
Approach 3 — SAT / MaxSAT Encoding
Frame acquisition as a MaxSAT problem: introduce a Boolean variable
bkfor each candidate constraintck. Encode:e−: at least one selected constraint must be violated →∨k (bk ∧ ¬ck(e−))e+: no selected constraint is violated → minimize conflicts withe+Objective: minimize the number of constraints selected (Occam's Razor), or minimize prediction error on a held-out set.
Trade-off: Declarative and flexible (easy to add preferences like "prefer global constraints"). Scales poorly for large candidate sets, but modern MaxSAT solvers handle moderate instances well.
Example: QuAcq find_scope in MiniZinc-style pseudo-code
Key Techniques
1. Bias and Language Bias
The constraint language (library
Γ) must be chosen carefully. A too-large library slows convergence; a too-small one may miss the target. Modern systems use intensional biases (e.g., "all binary constraints of the formaixi + ajxj ≤ b") rather than enumerating every possible constraint.2. Scope Inference and Arity Reduction
Finding which variables participate in a violated constraint (scope inference) is the hardest sub-problem. QuAcq's
find_scopeuses binary search over variable subsets, achievingO(n log n)queries per negative example for binary constraints.3. Symmetry and Redundancy Pruning
Learned networks often contain redundant constraints (e.g.,
x ≠ yis subsumed byallDifferent(x, y, z)). Post-processing with a CP solver to detect and remove dominated constraints greatly compresses the learned model.4. Partial Queries and Noise Tolerance
Real users make mistakes. Robust variants (e.g., CAR — Constraint Acquisition with Robustness) relax the requirement that every label is correct, using weighted voting or MaxSAT to find a network consistent with the majority of examples.
Challenge Corner
References
Bessiere, C., Coletta, R., Freuder, E., O'Sullivan, B. (2005). Leveraging the learning power of examples in automated constraint acquisition. CP 2005. — Introduces CONACQ.
Bessiere, C., Coletta, R., Hebrard, E., Katsirelos, G., Lazaar, N., Narodytska, N., Quimper, C., Walsh, T. (2013). Constraint Acquisition via Partial Queries. IJCAI 2013. — Introduces QuAcq with polynomial query complexity.
Tsouros, D., Stergiou, K., Bessiere, C. (2023). Omni-directional search for constraint acquisition. IJCAI 2023. — Recent extension handling noisy oracles and global constraints.
Rossi, F., van Beek, P., Walsh, T. (eds.) (2006). Handbook of Constraint Programming. Elsevier. — Chapter 17 covers learning and constraint acquisition in depth.
Beta Was this translation helpful? Give feedback.
All reactions