Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Optimization in SMT with ${\mathcal LA}$ (ℚ) Cost Functions

Lecture Notes in Computer Science, 2012
...Read more
DISI - Via Sommarive, 14 - 38123 POVO, Trento - Italy http://disi.unitn.it OPTIMIZATION IN SMT WITH LA(Q) COST FUNCTIONS Roberto Sebastiani and Silvia Tomasi January 2012 Technical Report # DISI-12-003
DISI - Via Sommarive, 14 - 38123 POVO, Trento - Italy http://disi.unitn.it OPTIMIZATION IN SMT WITH LA(Q) COST FUNCTIONS Roberto Sebastiani and Silvia Tomasi January 2012 Technical Report # DISI-12-003 Optimization in SMT with LA(Q) Cost Functions Roberto Sebastiani and Silvia Tomasi DISI, University of Trento, Italy Abstract. In the contexts of automated reasoning and formal verification, important decision problems are effectively encoded into Satisfiability Modulo Theories (SMT). In the last decade efficient SMT solvers have been developed for several theories of practical interest (e.g., linear arithmetic, arrays, bit-vectors). Surprisingly, very few work has been done to extend SMT to deal with optimization problems; in particular, we are not aware of any work on SMT solvers able to produce solutions which minimize cost functions over arithmetical variables. This is unfortunate, since some problems of interest require this functionality. In this paper we start filling this gap. We present and discuss two general procedures for leveraging SMT to handle the minimization of LA(Q) cost functions, combining SMT with standard minimization techniques. We have implemented the procedures within the MathSAT SMT solver. Due to the absence of competitors in AR and SMT domains, we have experimentally evaluated our implementation against state-of-the-art tools for the domain of linear generalized disjunctive programming (LGDP), which is closest in spirit to our domain, on sets of problems which have been previously proposed as benchmarks for the latter tools. The results show that our tool is very competitive with, and often outperforms, these tools on these problems, clearly demonstrating the potential of the approach. Table of Contents Optimization in SMT with LA(Q) Cost Functions . . . . . . . . . . . . . . . . . . . . . . . . Roberto Sebastiani and Silvia Tomasi 1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Related work. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Content. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1 Linear Generalized Disjunctive Programming . . . . . . . . . . . . . . . . . . . . . . 2.2 SAT and CDCL SAT Solvers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3 SMT and Lazy SMT Solvers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Optimization in SMT(LA(Q) ∪ T ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Procedures for OMT(LA(Q)) and OMT(LA(Q) ∪ T ) . . . . . . . . . . . . . . . . . . . 4.1 An Offline Schema for OMT(LA(Q)) . . . . . . . . . . . . . . . . . . . . . . . . . . . . Discussion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2 An Inline Schema for OMT(LA(Q)) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3 Extensions to OMT(LA(Q) ∪ T ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Experimental Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1 Comparison on LGDB Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The strip-packing problem. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The zero-wait jobshop problem. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Discussion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2 Comparison on SMT-LIB Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Conclusions and Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . i 1 2 2 2 3 5 6 8 9 9 12 13 15 17 18 18 20 21 21 23 1 Introduction In the contexts of automated reasoning (AR) and formal verification (FV), important decision problems are effectively encoded into and solved as Satisfiability Modulo Theories (SMT) problems. In the last decade efficient SMT solvers have been developed, that combine the power of modern conflict-driven clause-learning (CDCL) SAT solvers with dedicated decision procedures (T -Solvers) for several first-order theories of practical interest like, e.g., those of linear arithmetic over the rationals (LA(Q)) or the integers (LA(Z)), of arrays (AR), of bit-vectors (BV), and their combinations. (See [36, 13] for an overview.) Many SMT-encodable problems of interest, however, may require also the capability of finding models that are optimal wrt. some cost function over continuous arithmetical variables. 1 E.g., in (SMT-based) planning with resources [40] a plan for achieving a certain goal must be found which not only fulfills some resource constraints (e.g. on time, gasoline consumption, ...) but that also minimizes the usage of some such resource; in SMT-based model checking with timed or hybrid systems (e.g. [9, 8]) you may want to find executions which minimize some parameter (e.g. elapsed time), or which minimize/maximize the value of some constant parameter (e.g., a clock timeout value) while fulfilling/violating some property (e.g., minimize the closure time interval of a rail-crossing while preserving safety). This also involves, as particular subcases, problems which are traditionally addressed as linear disjunctive programming (LDP) [10] or linear generalized disjunctive programming (LGDP) [32, 35], or as SAT/SMT with Pseudo-Boolean (PB) constraints and Weighted Max-SAT/SMT problems [33, 24, 29, 17, 7]. Notice that the two latter problems can be easily encoded into each other. Surprisingly, very few work has been done to extend SMT to deal with optimization problems [29, 17, 7]; in particular, to the best of our knowledge, all such works aim at minimizing cost functions over Boolean variables (i.e., SMT with PB cost functions or MAX-SMT), whilst we are not aware of any work on SMT solvers able to produce solutions which minimize cost functions over arithmetical variables. Notice that the former can be easily encoded into the latter, but not vice versa (see §3). In this paper we start filling this gap. We present two general procedures for adding to SMT(LA(Q) ∪ T ) the functionality of finding models minimizing some LA(Q) cost variable —T being some (possibly empty) stably-infinite theory s.t. T and LA(Q) are signature-disjoint. These two procedures combine standard SMT and minimization techniques: the first, called offline, is much simpler to implement, since it uses an incremental SMT solver as a black-box, whilst the second, called inline, is more sophisticate and efficient, but it requires modifying the code of the SMT solver. (This distinction is important, since the source code of most SMT solvers is not publicly available.) We have implemented these procedures within the M ATH SAT5 SMT solver [5]. Due to the absence of competitors from AR and SMT domains, we have experimentally evaluated our implementation against state-of-the-art tools for the domain of LGDP, 1 Although we refer to quantifier-free formulas, as it is frequent practice in SAT and SMT, with a little abuse of terminology we often call “Boolean variables” the propositional atoms and we call “variables” the Skolem constants xi in LA(Q)-atoms like “3x1 − 2x2 + x3 ≤ 3”. 1 which is closest in spirit to our domain, on sets of problems which have been previously proposed as benchmarks for the latter tools. (Notice that LGDP is limited to plain LA(Q), so that, e.g., it cannot handle combination of theories like LA(Q) ∪ T .) The results show that our tool is very competitive with, and often outperforms, these tools on these problems, clearly demonstrating the potential of the approach. Related work. The idea of optimization in SMT was first introduced by Nieuwenhuis & Oliveras [29], who presented a very-general logical framework of “SMT with progressively stronger theories” (e.g., where the theory is progressively strengthened by every new approximation of the minimum cost), and present implementations for MaxSAT/SMT based on this framework. Cimatti et al. [17] introduced the notion of “Theory of Costs” C to handle PB cost functions and constraints by an ad-hoc and independent “C-solver” in the standard lazy SMT schema, and implemented a variant of MathSAT tool able to handle SAT/SMT with PB constraints and to minimize PB cost functions. The SMT solver Y ICES [7] also implements Max-SAT/SMT, but we are not aware of any document describing the procedures used there. Mixed Integer Linear Programming (MILP) is an extension of Linear Programming (LP) involving both discrete and continuous variables. A large variety of techniques and tools for MILP are available, mostly based on efficient combinations of LP, branch-andbound search mechanism and cutting-plane methods (see e.g. [25]). Linear Disjunctive Programming (LDP) problems are LP problems where linear constraints are connected by conjunctions and disjunctions [10]. Closest to our domain, Linear Generalized Disjunctive Programming (LGDP), is a generalization of LDP which has been proposed in [32] as an alternative model to the MILP problem. Unlike MILP, which is based entirely on algebraic equations and inequalities, the LGDP model allows for combining algebraic and logical equations with Boolean propositions through Boolean operations, providing a much more natural representation of discrete decisions. (To this extent, LGDP and OMT(LA(Q)), without the “∪T ”, can be encoded into each other.) Current approaches successfully address LGDP by reformulating and solving it as a MILP problem [32, 39, 34, 35]; these reformulations focus on efficiently encoding disjunctions and logic propositions into MILP, so that to be fed to an efficient MILP solver like C PLEX. Content. The rest of the paper is organized as follows: in §2 we provide some background knowledge about MILP, LGDP, SAT and SMT; in §3 we define the problem addressed, and show how it generalizes many known optimization problems; in §4 we present our novel procedures; in §5 we present an experimental evaluation; in §6 we briefly conclude and highlight directions for future work. 2 Background In this section we provide the necessary background about SAT (§2.2) and SMT (§2.3). We assume a basic background knowledge about operational research and logic. We provide a uniform notation for SAT and SMT: we use boldface lowcase letters a, y for arrays and boldface upcase letters A, Y for matrices, standard lowcase letters a, y for single rational variables/constants or indices and standard upcase letters A, Y for Boolean atoms and index sets; we use the first five letters in the various forms a, ...e, ... A, ...E, to denote constant values, the last five v, ...z, ... V, ...Z to denote variables, 2 and the letters i, j, k, I, J, K for indexes and index sets respectively, pedices .j denote the j-th element of an array or matrix, whilst apices .ij are just indexes, being part of the name of the element. We use lowcase Greek letters ϕ, φ, ψ, µ, η for denoting formulas and upcase ones Φ, Ψ for denoting sets of formulas. We assume the standard syntactic and semantic notions of propositional logic. Given a non-empty set of primitive propositions P = {p1 , p2 , . . .}, the language of propositional logic is the least set of formulas containing P and the primitive constants � and ⊥ (“true” and “false”) and closed under the set of standard propositional connectives {¬, ∧, ∨, →, ↔}. We call a propositional atom every primitive proposition in P, and a propositional literal every propositional atom (positive literal) or its negation (negative literal). We implicitly remove double negations: e.g., if l is the negative literal ¬pi , by ¬l we mean � pi rather than ¬¬pi . We represent a truth assignment µ as a conjunction of literals i li (or indifferently as a set of literals {li }i ) with the intended meaning that a positive [resp. negative] � literal pi means that pi is assigned to true [resp. false], and we see ¬µ as the clause i ¬li A propositional formula is in conjunctive � � normal form, CNF, if it is written � as a conjunction of disjunctions of literals: i j lij . Each disjunction of literals j lij is called a clause. A unit clause is a clause with only one literal. 2.1 Linear Generalized Disjunctive Programming Mixed Integer Linear Programming (MILP) is an extension of Linear Programming (LP) involving both discrete and continuous variables [25]. MILP problems have the following form: min{cx : Ax ≥ b, x ≥ 0, xj ∈ Z ∀j ∈ I} (1) where A is a matrix, c and b are constant vectors and x the variable vector. They are effectively solved by integrating the branch-and-bound search mechanism and cutting plane methods, resulting in a branch-and-cut approach. The branch-and-bound search iteratively partitions the solution space of the original MILP problem into subproblems and solves their LP relaxation (i.e. a MILP problem where the integrality constraint on the variables xj , for all j ∈ I, is dropped) until all variables are integral in the LP relaxation. The solutions that are infeasible in the original problem guide the search in the following way. When the optimal solution of a LP relaxation is greater than or equal to the optimal solution found so far, the search backtracks since there cannot exist a better solution. Otherwise, if a variable xj is required to be integral in the original problem, the rounding of its value a in the LP relaxation suggests how to branch by requiring xj ≤ �a� in one branch and xj ≥ �a� + 1 in the other. Cutting planes (e.g. Gomory mixed-integer and lift-and-project cuts [25]) are linear inequalities that can be inferred and added to the original MILP problem and its subproblems in order to cut away non-integer solutions of the LP relaxation and obtain a tighter relaxation. Linear Disjunctive Programming (LDP) problems are LP problems where linear constraints are connected by the logical operations of conjunction and disjunction [10]. Typically, the constraint set is expressed by a disjunction of linear systems: � (Ai x ≥ bi ) (2) i∈I 3 or, alternatively, as: (Ax ≥ b) ∧ t � � j=1 k∈Ij (ck x ≥ dk ) (3) where Ax ≥ b consists of the inequalities common to Ai x ≥ bi for i ∈ I, Ij for j = 1, . . . , t contains one inequality of each system Ai x ≥ bi and t is the number of sets Ij having this property. LDP problems are effectively solved by the lift-and-project approach which combines a family of cutting planes, called lift-and-project cuts, and the branch-and-bound schema (see, e.g., [11]). Linear Generalized Disjunctive Programming (LGDP) extends LDP by combining algebraic and logical equations through disjunctions and logic propositions. The general formulation of a LGDP problem is the following [32]: � zk + dx Bx ≤ b � � Y jk ∨j∈Jk Ajk x ≥ ajk zk = cjk φ 0≤x≤e min s.t. ∀k∈K ∀k ∈ K (4) zk ∈ R1+ , Y jk ∈ {T rue, F alse} ∀j ∈ Jk , ∀k ∈ K where x is a vector of rational variables, z is a vector representing the cost assigned to each disjunction and cjk are fixed charges, e is a vector of upper bounds for x and Y jk are Boolean variables. Each disjunction k ∈ K is composed by two or more disjuncts j ∈ Jk that contain a set of linear constraints Ajk x ≥ ajk , where (Ajk , ajk ) is a mjk × (n + 1) matrix, for all j ∈ Jk and k ∈ K, that are connected by the logical OR operator. Boolean variables Y jk and logic propositions φ in terms of Y jk (expressed in in Conjunctive Normal Form) represents discrete decisions. Only the constraints inside disjunct j ∈ Jk , where Y jk is true, are enforced. Bx ≤ b, where (B, b) is a m×(n+1) matrix, are constraints that must hold regardless of disjuncts. LGDP problems can be solved using MILP solvers by reformulating the original problem in different ways, big-M (BM) and convex hull (CH) are the two most common reformulations. In BM Boolean variables Y jk and logic constraints φ are replaced by binary variables Yjk and linear inequalities as follows [32]: min s.t. � ∀k∈K � ∀j∈Jk cjk Yjk + dx Bx ≤ b A x − a ≤ Mjk (1 − Yjk ) ∀j ∈ Jk , ∀k ∈ K � ∀k ∈ K ∀j∈Jk Yjk = 1 jk jk DY ≤ D� x ∈ Rn+ , Yjk ∈ {0, 1} 4 ∀j ∈ Jk , ∀k ∈ K (5) where Mjk are the ‘”big-M“ parameters that makes redundant the system of constraint j ∈ Jk in the disjunction k ∈ K when Yjk = 0 and the constraints DY ≤ D� are derived from φ. In CH Boolean variables Y jk are replaced by binary variables Yjk and the variables x ∈ Rn are disaggregated into new variables v ∈ Rn in the following way: � � jk min ∀k∈K ∀j∈Jk c Yjk + dx s.t. Bx ≤ b A vjk ≤ ajk Yjk � x = ∀j∈Jk vjk kj jk v ≤ Yjk e � jk ∀j∈Jk Yjk = 1 DY ≤ D� x, v ∈ Rn+ , Yjk ∈ {0, 1} ∀j ∈ Jk , ∀k ∈ K ∀k ∈ K (6) ∀j ∈ Jk , ∀k ∈ K ∀k ∈ K ∀j ∈ Jk , ∀k ∈ K where constant ejk are upper bounds for variables v chosen to match the upper bounds on the variables x. Sawaya and Grossman [34] observed two facts. First, the relaxation of BM is often weak causing a higher number of nodes examined in the branch-and-bound search. Second, the disaggregated variables and new constraints increase the size of the reformulation leading to a high computational effort. In order to overcome these issues, they proposed a cutting plane method that consists in solving a sequence of BM relaxations with cutting planes that are obtained from CH relaxations. They provided an evaluation of the presented algorithm on three different problems: strip-packing, retrofit planning and zero-wait job-shop scheduling problems. 2.2 SAT and CDCL SAT Solvers We present here a brief description on how a Conflict-Driven Clause-Learning (CDCL) SAT solver works. (We refer the reader, e.g., to [27] for a detailed description.) We assume the input propositional formula ϕ is in CNF. (If not, it is first CNF-ized as in [31].) The assignment µ is initially empty, and it is updated in a stack-based manner. The SAT solver performs an external loop, alternating three main phases: Decision, Boolean Constraint Propagation (BCP) and Backjumping and Learning. During Decision an unassigned literal l from ϕ is selected according to some heuristic criterion, and it is pushed into µ. (l is called decision literal and the number of decision literals in µ after this operation is called the decision level of l.) Then BCP iteratively deduces literals l deriving from the current assignment and pushes them into µ. BCP is based on the iterative application of unit propagation: if all but one literals in a clause ψ are false, then the lonely unassigned literal l is added to µ, all negative occurrences of l in other clauses are declared false and all clauses with positive occurrences of l are declared satisfied. Current SAT solvers include rocketfast implementations of BCP based on the two-watched-literal scheme, see [27]. BCP is repeated until either no more literals can be deduced, so that the loop goes back to 5 another Decision step, or no more Boolean variable can be assigned, so that the SAT solver ends returning SAT, or µ falsifies some clause ψ of ϕ (conflicting clause). In the latter case, Backjumping and learning are performed. A process of conflict analysis 2 detects a subset η of µ which actually caused the falsification of ψ (conflict set) 3 and the decision level blevel where to backtrack. Otherwise, the conflict clause def ψ � = ¬η is added to ϕ (learning) and the procedure backtracks up to blevel (backjumping), popping out of µ all literals whose decision level is greater than blevel. When two contradictory literals l, ¬l are assigned at level 0, the loop terminates, returning UNSAT. Notice that CDCL SAT solvers implement “safe” strategy for discharging clauses when no more necessary, which guarantee the use of polynomial space without affecting the termination, correctness and completeness of the procedure. (See e.g. [27, 30].) Many modern CDCL SAT solvers provide a stack-based incremental interface (see e.g. [21]), by which it is possible to push/pop sub-formulas φi into a stack of formulas �k def Φ = {φ1 , ..., φk }, and check incrementally the satisfiability of i=1 φi . The interface maintains the status of the search from one call to the other, in particular it records the learned clauses (plus other information). Consequently, when invoked on Φ the solver can reuse a clause ψ which was learned during a previous call on some Φ� if ψ was derived only from clauses which are still in Φ; 4 in particular, if Φ� ⊆ Φ, then the solver can reuse all clauses learned while solving Φ� . Another important feature of many incremental CDCL SAT solvers is the capability, when Φ is found unsatisfiable, of returning the subset of formulas in Φ which caused the unsatisfiability of Φ. (This is a subcase of the more general problem of finding the unsatisfiable core of a formula, see e.g. [26].) Notice that such subset is not unique, and it is not necessarily minimal. 2.3 SMT and Lazy SMT Solvers A theory solver for T , T -Solver, is a procedure able to decide the T -satisfiability of a conjunction/set µ of T -literals. If µ is T -unsatisfiable, then T -Solver returns UNSAT and the set/conjunction η of T -literals in µ which was found T -unsatisfiable; η is called a T conflict set, and ¬η a T -conflict clause. If µ is T -satisfiable, then T -Solver returns SAT; it may also be able to return some unassigned T -literal l �∈ µ5 s.t.�{l1 , ..., ln } |=T l, n where {l1 , ..., ln } ⊆ µ. We call this process T -deduction and ( i=1 ¬li ∨ l) a T deduction clause. Notice that T -conflict and T -deduction clauses are valid in T . We call them T -lemmas. Given a T -formula ϕ, the formula ϕp obtained by rewriting each T -atom in ϕ into a fresh atomic proposition is the Boolean abstraction of ϕ, and ϕ is the refinement of ϕp . Notationally, we indicate by ϕp and µp the Boolean abstraction of ϕ and µ, and by 2 3 4 5 When a clause ψ is falsified by the current assignment a conflict clause ψ � is computed from ψ s.t. ψ � contains only one literal lu which has been assigned at the last decision level. ψ � is computed starting from ψ � = ψ by iteratively resolving ψ � with the clause ψl causing the unit-propagation of some literal l in ψ � until some stop criterion is met. that is, η is enough to force the unit-propagation of the literals causing the failure of ψ. provided ψ was not discharged in the meantime. taken from a set of all the available T -literals; when combined with a SAT solver, such set would be the set of all the T -literals occurring in the input formula to solve. 6 ϕ and µ the refinements of ϕp and µp respectively. With a little abuse of notation, we say that µp is T -(un)satisfiable iff µ is T -(un)satisfiable. We say that the truth assignment µ propositionally satisfies the formula ϕ, written µ |=p ϕ, if µp |= ϕp . In a lazy SMT(T ) solver, the Boolean abstraction ϕp of the input formula ϕ is given as input to a CDCL SAT solver, and whenever a satisfying assignment µp is found s.t. µp |= ϕp , the corresponding set of T -literals µ is fed to the T -Solver; if µ is found T -consistent, then ϕ is T -consistent; otherwise, T -Solver returns the T -conflict set η causing the inconsistency, so that the clause ¬η p is used to drive the backjumping and learning mechanism of the SAT solver. The process proceeds until either a T -consistent assignment µ is found, or no more assignments are available (ϕ is T -inconsistent). Important optimizations are early pruning and T -propagation: the T -Solver is invoked also when an assignment µ is still under construction: if it is T -unsatisfiable, then the procedure backtracks, without exploring the (up to exponentially-many) extensions of µ; if not, and if the T -Solver is able to perform a T -deduction {l1 , ..., ln } |=T l, �n then l can be unit-propagated, and the T -deduction clause ( i=1 ¬li ∨ l) can be used in backjumping and learning. Another optimization is pure-literal filtering: if some LA(Q)-atoms occur only positively [resp. negatively] in the original formula (learned clauses are ignored), then we can safely drop every negative [resp. positive] occurrence of them from the assignment µ to be checked by the T -solver [36]. (Intuitively, since such occurrences play no role in satisfying the formula, the resulting partial assignment µp � still satisfies ϕp .) The benefits of this action is twofold: (i) reduces the workload for the T -Solver by feeding it smaller sets; (ii) increases the chance of finding a T -consistent satisfying assignment by removing “useless” T -literals which may cause the T -inconsistency of µ. The above schema is a coarse abstraction of the procedures underlying all the stateof-the-art lazy SMT tools. (The interested reader is pointed to, e.g., [30, 36, 13] for details and further references.) Importantly, some SMT solvers, including M ATH SAT, inherit from their embedded SAT solver the capabilities of working incrementally and of returning the subset of input formulas causing the inconsistency, as described in §2.2. The Theory of Linear Arithmetic on the rationals (LA(Q)) and on the integer (LA(Z)) is one of the theories of main interest in SMT. It is a first-order theory whose atoms are of the form (a1 x1 +. . .+an xn �b) (i.e. (ax �b)) s.t � ∈ {=, �=, <, >, ≤, ≥,}. Difference logic on Q (DL(Q)) is an important sub-theory of LA(Q), in which all atoms are in the form (x1 − x2 � b). Efficient incremental and backtrackable procedures have been conceived in order to decide LA(Q) [20], LA(Z) [22] and DL [19]. In particular, for LA(Q) substantially all SMT solvers implement variants of the simplex-based algorithm by Dutertre and de Moura [20] which is specifically designed for integration in a lazy SMT solver, since it is fully incremental and backtrackable and allows for aggressive T -deduction. Another benefit of such algorithm is that it handles strict inequalities directly. Its method is based on the fact that a set of LA(Q) atoms Γ containing strict inequalities S = {0 < t1 , . . . , 0 < tn } is satisfiable iff there exists a rational number � > 0 such that def def Γ� = (Γ ∪ S� ) \ S is satisfiable, s.t. S� = {� ≤ t1 , . . . , � ≤ tn }. The idea of [20] is that of treating the infinitesimal parameter � symbolically instead of explicitly computing 7 its value. Strict bounds (x < b) are replaced with weak ones (x ≤ b − �), and the operations on bounds are adjusted to take � into account. (We refer the reader to [20] for details.) 3 Optimization in SMT(LA(Q) ∪ T ) Let T be some stably infinite theory with equality s.t. LA(Q) and T are signaturedisjoint, as in [28]. (T can be itself a combination of theories.) We call an Optimization Modulo LA(Q) ∪ T problem, OMT(LA(Q) ∪ T ), a pair �ϕ, cost� such that ϕ is a SMT(LA(Q) ∪ T ) formula and cost is a LA(Q) variable occurring in ϕ, representing the cost to be minimized. The problem consists in finding a model M for ϕ (if any) whose value of cost is minimum. We call an Optimization Modulo LA(Q) problem (OMT(LA(Q))) an SMT(LA(Q) ∪ T ) problem where T is empty. If ϕ is in the form ϕ� ∧ (cost < c) [resp. ϕ� ∧ ¬(cost < c)] for some value c ∈ Q, then we call c an upper bound [resp. lower bound] for cost. If ub [resp lb ] is the minimum upper bound [resp. the maximum lower bound] for ϕ, we also call the interval [lb, ub[ the range of cost. 6 These definitions capture many interesting optimizations problems. LP is a particudef � lar subcase of OMT(LA(Q)) � � � with no Boolean component, such that ϕ = ϕ ∧ (cost = � i ai xi ) and ϕ = j( i Aij xi ≤ bj ). LDP is easily encoded into OMT(LA(Q)), since (2) and (3) can be written as � � � �t � i i k k (7) i j (Aj x ≥ bj ) or j (Aj x ≥ bj ) ∧ j=1 k∈Ij (c x ≥ d ) respectively, where Aij and Aj are respectively the jth row of the matrices Ai and A, bij and bj are respectively the jth row of the vectors bi and b. Since the left equation (7) is not in CNF, the CNF-ization process of [31] is then applied. LGDP (4) is straightforwardly encoded into a OMT(LA(Q)) problem �ϕ, cost�: � def ϕ = (cost =� ∀k∈K zk + dx) ∧ [[Bx ≤ b]] ∧ φ ∧ [[0 ≤ x]] ∧ [[x ≤ e]] � (8) ∧ k∈K j∈Jk (Y jk ∧ [[Ajk x ≥ ajk ]] ∧ (zk = cjk )) � s.t. [[x �� a]] and [[Ax �� a]] are abbreviations respectively for i (xi �� ai ) and � i (Ai· x �� ai ), �� ∈ {=, �=≤, ≥, <, >}. Since (8) is not in CNF, the CNF-ization process of [31] is then applied. � b), s.t. X i are Pseudo-Boolean (PB) constraints (see [33]) in the form ( i ai X i ≤ � Boolean atoms and ai constant values in Q, and cost functions cost = i ai X i , are � i encoded into OMT(LA(Q)) by rewriting each PB-term i ai X into the LA(Q)-term � x , x being an array of fresh LA(Q) variables, and by conjoining to ϕ the formula: i i � i i 7 (9) i ((¬X ∨ (xi = ai )) ∧ (X ∨ (xi = 0)) ∧ (xi ≥ 0) ∧ (xi ≤ ai ) ). 6 7 We adopt the convention of defining upper bounds to be strict and lower bounds to be nonstrict for a practical reason: typically an upper bound (cost < c) derives from the fact that a model M of cost c has been previously found, whilst a lower bound ¬(cost < c) derives either from the user’s knowledge (e.g. “the cost cannot be lower than zero”) of from the fact that the formula ϕ ∧ (cost < c) has been previously found T -unsatisfiable whilst ϕ is not. The term “(xi ≥ 0) ∧ (xi ≤ ai )” is not necessary, but it improves the performances of the SMT(LA(Q)) solver because it allows for exploiting the early-pruning technique. 8 Moreover, since Max-SAT (see [24]) [resp. Max-SMT (see [29, 17, 7])] can be encoded into SAT [resp. SMT] with PB constraints (see e.g. [29, 17]), then optimization problems for SAT with PB constraints and Max-SAT can be encoded into OMT(LA(Q)), whilst those for SMT(T ) with PB constraints and Max-SMT can be encoded into OMT(LA(Q) ∪ T ) (assuming T matches the definition above). We remark the deep difference between OMT(LA(Q))/OMT(LA(Q) ∪ T ) and the problem of SAT/SMT with PB constraints and cost functions (or Max-SAT/SMT) addressed in [29, 17]. With the latter problem, the cost is a deterministic consequence of a truth assignment to the atoms of the formula, so that the search has only a Boolean component, consisting in finding the cheapest truth assignment. With OMT(LA(Q))/ OMT(LA(Q) ∪ T ), instead, for every satisfying assignment µ it is also necessary to find the minimum-cost LA(Q)-model for µ, so that the search has both a Boolean and a LA(Q)-component. 4 Procedures for OMT(LA(Q)) and OMT(LA(Q) ∪ T ) It may be noticed that very naive OMT(LA(Q)) or OMT(LA(Q) ∪ T ) procedures could be straightforwardly implemented by performing a sequence of calls to an SMT solver on formulas like ϕ ∧ (cost ≥ li ) ∧ (cost < ui ), each time restricting the range [li , ui [ according to a linear-search of binary-search schema. With the former schema, every time the SMT solver returns a model of cost ci , a new constraint (cost < ci ) would be added to ϕ, and the solver would be invoked again; however, the SMT solver would repeatedly generate the same LA(Q)-satisfiable truth assignments, each time finding a cheaper model for it. With the latter schema the efficiency should improve; however, an initial lower-bound should be necessarily required as input (which is not the case, e.g., of the problems in §5.2.) In this section we present more sophisticate procedures, based on the combination of SMT and minimization techniques. We first present and discuss an offline schema (§4.1) and an inline (§4.2) schema for an OMT(LA(Q)) procedure; then we show how to extend them to the OMT(LA(Q) ∪ T ) case (§4.2). 4.1 An Offline Schema for OMT(LA(Q)) The general schema for the offline OMT(LA(Q)) procedure is displayed in Algorithm 1. It takes as input an instance of the OMT(LA(Q)) problem, plus optionally values for lb and ub (which are implicitly considered to be −∞ and +∞ if not present), and returns the model M of minimum cost and its cost u (the value ub if ϕ is LA(Q)inconsistent). Notice that by providing a lower bound lb [resp. an upper bound ub ] the user implicitly assumes the responsibility of asserting there is no model whose cost is lower than lb [there is a model whose cost is ub ]. We represent the ϕ as a set of clauses, which may be pushed or popped from the input formula-stack of an incremental SMT solver. First, the variables l, u (defining the current range) are initialized to lb and ub respectively, the atom PIV to �, and M is initialized to be an empty model. Then the procedure adds to ϕ the bound constraints, if present, which restrict the search within 9 Algorithm 1 Offline OMT(LA(Q)) Procedure based on Mixed Linear/Binary Search. Require: �ϕ, cost, lb, ub� {ub can be +∞, lb can be −∞} 1: l ← lb; u ← ub; PIV ← �; M ← ∅ 2: ϕ ← ϕ ∪ {¬(cost < l), (cost < u)} 3: while (l < u ) do 4: if (BinSearchMode()) then {Binary-search Mode} 5: pivot ← ComputePivot(l, u) 6: PIV ← (cost < pivot) 7: ϕ ← ϕ ∪ {PIV} 8: �res, µ� ← SMT.IncrementalSolve(ϕ) 9: η ← SMT.ExtractUnsatCore(ϕ) 10: else {Linear-search Mode} 11: �res, µ� ← SMT.IncrementalSolve(ϕ) 12: η←∅ 13: end if 14: if (res = SAT) then 15: �M, u� ← Minimize(cost, µ) 16: ϕ ← ϕ ∪ {(cost < u)} 17: else {res = UNSAT } 18: if (PIV �∈ η) then 19: l←u 20: else 21: l ← pivot 22: ϕ ← ϕ \ {PIV} 23: ϕ ← ϕ ∪ {¬PIV} 24: end if 25: end if 26: end while 27: return �M, u� the range [l, u[ (row 2). 8 The solution space is then explored iteratively (rows 3-26), reducing at at each loop the current range [l, u[ to explore, until the range is empty. Then �M, u� is returned —�∅, ub� if there is no solution in [lb, ub[— M being the model of minimum cost u. Each loop may work in either linear-search or binary-search mode, driven by the heuristic BinSearchMode(). Notice that if u = +∞ or l = −∞, then BinSearchMode() returns false. In linear-search mode, steps 4-9 and 21-23 are not executed. First, an incremental SMT(LA(Q)) solver is invoked on ϕ (row 11). (Notice that, given the incrementality of the solver, every operation in the form “ϕ ← ϕ ∪ {φi }” [resp. ϕ ← ϕ \ {φi }] is implemented as a “push” [resp. “pop”] operation on the stack representation of ϕ, see §2.2; it is also very important to recall that during the SMT call ϕ is updated with the clauses which are learned during the SMT search.) η is set to be empty, which forces condition 18 to hold. If ϕ is LA(Q)-satisfiable, then it is returned res =SAT and a LA(Q)-satisfiable truth assignments µ for ϕ. Thus Minimize is invoked on (the subset 8 Of course literals like ¬(cost < −∞) and (cost < +∞) are not added. 10 of LA(Q)-literals of) µ, 9 returning the model M for µ of minimum cost u (−∞ iff the problem in unbounded). The current solution u becomes the new upper bound, thus the LA(Q)-atom (cost < u) is added to ϕ (row 16). Notice that if the problem is unbounded, then for some µ Minimize will return −∞, forcing condition 3 to be false and the whole process to stop. If ϕ is LA(Q)-unsatisfiable, then no model in the current cost range [l, u[ can be found; hence the flag l is set to u, forcing the end of the loop. In binary-search mode at the beginning of the loop (steps 4-9), the value pivot ∈ ]l, u[ is computed by the heuristic function ComputePivot (in the simplest form, pivot def is (l + u)/2), the (possibly new) atom PIV = (cost < pivot) is pushed into the formula stack, so that to temporarily restrict the cost range to [l, pivot[; then the incremental SMT solver is invoked on ϕ, this time activating the feature SMT.ExtractUnsatCore, which returns also the subset η of formulas in (the formula stack of) ϕ which caused the unsatisfiability of ϕ (see §2.2). This exploits techniques similar to unsat-core extraction [26]. (In practice, it suffices to say if PIV ∈ η.) If ϕ is LA(Q)-satisfiable, then the procedure behaves as in linear-search mode. If instead ϕ is LA(Q)-unsatisfiable, we look at η and distinguish two subcases. If PIV does not occur in η, this means that ϕ \ {PIV} is LA(Q)-inconsistent, i.e. there is no model in the whole cost range [l, u[. Then the procedure behaves as in linear-search mode, forcing the end of the loop. Otherwise, we can only conclude that there is no model in the cost range [l, pivot[, so that we still need exploring the cost range [pivot, u[. Thus l is set to pivot, PIV is popped from ϕ and its negation is pushed into ϕ. Then the search proceeds, investigating the cost range [pivot, u[. We notice an important fact: if BinSearchMode() always returned true, then Algorithm 1 would not necessarily terminate. In fact, an SMT solver invoked on ϕ may return a set η containing PIV even if ϕ \ PIV is LA(Q)-inconsistent. 10 Thus, e.g., the procedure might got stuck into a “Zeno” 11 infinite loop, each time halving the cost range right-bound (e.g., [−1, 0[, [−1/2, 0[, [−1/4, 0[,..). To cope with this fact, however, it suffices that BinSearchMode() returns false infinitely often, forcing then a “linear-search” call which finally detects the inconsistency. (In our implementation, we have empirically experienced the best performance with one linear-search loop after every binary-search one, because satisfiable calls are typically much cheaper then unsatisfiable ones.) Under such hypothesis, it is straightforward to see the following facts: (i) Algorithm 1 terminates, in both modes, because there are only a finite number of candidate truth assignments µ to be enumerated, and steps 15-16 guarantee that the same assignment µ will never be returned twice by the SMT solver; (ii) it returns a model of minimum cost, because it explores the whole search space of candidate truth assignments, and for every suitable assignment µ Minimize finds the minimum-cost model for µ; 9 10 11 possibly after applying pure-literal filtering to µ (see §2.3). In a nutshell, a CDCL-based SMT solver implicitly builds a resolution refutation whose leaves are either clauses in ϕ or LA(Q)-lemmas, and the set η represents the subset of clauses in ϕ which occur as leaves of such proof (see e.g. [18] for details). If the SMT solver is invoked on ϕ even ϕ \ PIV is LA(Q)-inconsistent, then it can “use” PIV and return a proof involving it even though another PIV-less proof exists. In the famous Zeno’s paradox, Achilles never reaches the tortoise for a similar reason. 11 (iii) it requires polynomial space, under the assumption that the underlying CDCL SAT solver adopts a polynomial-size clause discharging strategy (which is typically the case of SMT solvers, including M ATH SAT). In a nutshell, Minimize is a simple extension of the simplex-based LA(Q)-Solver of [20] which is invoked after one solution is found, minimizing it by standard Simplex techniques. We recall that the algorithm in [20] can handle strict inequalities. Thus, if the input problem contains strict inequalities, then Minimize temporarily treats them as non-strict ones and finds the minimum-cost solution with standard Simplex techniques. If such minimum-cost solution x of cost min lays only on non-strict inequalities, then x is a solution; otherwise, for some δ > 0 and for every cost c ∈ ]min, min + δ] there exists a solution of cost c. (If needed, such solution is computed using the techniques for handling strict inequalities described in [20].) Thus the value min is returned, tagged as a non-strict minimum, so that the constraint (cost ≤ min) rather than (cost < min) is added to ϕ. This latter fact, however, never happens if the SMT solver (like M ATH SAT) implements pure-literal filtering (§2.3) and if no strict inequalities occur in ϕ with positive polarity (resp. no non-strict inequality occur in ϕ with negative polarity), which is the case of most problems in this paper. In fact, due to pure-literal filtering, the only strict inequalities which may be fed to Minimize are upper-bound constraints (cost < ui ), which by construction do not touch the minimum-cost solution x above. Discussion. We remark a few facts about this procedure. First, if Algorithm 1 is interrupted (e.g., by a timeout device), then u can be returned, representing the best approximation of the minimum cost found so far. Second, the incrementality of the SMT solver (see §2.2 and §2.3) plays an essential role here, since at every call SMT.IncrementalSolve resumes the status of the search of the end of the previous call, only with tighter cost range constraints. (Notice that at each call here the solver can reuse all previously-learned clauses.) To this extent, one can see the whole process as only one SMT process, which is interrupted and resumed each time a new model is found, in which cost range constraints are progressively tightened. Third, we notice that in Algorithm 1 all the literals constraining the cost range (i.e., ¬(cost < l), (cost < u)) are always added to ϕ as unit clauses; thus inside SMT.IncrementalSolve these literals are immediately unit-propagated, becoming part of each truth assignment µ from the very beginning of its construction. As soon as novel LA(Q)-literals are added to µ which prevent it from having a LA(Q)-model of cost in [l, u[, the LA(Q)-solver invoked on µ by early-pruning calls (see §2.3) returns UNSAT and the LA(Q)-lemma ¬η describing the conflict η ⊆ µ, triggering theorybackjumping and -learning. To this extent, SMT.IncrementalSolve implicitly plays a form of branch & bound: (i) decide a new literal l and unit- or theory-propagate the literals which derive from l (“branch”) and (ii) backtrack as soon as the current branch can no more be expanded into models in the current cost range (“bound”). We remark that also the constraint ¬(cost < l) plays a role even in linear-search mode, since it helps pruning the search inside SMT.IncrementalSolve. Fourth, in binary-search mode, the range-partition strategy may be even more aggressive than that of standard binary search, because the minimum cost u returned in row 15 can be significantly smaller than pivot, so that the cost range is more than halved. 12 Finally, unlike with other domains (e.g., search in a sorted array) the binary-search strategy here is not “obviously faster” than the linear-search one, because the unsatisfiable calls to SMT.IncrementalSolve are typically much more expensive than the satisfiable ones, because they must explore the whole Boolean search space rather than only a portion of it (although with a higher pruning power, due to the stronger constraint induced by the presence of pivot). Thus, we have a tradeoff between a typically much-smaller number of calls plus a stronger pruning power in binary search versus an average much smaller cost of the calls in linear search. To this extent, it is possible to use dynamic/adaptive strategies for ComputePivot (see [37]). 4.2 An Inline Schema for OMT(LA(Q)) With the inline schema, the whole optimization procedure is pushed inside the SMT solver by embedding the range-minimization loop inside the CDCL Boolean-search loop of the standard lazy SMT schema of §2.3. The SMT solver, which is thus called only once, is modified as follows. Initialization. The variables lb, ub, l, u, PIV, pivot, M are brought inside the SMT solver, and are initialized as in Algorithm 1, steps 1-2. Range Updating & Pivoting. Every time the search of the CDCL SAT solver gets back to decision level 0, the range [l, u[ is updated s.t. u [resp. l ] is assigned the lowest [resp. highest] value ui [resp. li ] such that the atom (cost < ui ) [resp. ¬(cost < ui )] is currently assigned at level 0. (If u ≤ l, or two literals l, ¬l are both assigned at level 0, then the procedure terminates, returning the current value of u.) Then BinSearchMode() is invoked: if it returns true, then ComputePivot computes pivot ∈ ]l, u[, and the (possibly def new) atom PIV = (cost < pivot) is decided (level 1) by the SAT solver. This mimics steps 4-7 in Algorithm 1, temporarily restricting the cost range to [l, pivot[. Decreasing the Upper Bound. When an assignment µ propositionally satisfying ϕ is generated which is found LA(Q)-consistent by LA(Q)-Solver, µ is also fed to Minimize, returning the minimum cost min of µ; then the unit clause (cost < min) is learned and fed to the backjumping mechanism, which forces the SAT solver to backjump to level 0, then unit-propagating (cost < min). This case mirrors steps 14-16 in Algorithm 1, permanently restricting the cost range to [l, min[. Minimize is embedded within LA(Q)-Solver, so that it is called incrementally after it, without restarting its search from scratch. As a result of these modifications, we also have the following typical scenario (see Figure 1). Increasing the Lower Bound. In binary-search mode, when a conflict occurs s.t. the conflict analysis of the SAT solver produces a conflict clause in the form ¬PIV ∨¬η � s.t. all literals in η � are assigned true at level 0 (i.e., ϕ ∧ PIV is LA(Q)-inconsistent), then the SAT solver backtracks to level 0, unit-propagating ¬PIV. This case mirrors steps 21-23 in Algorithm 1, permanently restricting the cost range to [pivot, u[. Although the modified SMT solver mimics to some extent the behaviour of Algorithm 1, the “control” of the range-restriction process is handled by the standard SMT search. To this extent, notice that also other situations may allow for restricting the cost range: e.g., if ϕ ∧ ¬(cost < l) ∧ (cost < u) |= (cost �� m) for some atom (cost �� m) 13 ϕ (cost < pivot0) conflict lb0 pivot0 ub0 µ |= ϕ ϕ (cost < pivot0) ϕ ∧ ¬(cost < pivot0) conflict lb0 pivot0 ub0 µ |= ϕ ϕ (cost < pivot0) ϕ ∧ ¬(cost < pivot0) (cost < pivot1) ϕ ∧ ¬(cost < pivot0) ∧ ¬ηi ∧ (cost < mi) ∧ (cost < pivot1) conflict ηi ⊆ µ i mi = mincost(µi) lb0 µ |= ϕ pivot0 pivot1 ub0 mi Fig. 1. One piece of possible execution of an inline procedure. (i) Pivoting on (cost < pivot0 ). (ii) Increasing the lower bound to pivot0 . (iii) Decreasing the upper bound to mincost(µi ). 14 occurring in ϕ s.t. m ∈ [l, u[ and �� ∈ {≤, <, ≥, >}, then the SMT solver may backjump to decision level 0 and propagate (cost �� m), further restricting the cost range. The same considerations about the offline procedure in §4.1 hold for the inline version. The efficiency of the inline procedure can be further improved as follows. First, when a truth assignment µ with a novel minimum min is found, not only def (cost < min) but also PIV = (cost < pivot) is learned as unit clause. Although redundant from the logical perspective because min < pivot, the unit clause PIV allows the SAT solver for reusing all the clauses in the form ¬PIV ∨ C which have been learned when investigating the cost range [l, pivot[. (In Algorithm 1 this is done implicitly, since PIV is not popped from ϕ before step 16.) Moreover, the LA(Q)-inconsistent assignment µ ∧ (cost < min) may be fed to LA(Q)-Solver and the negation of the returned conflict ¬η ∨ ¬(cost < min) s.t. η ⊆ µ, can be learned, which prevents the SAT solver from generating any assignment containing η. Second, in binary-search mode, if the LA(Q)-Solver returns a conflict set η∪{PIV}, then it is further asked to find the maximum value max s.t. η ∪ {(cost < max)} is also LA(Q)-inconsistent. (This is done with a simple modification of the algorithm in [20].) def If max ≥ u, then the clause C ∗ = ¬η ∨ ¬(cost < u) is used do drive backjumping and def learning instead of C = ¬η ∨ ¬PIV. Since (cost < u) is permanently assigned at level 0, the dependency of the conflict from PIV is removed. Eventually, instead of using C to drive backjumping to level 0 and propagating ¬PIV, the SMT solver may use C ∗ , def then forcing the procedure to stop. If u > max > pivot, then the two clauses C1 = def ¬η ∨ ¬(cost < max) and C2 = ¬PIV ∨ (cost < max) are used to drive backjumping def and learning instead of C = ¬η ∨ ¬PIV. In particular, C2 forces backjumping to level 1 ad propagating the (possibly fresh) atom (cost < max); eventually, instead of using C do drive backjumping to level 0 and propagating ¬PIV, the SMT solver may use C1 for backjumping to level 0 and propagating ¬(cost < max), restricting the range to [max, u[ rather than to [pivot, u[. def Example 1. Consider the formula ϕ = ψ ∧ (cost ≥ a + 15) ∧ (a ≥ 0) for some ψ in the def cost range [0, 16[. With basic binary-search, deciding PIV = (cost < 8), the LA(Q)def Solver produces the LA(Q)-lemma C = ¬(cost ≥ a + 15) ∨ ¬(a ≥ 0) ∨ ¬PIV causing backjumping to level 0 and unit-propagating ¬PIV on C, restricting the range to [8, 16[; it takes a sequence of similar steps to progressively restrict the range to [8, 16[, [12, 16[, [14, 16[, and [15, 16[. If instead the LA(Q)-Solver produces the LA(Q)-lemmas C1 = ¬(cost ≥ a + 15) ∨ ¬(a ≥ 0) ∨ ¬(cost < 15) and C2 = ¬PIV ∨ (cost < 15), this first causes backjumping to level 1 the unit-propagation of (cost < 15) after PIV, and then a backjumping on C1 to level zero, unit-propagating ¬(cost < 15), which directly restricts the range to [15, 16[. 4.3 Extensions to OMT(LA(Q) ∪ T ) The procedures of §4.1 and §4.2 extend to the OMT(LA(Q)∪T ) case straightforwardly as follows. We assume that the underlying SMT solver handles LA(Q) ∪ T , and that ϕ is a LA(Q) ∪ T formula (which for simplicity and wlog we assume to be pure [28]). 15 We first recall that a LA(Q) ∪ T formula ϕ is LA(Q) ∪ T -satisfiable iff there is a truth assignment def µ = µLA(Q) ∪ µed ∪ µT (10) where µ propositionally satisfies ϕ, µed is a total truth assignment for the equalities (xi = xj ) over all the shared variables in ϕ (interface equalities), µLA(Q) ∪µed and µT ∪ µed are LA(Q)- and T -satisfiable respectively (see e.g. [28, 15]). (The pedexes e, d, i in µ... mean “equalities”, “disequalities” and “inequalities” respectively.) Thus, the problem reduces to find a truth assignment µ like (10) s.t. µLA(Q) ∪ µed has a LA(Q)-model M of minimum cost. (Notice that µed is a set of both equalities (xi = xj ) and disequalities ¬(xi = xj ).) Consequently, a naive OMT(LA(Q)∪T ) variant of the procedures for OMT(LA(Q)) of §4.1, §4.2 would be such that the SMT solver enumerates “extended” satisfying truth assignments µ like (10), checking the LA(Q)- and T -consistency of its µLA(Q) ∪ µed and µT ∪ µed components and then minimizing the µLA(Q) ∪ µed component. However, minimizing µLA(Q) ∪ µed could be computationally problematic due to the presence of disequalities ¬(xi = xj )s, which would force case-splitting each of them into (xi < xj ) ∨ (xj < xi ). A better idea [20, 12] is to let the SAT solver handle this case-splittings, and only when it is necessary. In principle, we could safely augment ϕ with LA(Q)-valid clauses, obtaining � def ((xi = xj ) ∨ (xi < xj ) ∨ (xj < xi )), (11) ϕ� = ϕ ∧ xi ,xj ∈SharedV ars(ϕ) which is equivalent to ϕ. If we applied the “naive” OMT(LA(Q) ∪ T ) procedure above to ϕ� , we would generate assignments µ like (10) in which each (xi = xj ) would “occur” in either of the following forms: ..., (xi = xj ), ¬(xi < xj ), ¬(xj < xi ), ... ..., (xi < xj ), ¬(xi = xj ), ¬(xj < xi ), ... ..., (xj < xi ), ¬(xi = xj ), ¬(xi < xj ), ... (12) (13) (14) On the T side, since T and LA(Q) are signature-disjoint, the two strict inequalities are not T -atoms, so that only the equality or disequality is fed to T -Solver. On the LA(Q) side, since in all the three sub-assignment the first literal entails the other two, the latter ones can be safely dropped from the assignment to be fed to the LA(Q)-solver. Therefore, overall, an alternative “asymmetric” algorithm works by enumerating truth assignments in the form: µ� = µLA(Q) ∪ µeid ∪ µT def (15) where (i) µ� propositionally satisfies ϕ, (ii) µeid is a set of interface equalities (xi = xj ) and disequalities ¬(xi = xj ), containing also one inequality in {(xi < xj ), (xj < xi )} def def for every ¬(xi = xj ) ∈ µeid ; then µ�LA(Q) = µLA(Q) ∪ µei and µ�T = µT ∪ µed are passed to the LA(Q)-Solver and T -Solver respectively, µei and µed being obtained 16 from µeid by dropping the disequalities and inequalities respectively. If µ�LA(Q) and µ�T are found consistent in the respective theories, then µ� is LA(Q) ∪ T -satisfiable, and so is ϕ. Then µ�LA(Q) can be fed to Minimize, and hence (cost < min) can be used as new upper bound, as in §4.1 and §4.2. This motivates and explains the following OMT(LA(Q) ∪ T ) variants of the offline and inline procedures of §4.1 and §4.2. Algorithm 1 is modified as follows. First, SMT.IncrementalSolve in step 8 or 11 is asked to return also a LA(Q)∪T -model M. Then Minimize is invoked on �cost, µLA(Q) ∪ µei �, s.t. µLA(Q) is the truth assignment over the LA(Q)-atoms in ϕ returned by the solver, and µei is the set of equalities (xi = xj ) and strict inequalities (xi < xj ) on the shared variables xi which are true in M. (The equalities and strict inequalities obtained from the others by the transitivity of =, < can be omitted.) The implementation of an inline OMT(LA(Q) ∪ T ) procedures comes nearly for free if the SMT solver handles LA(Q) ∪ T -solving by Delayed Theory Combination [15], with the strategy of case-splitting automatically disequalities ¬(xi = xj ) into the two inequalities (xi < xj ) and (xj < xi ), which is implemented in M ATH SAT. If so def the solver enumerates truth assignments in the form µ� = µLA(Q) ∪ µeid ∪ µT , where (i) µ� propositionally satisfies ϕ, (ii) µeid is a set of interface equalities (xi = xj ) and disequalities ¬(xi = xj ), containing also one inequality in {(xi < xj ), (xj < xi )} for def def every ¬(xi = xj ) ∈ µeid ; then µ�LA(Q) = µLA(Q) ∪ µei and µ�T = µT ∪ µed are passed to the LA(Q)-Solver and T -Solver respectively, µei and µed being obtained from µeid by dropping the disequalities and inequalities respectively. 12 If this is the case, it suffices to apply Minimize to µ�LA(Q) , then learn (cost < min) and use it for backjumping, as in §4.2. 5 Experimental Evaluation We have implemented both the OMT(LA(Q)) procedures and the inline OMT(LA(Q)∪ T ) procedures of §4 on top of M ATH SAT [5] (thus we refer to them as OPT-M ATH SAT). We consider four different configurations of OPT-M ATH SAT, depending on the approach (offline vs. inline, denoted by “-OF” and “-IN”) and the search schema (linear vs. binary, denoted by “-LIN” and “-BIN”). 13 For example, the configuration OPTM ATH SAT-LIN-OF denotes the offline linear-search procedure. Due to the absence of competitors on OMT(LA(Q) ∪ T ), we evaluate the performance of our four configurations of OPT-M ATH SAT by comparing them on OMT(LA(Q)) problems against GAMS v23.7.1 [16]. GAMS provides two reformulation tools, L OG MIP v2.0 [4] and JAMS [3] (a new version of the EMP solver [2]), both of them allow 12 13 def In [15] µ� = µLA(Q) ∪µed ∪µT , µed being a truth assignment over the interface equalities, and as such a set of equalities and disequalities. However, since typically a SMT(LA(Q)) solver handles disequalities ¬(xi = xj ) by case-splitting them into (xi < xj ) ∨ (xj < xi ), the assignment considers also one of the two strict inequalities, which is ignored by the T -Solver and is passed to the LA(Q)-Solver instead of the corresponding disequality. Here “-LIN” means that BinSearchMode() always returns false, whilst “-BIN” denotes the mixed linear-binary strategy described in §4.1 to ensure termination. 17 to reformulate LGDP models by using either big-M (BM) or convex-hull (CM) methods [32, 35]. We use C PLEX v12.2 [23] (through an OSI/C PLEX link) to solve the reformulated MILP models. All the tools were executed using default options, as indicated to us by the authors [38]. Notice that OPT-M ATH SAT uses infinite precison arithmetic whilst, to the best of our knowledge, the GAMS tools implement standard floatingpoint arithmetic. All tests were executed on 2.66 GHz Xeon machines with 4GB RAM running Linux, using a timeout of 600 seconds. The correctness of the minimum costs min found by OPT-M ATH SAT have been cross-checked by another SMT solver, either M ATH SAT or Y ICES [7], by detecting the inconsistency within the bounds of ϕ∧(cost < min) and the consistency of ϕ∧(cost = min) (if min is non-strict), or of ϕ∧(cost ≤ min) and ϕ ∧ (cost = min + �) (if min is strict), � being some very small value. All tools agreed on the final results, apart from tiny rounding errors, 14 and, much more importantly, from some noteworthy exceptions on the smt-lib problems (see §5.2). In order to make the experiments reproducible, the full-size plots, a Linus binary of OPT-M ATH SAT, the problems, and the results are available at [1]. 15 5.1 Comparison on LGDB Problems We first performed our comparison over two distinct benchmarks, strip-packing and zero-wait job-shop scheduling problems, which have been previously proposed as benchmarks for L OG MIP and JAMS by their authors [39, 34, 35]. The strip-packing problem. Given a set N of rectangles of different length length Lj and height Hj , j ∈ 1, .., N , and a strip of fixed width W but unlimited length, the strippacking problem aims at minimizing the length L of the filled part of the strip while filling the strip with all rectangles, without any overlap and any rotation. We considered the LGDP model provided by [34] and a corresponding OMT(LA(Q)) encoding. Every rectangle j ∈ J is represented by length Lj , height Hj and the coordinates (xj , yj ) of the upper left corner in the 2-dimensional space. The cost variable to minimize is the length of the strip L which is bounded by the constraints L ≥ (xi + Li ), for all i ∈ I, and L ≤ ub, where ub is an upper bound on the optimal value. For each pair of rectangles (i, j) where i, j ∈ N, i < j, the encoding contains a disjunction with four disjuncts (xi + Li ≤ xj ), (xj + Lj ≤ xi ), (yi − Hi ≥ yj ) and (yj − Hj ≥ yi ) that constraint their position so that they do not overlap. Three distinct constraints are added to model the position of each rectangle j in the strip: (yi ≤ W ) bounds the y-coordinate by the fixed width of the strip, (yi ≥ Hi ) bounds the y-coordinate by the height Hj and (xi ≤ ub − Li ) bounds the x-coordinate. We randomly generated benchmarks according to a fixed width W of the strip and a fixed number of rectangles N . For each rectangle j ∈ N , length Lj and height Hj are selected in the interval ]0, 1] uniformly at random. The upper bound ub is computed 14 15 GAMS +C PLEX often gives some errors ≤ 10−5 , which we believe are due to the printing floating-point format: (e.g. “3.091250e+00”); notice that OPT-M ATH SAT uses infiniteprecision arithmetic, returning values like, e.g. “7728125177/2500000000”. We cannot distribute the GAMS tools since they are subject to licencing restrictions. See [16]. 18 104 103 103 103 102 101 100 10-1 10-2 LogMIP(BM)+CPLEX LogMIP(CH)+CPLEX JAMS(BM)+CPLEX JAMS(CH)+CPLEX OPT-MathSAT5-BIN-OFF OPT-MathSAT5-LIN-OFF OPT-MathSAT5-BIN-IN OPT-MathSAT5-LIN-IN 25 50 75 102 101 100 10-1 10-2 100 LogMIP(BM)+CPLEX LogMIP(CH)+CPLEX JAMS(BM)+CPLEX JAMS(CH)+CPLEX OPT-MathSAT5-BIN-OFF OPT-MathSAT5-LIN-OFF OPT-MathSAT5-BIN-IN OPT-MathSAT5-LIN-IN 25 50 75 102 101 100 10-1 10-2 100 Number of instances for strip-packing with 12 rectangles and width W=sqrt(r)/2 104 103 103 103 100 10-1 10-2 LogMIP(BM)+CPLEX LogMIP(CH)+CPLEX JAMS(BM)+CPLEX JAMS(CH)+CPLEX OPT-MathSAT5-BIN-OFF OPT-MathSAT5-LIN-OFF OPT-MathSAT5-BIN-IN OPT-MathSAT5-LIN-IN 25 50 75 102 101 100 10-1 10-2 100 103 102 101 100 -1 10 10-1 W=sqrt(r)/2, N=9 W=1, N=9 W=sqrt(r)/2, N=12 W=1, N=12 W=sqrt(r)/2, N=15 W=1, N=15 100 101 102 103 Execution time (in sec) of OPT-MathSAT5-BIN-IN 25 50 75 100 10-2 100 75 100 LogMIP(BM)+CPLEX LogMIP(CH)+CPLEX JAMS(BM)+CPLEX JAMS(CH)+CPLEX OPT-MathSAT5-BIN-OFF OPT-MathSAT5-LIN-OFF OPT-MathSAT5-BIN-IN OPT-MathSAT5-LIN-IN 25 50 75 100 Number of instances for strip-packing with 15 rectangles and width W=1 103 102 101 100 W=sqrt(r)/2, N=9 W=1, N=9 W=sqrt(r)/2, N=12 W=1, N=12 W=sqrt(r)/2, N=15 W=1, N=15 -1 10-1 50 101 10-1 103 10 25 102 Number of instances for strip-packing with 12 rectangles and width W=1 Execution time (in sec) of GAMS=LogMIP(CH)+CPLEX Number of instances for strip-packing with 9 rectangles and width W=1 LogMIP(BM)+CPLEX LogMIP(CH)+CPLEX JAMS(BM)+CPLEX JAMS(CH)+CPLEX OPT-MathSAT5-BIN-OFF OPT-MathSAT5-LIN-OFF OPT-MathSAT5-BIN-IN OPT-MathSAT5-LIN-IN 100 101 102 103 Execution time (in sec) of OPT-MathSAT5-BIN-IN Execution time (in sec) of OPT-MathSAT5-LIN-IN 101 Execution time (in sec) 104 102 LogMIP(BM)+CPLEX LogMIP(CH)+CPLEX JAMS(BM)+CPLEX JAMS(CH)+CPLEX OPT-MathSAT5-BIN-OFF OPT-MathSAT5-LIN-OFF OPT-MathSAT5-BIN-IN OPT-MathSAT5-LIN-IN Number of instances for strip-packing with 15 rectangles and width W=sqrt(r)/2 104 Execution time (in sec) Execution time (in sec) Number of instances for strip-packing with 9 rectangles and width W=sqrt(r)/2 Execution time (in sec) of GAMS=LogMIP(BM)+CPLEX Execution time (in sec) 104 Execution time (in sec) Execution time (in sec) 104 102 101 100 -1 10 10-1 W=sqrt(r)/2, N=9 W=1, N=9 W=sqrt(r)/2, N=12 W=1, N=12 W=sqrt(r)/2, N=15 W=1, N=15 100 101 102 103 Execution time (in sec) of OPT-MathSAT5-BIN-IN Fig. 2. First and second row: cumulative plots of OPT-M ATH SAT and GAMS (using L OG MIP and JAMS) on 100 random instances each of the strip-packing problem√for N rectangles, where N = 9, 12, 15 (left, center and right respectively), and for width W = N /2 and 1 (first and second row respectively). (The plots for L OG MIP(CH)+CPLEX and JAMS(CH)+CPLEX do not appear since no formula was solved within the timeout.) Third row: comparison of the best configuration of OPT-M ATH SAT (OPT-M ATH SAT-BIN-IN) against GAMS and OPT-M ATH SAT-L IN√ -IN on 100 random instances of all the strip-packing problem (N = 9, 12, 15 and W = N /2 and 1). Left: with L OG MIP(BM)+CPLEX; Center: with L OG MIP(CH)+CPLEX; Right: with OPT-M ATH SAT-L IN -IN. with the same heuristic used by [34], which sorts the rectangles in non-increasing order of width and fills the strip by placing each rectangles in the bottom-left corner, and the 19 4 10 3 10 3 10 2 10 2 10 0 25 50 75 Number of instances for job-shop with 9 jobs and 8 stages 100 103 2 10 1 10 100 10-1 -1 10 9 job and 8 stages 10 job and 8 stages 11 job and 8 stages 100 101 102 103 Execution time (in sec) of OPT-MathSAT5-BIN-IN 10 1 10 0 LogMIP(BM)+CPLEX LogMIP(CH)+CPLEX JAMS(BM)+CPLEX JAMS(CH)+CPLEX OPT-MathSAT5-BIN-OF OPT-MathSAT5-LIN-OF OPT-MathSAT5-BIN-IN OPT-MathSAT5-LIN-IN 25 50 75 Number of instances for job-shop with 10 jobs and 8 stages 5 10 4 10 3 102 10 100 103 0 LogMIP(BM)+CPLEX LogMIP(CH)+CPLEX JAMS(BM)+CPLEX JAMS(CH)+CPLEX OPT-MathSAT5-BIN-OF OPT-MathSAT5-LIN-OF OPT-MathSAT5-BIN-IN OPT-MathSAT5-LIN-IN 25 50 75 Number of instances for job-shop with 11 jobs and 8 stages 100 103 2 10 1 10 100 10-1 -1 10 10 101 9 job and 8 stages 10 job and 8 stages 11 job and 8 stages 100 101 102 103 Execution time (in sec) of OPT-MathSAT5-BIN-IN Execution time (in sec) of OPT-MathSAT5-LIN-IN 10 1 LogMIP(BM)+CPLEX LogMIP(CH)+CPLEX JAMS(BM)+CPLEX JAMS(CH)+CPLEX OPT-MathSAT5-BIN-OF OPT-MathSAT5-LIN-OF OPT-MathSAT5-BIN-IN OPT-MathSAT5-LIN-IN Execution time (in sec) 10 Execution time (in sec) 4 Execution time (in sec) of GAMS=LogMIP(CH)+CPLEX Execution time (in sec) Execution time (in sec) of GAMS=LogMIP(BM)+OSICPLEX 10 2 10 1 10 100 10-1 -1 10 9 job and 8 stages 10 job and 8 stages 11 job and 8 stages 100 101 102 103 Execution time (in sec) of OPT-MathSAT5-BIN-IN Fig. 3. 1st row: cumulative plots of OPT-M ATH SAT and GAMS on 100 random samples each of the job-shop problem, for J = 8 stages and I = 9, 10, 11 jobs (left, center and right respectively). Times for L OG MIP(CH)+CPLEX are not reported since no formula was solved within the timeout. 2nd row: comparison of the best configuration of OPT-M ATH SAT (OPT-M ATH SAT-BININ) against GAMS and OPT-M ATH SAT-L IN -IN on 100 randomly generated instances of all the job-shop problems (J = 8, I = 9, 10, 11). Left: with L OG MIP(BM)+CPLEX; Center: with L OG MIP(CH)+CPLEX; Right: with OPT-M ATH SAT-L IN -IN. lower bound lb is set to zero. We√ generated 100 samples each for 9, 10 and 11 rectangles and for two values of the width N /2 and 116 . The first two rows of the Figure 2 shows the cumulative plots of the execution time for different configurations of OPT-M ATH SAT and GAMS on the generated formulas. (The plots for L OG MIP(CH)+CPLEX and JAMS(CH)+CPLEX do not appear since no formula was solved within the timeout.) The third row of Figure 2 compares our best optimization procedure OPT-M ATH SAT-BIN-IN against GAMS using L OG MIP with BM and CH reformulation (left and center respectively). The figure also compares our two inline versions OPT-M ATH SAT-BIN-IN and OPT-M ATH SAT-L IN -IN (right). The zero-wait jobshop problem. Consider the scenario where there is a set I of jobs which must be scheduled sequentially on a set J of consecutive stages with zero-wait transfer between them. Each job i ∈ I has a start time si and a processing time tij in 16 √ Notice that with W = N /2 the filled strip looks approximatively like a square, whilst W = 1 is the average of two 2 rectangles. 20 the stage j ∈ Ji . The goal of the zero-wait job-shop scheduling problem is to minimize the makespan, that is the total length of the schedule. In our experiments, we used the LGDP model used in [34] and a corresponding OMT(LA(Q)) encoding. Every jobs i ∈ I is represented by the start time si and the processing time tij in stage j ∈ Ji . The � cost variable is the makespan ms, which is bounded by the constraints (ms ≥ si + ∀j∈Ji tij ), for all i ∈ I. For each pair of jobs i, k ∈ I and for each stage j with potential clashes�(i.e j ∈ {Ji Jk }), a disjunction � �with two disjuncts, (si + t ≤ s + ) and (t + im k k m<j,∀m∈Jk tkm m≤j,∀m∈Jk tkm ≤ si + �m≤j,∀m∈Ji t ), ensures that there is no clash between jobs at any stage at the same im m<i∀m∈ji time. We randomly generated benchmarks according to a fixed number of jobs I and a fixed number of stages J. For each job i ∈ I, start time si and processing time tij of every job are selected in the interval ]0, 1] uniformly at random. We consider a set of 100 samples each for 9, 10 and 11 jobs and 8 stages. We set no value for ub and lb = 0. The first row of Figure 3 shows the cumulative plots of the execution time for different configurations of OPT-M ATH SAT and GAMS on the randomly generated formulas. (The plots for L OG MIP(CH)+CPLEX do not appear since no formula was solved within the timeout.) The second row of Figure 3 compares our best optimization procedure OPT-M ATH SAT-BIN-IN against GAMS using L OG MIP with BM and CH reformulation (left and center respectively). The figure also compares our two inline versions OPT-M ATH SAT-BIN-IN and OPT-M ATH SAT-L IN -IN (right). Discussion. Comparing the different version of OPT-M ATH SAT, there is no definite winner between -LIN and -BIN options. In fact, OPT-M ATH SAT-LIN-OF performs most often better than OPT-M ATH SAT-BIN-OF, but OPT-M ATH SAT-BIN-IN performances are identical to those of OPT-M ATH SAT-L IN -IN. We notice that the -IN options behave uniformly better than the -OF options. Comparing the different versions of the GAMS tools, we see that (i) on strippacking instances L OG MIP reformulations lead to better performance than JAMS reformulations, (ii) on job-shop instances they produce substantially identical results. For both reformulation tools, the “BM” versions uniformly outperforms the “CH” ones. Comparing the different versions of OPT-M ATH SAT against all the GAMS tools, we notice that (i) on strip-packing problems all versions of OPT-M ATH SAT always outperform all GAMS tools, (ii) on job-shop problems OPT-M ATH SAT outperforms the “CM” versions whilst it is beaten by the “BM” ones. 5.2 Comparison on SMT-LIB Problems We compare OPT-M ATH SAT against GAMS also on the satisfiable LA(Q)-formulas (QF LRA) in the SMT-LIB [6]. These instances are all classified as “industrial”, because they come from the encoding of different real-world problems in formal verification, planning and optimization. They are divided into six categories: sc, uart, sal, TM, tta startup, and miplib. 17 Since we have no information on lower bounds 17 Notice that other SMT-LIB categories like spider benchmarks and clock synchro do not contain satisfiable instances and are thus not reported here. 21 3 3 10 Execution time (in sec) of LogMIP(BM)+CPLEX Execution time (in sec) of LogMIP(CH)+CPLEX 10 102 1 10 0 10 10-1 QFLRA/sc QFLRA/uart QFLRA/tta_startup QFLRA/TM QFLRA/sal -2 10 -2 10 -1 0 2 -2 10 -1 0 1 2 10 10 10 10 10 Execution time (in sec) of OPT-MathSAT5-LIN-IN 3 3 Execution time (in sec) of JAMS(BM)+CPLEX Execution time (in sec) of JAMS(CH)+CPLEX QFLRA/sc QFLRA/uart QFLRA/tta_startup QFLRA/TM QFLRA/sal 10 1 10 0 10 10-2 10-1 10 3 102 -2 0 10 -2 1 3 10 1 10 10 10 10 10 10 Execution time (in sec) of OPT-MathSAT5-LIN-IN 10 10-1 102 QFLRA/sc QFLRA/uart QFLRA/tta_startup QFLRA/TM QFLRA/sal 102 1 10 0 10 10-1 -2 10-1 100 101 102 103 Execution time (in sec) of OPT-MathSAT5-LIN-IN 10 10-2 QFLRA/sc QFLRA/uart QFLRA/tta_startup QFLRA/TM QFLRA/sal 10-1 100 101 102 103 Execution time (in sec) of OPT-MathSAT5-LIN-IN Fig. 4. Scatter-plots of the pairwise comparisons on the smt-lib LA(Q) satisfiable instances between OPT-M ATH SAT-BIN-LIN and the two versions of L OG MIP (up) and JAMS. (down). on these problems, we use the linear-search version OPT-M ATH SAT-LIN-IN. Since we have no control on the origin of each problem and on the name and meaning of the variables, we selected iteratively one variable at random as cost variable, dropping it if the resulting minimum was −∞. This forced us to eliminate a few instances, in particular all miplib ones. We first noticed that some results for GAMS have some problem (see Table 1). Using the default options, on ≈ 60 samples over 193, both GAMS tools with the CH option returned “unfeasible” (inconsistent), whilst the BM ones, when they did not timeout, returned the same minimum value as OPT-M ATH SAT. (We recall that all OPT-M ATH SAT results were cross-checked, and that the four GAMS tool were fed with the same files.) Moreover, on four sal instances the two GAMS tools with BM options returned a wrong minimum value “0”, with “CH” they returned “unfeasible”, whilst OPT-M ATH SAT returned the minimum value “2”; by modifying a couple of parameters from their default value, namely “eps” e “bigM Mvalue”, the results become unfeasible also with BM options. After eliminating all flawed instances, the results appear as displayed in Figure 4. OPT-M ATH SAT solved all problems within the timeout, whilst GAMS did not solve many samples. Moreover, with the exception of 3-4 samples, OPT-M ATH SAT always outperforms the GAMS tool, often by more than one order magnitude. 22 Solved Feasible but �= from test Infeasible Timeout Total sc OPT-M ATH SAT-L IN -IN 108 0 0 0 108 JAMS(BM)+CPLEX 108 0 0 0 108 JAMS(CH)+CPLEX 108 0 0 0 108 L OG MIP(BM)+CPLEX 108 0 0 0 108 L OG MIP(CH)+CPLEX 108 0 0 0 108 uart OPT-M ATH SAT-L IN -IN 36 0 0 0 36 JAMS(BM)+CPLEX 25 0 0 11 36 JAMS(CH)+CPLEX 0 0 36 0 36 L OG MIP(BM)+CPLEX 25 0 0 11 36 L OG MIP(CH)+CPLEX 0 0 36 0 36 tta startup OPT-M ATH SAT-L IN -IN 24 0 0 0 24 JAMS(BM)+CPLEX 8 0 0 16 24 JAMS(CH)+CPLEX 0 0 20 4 24 L OG MIP(BM)+CPLEX 8 0 0 16 24 L OG MIP(CH)+CPLEX 0 0 22 2 24 TM OPT-M ATH SAT-L IN -IN 15 0 0 0 15 JAMS(BM)+CPLEX 12 0 1 2 15 JAMS(CH)+CPLEX 11 0 0 4 15 L OG MIP(BM)+CPLEX 12 0 1 2 15 L OG MIP(CH)+CPLEX 11 0 0 4 15 sal OPT-M ATH SAT-L IN -IN 10 0 0 0 10 JAMS(BM)+CPLEX 10 4 0 0 10 JAMS(CH)+CPLEX 1 0 9 0 10 L OG MIP(BM)+CPLEX 10 4 0 0 10 L OG MIP(CH)+CPLEX 1 0 9 0 10 check OPT-M ATH SAT-L IN -IN 1 0 0 0 1 JAMS(BM)+CPLEX 0 0 1 0 1 JAMS(CH)+CPLEX 0 0 1 0 1 L OG MIP(BM)+CPLEX 0 0 1 0 1 L OG MIP(CH)+CPLEX 0 0 1 0 1 Table 1. Number of solved and correctly-solved problems for OPT-M ATH SAT-BIN-LIN and L OG MIP and JAMS CH/BN, on the five groups of smt-lib LA(Q) satisfiable instances, plus the “chack” instance. Solver 6 Conclusions and Future Work In this paper we have introduced the problem of OMT(LA(Q) ∪ T ), an extension of SMT(LA(Q)∪T ) with minimization of LA(Q) terms, and proposed two novel procedures addressing it. We have described, implemented and experimentally evaluated this 23 approach, clearly demonstrating all its potentials. We believe that OMT(LA(Q) ∪ T ) and its solving procedures propose as a very-promising tools for a variety of optimization problems. This research opens the possibility for several interesting future directions. A shortterm goal is to improve the efficiency and applicability of OPT-M ATH SAT: we plan to (i) investigate and implement novel mixed linear/binary-search strategies and heuristics (ii) extend the experimentation to novel sets of problems, possibly investigating adhoc customizations. A middle-term goal is to extend the approach to LA(Z) or mixed LA(Q) ∪ LA(Z), by exploiting the solvers which are already present in M ATH SAT [22]. A much longer-term goal is to investigate the feasibility of extending the technique to deal with non-linear constraints, possibly using MINLP tools as T -Solver/Minimize. References 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. http://disi.unitn.it/˜rseba/ijcar12/ijcar12-tarball.tar.gz. EMP. http://www.gams.com/dd/docs/solvers/emp.pdf. JAMS. http://www.gams.com/. LogMIP v2.0. http://www.logmip.ceride.gov.ar/index.html. MathSAT 5. http://mathsat.fbk.eu/. SMT-LIB. http://www.smtlib.org/. Yices. http://yices.csl.sri.com/. G. Audemard, M. Bozzano, A. Cimatti, and R. Sebastiani. Verifying Industrial Hybrid Systems with MathSAT. In Proc. BMC 2004, volume 119 of ENTCS. Elsevier, 2005. G. Audemard, A. Cimatti, A. Korniłowicz, and R. Sebastiani. SAT-Based Bounded Model Checking for Timed Systems. In Proc. FORTE’02., volume 2529 of LNCS. Springer, 2002. E. Balas. Disjunctive programming: Properties of the convex hull of feasible points. Discrete Applied Mathematics, 89(1-3):3 – 44, 1998. E. Balas and P. Bonami. New variants of lift-and-project cut generation from the lp tableau: Open source implementation and testing. In IPCO, pages 89–103, 2007. C. Barrett, R. Nieuwenhuis, A. Oliveras, and C. Tinelli. Splitting on Demand in SAT Modulo Theories. In Proc. LPAR’06, volume 4246 of LNAI. Springer, 2006. C. Barrett, R. Sebastiani, S. A. Seshia, and C. Tinelli. Satisfiability Modulo Theories, chapter 26, pages 825–885. In Biere et al. [14], February 2009. A. Biere, M. J. H. Heule, H. van Maaren, and T. Walsh, editors. Handbook of Satisfiability. Frontiers in Artificial Intelligence and Applications. IOS Press, February 2009. M. Bozzano, R. Bruttomesso, A. Cimatti, T. A. Junttila, S. Ranise, P. van Rossum, and R. Sebastiani. Efficient Theory Combination via Boolean Search. Information and Computation, 204(10), 2006. A. Brooke, D. Kendrick, A. Meeraus, and R. Raman. GAMS - A User’s Guide. GAMS Development Corporation, Washington, DC, USA, 2011. A. Cimatti, A. Franzén, A. Griggio, R. Sebastiani, and C. Stenico. Satisfiability modulo the theory of costs: Foundations and applications. In TACAS, volume 6015 of LNCS. Springer, 2010. A. Cimatti, A. Griggio, and R. Sebastiani. Computing Small Unsatisfiable Cores in SAT Modulo Theories. Journal of Artificial Intelligence Research, JAIR, 40, April 2011. S. Cotton and O. Maler. Fast and Flexible Difference Constraint Propagation for DPLL(T). In SAT, volume 4121 of LNCS. Springer, 2006. 24 20. B. Dutertre and L. de Moura. A Fast Linear-Arithmetic Solver for DPLL(T). In CAV, volume 4144 of LNCS, 2006. 21. N. Eén and N. Sörensson. An extensible SAT-solver. In Theory and Applications of Satisfiability Testing (SAT 2003), volume 2919 of LNCS, pages 502–518. Springer, 2004. 22. A. Griggio. A Practical Approach to Satisfiability Modulo Linear Integer Arithmetic. Journal on Satisfiability, Boolean Modeling and Computation - JSAT, 8:1–27, 2012. 23. IBM. IBM ILOG CPLEX Optimizer, 2010. http://www-01.ibm.com/software/ integration/optimization/cplex-optimizer/. 24. C. M. Li and F. Manyà. MaxSAT, Hard and Soft Constraints, chapter 19, pages 613–631. In Biere et al. [14], February 2009. 25. A. Lodi. Mixed Integer Programming Computation. In 50 Years of Integer Programming 1958-2008, pages 619–645. Springer-Verlag, 2009. 26. I. Lynce and J. Marques-Silva. On Computing Minimum Unsatisfiable Cores. In SAT, 2004. 27. J. P. Marques-Silva, I. Lynce, and S. Malik. Conflict-Driven Clause Learning SAT Solvers, chapter 4, pages 131–153. In Biere et al. [14], February 2009. 28. C. G. Nelson and D. C. Oppen. Simplification by cooperating decision procedures. TOPLAS, 1(2):245–257, 1979. 29. R. Nieuwenhuis and A. Oliveras. On SAT Modulo Theories and Optimization Problems. In SAT, volume 4121 of LNCS. Springer, 2006. 30. R. Nieuwenhuis, A. Oliveras, and C. Tinelli. Solving SAT and SAT Modulo Theories: from an Abstract Davis-Putnam-Logemann-Loveland Procedure to DPLL(T). Journal of the ACM, 53(6):937–977, November 2006. 31. D. Plaisted and S. Greenbaum. A Structure-preserving Clause Form Translation. Journal of Symbolic Computation, 2:293–304, 1986. 32. R. Raman and I. Grossmann. Modelling and computational techniques for logic based integer programming. Computers and Chemical Engineering, 18(7):563 – 578, 1994. 33. O. Roussel and V. Manquinho. Pseudo-Boolean and Cardinality Constraints, chapter 22, pages 695–733. In Biere et al. [14], February 2009. 34. N. W. Sawaya and I. E. Grossmann. A cutting plane method for solving linear generalized disjunctive programming problems. Comput Chem Eng, 29(9):1891–1913, 2005. 35. N. W. Sawaya and I. E. Grossmann. A hierarchy of relaxations for linear generalized disjunctive programming. European Journal of Operational Research, 216(1):70–82, 2012. 36. R. Sebastiani. Lazy Satisfiability Modulo Theories. Journal on Satisfiability, Boolean Modeling and Computation, JSAT, 3(3-4), 2007. 37. M. Sellmann and S. Kadioglu. Dichotomic Search Protocols for Constrained Optimization. In CP, volume 5202 of LNCS. Springer, 2008. 38. A. Vecchietti, 2011. Personal communication. 39. A. Vecchietti and I. Grossmann. Computational experience with logmip solving linear and nonlinear disjunctive programming problems. In Proc. of FOCAPD, pages 587–590, 2004. 40. S. Wolfman and D. Weld. The LPSAT Engine & its Application to Resource Planning. In Proc. IJCAI, 1999. 25
Keep reading this paper — and 50 million others — with a free Academia account
Used by leading Academics
Lyudmila S Mihaylova
The University of Sheffield
Antoine Meyer
Université Gustave Eiffel
Nikos Mantzakouras
National & Kapodistrian University of Athens
Adnan Awad
The University Of Jordan