Encoding 1 - The direct encoding from MinSAT into Partial. MaxSAT. Example. Given a MinSAT instance I : {C1,C2,C3,C4,C5}. C1 = a ⨠b, C2 = a ⨠¬b, C3 = ¬a ...
Exact MinSAT Solving Chu Min Li 1
1
Felip Manyà
2
Zhe Quan
1
Zhu Zhu
MIS, Université de Picardie Jules Verne, 5 Rue du Moulin Neuf, 80000 Amiens, France 2 IIIA-CSIC, Campus UAB, 08193 Bellaterra, Spain
July
1
Summary
Introduction Three encodings from MinSAT into MaxSAT Experimental Results Conclusions
Definition of the SAT problem
NP-Complete [Cook 71] boolean variable : {x1 , x2 , . . . , xn } CNF(Conjunctive Normal Form) formula : ¬x1 , x1 ∨ x2 , x1 ∨ x3 ∨ x4 , ¬x2 ∨ ¬x5 ∨ ¬x6
SAT problem To test if there is at least one assignment of TRUE and FALSE values to the variables that will make the entire expression true.
MaxSAT and MinSAT MaxSAT : finding a truth assignment that maximizes the number of satisfied clauses in a CNF formula. ◮ ◮ ◮
Hard Clause : a clause that must be satisfied Soft Clause : a clause that may be relaxed Partial MaxSAT : finding an assignment that satisfies all the hard clauses and the maximum number of soft clauses.
There are competitive exact solvers for MaxSAT MinSAT : finding a truth assignment that minimizes the number of satisfied clauses. ◮ ◮ ◮
Bioinformatics Supervised Learning Laurent Simon
There exists no exact MinSAT solver
MaxSAT and MinSAT MaxSAT : finding a truth assignment that maximizes the number of satisfied clauses in a CNF formula. ◮ ◮ ◮
Hard Clause : a clause that must be satisfied Soft Clause : a clause that may be relaxed Partial MaxSAT : finding an assignment that satisfies all the hard clauses and the maximum number of soft clauses.
There are competitive exact solvers for MaxSAT MinSAT : finding a truth assignment that minimizes the number of satisfied clauses. ◮ ◮ ◮
Bioinformatics Supervised Learning Laurent Simon
There exists no exact MinSAT solver
MaxSAT and MinSAT MaxSAT : finding a truth assignment that maximizes the number of satisfied clauses in a CNF formula. ◮ ◮ ◮
Hard Clause : a clause that must be satisfied Soft Clause : a clause that may be relaxed Partial MaxSAT : finding an assignment that satisfies all the hard clauses and the maximum number of soft clauses.
There are competitive exact solvers for MaxSAT MinSAT : finding a truth assignment that minimizes the number of satisfied clauses. ◮ ◮ ◮
Bioinformatics Supervised Learning Laurent Simon
There exists no exact MinSAT solver
MaxSAT and MinSAT MaxSAT : finding a truth assignment that maximizes the number of satisfied clauses in a CNF formula. ◮ ◮ ◮
Hard Clause : a clause that must be satisfied Soft Clause : a clause that may be relaxed Partial MaxSAT : finding an assignment that satisfies all the hard clauses and the maximum number of soft clauses.
There are competitive exact solvers for MaxSAT MinSAT : finding a truth assignment that minimizes the number of satisfied clauses. ◮ ◮ ◮
Bioinformatics Supervised Learning Laurent Simon
There exists no exact MinSAT solver
Three encodings from MinSAT into MaxSAT
MinSAT and partial MaxSAT 1
Encoding 1 - The direct encoding from MinSAT into Partial MaxSAT
2
Encoding 2 - MaxClique-based MaxSAT Encoding
3
Encoding 3 - Improved MaxClique-based MaxSAT Encoding
Encoding 1 - The direct encoding from MinSAT into Partial MaxSAT Example Given a MinSAT instance I : {C1 , C2 , C3 , C4 , C5 } C1 = a ∨ b, C2 = a ∨ ¬b, C3 = ¬a ∨ b, C4 = ¬a ∨ ¬b, C5 = a ∨ c. vi = 1 iff Ci is satisfied vi = 0 otherwise The direct encoding from MinSAT for I : [v1 ↔ a ∨ b]
v1 → a ∨ b = ¬ v1 ∨ a ∨ b v1 ← a ∨ b = ¬ a ∨ v1 , ¬ b ∨ v1
Encoding 1 - The direct encoding from MinSAT into Partial MaxSAT Example Given a MinSAT instance I : {C1 , C2 , C3 , C4 , C5 } C1 = a ∨ b, C2 = a ∨ ¬b, C3 = ¬a ∨ b, C4 = ¬a ∨ ¬b, C5 = a ∨ c.
The direct encoding from MinSAT for I : [v1 [v2 [v3 [v4 [v5
↔ a ∨ b] ↔ a ∨ ¬b] ↔ ¬a ∨ b] ↔ ¬a ∨ ¬b] ↔ a ∨ c]
Encoding 1 - The direct encoding from MinSAT into Partial MaxSAT Example Given a MinSAT instance I : {C1 , C2 , C3 , C4 , C5 } C1 = a ∨ b, C2 = a ∨ ¬b, C3 = ¬a ∨ b, C4 = ¬a ∨ ¬b, C5 = a ∨ c. The direct encoding from MinSAT for I : [v1 [v2 [v3 [v4 [v5
↔ a ∨ b] ↔ a ∨ ¬b] ↔ ¬a ∨ b] ↔ ¬a ∨ ¬b] ↔ a ∨ c]
¬v1 ¬v2 ¬v3 ¬v4 ¬v5
The optimal solution for Partial MaxSAT : v2 = v3 = v4 = true and v1 = v5 = a = b = c = false An optimal MaxSAT solution : a = b = c = false
Encoding 1 - The direct encoding from MinSAT into Partial MaxSAT Example Given a MinSAT instance I : {C1 , C2 , C3 , C4 , C5 } C1 = a ∨ b, C2 = a ∨ ¬b, C3 = ¬a ∨ b, C4 = ¬a ∨ ¬b, C5 = a ∨ c. The direct encoding from MinSAT for I : [v1 [v2 [v3 [v4 [v5
↔ a ∨ b] ↔ a ∨ ¬b] ↔ ¬a ∨ b] ↔ ¬a ∨ ¬b] ↔ a ∨ c]
¬v1 ¬v2 ¬v3 ¬v4 ¬v5
The optimal solution for Partial MaxSAT : v2 = v3 = v4 = true and v1 = v5 = a = b = c = false An optimal MaxSAT solution : a = b = c = false
MaxClique Problem
Given a graph G =(V ,E ) A clique is a subset of its vertices such that every two vertices in the subset are connected by an edge MAXCLIQUE : a clique of the largest possible size in a given graph V1
V3 V5
V2
V4
The auxiliary graph and its complement
Exemple Let I be the MinSAT instance {C1 , C2 , C3 , C4 , C5 } C1 = a ∨ b, C2 = a ∨ ¬b, C3 = ¬a ∨ b, C4 = ¬a ∨ ¬b, C5 = a ∨ c.
C1
C3 C5
C2
C4
The auxiliary graph GI
The auxiliary graph and its complement
Exemple Let I be the MinSAT instance {C1 , C2 , C3 , C4 , C5 } C1 = a ∨ b, C2 = a ∨ ¬b, C3 = ¬a ∨ b, C4 = ¬a ∨ ¬b, C5 = a ∨ c.
C1
C3 C5
C2
C4
The auxiliary graph GI
The auxiliary graph and its complement
Exemple Let I be the MinSAT instance {C1 , C2 , C3 , C4 , C5 } C1 = a ∨ b, C2 = a ∨ ¬b, C3 = ¬a ∨ b, C4 = ¬a ∨ ¬b, C5 = a ∨ c.
C1
C3 C5
C2
C4
The auxiliary graph GI
The auxiliary graph and its complement Exemple Let I be the MinSAT instance {C1 , C2 , C3 , C4 , C5 } C1 = a ∨ b, C2 = a ∨ ¬b, C3 = ¬a ∨ b, C4 = ¬a ∨ ¬b, C5 = a ∨ c. C1
C3
C1
C3
C5 C2
C4
The auxiliary graph GI
C5 C2
C4
The complement graph GI
All the clauses in a clique of GI can be unsatisfied by the same assignment For a maximum clique, the number of unsatisfied clauses is maximum
Encoding 2 - MaxClique-based MaxSAT Encoding
Exemple Let I be the MinSAT instance {C1 , C2 , C3 , C4 , C5 } C1 = a ∨ b, C2 = a ∨ ¬b, C3 = ¬a ∨ b, C4 = ¬a ∨ ¬b, C5 = a ∨ c. C1
C3 C5
C2
C4
The complement graph GI
vi = 1, if the vertex Ci is in a clique vi = 0, otherwise
Encoding 2 - MaxClique-based MaxSAT Encoding
Exemple Let I be the MinSAT instance {C1 , C2 , C3 , C4 , C5 } C1 = a ∨ b, C2 = a ∨ ¬b, C3 = ¬a ∨ b, C4 = ¬a ∨ ¬b, C5 = a ∨ c. C1
C3 C5
C2
C4
The MaxClique-based MaxSAT encoding of I
Encoding 2 - MaxClique-based MaxSAT Encoding
Exemple Let I be the MinSAT instance {C1 , C2 , C3 , C4 , C5 } C1 = a ∨ b, C2 = a ∨ ¬b, C3 = ¬a ∨ b, C4 = ¬a ∨ ¬b, C5 = a ∨ c. C1
C3 C5
C2
C4
The MaxClique-based MaxSAT encoding of I [¬v1 ∨ ¬v2 ]
Encoding 2 - MaxClique-based MaxSAT Encoding
Exemple Let I be the MinSAT instance {C1 , C2 , C3 , C4 , C5 } C1 = a ∨ b, C2 = a ∨ ¬b, C3 = ¬a ∨ b, C4 = ¬a ∨ ¬b, C5 = a ∨ c. C1
C3 C5
C2
C4
The MaxClique-based MaxSAT encoding of I [¬v1 ∨ ¬v2 ] [¬v1 ∨ ¬v3 ] [¬v1 ∨ ¬v4 ] [¬v2 ∨ ¬v3 ] [¬v2 ∨ ¬v4 ] [¬v3 ∨ ¬v4 ] [¬v3 ∨ ¬v5 ] [¬v4 ∨ ¬v5 ]
Encoding 2 - MaxClique-based MaxSAT Encoding
Exemple Let I be the MinSAT instance {C1 , C2 , C3 , C4 , C5 } C1 = a ∨ b, C2 = a ∨ ¬b, C3 = ¬a ∨ b, C4 = ¬a ∨ ¬b, C5 = a ∨ c. C1
C3 C5
C2
C4
The MaxClique-based MaxSAT encoding of I [¬v1 ∨ ¬v2 ] v1 [¬v1 ∨ ¬v3 ] v2 [¬v1 ∨ ¬v4 ] v3 [¬v2 ∨ ¬v3 ] v4 [¬v2 ∨ ¬v4 ] v5 [¬v3 ∨ ¬v4 ] [¬v3 ∨ ¬v5 ] [¬v4 ∨ ¬v5 ]
Encoding 3 : Improved MaxClique-based MaxSAT Encoding Exemple Let I be the MinSAT instance {C1 , C2 , C3 , C4 , C5 } C1 = a ∨ b, C2 = a ∨ ¬b, C3 = ¬a ∨ b, C4 = ¬a ∨ ¬b, C5 = a ∨ c. C1
C3 C5
C2
C4
An improved MaxClique-based MaxSAT encoding of I [¬v1 ∨ ¬v2 ] [¬v1 ∨ ¬v3 ] [¬v1 ∨ ¬v4 ] v1 ∨ v2 ∨ v3 ∨ v4 [¬v2 ∨ ¬v3 ] [¬v2 ∨ ¬v4 ] v5 [¬v3 ∨ ¬v4 ] [¬v3 ∨ ¬v5 ] [¬v4 ∨ ¬v5 ]
The encoding based on independent partitions
C1
Boolean variables :
C3 C5
C2
C4
Independent sets : {{}}
{v1 , v2 , v3 , v4 , v5 }
The encoding based on independent partitions
C1
Boolean variables :
C3 C5
C2
C4
Independent sets : {{C5 }}
{v1 , v2 , v3 , v4 , v5 }
The encoding based on independent partitions
C1
Boolean variables :
C3 C5
C2
C4
Independent sets : {{C1 },{C5 }}
{v1 , v2 , v3 , v4 , v5 }
The encoding based on independent partitions
C1
Boolean variables :
C3 C5
C2
C4
Independent sets : {{C1 , C2 },{C5 }}
{v1 , v2 , v3 , v4 , v5 }
The encoding based on independent partitions
C1
Boolean variables :
C3 C5
C2
{v1 , v2 , v3 , v4 , v5 }
C4
Independent sets : {{C1 , C2 , C3 },{C5 }}
The encoding based on independent partitions
C1
Boolean variables :
C3 C5
C2
{v1 , v2 , v3 , v4 , v5 }
C4
Independent sets : {{C1 , C2 , C3 , C4 },{C5 }}
The encoding based on independent partitions
C1
Boolean variables :
C3 C5
C2
{v1 , v2 , v3 , v4 , v5 }
C4
Independent sets : {{C1 , C2 , C3 , C4 },{C5 }} Soft Clauses : {{v1 ∨ v2 ∨ v3 ∨ v4 },{v5 }} Hard Clauses :{¬v 1 ∨ ¬v 2 , ¬v 1 ∨ ¬v 3 , ¬v 1 ∨ ¬v 4 , ¬v 2 ∨ ¬v 3 , ¬v 2 ∨ ¬v 4 , ¬v 3 ∨ ¬v 4 , ¬v 3 ∨ ¬v 5 , ¬v 4 ∨ ¬v 5 }
The encoding based on independent partitions
C1
Boolean variables :
C3 C5
C2
{v1 , v2 , v3 , v4 , v5 }
C4
Independent sets : {{C1 , C2 , C3 , C4 },{C5 }} Soft Clauses : {{v1 ∨ v2 ∨ v3 ∨ v4 },{v5 }} Hard Clauses :{¬v 1 ∨ ¬v 2 , ¬v 1 ∨ ¬v 3 , ¬v 1 ∨ ¬v 4 , ¬v 2 ∨ ¬v 3 , ¬v 2 ∨ ¬v 4 , ¬v 3 ∨ ¬v 4 , ¬v 3 ∨ ¬v 5 , ¬v 4 ∨ ¬v 5 }
Experimental Results
The Solvers 1 2 3 4 5 6
MaxSatz : Chu Min Li and Felip Manyà and Jordi Planes WBO : Vasco M. Manquinho and João P. Marques Silva and Jordi Planes PM2 : Carlos Ansótegui and María Luisa Bonet and Jordi Levy SAT4J-Maxsat : Daniel Le Berre, http ://www.sat4j.org MaxCliqueDyn : J. Konc and D. Janezic Cliquer : P. R. J. Ostergard
Experimental Results Table: Number of instances solved within 3 hours and run times in second on random Min-2-SAT. instance Dyn Cliquer #var C/V 20 3.0 0.02 0.00 (50) (50) 30 3.0 0.02 0.00 (50) (50) 40 3.0 0.03 0.01 (50) (50) 50 3.0 0.04 1.23 (50) (50) 60 3.0 0.07 15.88 (50) (50) 70 3.0 0.13 68.01 (50) (50) 80 3.0 0.25 302.4 (50) (50) 90 3.0 0.91 895.5 (50) (42) 100 3.0 1.51 1185 (50) (44)
MaxSatz PM2 WBO sat4j-maxsat E1 E2 E3 E1 E2 E3 E1 E2 E3 E1 E2 E3 0.01 0.03 0.00 0.02 0.02 0.00 0.01 0.01 0.00 0.81 1.20 0.07 (50) (50) (50) (50) (50) (50) (50) (50) (50) (50) (50) (50) 0.03 1.39 0.01 0.14 0.14 0.00 0.14 0.22 0.00 112.5 1530 0.17 (50) (50) (50) (50) (50) (50) (50) (50) (50) (50) (32) (50) 0.12 52.95 0.01 0.19 0.51 0.00 0.07 0.52 0.00 9904 - 0.20 (50) (50) (50) (50) (50) (50) (50) (50) (50) (4) (0) (50) 0.89 2053 0.01 5.25 7.89 0.00 42.35 51.12 0.01 - 0.43 (50) (48) (50) (50) (50) (50) (50) (50) (50) (0) (0) (50) 7.42 - 0.02 49.35 79.77 0.01 207.6 93.17 0.20 - 2.41 (50) (0) (50) (50) (50) (50) (50) (50) (50) (0) (0) (50) 43.25 - 0.03 144.3 135.8 0.01 225.1 143.9 0.08 - 2.42 (50) (0) (50) (50) (50) (50) (50) (50) (50) (0) (0) (50) 201.2 - 0.05 199.9 231.8 0.02 416.8 432.9 0.70 - 3.35 (50) (0) (50) (50) (50) (50) (50) (50) (50) (0) (0) (50) 1355 - 0.08 353.1 330.3 0.05 558.8 295.1 1.37 - 5.38 (49) (0) (50) (50) (50) (50) (50) (50) (50) (0) (0) (50) 3258 - 0.11 256.7 455.3 0.09 548.5 665.9 29.27 - 96.91 (46) (0) (50) (10) (50) (50) (50) (50) (50) (0) (0) (50)
Experimental Results Table: Number of instances solved within 3 hours and run times in second on random Min-3-SAT. instance #var C/V 20 4.00 30 4.00 40 4.00 50 4.00 60 4.00 70 4.00 80 4.00 90 4.00 100 4.00 20 4.25 30 4.25 40 4.25 50 4.25 60 4.25 70 4.25 80 4.25 90 4.25 100 4.25
E1 0.02(50) 0.24(50) 3.28(50) 49.30(50) 742.4(50) 5735(34) - (0) - (0) - (0) 0.02(50) 0.30(50) 4.67(50) 75.6(50) 1153(50) 5989(5) - (0) - (0) - (0)
MaxSatz E2 0.10(50) 7.73(50) 507.8(50) - (0) - (0) - (0) - (0) - (0) - (0) 0.14(50) 12.05(50) 992.5(50) - (0) - (0) - (0) - (0) - (0) - (0)
E3 0.01(50) 0.04(50) 0.19(50) 0.92(50) 4.96(50) 23.21(50) 100.7(50) 381.5(50) 1658(33) 0.01(50) 0.05(50) 0.28(50) 1.57(50) 8.31(50) 42.77(50) 186.3(50) 760.4(50) 2819(26)
Dyn
Cliquer
0.02(50) 0.03(50) 0.09(50) 0.57(50) 6.29(50) 56.01(50) 436.0(50) 2788(50) 5610(9) 0.02(50) 0.03(50) 0.12(50) 0.98(50) 9.94(50) 106.4(50) 917.4(50) 4453(41) - (0)
0.00(50) 0.04(50) 4.40(50) 454.4(50) 3886(11) - (0) - (0) - (0) - (0) 0.00(50) 0.07(50) 15.94(50) 945.0(49) 5385(10) - (0) - (0) - (0) - (0)
Experimental Results Figure: The maximum and the minimum numbers of satisfied clauses for Min-3-SAT 500 Max(C/V=5) Max(C/V=4.25) Max(C/V=4) Min(C/V=5) Min(C/V=4.25) Min(C/V=4)
number of satisfied clauses
400
300
200
100
0 20
30
40
50
60 number of variables
70
80
90
100
Conclusions
Our Encoding 3 : ◮
◮
◮
Provides better performance than the specific solvers MaxClique Provides an alternative that is appropriate and competitive for solving real MinSAT problems Promotes research on MaxSAT
Future research directions : ◮ ◮
◮ ◮
Develop inference systems Design methods that computer upper and lower bounds for specific MinSAT problems Extend our approach to hard clauses and weighted soft clause Apply MinSAT technology to solve industrial problems
Conclusions
Thanks ! !