Generalizing Constraint Models in Constraint Acquisition

Dimos Tsouros, Senne Berden, Steven Prestwich, Tias Guns

TL;DR

This paper introduces GENCON, a novel approach to learn parameterized constraint models that can generalize across different instances of the same problem. By leveraging machine learning for constraint-level classification, GENCON addresses a key limitation in constraint acquisition, enabling more robust and adaptable constraint programming models.

What Problem Does This Paper Address?

Constraint Programming (CP) is a powerful paradigm for solving complex combinatorial problems, but its adoption is hindered by the expertise required for manual modeling. Constraint Acquisition (CA) aims to automate this process by learning constraint models from examples. However, most existing CA methods learn "ground constraints" specific to a single problem instance. In practice, problem instances often change, and CP modeling languages like MiniZinc and CPMpy use parameters to define these variations. Learning models that can adapt to these parameter changes, i.e., generalize across instances, is a significant challenge. This paper tackles this gap by proposing a method to learn parameterized constraint specifications that can generate ground constraints for new, unseen instances based on parameter values.

Methods

GENCON's core idea is to use machine learning to identify patterns in existing constraints and reconstruct "constraint specifications" (CSs). A CS is a higher-level description of a constraint requirement that can be instantiated for different problem parameters.

The process involves:

  1. Dataset Building: Creating a dataset where each example is an individual constraint from a problem instance. Each example is represented by a feature vector describing the constraint and a binary label indicating whether it's a true constraint for the problem.
  2. Parameterized Feature Representation: Developing a feature representation for constraints that captures their relation, variable partitioning characteristics, and sequence conditions. Crucially, numerical features are transformed into categorical ones based on problem parameters, allowing the model to generalize.
  3. Constraint Classification: Training a machine learning classifier (e.g., decision trees, random forests) on this dataset to predict whether a given constraint belongs to the true model for a given parameterization.
  4. Constraint Specification Extraction:
    • For interpretable classifiers (like decision trees): Decision rules are extracted from the classifier and translated directly into parameterized constraint specifications.
  5. For non-interpretable classifiers: A "generate-and-test" approach is used. Candidate constraints are generated, and the classifier predicts which ones should be part of the model.

Datasets

The paper evaluates GENCON on several standard benchmarks commonly used in CA: Sudoku, Golomb, Exam Timetabling (ET), and Nurse Rostering (NR). For each benchmark, 10 instances with different parameters were used. The evaluation employed a "leave-one-in cross-validation" strategy, where one instance was used for training and the remaining nine for testing. No new benchmarks were introduced.

Key Insights and Ideas

  • Generalization is Key: The paper highlights that true constraint acquisition needs to go beyond single instances and learn parameterized models that adapt to changing problem parameters.
  • Constraint Specifications (CSs) as the Abstraction: The concept of CSs provides a structured way to represent parameterized requirements, breaking down complex models into manageable, reusable components.
  • ML for Pattern Recognition: Machine learning, particularly classification, is a powerful tool for identifying patterns in constraints that indicate underlying parameterized requirements.
  • Parameterized Features are Crucial: Transforming numerical constraint features into categorical ones based on problem parameters is essential for enabling generalization across instances.
  • Robustness to Noise: GENCON demonstrates significant robustness to both false positive (extra, incorrect constraints) and false negative (missing constraints) noise in the input data, a common issue in real-world CA.

Key Results

  • High Accuracy: GENCON, using various classifiers, achieved high precision and recall across multiple benchmarks, indicating effective generalization.
  • Robustness: The approach maintained high performance even with up to 20% noise in the input constraint sets.
  • Decision Trees Recommended: Decision trees were found to be a good choice for classifiers, facilitating the extraction of interpretable CSs while offering strong performance.
  • Comparison to COUNT-CP: GENCON generally outperformed COUNT-CP, especially in scenarios involving sequence conditions or when custom partitions were not explicitly provided to COUNT-CP. COUNT-CP struggled with missing constraints (low recall) when sequence conditions were involved or when partitions were not automatically detected.

Limitations and Future Work

  • Arbitrary Constants: The current parameterization method assumes that all constants in constraints are related to problem parameters. It cannot capture arbitrary, unrelated constants.
  • Future Work: The authors suggest exploring active learning to improve generalization and reduce queries, integrating generalization into interactive constraint learning, and applying GENCON to passive CA scenarios. They also propose further investigation into the impact of noise and the development of more sophisticated feature representations.

Summary updated

BibTeX
@inproceedings{tsouros2025generalizing,
  author = {Dimos Tsouros and Senne Berden and Steven Prestwich and Tias Guns},
  title = {{Generalizing Constraint Models in Constraint Acquisition}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.1609/aaai.v39i11.33236},
}
Figure