arXiv:2610.13640cs.AIOct 2026

Manuscript Offprint

arXiv:2610.13640

Learning Size Independent Constraint Models from Input Data and Positive and Negative Example Solutions

Helmut Simonis

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

In this paper we describe a Constraint Acquisition Tool that generates size independent constraint programs from input data and positive and negative example solutions of multiple problem instances. The system finds size specific models based on typical constraint patterns over global and binary constraints, then generalizes the models to a size independent model that can be run on unseen input data. The system produces MiniZinc code as well as a textual description of the model. We evaluate the tool on the example problems of the PTHG21 Challenge and show the feasibility of the approach.

2012 ACM Subject Classification Theory of computation → Constraint and logic programming

Keywords and phrases constraint acquisition, modelling, global constraints

1 Introduction

Constraint Acquisition [14] is the process of defining a constraint model from a set of example solutions and non-solutions. In most of the existing literature, a model of a single problem instance is learned, which can then only be used to generate new solutions of the same problem, or perhaps the same problem with different domain bounds. In most practical CP applications, the actual constraint model heavily depends on input data. Consider a scheduling problem for a factory. Every day the set of orders that need to be scheduled will be different, and from time to time new products or processes will be introduced. A CP model for this factory needs to be able to create the appropriate constraint model for a given dataset, and change the specific constraints of the instance from one day to the next, due to different process steps or resources used. If we want to acquire a generic constraint model in this scenario, we have to understand how the number of variables, their domains, and the constraints depend on the input data. Having acquired the model, we then should be able to apply the model to a new, previously unseen set of input data, and solve the resulting model. This is a more challenging problem than the use case previously discussed in constraint acquisition, but, as this paper shows, this task is not out of reach at this point.

The general use case we want to model is shown in Figure 1. We are given a set of input data, solutions and non-solutions for multiple problem instances of different sizes. Our constraint acquisition tool produces a generic model based on those problem instances. This model can then be fed, together with new, unseen input data, into an existing constraint solver to produce a solution for this new instance. The user can interact with the constraint acquisition to accept or reject certain constraints, in addition the users should be able to understand and extend the generated model if they so wish.

This leads to the following set of properties that a generic constraint acquisition tool should have:

diverse structure We must be able to handle not just a single set of unstructured variables, but a collection of variables, vectors and matrices, and possibly more complex structures. We can exploit this structural information to find likely constraints linking multiple structures, which would be difficult to identify in an unstructured list.

Learning Size Independent Constraint Models

Figure 1 Intended Use Case

Figure

hidden variables The variables described in the solution may not describe all variables used in the constraint model. Some derived variables, especially cost variables, may be missing from the samples, with only aggregate cost values presented. Our system should reconstruct such missing, hidden variables in order to find the complete constraint model. generic The model should not be specific to one given instance only, but apply to a series of instances which are specified by different input data and parameter values.

consistent The generated model should be consistent, so that all given positive samples are accepted, and all negative samples are rejected. We are currently not handling the case where solutions or non-solutions are labelled incorrectly.

minimal The model should not contain any constraints that are not required, in particular any subsumed constraint should be filtered out.

transferable We must be able to use the generated model on new, previously unseen input data, as long as the structure of the problem remains the same.

executable It is not enough to generate an abstract model, we should be able to execute the model with some existing constraint solver. In our case, we produce MiniZinc[27] code, which can then be run with a variety of back-end solvers.

explainable We should be able to explain the generated model to a user not familiar with specific constraint programming systems and languages. A natural language description of the model would provide a good initial explanation.

efficient As we are solving combinatorially hard problems, we will not be able to solve every new problem instance. We consider the generated model efficient if its runtime is comparable to a handwritten program for the same problem written in a high-level modelling language like MiniZinc.

The main contributions of this paper are:

introduction of a more realistic constraint acquisition use case driven by practical needs

generating size independent constraint models dealing with structured, positive and negative samples and input data

simplifying the concept of partition generator in ModelSeeker [7] to allow for trivial generalization with an acceptable loss of flexibility

producing executable constraint programs in MiniZinc, whose performance is comparable to hand-crafted code for the same problem producing a natural language, textual description of the generated model to explain the model to a user

demonstrating the feasibility of the approach on all benchmark problems defined for the PTHG21 Challenge [40]

The paper is structured in the following way. In the next Section we discuss related work, and influences on the current paper. In Section 3 we introduce a running example that we use throughout the presentation of the different elements of our system. Section 4 is the main part of paper, describing the different components of the tool. This is followed in Section 5 by an evaluation of the tool based on the problems in the PTHG21 Challenge. We conclude in Section 6 with a discussion of existing gaps, and future work.

References (41)