State Key Laboratory of Computer Science,
Institute of Software, Chinese Academy of Sciences, Beijing, China
11email: {hexiang,libh,zhaomy,caisw}@ios.ac.cn 22institutetext: School of Computer Science and Technology
University of Chinese Academy of Sciences, Beijing, China
A Local Search Algorithm for MaxSMT(LIA)
Abstract
MaxSAT modulo theories (MaxSMT) is an important generalization of Satisfiability modulo theories (SMT) with various applications. In this paper, we focus on MaxSMT with the background theory of Linear Integer Arithmetic, denoted as MaxSMT(LIA). We design the first local search algorithm for MaxSMT(LIA) called PairLS, based on the following novel ideas. A novel operator called pairwise operator is proposed for integer variables. It extends the original local search operator by simultaneously operating on two variables, enriching the search space. Moreover, a compensation-based picking heuristic is proposed to determine and distinguish the pairwise operations. Experiments are conducted to evaluate our algorithm on massive benchmarks. The results show that our solver is competitive with state-of-the-art MaxSMT solvers. Furthermore, we also apply the pairwise operation to enhance the local search algorithm of SMT, which shows its extensibility.
Keywords:
MaxSMT Linear Integer Arithmetics Local Search.1 Introduction
The maximum satisfiability problem (MaxSAT) is an optimization version of the satisfiability problem (SAT), aiming to minimize the number of falsified clauses, and it has various applications [22]. A generalization of MaxSAT is the weighted Partial MaxSAT problem, where clauses are divided into hard and soft clauses with weights (positive numbers). The goal is to find an assignment that satisfies all hard clauses and minimizes the total weight of falsified soft clauses. MaxSAT solvers have made substantial progress in recent years [2, 25, 19, 23, 17].
However, MaxSAT has limited expressiveness, and it can be generalized from the Boolean case to Satisfiability Modulo Theories (SMT), deciding the satisfiability of a first-order logic formula with respect to certain background theories, leading to a generalization called MaxSAT Modulo Theories (MaxSMT) [29]. With its enhanced expressive power, MaxSMT has various practical applications, such as safety verification [6], concurrency debugging [33], non-termination analysis [18] and superoptimization [1].
Compared to MaxSAT and SMT solving, the research on MaxSMT solving is still in its preliminary stage. Cimatti et al. [13] introduced the concept of “Theory of Costs” and developed a method to manage SMT with Pseudo-Boolean (PB) constraints and minimize PB cost functions. Sebastiani et al. [30, 31] proposed an approach to solve MaxSMT problem by encoding it into SMT with PB functions. A modular approach for MaxSMT called Lemma-Lifting was proposed by Cimatti et al. [14], which involves the iterative exchange of information between a lazy SMT solver and a purely propositional MaxSAT solver. The implicit hitting set approach was lifted from the propositional level to SMT [15]. Two well-known MaxSMT solvers are OptiMathSAT [32] and [5], which are currently the state-of-the-art MaxSMT solvers. In this paper, we focus on the MaxSMT problem with the background theory of Linear Integer Arithmetic (LIA), denoted as MaxSMT(LIA), which consists of arithmetic atomic formulas in the form of linear equalities or inequalities over integer variables.
We apply the local search method to solve MaxSMT(LIA). Although local search has been successfully used to solve SAT [21, 3, 12, 11, 4] and recently to SMT on the theory of bit-vector theory [16, 27, 28, 26], integer arithmetic [9, 10] and real arithmetic [20, 24], this is the first time that it is applied to MaxSMT.
First, we propose a novel operator for integer variables, named pairwise operator, to enrich the search space by simultaneously operating on two variables. When the algorithm falls into the local optimum w.r.t. operations on a single variable, further exploring the neighborhood structure of pairwise operator can help it escape from the local optimum.
Moreover, a novel method based on the concept of compensation is proposed to determine the pairwise operation. Specifically, the pairwise operation is determined as a pair of simultaneous modifications, one to satisfy a falsified clause, and the other to minimize the disruptions the first operation might wreak on the already satisfied clauses. Then, a two-level picking heuristic is proposed to distinguish these pairwise operations, by considering the potential of a literal becoming falsified.
Based on the above novel ideas, we design the first local search solver for MaxSMT(LIA) called PairLS, prioritizing hard clauses over soft clauses. Experiments are conducted on massive benchmarks. New instances based on SMT-LIB are generated to enrich the benchmarks for MaxSMT(LIA). We compare our solver with 2 state-of-the-art MaxSMT(LIA) solvers, OptiMathSAT and . Experimental results show that our solver is competitive with these state-of-the-art solvers. We also present the evolution of solution quality over time, showing that PairLS can efficiently find a promising solution within a short cutoff time. Ablation experiments are also conducted to confirm the effectiveness of proposed strategies. Moreover, we apply the pairwise operator to enhance the local search algorithm of SMT, demonstrating its extensibility.
2 Preliminary
2.1 MaxSMT on Linear Integer Arithmetics
The Satisfiability modulo theories (SMT) problem determines the satisfiability of a given quantifier-free first-order formula with respect to certain background theories. Here we consider the theory of Linear Integer Arithmetic (LIA), consisting of arithmetic formulae in the form of linear equalities or inequalities over integer variables ( or )111strict linear equalities in the form of () can be transformed to (). An atomic formula can be a propositional variable or an arithmetic formula. A is an atomic formula, or the negation of an atomic formula. A is the disjunction of a set of literals, and a formula in conjunctive normal form (CNF) is the conjunction of a set of clauses. Given the sets of propositional variables and integer variables, denoted as and respectively, an assignment is a mapping and , and denotes the value of a variable under .
The (weighted partial) MaxSAT Modulo Theories problem (MaxSMT for short) is generated from SMT. The clauses are divided into clauses and clauses with positive weight.
Definition 1.
For a MaxSMT instance , given the current assignment , if it satisfies all hard clauses, then is a feasible solution, and the cost is defined as the total weight of all falsified soft clauses, denoted as .
MaxSMT aims to find a feasible solution with minimal , that is, to find an assignment satisfying all hard clauses and minimizing the sum of the weights of the falsified soft clauses. The MaxSMT problem with the background theory of LIA is denoted as MaxSMT(LIA).
Example 1.
Given a MaxSMT(LIA) formula , let and be hard clauses, and be soft clauses with weight 1 and 2. Given the current assignment , , since only is falsified.
2.2 Local Search Components
The clause weighting scheme is a popular local search method that associates an additional property (which is an integer number) called penalty weight to clauses and dynamically adjusts them to prevent the search from getting stuck in a local optimum. We adopt the weighting scheme called Weighting-PMS [19] to instruct the search. Weighting-PMS has been applied in state-of-the-art local search solvers for MaxSAT, such as SATLIKE [19] and SATLIKE3.0 [8]. When the algorithm falls into a local optimum, the Weighting-PMS dynamically adjusts the penalty weights of hard and soft clauses to guide the search direction.
Note that the penalty weight and the original weight of soft clauses are different. The goal of MaxSMT is to minimize the total original weight of unsatisfied soft clauses, while the penalty weight is updated during the search process, guiding the search in a promising direction.
Another key component of a local search algorithm is the operator, defining how to modify the current solution. When an operator is instantiated by specifying the variable to operate and the value to assign, an operation is obtained.
Definition 2.
The score of an operation , denoted by , is the decrease of the total penalty weight of falsified clauses caused by applying .
An operation is decreasing if its score is greater than 0. Note that given a set of clauses, denoted as , the of operation on the subformula composed of is denoted as .
3 Review of LS-LIA
As our algorithm adopts the two-mode framework of LS-LIA, which is the first local search algorithm for SMT(LIA) [9], we briefly review it in this section.
After the initialization, the algorithm switches between Integer mode and Boolean mode. In each mode, an operation on a variable of the corresponding data type is selected to modify the current assignment. The two modes switch to each other when the number of non-improving steps of the current mode reaches a threshold. The threshold is set to for the Boolean mode and for the Integer mode, where and denote the proportion of Boolean and integer literals to all literals in falsified clauses, and is a parameter.
In the Boolean mode, the flip operator is adopted to modify a Boolean variable to the opposite of its current value. In the Integer mode as in Algorithm 1, a novel operator called critical move ( for short) is proposed by considering the literal-level information.
Definition 3.
The critical move operator, denoted as , assigns an integer variable to the threshold value making literal true, where is a falsified literal containing .
Specifically, the threshold value refers to the minimum modification to that can make true. Example 2 is given to help readers understand the definition.
Example 2.
Given two falsified literals and , and the current assignment is . Then , , , and refers to assigning to -2, assigning to , assigning to 1 and assigning to respectively.
An important property of the critical move operator is that after the execution, the corresponding literal must be true. Therefore, by picking a falsified literal and performing a operation on it, we can make the literal true.
In our algorithm for MaxSMT(LIA), the critical move operator is also adopt-
ed to make a falsified literal become true.
4 Pairwise Operator
In this section, we introduce a novel operator for integer variables, denoted as pairwise operator. It extends the original critical move operator to enrich the search space, serving as an extended neighborhood structure. We first introduce the motivation for the pairwise operator. Then, based on pairwise operator, the framework of our algorithm in Integer mode is proposed.
4.1 Motivation
The original critical move operator only considers one single variable each time. However, it may miss potential decreasing operations. Specifically, when there exists no decreasing critical move operation, operations that simultaneously modify two variables may be decreasing, which are not considered by critical move.
Example 3.
Given a formula where the penalty weight of each clause is 1. and the current assignment is . There exist two critical move operations: and , referring to assigning to and to , respectively. Both operations are not decreasing, since these two operations will respectively falsify and . However, simultaneously assigning to and to can be decreasing, since after the operation, all clauses become satisfied.
Thus, the pairwise operator simultaneously modifying two variables is proposed to find a decreasing operation when there is no decreasing operation.
Definition 4.
Pairwise operator, denoted as , will simultaneously modify to and to respectively, where and are integer variables, and and are integer parameters.
The pairwise operator can be regarded as an extended neighborhood. When there exists no decreasing critical move operation, indicating that the local optimum of modifying individual variables is found, the search space can be expanded by simultaneously modifying two variables, and the solution may be further improved, thanks to the following property:
Proposition 1.
Given a pairwise operation , and two operations individually assigning to and to , denoted as and respectively. is decreasing while neither nor is decreasing, only if there exists a clause containing both and , and on clause , .
The proof can be found in Appendix 0.A. Recall the Example 3, the pairwise operation that simultaneously assigns to 2 and to 1, denoted as , is decreasing, while none of the operations that individually assign to 2 and to 1, denoted as and , is decreasing. The reason lies in that and both appear in the clause , and .
5 Compensation-based Picking Heuristic
To find a decreasing pairwise operation when there is no decreasing operation, we first introduce a method based on the concept of compensation to determine pairwise operations, which can satisfy the necessary condition in Proposition 1 (Details can be found in Lemma 1 of Appendix 0.B). Then, among these pairwise operations, we propose a two-level heuristic to distinguish them, by considering the potential of the compensated literals becoming falsified.
5.1 Pairwise Operation Candidates for Compensation
Motivation for compensation: Since one variable may exist in multiple literals, changing a variable will affect all literals containing the variable, and may make some originally true literals become false. Moreover, if the literal is the reason for some clauses being satisfied, i.e., it is the only true literal in the clause, then falsifying the literal also falsifies the clause.
Formally, for an operation , we define a special set of literals is true and is the only true literal for some clauses, but would become false after individually performing . After performing an operation , the literals in the set are of special interest since some clauses containing such a literal would become falsified.
Concept of compensation: Let and denote two operations modifying individual variables. To minimize the disruptions that might wreak on the already satisfied clauses, another operation is simultaneously executed to make a literal remain true under the assignment after operating . is denoted as compensation for , and literals in the set are denoted as Compensated Literals.
Compensation-based pairwise operation: A pairwise operation p(,, ,) can be regarded as simultaneously performing a pair of operations modifying individual variables, assigning to and assigning to . The procedure to determine and is described as follows.
First, a candidate is chosen to satisfy a falsified clause. To this end, we pick a variable from a false literal in a random falsified clause, and is the corresponding cm operation, . It prioritizes literals from hard clauses and soft clauses are considered only when all hard clauses are satisfied. To obtain sufficient candidates of , (a parameter) literals are randomly selected from overall falsified clauses, and all variables in these literals are considered. The set of all candidate found in this stage is denoted as .
Second, given a literal , the w.r.t is determined to guarantee that remains true after simultaneously performing and , meaning that is selected to compensate for . Specifically, to determine , we pick a variable appearing in a literal , and calculate the value according to assuming performed.
Example 4.
Let us consider the formula presented in example 3: where the penalty weight of each clause is 1, and the current assignment is . There is no decreasing critical move operation. As shown in Fig. 1, performing that assigns to would falsify the literal , the only true literal in . To compensate for , the operation that assigns to 1 is determined according to , assuming that has been performed. All clauses become satisfied after simultaneously performing and , and thus a decreasing pairwise operation is found.

