# querydriven_qualitative_constraint_acquisition__4b2bfbea.pdf Journal of Artificial Intelligence Research 79 (2024) 241-271 Submitted 03/2023; published 01/2024 Query-driven Qualitative Constraint Acquisition Mohamed-Bachir Belaid bbel@nilu.no NILU, Climate and environmental research institute, Kjeller, Norway. Department of Computer Science, Oslo Met, Oslo, Norway. Nassim Belmecheri nassim@simula.no Simula Research Laboratory, Oslo, Norway. Arnaud Gotlieb arnaud@simula.no Simula Research Laboratory, Oslo, Norway. Nadjib Lazaar lazaar@lirmm.fr LIRMM, University of Montpellier, CNRS, Montpellier, France. Helge Spieker helge@simula.no Simula Research Laboratory, Oslo, Norway. Many planning, scheduling or multi-dimensional packing problems involve the design of subtle logical combinations of temporal or spatial constraints. Recently, we introduced GEQCA-I, which stands for Generic Qualitative Constraint Acquisition, as a new active constraint acquisition method for learning qualitative constraints using qualitative queries. In this paper, we revise and extend GEQCA-I to GEQCA-II with a new type of query, universal query, for qualitative constraint acquisition, with a deeper query-driven acquisition algorithm. Our extended experimental evaluation shows the efficiency and usefulness of the concept of universal query in learning randomly-generated qualitative networks, including both temporal networks based on Allen s algebra and spatial networks based on region connection calculus. We also show the effectiveness of GEQCA-II in learning the qualitative part of real scheduling problems. 1. Introduction Qualitative reasoning about time or space is essential for many practical Artificial Intelligence problems, such as automated planning (Belhadji & Isli, 1998), task scheduling (Bart ak, Salido, & Rossi, 2008), and multi-dimensional packing problems (Crainic, Perboli, & Tadei, 2012). In this context, qualitative calculus provides an algebraic framework that establishes relations between entities (or pairs of entities) through a language that is jointly exhaustive and pairwise disjoint. Examples of qualitative calculus include Point Algebra (Vilain & Kautz, 1986b) and Allen s Interval Algebra (Allen, 1983) for reasoning about temporal tasks, and Region Connection Calculus (RCC) (Randell, Cui, & Cohn, 1992) for reasoning about topological relationships between spatial regions. Constraint satisfaction techniques and constraint programming (CP) are well-suited frameworks to model and solve qualitative constraint networks. However, in many practical situations, complex problems are not represented as constraint networks and are solved solely based on historical records and manually crafted 2024 The Authors. Published by AI Access Foundation under Creative Commons Attribution License CC BY 4.0. Belaid, Belmecheri, Gotlieb, Lazaar, & Spieker solutions. Furthermore, inter-relationships among entities may only be known locally and between pairs of entities, leaving the implications for other pairs of entities unknown. To facilitate the modelling of CP problems, the concept of constraint acquisition (CA) was introduced for learning CP models. CA can be achieved through passive learning from a set of complete labelled example assignments (Bessiere, Coletta, Koriche, & O Sullivan, 2005), or active learning with specific queries that aid in classifying complete assignments (Bessiere, Coletta, O Sullivan, & Paulin, 2007). Several state-of-the-art active CA algorithms exist, including: Qu Acq (Bessiere, Coletta, Hebrard, Katsirelos, Lazaar, Narodytska, Quimper, & Walsh, 2013), an interactive query-based approach also known as exact learning (Bshouty, 2018), which asks complete or partial queries to reduce the set of possible satisfiable constraints from a given constraint language; Multi Acq (Arcangioli, Bessiere, & Lazaar, 2016), an extension of Qu Acq that learns the maximum number of constraints violated by a given negative example; T-Quacq (Addi, Bessiere, Ezzahir, & Lazaar, 2018), which places a bound on the query-generation time to speed up CA; MQu Acq-2 (Tsouros, Stergiou, & Bessiere, 2019), which leverages the structure of learned models by focusing queries on quasi-cliques of constraints; and Class Acq (Prestwich, Freuder, O Sullivan, & Browne, 2021), which utilizes a Naive Bayes classifier to differentiate solutions from non-solutions and acquire constraint models in a passive manner. Other notable approaches for learning constraint models include Model Seeker (Beldiceanu & Simonis, 2012, 2016), which can acquire global constraints, and the general frameworks of constraint learning (De Raedt, Passerini, & Reso, 2018) and constraint synthesis, which are based on mixed linear integer programming (Pawlak & Krawiec, 2017). The issue of handling incorrect responses to queries is also a significant challenge in interactive CA (Tsouros, Stergiou, & Bessiere, 2020). However, standard active CA algorithms face difficulties in handling qualitative constraints since managing disjunctions of general relations over variable pairs can result in an exponential increase of the constraint search space. Moreover, although the number of possible inter-relations is limited, controlling the number of queries asked to the user or the time allocated to generate these queries is a crucial aspect of the adoption of CA techniques in practical applications (Bessiere, Koriche, Lazaar, & O Sullivan, 2017). Learning qualitative temporal constraints has been initiated by (Mouhoub, Marri, & Alanazi, 2018) in LQCN. LQCN follows the active learning version of Conacq by considering each qualitative constraint between time intervals as a concept to learn using membership queries. Then, the consistency of the network as a whole is maintained using path consistency and by considering the composition table as background knowledge. Further, LQCN was extended to the RCC8 algebra in (Mouhoub, Marri, & Alanazi, 2021) but its generalization to other algebras is not straightforward without further development and correctness proofs. In particular, understanding which fundamental property of an algebra is necessary to generalize CA to other qualitative reasoning is not easy. Also, using background knowledge beyond the only composition table can be beneficial, in cases more information about the network is available (e.g., task durations, resource limits, pre-crafted constraints). These elements are crucial to complete the constraint propagation step and further filter the queries to generate. Query-driven Qualitative Constraint Acquisition Recently, in (Belaid, Belmecheri, Gotlieb, Lazaar, & Spieker, 2022), we have introduced Generic Qualitative Constraint Acquisition coined as (GEQCA-I), which is a generic active CA algorithm for learning any kind of constraints between pairs of entities in a qualitative reasoning problem. GEQCA-I is a correct method in CA that acquires any kind of qualitative constraint network. It combines qualitative queries, time-bounded path consistency (PC), Path-Lex, a novel search heuristic and extends background knowledge propagation to learn any qualitative constraint network. Our approach differs from classical active CA algorithms in three ways. First, it handles the disjunction of qualitative constraints effectively through the usage of queries and path consistency. Second, it generalizes the concept of CA for qualitative constraint networks by building its theoretical framework on the JEPD (Joint Exhaustive and Pairwise Disjoint) property. Third, it solves CP models to reduce the number of queries using extended background knowledge. In this paper, our revision and extension of GEQCA-I to GEQCA-II are threefold: 1. We introduce a new type of query, universal query, motivated by real-world scenarios and revise GEQCA-I accordingly. We provide a sound and complete query-driven CA algorithm to propagate any information through path consistency. This paper contains a full theoretical analysis of GEQCA-II; 2. We propose another constraint selection heuristics, named Path-Weighted. We experimentally evaluate which constraint selection heuristics perform better for learning qualitative networks; 3. We provide an extended experimental evaluation of GEQCA-II on temporal and spatial qualitative networks, which answers four research questions related to the comparison between GEQCA-I and II. We also address qualitative networks extracted from real-world scheduling problems. The paper is organized as follows: In the next section, we introduce the necessary background material required to understand the paper; In Section 3, we introduce the concept of universal query and present GEQCA-II, our generic approach to learning qualitative constraints in CA. In Section 4, we conduct experiments with our implementation of GEQCA-II to evaluate its effectiveness and performance. Finally, we conclude the paper in Section 5. 2. Background 2.1 Qualitative Calculus A Qualitative Constraint Network (QCN) is a finite set of (binary) constraints C expressed on X, where X is a finite set of variables representing temporal or spatial entities (points, intervals, regions, etc.). For instance, an interval variable Xi is a pair of endpoints (X i , X+ i ) on the real line where X i < X+ i holds. A QCN is built on a language Γ, which stands for a finite set of jointly exhaustive and pairwise disjoint (JEPD) binary relations (e.g., before, after, contains, part-of, etc.) defined over an infinite domain D (e.g., a topological space for Region Connection Calculus or a real line for Allen s Interval Algebra). The 13 basic relations (resp., the 8 basic relations) in Belaid, Belmecheri, Gotlieb, Lazaar, & Spieker Precedes Meets Overlaps Finished by Contains Equals Started by During Finishes Overlapped by Met by Preceded by End Start p m o Disconnected Externally Connected Tangential Proper Part Non-Tangential Proper Part Partially Overlapping Equal Tangential Proper Part Inverse Non-Tangential Proper Part Inverse dc ec tpp ntpp po eq tppi ntppi Figure 1: (a) Overview of the 13 basic relations in Allen s Interval Algebra (Allen, 1983) as named in Krokhin et al. (2003) and (b) the 8 basic relations in Region connection calculus. These relations resemble the possible temporal/spatial qualitative queries, the oracle is asked. Allen s Interval Algebra (resp., in RCC8) are illustrated in Figure 1.(a) (resp., Figure 1.(b)). Formally speaking, Γ = {r1, . . . , rm} and |Γ| = m. Bear in mind that the relational algebra generated by Γ is finite, and it is closed under (weak) composition, converse and contains the identity. A binary constraint Cij = {rk1, . . . , rkd}, is a disjunction of d basic relations in Γ between Xi and Xj. Note that Cji represents the inverse constraint (with inverse relations) of Cij (i.e., Cji = C 1 ij ). Here, Cij is interpreted as (Xi rk1 Xj) . . . (Xi rkd Xj) and |Cij| = d. We denote by the empty constraint (i.e., the constraint defined by the empty set) and by the universal constraint (i.e., the constraint defined by a set containing all basic relations of the calculus). Size(C) = P (Cij C|i