Faster and Better Simple Temporal Problems
Total Page:16
File Type:pdf, Size:1020Kb
PRELIMINARY VERSION: DO NOT CITE The AAAI Digital Library will contain the published version some time after the conference Faster and Better Simple Temporal Problems Dario Ostuni1, Alice Raffaele2, Romeo Rizzi1, Matteo Zavatteri1* 1University of Verona, Department of Computer Science, Strada Le Grazie 15, 37134 Verona (Italy) 2University of Trento, Department of Mathematics, Via Sommarive 14, 38123 Povo (Italy) fdario.ostuni, romeo.rizzi, [email protected], [email protected] Abstract satisfied? TCSP is NP-complete (Dechter, Meiri, and Pearl 1991). In this paper we give a structural characterization and ex- tend the tractability frontier of the Simple Temporal Problem The Simple Temporal Problem (STP) is the fragment of (STP) by defining the class of the Extended Simple Temporal TCSP whose set of constraints consists of atoms of the form Problem (ESTP), which augments STP with strict inequal- y − x 2 [`; u] only. Historically, STP allows for two rep- ities and monotone Boolean formulae on inequations (i.e., resentations: the interval based one (as we just discussed formulae involving the operations of conjunction, disjunction above) or a set of inequalities y − x ≤ k where x; y are and parenthesization). A polynomial-time algorithm is pro- variables and k 2 R. While these are equivalent (y − x ≤ k vided to solve ESTP, faster than previous state-of-the-art al- can be written as y − x 2 [−∞; k]), the second represen- gorithms for other extensions of STP that had been consid- tation is more elementary as y − x 2 [`; u] amounts to ered in the literature, all encompassed by ESTP. We show the (y − x ≤ u) ^ (x − y ≤ −`). STP is in P (Dechter, Meiri, practical competitiveness of our approach through a proof-of- concept implementation and an experimental evaluation in- and Pearl 1991). volving also state-of-the-art SMT solvers. The set of constraints of an STP can also be generalized to include strict inequalities y − x < k and inequations y − x 6= k. Of course, any strict inequality y − x < k can be Introduction and Related Work seen as a non-strict inequality y − x ≤ k plus the inequation The Temporal Constraint Satisfaction Problem (TCSP), y − x 6= k. Inequations are useful to model temporal plans originally introduced by (Dechter, Meiri, and Pearl 1991), in which, for example, we require two events not to happen takes as input a finite set of real variables and a finite set at the same time. Koubarakis augmented STP with disjunc- of constraints. Two kinds of constraints are allowed: unary tions on inequations (y1 − x1 6= k1) _···_ (yn − xn 6= kn) and binary; both can take a disjunctive form. A unary con- in (Koubarakis 1992). He proved tractability of this exten- 4 straint has the form x 2 [`1; u1] _···_ [`n; un], where sion by providing an algorithm that runs in O(jjCjj ), where x is a variable and `i; ui 2 R [ {−∞; +1g, −∞ ≤ C is the set of constraints and jjCjj is the number of atoms `i ≤ ui ≤ 1. A binary constraint has the form y − x 2 y − x ./ k, ./2 {≤; 6=g appearing in C. As far as we know, [`1; u1] _···_ [`n; un], where x and y are variables and, this was still the bound for this problem. 6= again, `i; ui 2 R [ {−∞; +1g, −∞ ≤ `i ≤ ui ≤ 1. Gerevini and Cristani defined STP , which is a restric- Regardless of the type of constraint, the corresponding in- tion of (Koubarakis 1992) allowing only simple inequa- volved intervals are disjoint. Note that each unary constraint tions and not disjunctions of these, resulting in the possi- x 2 [`1; u1] _···_ [`n; un] can be seen as a binary one bility of handling both sets of strict-inequalities and inequa- x − z 2 [`1; u1] _···_ [`n; un] where z is an extra variable tions (Gerevini and Cristani 1997). They provided an algo- on which we impose the unary constraint z 2 [0; 0]. As such, rithm to solve STP6= that runs in O(n3 + h), where n is the one single unary constraint suffices. Or, we can even relax number of variables and h is the number of inequations (or that one and then consider the solution obtained by sub- O(n3) if there are only strict and non-strict inequalities). As tracting the value of z from that of every other variable. In- far as we know, the result in (Gerevini and Cristani 1997) deed, the solution space of a TCSP without unary constraints was the state of the art for STP6=, still used by more recent is closed under rigid shifting. We remark that binary con- works (e.g., (Broxvall 2002; Montanari et al. 2012; Cooper, straints are disjunctions over the same pair of variables (this Maris, and Regnier´ 2013; Carbonnel and Cooper 2015)). restriction is overcome in (Stergiou and Koubarakis 2000) For more details about temporal reasoning, the interested with the proposal of disjunctive temporal networks). TCSP reader is referred to (Vila 1994; Gennari 1998; Schwalb and asks the following question: does there exist an assignment Vila 1998; Bartak, Morris, and Venable 2014). of real values to the variables such that all constraints are Satisfiability Modulo Theory (SMT) (Barrett et al. 2009) *Corresponding author can address generalizations of the problems mentioned Copyright © 2021, Association for the Advancement of Artificial above by relying on the quantifier-free fragment of the the- Intelligence (www.aaai.org). All rights reserved. ory of real difference logic (QF RDL). QF RDL allows for arbitrary Boolean combinations of atoms y − x ./ k, where Example 1. Let S = (X; C) be the following instance of x; y are real variables and ./2 f<; ≤; >; ≥; =; 6=g. STP: X := fx1; x2; x3; x4; x5; x6; x7g, In this logic, strict inequalities y − x < k are usually turned into non-strict inequalities y − x ≤ k − ", with " C := fx2 − x1 ≤ −2:2; x3 − x2 ≤ −3:5; x1 − x3 ≤ 5:7; treated either numerically (Armando et al. 2005) or symbol- x4 − x5 ≤ 2; x5 − x7 ≤ 1; x7 − x6 ≤ 6; ically as an infinitesimal parameter (Dutertre and de Moura x6 − x4 ≤ −9; x6 − x3 ≤ −3:3; x2 − x4 ≤ −2g: 2006). As far as we know, the latter is the state of the art on difference arithmetic constraints (Dutertre and de Moura Most of the algorithms that solve instances of STP rely on 2006; de Moura, Dutertre, and Shankar 2007). their corresponding directed weighted graph representation. Note that the core algorithms to solve the problems men- Definition 1 (Directed weighted graph). A directed graph tioned above are typically based on tuned versions of short- is a pair (V; A) where V is a set of nodes and A ⊆ V × V est path algorithms or the simplex method, e.g., (SRI Inter- is a set of arcs (or, equivalently, directed edges). A directed national’s Computer Science Laboratory 2020). It is thus in- weighted graph is a triple (V; A; w) where (V; A) is a di- teresting and reasonable, e.g., when developing a more effi- rected graph and w : A 7! R is a weight function assigning cient procedure to solve STP with strict inequalities, to also a real value to each arc. make a comparison with SMT solvers supporting QF RDL. We write Px;y := h(x; x1);:::; (xn; y)i for the path (se- Organization and Contribution quence of arcs) going from x to y through a sequence of dis- tinct nodes. A cycle is a path P where x = y. In case of We start by giving background on STP. Then, we define x;y directed weighted graphs, we write w(P ) for the weight the Extended Simple Temporal Problem (ESTP), in which x;y of the path (i.e., the sum of the weights of the arcs in the we allow for inequalities, strict inequalities and monotone sequence). A path or a cycle P in a weighted graph is Boolean formulae on inequations. We give a characteriza- x;y negative if w(P ) < 0. tion of ESTP. Specifically, we define verification criteria to x;y detect inconsistency or decide consistency of any instance Definition 2 (Constraint graph). Let S = (X; C) be an in- of ESTP. These allow us to provide a strong polynomial- stance of STP. The corresponding constraint graph of S is time algorithm to solve ESTP, which is faster than current the directed weighted graph GS = (X; A; w) where: state-of-the-art algorithms for previously studied extended • A := f(x; y) j y − x ≤ k 2 Cg, and classes of STP. We discuss a proof-of-concept implementa- • w(x; y) := k for each y − x ≤ k 2 C. tion by comparing several variants of shortest paths algo- rithms. Moreover, we encode our model as a QF RDL for- Figure 1 shows the constraint graph of Example 1. mula since it is well-known that the satisfiability of conjunc- Theorem 1 ((Dechter, Meiri, and Pearl 1991)). An instance tions of atoms y − x ./ k for ./2 {≤; <g is tractable. We of STP is consistent iff GS has no negative-weight cycle. evaluate our performance against the state-of-the-art SMT solvers that competed in the 15th International Satisfiabil- Deciding whether an instance of STP S = (X; C) is con- ity Modulo Theories Competition — SMT-COMP 2020 — sistent can be done by computing a potential function for for QF RDL (Model Validation Track and Single Query GS, i.e., a function π : X 7! R such that π(y) − π(x) ≤ Track), (SMT Steering Committee 2020). Computational re- w(x; y) for each (x; y) 2 A.