Note that there may exist multiple variables in the literal , and thus given the operation , and the literal selected in the second step, a set of pairwise operations is determined by considering all variables in except the variable in , denoted as pair_set(,).
5.2 Two-level Heuristic
Among the literals selected in the second step of determining a pairwise operation, we consider that some literals are more likely to become false, and should be given higher priority. Thus, we distinguish such literals from others. They are formally defined as follows.
Definition 5.
Given an assignment , and a literal in the form of , we denote . The literal is a fragile literal if holds. Any true literal with is safe.
A fragile literal with is true as the inequality holds, but it can be falsified by any little disturbance that enlarges of the corresponding fragile literal. Comparatively, a literal is safe means that even if the value of a variable in the literal changes comparatively larger (as long as after the modification), it remains true.
Example 5.
Consider the formula: , where the current assignment is . and are two true literals. is a fragile literal since its , while is a safe literal since its . We consider that is more fragile than , since a small disturbance, that assigns to 1, can falsify but not .
In the second step of determining a pairwise operation, among those compensated literals, we prefer fragile literals and prioritize the corresponding pairwise operations. Based on the intuition above, a two-level picking heuristic is defined:
-
•
We first choose the decreasing pairwise operation involving a fragile compensated literal.
-
•
If there exists no such decreasing pairwise operation, we further select the pairwise operation involving safe compensated literals.
5.3 Algorithm for Picking a Pairwise Operation
Based on the picking heuristic, the algorithm for picking a pairwise operation is described in Algorithm 2. In the beginning, we initialize the set of pairwise operations involving fragile and safe compensated literals, denoted as and (line 1). Firstly, (a parameter) false literals are picked from overall falsified clauses, and all critical move operations in these literals are added into (lines 2–7). Note that it prioritizes hard clauses over soft clauses.
Then, for each operation , we go through each compensated literal . If is fragile (resp. safe), the set of corresponding pairwise operations determined by are added to the (resp. ) (line 8–13).
According to the two-level picking heuristic, if there exist decreasing operations in , we pick the one with the greatest (lines 14–15). Otherwise, we pick a decreasing operation in if it exists (lines 16–17). An operation with the greatest is selected via the BMS heuristic [7]. Specifically, the BMS heuristic samples pairwise operations (a parameter), and selects the decreasing one with the greatest .
6 Local search algorithm
Based on the above novel components, we propose our algorithm for MaxSMT(L
IA) called PairLS, prioritizing hard clauses over soft clauses.
PairLS initializes the complete current solution by assigning all Integer variables to 0 and all Boolean variables to .
Then, PairLS switches between Integer mode and Boolean mode.
When the time limit is reached, the best solution and the corresponding best cost are reported if a feasible solution can be found. Otherwise, “No solution found” is reported.
The Integer mode of PairLS is described in Algorithm 3. The current solution is iteratively modified until the number of non-improving steps exceeds the threshold (line 1). If a feasible solution with a smaller is found, then the best solution and the best cost are updated (lines 2–3). In each iteration, the algorithm first tries to find a decreasing critical move operation with the greatest score via BMS heuristic [7] (line 4–7). Note that it prefers to pick operations from falsified hard clauses, and falsified soft clauses are picked only if all hard clauses are satisfied. If it fails to find any decreasing critical move operation, indicating that it falls into the local optimum of modifying individual variables, then it continues to search the neighborhood of pairwise operation (line 8). If there exists no decreasing operation in both neighborhoods, the algorithm further escapes from the local optimum by updating the penalty weight (line 10), and satisfying a random clause by performing a critical move operation in it, preferring the one with the greatest score (lines 11–13). Specifically, it also prioritizes hard clauses over soft clauses.
In the Boolean mode, the formula is reduced to a subformula that purely contains Boolean variables, which is indeed a MaxSAT instance. Thus, our algorithm performs in the same way as SATLike3.0222 https://lcs.ios.ac.cn/~caisw/Code/maxsat/SATLike3.0.zip, a state-of-the-art local search algorithm for MaxSAT [19].
7 Experiments
Experiments are conducted on 3 benchmarks to evaluate PairLS, comparing it with state-of-the-art MaxSMT solvers. The promising experimental result indicates that our algorithm is efficient and effective in most instances. We also present the evolution of solution quality over time, showing that PairLS can efficiently find promising solutions within a short time limit. Moreover, the ablation experiment is carried out to confirm the effectiveness of our proposed strategies.
7.1 Experiment Preliminaries
Implementation: PairLS is implemented in C++ and compiled by g++ with the ’-O3’ option enabled. There are 3 parameters in the solver: for switching modes; (the number of samples) for the BMS heuristic; denotes the size of . The parameters are tuned according to our preliminary experiments and suggestions from the previous literature. They are set as follows: , , .
Competitors: We compare PairLS with 2 state-of-the-art MaxSMT solvers, namely OptiMathSAT(version 1.7.3) and (version 4.11.2). OptiMathSAT applies MaxRes as the MaxSAT engine, denoted as Opt_res, while the default configuration encodes the MaxSMT problem as an optimization problem, denoted as Opt_omt. also has 2 configurations based on the MaxSAT engines MaxRes and WMax, denoted as _res and _wmax, respectively. The binary code of OptiMathSAT and is downloaded from their websites.
Benchmarks: Our experiments are conducted on 3 benchmarks. Those instances where the hard constraints are unsatisfiable are excluded, as they do not have feasible solutions.
Benchmark MaxSMT-LIA: This benchmark consists of 5520 instances generated based on SMT(LIA) instances from SMT-LIB333 https://clc-gitlab.cs.uiowa.edu:2443/SMT-LIB-benchmarks/QF_LIA.
The original SMT(LI
A) benchmark consists of 690 instances from 3 families, namely bofill, convert, and wisa444SMT(LIA) instances from other families are excluded because most of them are in the form of a conjunction of unit clauses, and thus the generation method is not applicable, since each produced soft assertion is also a hard assertion..
We adopt the same method to generate instances as in previous literature [15]: adding randomly chosen arithmetic atoms in the original problem with a certain proportion as unit soft assertions.
4 proportions of soft clauses (denoted as ) are applied, namely 10%, 25%, 50% and 100%.
2 MaxSMT instances can be generated from each original SMT instance, based on different ways to associate soft clauses with weights:
one associates each soft clause with a unit weight of 1, and the other associates each soft clause with a random weight between 1 and the total number of atoms.
Instances with unit weights and random weights are not distinguished as in [15].
The total number of instances is , where 690 denotes the number of original SMT(LIA) instances, 2 denotes 2 kinds of weights associated with soft clauses, and 4 denotes the 4 proportions of soft clauses.
Note that the “bofill” family was adopted in [15], while the family of “convert” and “wisa” are new instances.
Benchmark MaxSMT-IDL: This benchmark contains 12888 new MaxSM-
T instances generated by the above method, based on 1611 SMT(IDL) instances including all families from SMT-LIB555 https://clc-gitlab.cs.uiowa.edu:2443/SMT-LIB-benchmarks/QF_IDL (similar to MaxSMT-LIA benchmark, the total number of instances is ).
Instances with unit weights and random weights are also not distinguished when reporting results.
Benchmark LL: The benchmark was proposed in [14]. Unsatisfiable instances and instances over linear real arithmetic are excluded, resulting in 114 instances in total. 56 instances contain soft clauses with unit weights of 1, and 58 instances contain soft clauses with random weights ranging from 1 to 100. Instances with Unit weights and Random weights are distinguished as in [14].
Experiment Setup: All experiments are conducted on a server with Intel Xeon Platinum 8153 2.00GHz and 2048G RAM under the system CentOS 7.7.1908. Each solver executes one run for each instance in these benchmarks, as they contain sufficient instances. The cutoff time is set to 300 seconds for the MaxSMT-LIA and MaxSMT-IDL benchmarks as previous work [15], and 1200 seconds for the LL benchmark as previous work [14].
For each family of instances, we report the number of instances where the corresponding solver can find the best solution with the smallest among all solvers, denoted by , and the average running time to yield those best solutions, denoted as . Note that when multiple solvers find the best solution with the same within the cutoff time, they are all considered to be winners. The solvers with the most in the table are emphasized with bold value.
The solution found by solvers and the corresponding time are defined as follows: As for complete solvers, and OptiMathSAT, we take the best upper bound found within the cutoff time as their solution, and the time to find such upper bound is recorded by referring to the log file. Note that the proving time for complete solvers is excluded. As for PairLS, the best solution found so far within the cutoff time and the time to find such a solution are recorded.
7.2 Comparison to Other MaxSMT Solvers
Results on benchmark MaxSMT-LIA: As presented in Table 1, PairLS shows competitive and complementary performance on this benchmark. Regardless of the proportion of soft clauses , PairLS always leads in the total number of winning instances. On the “bofill” family, PairLS performs better on instances with larger , confirming that PairLS is good at solving hard instances. On the “convert” family, PairLS outperforms all competitors regardless of . On the “wisa” family, PairLS cannot rival its competitors. In Fig.3 of Appendix C, we also present the run time comparison between PairLS and the best configuration of competitors, namely _res and Opt_res. The run time comparison indicates that PairLS is more efficient than Opt_res and is complementary to _res.
Results on benchmark MaxSMT-IDL: As presented in Table 2, PairLS can significantly outperform all competitors regardless of the proportion of soft clauses. In the overall benchmark, PairLS can find a better solution than all competitors on 53.5% of total instances, and it can lead the best competitor by 1224 “winning” instances, confirming its dominating performance. In Fig.4 of Appendix C, we also present the run time comparison between PairLS and the best configuration of competitors, namely _res and Opt_omt, indicating that PairLS is more efficient than competitors in instances with small .
Results on LL benchmark: The results are shown in Table 3. PairLS shows comparable but overall poor performance compared to its competitors on this benchmark. One possible reason is that the front-end encoding for these benchmarks would generate many auxiliary Boolean variables, while PairLS cannot effectively explore the Boolean structure as LS-LIA [9]. Specifically, the average number of auxiliary variables in this benchmark is 1220, while the counterparts in MaxSMT-LIA and MaxSMT-IDL are 327 and 528.
family | #inst | Opt_omt | Opt_res | _res | _wmax | PairLS | |
() | () | () | () | () | |||
10% | bofill | 814 | 773(17.1) | 777(7.1) | 758(7.9) | 797(7.6) | 762(10.9) |
convert | 560 | 445(21.1) | 495(1.2) | 228(18.4) | 8(103.1) | 558(1.1) | |
wisa | 6 | 4(27.4) | 3 (33.3) | 6 (11.3) | 0(0) | 0(0) | |
Total | 1380 | 1222(18.6) | 1275(4.9) | 992(10.3) | 805(8.5) | 1320(6.7) | |
25% | bofill | 814 | 736(59.2) | 720 (17.1) | 677(21.9) | 776(21.8) | 641(35.4) |
convert | 560 | 415(16.3) | 493(12.7) | 205(13.3) | 5(125.6) | 558(1.4) | |
wisa | 6 | 4(14.5) | 1(11.3) | 4(73.2) | 0(0) | 0(0) | |
Total | 1380 | 1155(43.6) | 1214(16.1) | 886(20.1) | 781(22.5) | 1199(19.6) | |
50% | bofill | 814 | 82(231.0) | 489(12.1) | 515(33.1) | 217(35.8) | 542(66.7) |
convert | 560 | 405(22.3) | 508(9.1) | 177(19.8) | 0(0) | 558(1.2) | |
wisa | 6 | 3(36.6) | 1(11.3) | 5(39.2) | 0(0) | 0(0) | |
Total | 1380 | 490(57.3) | 998(10.8) | 697(29.8) | 217(39.7) | 1100(33.4) | |
100% | bofill | 814 | 0(0) | 0(0) | 402(75.6) | 15(20.7) | 601(128.8) |
convert | 560 | 399(27.3) | 503(14.7) | 185(19.3) | 19(55.0) | 558(1.2) | |
wisa | 6 | 1(162.2) | 1(193.3) | 6(38.3) | 0(0) | 0(0) | |
Total | 1380 | 400(27.7) | 504(15.0) | 593(57.6) | 34(39.9) | 1159(67.3) | |
5520 | 3267(34.3) | 3937(10.9) | 3168(26.1) | 1837(18.7) | 4778(30.7) |
#inst | Opt_omt | Opt_res | _res | _wmax | PairLS | |
---|---|---|---|---|---|---|
() | () | () | () | () | ||
10% | 3222 | 1086(248.1) | 873(201.6) | 1151(238.4) | 839(221.5) | 1542(159.9) |
25% | 3222 | 1171(195.2) | 934(178.6) | 1502(192.7) | 722(292.1) | 1744(148.0) |
50% | 3222 | 1094(195.8) | 890(183.2) | 1461(198.2) | 758(290.9) | 1829(149.3) |
100% | 3222 | 1061(204.1) | 880(198.3) | 1559(201.6) | 934(260.4) | 1782(157.1) |
12888 | 4412(210.5) | 3577(190.2) | 5673(205.8) | 3253(264.5) | 6897(153.3) |
Category | #inst | Opt_omt | Opt_res | _res | _wmax | PairLS |
---|---|---|---|---|---|---|
() | () | () | () | () | ||
Unit | 56 | 41(117.3) | 32(130.3) | 49(183.2) | 15(40.0) | 23(0.4) |
Random | 58 | 45(117.9) | 37(120.3) | 53(100.1) | 17(39.0) | 22(0.4) |
114 | 86(117.6) | 69(124.9) | 102(140.0) | 32(39.5) | 45(0.4) |
7.3 Evolution of Solution Quality
To be more informative in understanding how the solvers compare in practice, the evolution of the solution quality over time is presented. Specifically, we evaluate the overall performance on the MaxSMT-LIA and MaxSMT-IDL benchmark with 4 cutoff times, denoted as cutoff: 50, 100, 200, 300 seconds. Given an instance, the proportion of the to the sum of soft clause weights is denoted as 666If no feasible solution is found, then is set as 1. Note that we present the average rather than the average , since the of certain instances can be quite large, dominating the average .. The average over time is presented in Fig.LABEL:ev, showing that PairLS can efficiently find high-quality solutions within a short time. Moreover, we also report the “winning” instances over time. As shown in Table 7 in Appendix D, on each benchmark, PairLS leads the best competitor by at least 645 “winning” instances regardless of the cutoff time, confirming its dominating performance.
7.4 Effectiveness of Proposed Strategies
To analyze the effectiveness of our proposed strategies, two modified versions of PairLS are proposed as follows.
-
•
To analyze the effectiveness of pairwise operation, we modify PairLS by only using the critical move operator, leading to the version .
-
•
To analyze the effectiveness of two-level heuristic in compensation-based picking heuristic for picking a pairwise operation, PairLS is modified by selecting pairwise operation without distinguishing the fragile and safe compensated literals, leading to the version .
We compare PairLS with these modified versions on 3 benchmarks. The results of this ablation experiment are presented in Table 4, confirming the effectiveness of the proposed strategies.
Moreover, we also analyze the extension for simultaneously operating on more variables. PairLS is modified by simultaneously modifying three variables, where the third variable is modified to compensate for the second one, leading to the version . We conduct our experiments on MaxSMT-LIA. The results are in Apendix E. When , the number of possible operations increases from O() to O(), where is the number of variables in unsatisfied clauses. This might significantly slow down the searching process, indicating that modifying 2 variables simultaneously is the best choice of trade-off between cost and effectiveness.
#inst | |||||
---|---|---|---|---|---|
MaxSMT-LIA | 5520 | 1834 | 65 | 705 | 457 |
MaxSMT-IDL | 12888 | 3242 | 1962 | 3005 | 1826 |
LL | 114 | 27 | 0 | 5 | 0 |
8 Discussion on the Extension of Pairwise Operation
Since pairwise operator can be adapted to SMT(LIA) instances without additional modifications, a potential extension is incorporating it into the local search algorithm for SMT(LIA). When there is no decreasing cm operation in the integer mode of LS-LIA (Algorithm 1 in Page 5), we apply pairwise operator to LS-LIA to enrich the search space as in PairLS, resulting in the corresponding version called LS-LIA-Pair. We compare LS-LIA-Pair with LS-LIA and other complete SMT solvers on SMT(LIA) instances, reporting the number of unsolved instances for each solver (Details are in Appendix F). Without any specific customization tailored for SMT, in both categories, LS-LIA-Pair can solve 20 more instances compared to LS-LIA, which demonstrates that pairwise operator is an extensible method and could be further explored to enhance the local search algorithm for SMT.
9 Conclusion and Future Work
In this paper, we propose the first local search algorithm for MaxSMT(LIA), called PairLS, based on the following components. A novel pairwise operator is proposed to enrich the search space. A compensation-based picking heuristic is proposed to determine and distinguish pairwise operations. Experiments show that PairLS is competitive with state-of-the-art MaxSMT solvers, and pairwise operator is a general method. Moreover, we also would like to develop a local search algorithm for MaxSMT on non-linear integer arithmetic and Optimization Modulo Theory problems. Lastly, we hope to combine PairLS with complete solvers, since PairLS can efficiently find a solution with promising , serving as an upper bound for complete solvers to prune the search space.
Acknowledgements
This research is supported by NSFC Grant 62122078 and CAS Project for Young Scientists in Basic Research (Grant No.YSBR-040).
References
- [1] Albert, E., Gordillo, P., Rubio, A., Schett, M.A.: Synthesis of super-optimized smart contracts using max-smt. In: International Conference on Computer Aided Verification. pp. 177–200. Springer (2020)
- [2] Ansótegui, C., Bonet, M.L., Levy, J.: Sat-based maxsat algorithms. Artificial Intelligence 196, 77–105 (2013)
- [3] Balint, A., Schöning, U.: Choosing probability distributions for stochastic local search and the role of make versus break. In: Proc. of SAT 2012. pp. 16–29 (2012)
- [4] Biere, A.: Splatz, Lingeling, Plingeling, Treengeling, YalSAT entering the SAT competition 2016. Proc. of SAT Competition 2016 pp. 44–45 (2016)
- [5] Bjørner, N.S., Phan, A.D.: z-maximal satisfaction with z3. Scss 30, 1–9 (2014)
- [6] Brockschmidt, M., Larra, D., Oliveras, A., Rodrıguez-Carbonell, E., Rubio, A.: Compositional safety verification with max-smt. In: 2015 Formal Methods in Computer-Aided Design (FMCAD). pp. 33–40. IEEE (2015)
- [7] Cai, S.: Balance between complexity and quality: Local search for minimum vertex cover in massive graphs. In: Twenty-Fourth International Joint Conference on Artificial Intelligence. pp. 747–753 (2015)
- [8] Cai, S., Lei, Z.: Old techniques in new ways: Clause weighting, unit propagation and hybridization for maximum satisfiability. Artificial Intelligence 287, 103354 (2020)
- [9] Cai, S., Li, B., Zhang, X.: Local search for smt on linear integer arithmetic. In: International Conference on Computer Aided Verification. pp. 227–248. Springer (2022)
- [10] Cai, S., Li, B., Zhang, X.: Local search for satisfiability modulo integer arithmetic theories. ACM Transactions on Computational Logic 24(4), 1–26 (2023)
- [11] Cai, S., Luo, C., Su, K.: CCAnr: A configuration checking based local search solver for non-random satisfiability. In: Proc. of SAT 2015. pp. 1–8 (2015)
- [12] Cai, S., Su, K.: Local search for boolean satisfiability with configuration checking and subscore. Artificial Intelligence 204, 75–98 (2013)
- [13] Cimatti, A., Franzén, A., Griggio, A., Sebastiani, R., Stenico, C.: Satisfiability modulo the theory of costs: Foundations and applications. In: International Conference on Tools and Algorithms for the Construction and Analysis of Systems. pp. 99–113. Springer (2010)
- [14] Cimatti, A., Griggio, A., Schaafsma, B.J., Sebastiani, R.: A modular approach to maxsat modulo theories. In: International conference on theory and applications of satisfiability testing. pp. 150–165. Springer (2013)
- [15] Fazekas, K., Bacchus, F., Biere, A.: Implicit hitting set algorithms for maximum satisfiability modulo theories. In: International Joint Conference on Automated Reasoning. pp. 134–151. Springer (2018)
- [16] Fröhlich, A., Biere, A., Wintersteiger, C., Hamadi, Y.: Stochastic local search for satisfiability modulo theories. In: Proc. of AAAI 2015. vol. 29 (2015)
- [17] Ignatiev, A., Morgado, A., Marques-Silva, J.: Rc2: an efficient maxsat solver. Journal on Satisfiability, Boolean Modeling and Computation 11(1), 53–64 (2019)
- [18] Larraz, D., Nimkar, K., Oliveras, A., Rodríguez-Carbonell, E., Rubio, A.: Proving non-termination using max-smt. In: Computer Aided Verification: 26th International Conference, CAV 2014, Held as Part of the Vienna Summer of Logic, VSL 2014, Vienna, Austria, July 18-22, 2014. Proceedings 26. pp. 779–796. Springer (2014)
- [19] Lei, Z., Cai, S.: Solving (weighted) partial maxsat by dynamic local search for sat. In: IJCAI. vol. 7, pp. 1346–52 (2018)
- [20] Li, B., Cai, S.: Local search for smt on linear and multilinear real arithmetic. arXiv preprint arXiv:2303.06676 (2023)
- [21] Li, C.M., Li, Y.: Satisfying versus falsifying in local search for satisfiability. In: Proc. of SAT 2012. pp. 477–478 (2012)
- [22] Li, C.M., Manya, F.: Maxsat, hard and soft constraints. In: Handbook of satisfiability, pp. 903–927. IOS Press (2021)
- [23] Li, C.M., Xu, Z., Coll, J., Manyà, F., Habet, D., He, K.: Combining clause learning and branch and bound for maxsat. In: 27th International Conference on Principles and Practice of Constraint Programming (CP 2021). Schloss Dagstuhl-Leibniz-Zentrum für Informatik (2021)
- [24] Li, H., Xia, B., Zhao, T.: Local search for solving satisfiability of polynomial formulas. arXiv preprint arXiv:2303.09072 (2023)
- [25] Martins, R., Manquinho, V., Lynce, I.: Open-wbo: A modular maxsat solver. In: Theory and Applications of Satisfiability Testing–SAT 2014: 17th International Conference, Held as Part of the Vienna Summer of Logic, VSL 2014, Vienna, Austria, July 14-17, 2014. Proceedings 17. pp. 438–445. Springer (2014)
- [26] Niemetz, A., Preiner, M.: Ternary propagation-based local search for more bit-precise reasoning. In: # PLACEHOLDER_PARENT_METADATA_VALUE#. vol. 1, pp. 214–224. TU Wien Academic Press (2020)
- [27] Niemetz, A., Preiner, M., Biere, A.: Precise and complete propagation based local search for satisfiability modulo theories. In: International Conference on Computer Aided Verification. pp. 199–217. Springer (2016)
- [28] Niemetz, A., Preiner, M., Biere, A.: Propagation based local search for bit-precise reasoning. Formal Methods in System Design 51(3), 608–636 (2017)
- [29] Nieuwenhuis, R., Oliveras, A.: On sat modulo theories and optimization problems. In: Theory and Applications of Satisfiability Testing-SAT 2006: 9th International Conference, Seattle, WA, USA, August 12-15, 2006. Proceedings 9. pp. 156–169. Springer (2006)
- [30] Sebastiani, R., Tomasi, S.: Optimization in smt with () cost functions. In: International Joint Conference on Automated Reasoning. pp. 484–498. Springer (2012)
- [31] Sebastiani, R., Tomasi, S.: Optimization modulo theories with linear rational costs. ACM Transactions on Computational Logic (TOCL) 16(2), 1–43 (2015)
- [32] Sebastiani, R., Trentin, P.: Optimathsat: A tool for optimization modulo theories. Journal of Automated Reasoning 64(3), 423–460 (2020)
- [33] Terra-Neves, M., Machado, N., Lynce, I., Manquinho, V.: Concurrency debugging with maxsmt. In: Proceedings of the AAAI Conference on Artificial Intelligence. vol. 33, pp. 1608–1616 (2019)
Appendix 0.A Proof of Proposition 1
Proof.
The sets of clauses containing variables and are denoted as and , respectively. For simplicity, we denote the sets of clauses where only either variable or occur (but not both) as and , respectively. If the pairwise operation is decreasing, then the following inequality holds:
(1) |
While individually operating and are not decreasing:
(2) |
(3) |
Note that, since and only either consist of or (but not both), and . By (1)-(2)-(3), it can be inferred from the above inequality that:
(4) |
Assumption: assume that there does not exist any clause containing both and (), and , the following inequality holds:
(5) |
According to (5), by summing up the on each clause we can conclude that:
(6) |
Appendix 0.B Compenstation-based pairwise operation can satisfy necessary condition of Proposition 1
Lemma 1.
The compensation-based pairwise operation can satisfy the necessary condition proposed in Proposition 1 to find a decreasing pairwise operation when there is no decreasing operation.
Proof.
A compensation-based pairwise is regarded as simultaneously performing a pair of operations modifying individual variables, assigning to and assigning to . According to the concept of compensation, there exists a true literal which is the only true literal for some clauses, but would become false after individually performing . Moreover, remains true after performing .
Let denote the satisfied clause containing such compensated literal as the only true literal in it. Since contains both and , contains both and .
According to the definition of , given a satisfied clause , if it is falsified by an operation , then . If remains satisfied after performing , then :
Since is the only true literal in and can be falsified by performing , then will be falsified by :
(7) |
Since has already been a satisfied clause, it can only be falsified or remain true after performing :
(8) |
Since remains true after performing , then remains satisfied after performing .
(10) |
Appendix 0.C Experiment of Time
In the MaxSMT-LIA and MaxSMT-IDL benchmark, scatter plots are adopted to present the runtime comparison between PairLS and competitors with the best configuration, if both solvers can find a solution with the same . The x-axis (resp. y-axis) denotes the runtime of PairLS (resp. competitor). Thus, nodes above the diagonal indicate instances that can be solved faster by PairLS.
Appendix 0.D Experiment of Evolution of Solution Quality
cutoff | #inst | Opt_omt | Opt_res | _res | _wmax | PairLS | |
---|---|---|---|---|---|---|---|
() | () | () | () | () | |||
LIA | 50 | 5520 | 2869(10.6) | 3362(10.3) | 2906(8.2) | 1803(10.2) | 4531(17.8) |
100 | 5520 | 3102(20.0) | 3712(10.5) | 2980(14.0) | 1802(18.9) | 4717(25.3) | |
200 | 5520 | 3237(32.1) | 3914(10.2) | 3130(19.6) | 1805(20.1) | 4763(27.6) | |
300 | 5520 | 3267(34.3) | 3937(10.9) | 3168(26.1) | 1837(18.7) | 4778(30.7) | |
IDL | 50 | 12888 | 5239(22.2) | 4589(20.9) | 6373(24.7) | 4322(18.7) | 7175(35.9) |
100 | 12888 | 5220(42.1) | 4489(39.6) | 6369(47.2) | 4075(34.8) | 7014(70.1) | |
200 | 12888 | 5091(138.7) | 4248(143.1) | 6063(130.1) | 3881(134.3) | 6968(131.4) | |
300 | 12888 | 4412(210.5) | 3577(190.2) | 5673(205.8) | 3253(264.5) | 6897(153.3) |
Appendix 0.E Experiment of Extended Neighborhood
We conduct our experiments on MaxSMT-LIA. The results are in Table 6. #Avergage Steps represents the number of iterations of the algorithm.
PairLS | |||
---|---|---|---|
#win | 3686 | 5455 | 1029 |
#Average Steps | 1952354 | 356752 | 35850 |
Appendix 0.F Experiment of SMT-LIB
Competitors: We compare LS-LIA_Pair with LS-LIA and 4 state-of-the-art complete SMT solvers according to SMT-COMP 2023777https://smt-comp.github.io/2023, namely MathSAT5(version 5.6.6), CVC5(version 0.0.4), Yices2(version 2.6.2), and Z3(version 4.8.14). The binaries of all competitors are downloaded from their websites.
Benchmarks: This benchmark consists of SMT(LIA) instances from SMT-LIB888https://clc-gitlab.cs.uiowa.edu:2443/SMT-LIB-benchmarks/QF_LIA. UNSAT instances are excluded, resulting in a benchmark consisting of 6670 unknown and satisfiable instances. Cutoff time is set as 1200 seconds.
Family | Type | #inst | MathSAT5 | CVC5 | Yices2 | Z3 | LS-LIA | LS-LIA-Pair |
---|---|---|---|---|---|---|---|---|
Without Boolean | 20180326-Bromberger | 631 | 123 | 206 | 273 | 99 | 50 | 50 |
bofill-scheduling | 407 | 0 | 5 | 0 | 2 | 16 | 10(-6) | |
CAV_2009_benchmarks | 506 | 0 | 8 | 110 | 0 | 0 | 0 | |
check | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
convert | 280 | 7 | 75 | 94 | 96 | 1 | 1 | |
dillig | 230 | 0 | 0 | 30 | 0 | 0 | 0 | |
miplib2003 | 16 | 6 | 7 | 5 | 8 | 3 | 3 | |
pb2010 | 41 | 27 | 36 | 20 | 8 | 13 | 6(-7) | |
prime-cone | 19 | 0 | 0 | 0 | 0 | 0 | 0 | |
RWS | 20 | 9 | 7 | 9 | 6 | 8 | 8 | |
slacks | 231 | 1 | 0 | 70 | 1 | 0 | 0 | |
wisa | 3 | 0 | 0 | 0 | 0 | 0 | 0 | |
SMPT(2022) | 4285 | 85 | 84 | 65 | 65 | 101 | 94 (-7) | |
Total | 6670 | 228 | 428 | 676 | 285 | 192 | 172(-20) | |
With Boolean | 2019-cmodelsdiff | 144 | 50 | 49 | 49 | 49 | 93 | 76 (-17) |
2019-ezsmt | 108 | 24 | 29 | 27 | 27 | 54 | 51 (-3) | |
20210219-Dartagnan | 47 | 25 | 25 | 24 | 24 | 45 | 45 | |
arctic-matrix | 100 | 57 | 74 | 41 | 53 | 23 | 23 | |
Averest | 9 | 0 | 0 | 0 | 0 | 2 | 2 | |
calypto | 24 | 0 | 0 | 0 | 0 | 21 | 21 | |
CIRC | 18 | 0 | 0 | 0 | 0 | 15 | 15 | |
fft | 5 | 2 | 2 | 2 | 2 | 2 | 2 | |
mathsat | 21 | 0 | 0 | 0 | 0 | 8 | 8 | |
nec-smt | 1256 | 12 | 831 | 0 | 14 | 675 | 675 | |
RTCL | 2 | 0 | 0 | 0 | 0 | 0 | 0 | |
tropical-matrix | 108 | 53 | 66 | 37 | 56 | 10 | 10 | |
Total | 1842 | 223 | 766 | 180 | 225 | 930 | 910(-20) |