π§© Constraint Solving POTD:Constraint Acquisition β Learning Constraint Models from Data #22898
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 #23114. |
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.
-
π March 25, 2026 Β· Category: Emerging Topics
What if instead of writing constraints by hand, you could learn them automatically from examples? Today's problem sits at the intersection of constraint programming and machine learning: Constraint Acquisition β the art of inferring a constraint model from observed data.
Problem Statement
Given a set of classified examples over a fixed set of variables, find a constraint network that:
More formally: let
X = {xβ, β¦, xβ}be variables with domainsDβ, β¦, Dβ, and letEβΊandEβ»be finite sets of complete assignments. The goal is to find a set of constraintsCoverXsuch that everye β EβΊsatisfiesCand everye β Eβ»violates at least one constraint inC.A Small Concrete Instance
Suppose we observe four variables
xβ, xβ, xβ, xβ β {1, 2, 3, 4}and receive these examples:(1, 2, 3, 4)(2, 1, 4, 3)(3, 4, 1, 2)(1, 1, 2, 3)(2, 2, 1, 3)(1, 2, 2, 4)A learner should infer:
AllDifferent(xβ, xβ, xβ, xβ)β all variables must take distinct values.Input: variables with domains, positive and negative example assignments.
Output: a set of constraints (from some background language
Ξ) consistent with all examples.Why It Matters
Modeling is the hardest part of CP. Expert modelers spend significant time formulating constraints, and errors are common. Constraint acquisition lowers the barrier to deploying constraint-based systems by automating this step.
Business rules are often implicit. In enterprise settings, valid configurations, schedules, or plans are known but hard to articulate as formal rules. Acquisition can extract those rules from historical data or from an interactive oracle (a domain expert who answers yes/no questions).
Preference learning and personalisation. In configuration and recommender systems, user preferences can be treated as soft constraints to be learned from feedback β enabling solvers to find solutions tailored to individual users.
Modeling Approaches
Approach 1: Version Space Learning (CONACQ)
The classical approach maintains a version space: the set of all constraint networks consistent with the examples seen so far.
Bias language
Ξ: define a finite set of candidate constraints (e.g., all binary constraints between pairs of variables from a library:=,β,<,β€,|, etc.).Decision variables: for each candidate constraint
c β Ξ, a booleany_c β {0, 1}indicates whethercis in the target network.Key invariants:
Objective:
minimize |{c : y_c = 1}|(Occam's razor β prefer a simpler model).Trade-offs: Finds provably minimal networks; scales well for moderate
|E|and|Ξ|; naturally handles noisy data by relaxing hard constraints onEβΊ.Example: QuAcq Active Learning Loop (Pseudo-code)
QuAcq drives learning by generating discriminating queries β assignments that are solutions under the current partial model but may violate unknown target constraints. Each negative answer focuses the search.
Key Techniques
1. Version Space & Constraint Elimination
Every positive example immediately eliminates from
Ξany constraint it violates (that constraint cannot be in the target). Every negative example guarantees that at least one remaining candidate must be in the target, which drives the search. Efficient data structures (indexed by constraint scope) make this tractable even for large|Ξ|.2. Active Learning and Query Generation
Passive acquisition (learning only from given examples) is data-hungry. Active acquisition generates queries by solving a CSP over the current partial model β each query is designed to maximally discriminate between possible target networks. The QuAcq algorithm provably converges to the target using
O(nΒ² Β· log|Ξ|)queries in the best case, wherenis the number of variables.3. Scope Inference via Conflict Sets
Rather than guessing which variables are related, modern algorithms identify conflict sets: minimal subsets of variables whose joint assignment is already infeasible. Finding a minimum conflict set (analogous to MUS extraction in SAT) focuses the learner on the right variable pairs or tuples, drastically pruning
Ξ.Challenge Corner
π§ Extension β handling noise: Real-world data is noisy; some positive examples may accidentally violate a true constraint. How would you adapt the MIP formulation to tolerate a bounded number of mis-labelled examples? Can you formulate a soft version where constraints are associated with confidence weights?
π§ Symmetry and redundancy: A learned network may contain redundant constraints (one implies another). Can you add a post-processing step to compute a canonical or irredundant basis for the learned network?
π§ Global constraints: The examples above hint at
AllDifferent. But acquisition frameworks typically work over binary or low-arity constraint libraries. Can you design a procedure that recognises when a set of binaryβconstraints should be lifted to a singleAllDifferentglobal constraint?References
Constraint acquisition bridges the gap between machine learning and constraint programming β instead of learning a function, you learn a feasibility boundary. As datasets grow and domain experts become the bottleneck, these techniques are more relevant than ever.
Tomorrow: another problem from the constraint solving universe. Stay curious! π
Beta Was this translation helpful? Give feedback.
All reactions